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);
}
Nordlöw
  • 11,838
  • 10
  • 52
  • 99

1 Answers1

3

Works well for me with monodevelop and GDB debugger (not with gdb debuger for D), you should use start command instead of break main. More details in yours dlangs forum thread: http://forum.dlang.org/thread/avbpulzptddlekkczwse@forum.dlang.org

Kozzi11
  • 2,413
  • 12
  • 17
  • When I run it as above, hardly any D symbol is presented correctly when doing `print SYMBOL` in GDB with regards to name demangling and their value. Is this the current state of ibuclaw's GDB or have I missed something? – Nordlöw Jan 09 '14 at 19:34
  • GDB can't yet demangle all D symbols. Iain Buclaw (core developer of the GDC project) have recently made some improvements that will soon hopefully be merged into the main GDB code, which will help us a lot. Did you try to compile your D program with the GDC? – DejanLekic Jan 09 '14 at 21:20