Bug 21771 – gdb: Debug information should include FQN for main function

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-03-26T05:04:45Z
Last change time
2024-12-13T19:15:33Z
Keywords
DebugInfo
Assigned to
No Owner
Creator
hsteoh
Moved to GitHub: dmd#19899 →

Comments

Comment #0 by hsteoh — 2021-03-26T05:04:45Z
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()!
Comment #1 by robert.schadek — 2024-12-13T19:15:33Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19899 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB