D2和gdb问题

时间:2011-01-24 22:24:21

标签: gdb debugging d



简短的问题:在gdb中是否有D2的支持(我有gdb 7.2)?

长话故事:我编写了下一个小应用程序......


// file main.d
int glVar = 0xAAAAAAAA;

void main()
{ 
 glVar = 0xBBBBBBBB; 
}

...使用命令“dmd -gc -debug main.d”;
然后我将它加载到gdb并尝试调试它:

vnm@vnm:~/proj/d_gdb_test$ gdb main
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/vnm/proj/d_gbb_test/main...done.
(gdb) b main
Breakpoint 1 at 0x804b667
(gdb) r
Starting program: /home/vnm/proj/d_gbb_test/main 
[Thread debugging using libthread_db enabled]

Breakpoint 1, 0x0804b667 in main ()
(gdb) info line
No line number information available.
(gdb) info variables glVar
All variables matching regular expression "glVar":

File main.d:
int _D4main5glVari;

为什么gdb无法显示行信息以及为什么它以错位形式显示符号?这个软件是问题还是我做错了什么?

1 个答案:

答案 0 :(得分:4)

从版本7.2开始,gdb支持D。因此,您可以使用gdb 7.2调试D程序。

现在,这并不意味着支持是完美的 - 事实上远非如此。例如,我不确定你是否可以正确打印字符串。如果它没有消解D符号,那就不足为奇了。所以,它有效,但它远非完美。