- 使用 cgdb 调试一个编译好的文件,结果发现打开看到的并不是源代码,而是 LLVM 的编译输出:
1│ // -*- C++ -*-
2│ //===------------------------------ vector --------------------------------===//
3│ //
4│ // The LLVM Compiler Infrastructure
5│ //
6│ // This file is dual licensed under the MIT and the University of Illinois Open
7│ // Source Licenses. See LICENSE.TXT for details.
8│ //
9│ //===----------------------------------------------------------------------===//
10│
11│ #ifndef _LIBCPP_VECTOR
12│ #define _LIBCPP_VECTOR
13│
14│ /*
15│ vector synopsis
16│
17│ namespace std
18│ {
19│
20│ template <class T, class Allocator = allocator<T> >
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/vector
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from PartialOrdering...done.
(gdb) l
849 data() + size(), data() + capacity());
850 }
851 void __annotate_increase(size_type __n) const
852 {
853 __annotate_contiguous_container(data(), data() + capacity(),
854 data() + size(), data() + size() + __n);
855 }
856 void __annotate_shrink(size_type __old_size) const
857 {
858 __annotate_contiguous_container(data(), data() + capacity(),
(gdb) help
- 吓得我赶紧又写了一个 helloworld 试了一下:
_| _|
_|_|_| _|_|_| _|_|_| _|_|_|
_| _| _| _| _| _| _|
_| _| _| _| _| _| _|
_|_|_| _|_|_| _|_|_| _|_|_|
_|
_|_|
a curses debugger
version 0.6.8
type q<Enter> to exit
type help<Enter> for GDB help
type <ESC>:help<Enter> for CGDB help
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello...Reading symbols from /Users/Shiratsuyu/Documents/Codes/PartialOrdering/hello.dSYM/Contents/
Resources/DWARF/hello...done.
done.
(gdb) list
Line number 8 out of range; h.cpp has 7 lines.
(gdb) list 1
1 #include <iostream>
2 using namespace std;
3
4 int main(){
5 cout<<"Hello, World!"<<endl;
6 return 0;
7 }
(gdb)
- 这都是什么鬼……
- …真的是没脾气了,怎么样才能让它老老实实的显示和 main.cpp 里一样的代码啊