【发布时间】:2021-11-20 03:38:28
【问题描述】:
我有一个a.c
#include <stdio.h>
int main() {
int a = 1;
int b = 2;
int c = a + b;
return 0;
}
使用clang -g a.c 编译时,无法获取调试符号。
joey@voyager-arch /t/a4> lldb a.out
(lldb) target create "a.out"
Current executable set to '/tmp/a4/a.out' (x86_64).
(lldb) l
(lldb)
但是如果我使用gcc,我可以成功得到调试符号,用gcc -g a.c编译
joey@voyager-arch /t/a4> gdb a.out
GNU gdb (GDB) 11.1
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...
(gdb) l
1 #include <stdio.h>
2
3 int main() {
4 int a = 1;
5 int b = 2;
6 int c = a + b;
7 return 0;
8 }
(gdb)
我正在使用带有 amd ryzen 7 cpu 的 archlinux。
clang: 12.0.1
lldb: 12.0.1
gcc: 11.1.0
gdb: 11.1
【问题讨论】: