我已经在我的Ubuntu 13.10 x86_64上成功地在GitHub上成功构建和安装了Ian Buclaw(Ibuclaw)GDB分支,其默认编译器GCC 4.8.1。

我不得不删除该文件 ld 来自 bin 子目录否则DMD会在链接阶段抱怨SYSROOT事物。

然后,当我编译测试程序并通过GDB运行它时,我会有问题。

我可以 break main, ,运行并且GDB在开始处停止 main 但当我这样做时 next 我得到以下不需要的输出

  Single stepping until exit from function main,
  which has no line number information.
  0x00007ffff760ede5 in __libc_start_main () from 
  /lib/x86_64-linux-gnu/libc.so.6

ibuclaw的GDB不是应该在这里工作吗?

我的测试程序编译为

dmd -debug -g -gs -wi t_array.d -oft_array

没有任何警告或错误。我也尝试过 假装自己是C

dmd -debug -g -gc -gs -wi t_array.d -oft_array

结果相同。

进一步当我这样做时 b 紧随其后的是,完成列表中的大多数符号都没有被删除。

我的测试程序看起来像

import std.stdio, std.algorithm;

void main(string args[]) {
    int[] x;
    writeln(x.sizeof);

    if (x) {
        writeln("Here!");
    } else {
        writeln("There!");
    }

    int xx[2];
    auto xc = xx;
    xc[0] = 1;
    writeln(xx);
    writeln(xc);
    int[2] xx_;


    auto hit = x.find(1);
    if (hit) {
        writeln("Hit: ", hit);
    } else {
        writeln("No hit");
    }
    int[2] z;                   // arrays are zero initialized
    writeln(z);

    assert([].ptr == null);
    assert("ab"[$..$] == []);
    auto p = "ab"[$..$].ptr;
    writeln(p);
    assert(p != null);
}
有帮助吗?

解决方案

对我来说,使用 monodevelop 和 GDB 调试器(不适用于 D 的 gdb 调试器)效果很好,您应该使用 start 命令而不是 break main。更多详细信息请参见您的 dlangs 论坛帖子:http://forum.dlang.org/thread/avbpulzptddlekkczwse@forum.dlang.org

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top