[Issue 21771] New: gdb: Debug information should include FQN for main function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 26 05:04:45 UTC 2021


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

          Issue ID: 21771
           Summary: gdb: Debug information should include FQN for main
                    function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: hsteoh at quickfur.ath.cx

Code:
----------
void fun() {}
void gun() {}
void main() {
        void hun() {}
}
----------

Compile with `dmd -g prog.d`.
Inside gdb:

----------
(gdb) break prog.<tab>
prog.d             prog.fun()         prog.gun()         prog.main().hun()  
----------

Notice that main() is missing from the above list. Turns out, the only way to
break in the main function is to specify it as `D main` (with the space).

Worse yet, if you `break prog.main`, it will actually set the breakpoint inside
hun() instead.  (It's not clear from the above because the line number
coincides with the body of main, but if you add some code into main and hun()
and test it in the debugger, you'll see.)

Expected behaviour:

- Since all the other functions in the module are recognized by their FQN in
gdb, `main` should also be recognized by its FQN.

- Setting a breakpoint on `prog.main` should not set a breakpoint inside the
nested function hun()!

--


More information about the Digitalmars-d-bugs mailing list