[Issue 14927] New: GDB cannot be used to debug D programs on OS X

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 17 15:32:21 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14927

          Issue ID: 14927
           Summary: GDB cannot be used to debug D programs on OS X
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: jack at jackstouffer.com

For reference:
    OSX 10.10.5
    GDB 7.9.1 (non apple; from homebrew)
    yes, GDB it is code signed
    Compiling with dmd -gc -gs

In GDB on OS X, trying to set a breakpoint in a file other than the one where
the main function is, and stepping into functions in a file other than the one
where the main function is, don't work. GDB will return something like:

    Cannot insert breakpoint 2.
    Cannot access memory at address 0x9bc06

when trying to insert a breakpoint in another file. GDB also treats the
aforementioned step command as a continue because it can't read the file where
the function is defined. Nothing changes when running the command as sudo
either.

Two more pain points: `info locals` doesn't work. It responds with "No symbol
table info available." And `info variables` returns the mangled D names for
variables and not their real name, despite the language being set to D and
doing `demangle [some_name]` returns the correct names.

Here is some sample code that does not work, e.g. you cannot step into the
'method' function:

a.d:
---------------------
import B;

void main() {
    auto b = Test();
    b.method();
}

b.d:
---------------------
module B;

struct Test {
    int b;

    void method() {
        b += 1;
    }
}

--


More information about the Digitalmars-d-bugs mailing list