gdb不支持DWARF 5宏部分?

huangapple go评论64阅读模式
英文:

gdb doesn't support DWARF 5 macro sections?

问题

#include <stdio.h>
#define A "hello world\n"
void main()
{
    printf(A);
}
英文:
#include &lt;stdio.h&gt;
#define A &quot;hello world\n&quot;
void main()
{
    printf(A);
}
$ gcc -gdwarf-4 -g3 a.c \
&amp;&amp; gdb -ex &#39;set confirm off&#39; \
       -ex &#39;break main&#39; \
       -ex &#39;run&#39; \
       -ex &#39;p A&#39; \
       -ex q \
       a.out
...
Breakpoint 1, main () at a.c:5
5	    printf(A);
$1 = &quot;hello world\n&quot;

$ gcc -gdwarf-5 -g3 a.c \
&amp;&amp; gdb -ex &#39;set confirm off&#39; \
       -ex &#39;break main&#39; \
       -ex &#39;run&#39; \
       -ex &#39;p A&#39; \
       -ex q \
       a.out
...
Breakpoint 1, main () at a.c:5
5	    printf(A);
No symbol &quot;A&quot; in current context.

$ gcc --version
gcc (GCC) 12.2.1 20230201
...

$ gdb --version
GNU gdb (GDB) 12.1
...

答案1

得分: 0

这看起来像是gdb-12.1中的一个bug,修复已发布在gdb-13.1中。

英文:

As ssbssa suggested this looks like a bug in gdb-12.1. The fix is released in gdb-13.1

huangapple
  • 本文由 发表于 2023年3月4日 04:11:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/75631484.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定