【问题标题】:clang not generating debug symbolsclang 不生成调试符号
【发布时间】: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

【问题讨论】:

    标签: clang lldb


    【解决方案1】:

    可能是 lldb 12 不兼容的 bug,降级到 lldb 10 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2014-11-14
      • 2014-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-14
      • 1970-01-01
      • 2019-09-24
      相关资源
      最近更新 更多