我有一个补丁gdb
6.8,但我不能得到任何调试工作。鉴于此测试文件:如何让gdb在linux下使用D程序?
import std.stdio;
void main()
{
float f = 3.0;
int i = 1;
writeln(f, " ", i);
f += cast(float)(i/10.0);
writeln(f, " ", i);
i++;
f += cast(float)(i/10.0);
writeln(f, " ", i);
i += 2;
f += cast(float)(i/5.0);
writeln(f, " ", i);
}
,并试图在命令行调试:
bash-4.0 [d]$ dmd -g test.d # '-gc' shows the same behaviour.
bash-4.0 [d]$ ~/src/gdb-6.8/gdb/gdb test
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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-pc-linux-gnu"...
(gdb) list
1 ../sysdeps/i386/elf/start.S: No such file or directory.
in ../sysdeps/i386/elf/start.S
和调试使用Eclipse
项目中使用-gc
:
Dwarf Error: Cannot find DIE at 0x134e4 referenced from DIE at 0x12bd4 [in module /home/bernard/projects/drl/drl.i386]
(gdb) Dwarf Error: Cannot find DIE at 0x1810 referenced from DIE at 0x1b8 [in module /home/bernard/projects/drl/drl.i386]
使用-g
:
(gdb) Die: DW_TAG_<unknown> (abbrev = 7, offset = 567)
has children: FALSE
attributes:
DW_AT_byte_size (DW_FORM_data1) constant: 4
DW_AT_type (DW_FORM_ref4) constant ref: 561 (adjusted)
DW_AT_containing_type (DW_FORM_ref4) constant ref: 539 (adjusted)
Dwarf Error: Cannot find type of die [in module /home/bernard/projects/drl/drl.i386]
我在Digital Mars新闻组上看到过很多这样的帖子,但都被忽略了。任何人都可以点亮这个情况吗?
我知道ZeroBUGS,但我真的想得到gdb
的工作。
更新:
由于luca_,在IRC(freenode上,#D),我得到了简单的情况下(一个文件)工作:
(gdb) list Dmain
1 void main()
2 {
3 float f = 3.0;
4 int i = 1;
5 f += cast(float)(i/10.0);
6 i++;
7 f += cast(float)(i/10.0);
8 i += 2;
9 f += cast(float)(i/5.0);
10 }
(gdb) break 3
不幸的是,我的项目组成的多个文件因DWARF错误而死亡。
编辑:
截至2.036(我认为),由DMD产生的GDB调试信息是否正确,如预期应该工作。
不幸的是,CVS Head存在同样的问题。这个:http://d.puremagic.com/issues/show_bug.cgi?id=1079让我觉得它可能是gdb的一个问题。这就是说,ZeroBUGS的工作原理(或工作 - 它不会运行在这台机器上(此外,下降不支持它,因此希望得到gdb的工作)),所以它可能是gdb都一样。我可能需要学习DWARF,dmd和gdb,看看我能做些什么。没有任何调试会咬人大牌。我甚至无法拿到堆栈(如果我很幸运,最高的功能可能会出现)!谢谢你的信息。给我更多的地方看看。 – Bernard 2009-10-17 23:58:12