6

I have successfully built and installed Ian Buclaw's (ibuclaw) GDB branch on github on my Ubuntu 13.10 x86_64 with its default compiler GCC 4.8.1.

I had to remove the file ld from the bin sub-directory otherwise DMD complains about a sysroot thing in link phase.

When I then compile my test program and run it through GDB I have problems.

I can do break main, run and GDB stops at the beginning of main but when I do next I get the following undesired output

  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

Isn't ibuclaw's GDB supposed to work here?

My test program was compiled as

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

without any warnings nor errors. I've also tried to pretend to be C

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

with same result.

Further when I do b followed by tab, most of the symbols in the completion list are not demangled.

My test program looks like

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);
}
4

1 回答 1

3

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

于 2014-01-09T18:39:18.803 回答