-
-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dwarf] Emit all symbols as children of the given module #4746
Conversation
| if (global.params.isWindows) | ||
| s->prettyIdent = fd->toPrettyChars(true); | ||
| else | ||
| s->prettyIdent = fd->toChars(); | ||
| s->Sclass = SCglobal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you want to parse the human readable function type, e.g. void function() foo(int arg)? Sounds like it would require half of a D parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't fd->toChars print something like the original function declaration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just be the base identifier name, I've never seen strange things coming from gdc when using this, can check instantiated functions just to be sure though. Why do you think it would require half of a D parser to do it this way though?
If dmd is emitting children correctly in debug, gdb can build up a list of qualified names just by looking up the names of all parents, joining them together using the appropriate separator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I confused this with FunctionType::toChars, FuncDeclaration::toChars uses Dsymbol::toChars and should be fine.
|
This breaks test/runnable/gdb14313.d, and maybe you can come up with some sort of gdb test already. |
I think it's just a problem with the version of gdb the autotester has installed. Older gdb versions don't know how to correctly handle what I described. |
|
Well, that would mean we break debugging for some user with that gdb version. |
|
If you are using gdb-7.6 or 7.7, you'll have D2 demangling support, in which case getting the value by the full qualified name will match the demangled symbol and start working again. I don't consider it unreasonable to break older versions of gdb. You for sure cannot use gdb-7.5 with gcc-4.9, for instance. |
|
Well, gdb-7.4 is what you get on Ubuntu 12.04LTS. |
A mixture between two things:
I think that this PR, and the other two should probably be merged together under one umbrella in a way, as it's looking like the latter two PRs are not trivial (this change just lacks any controls). But I've still not heard back from anyone who knows better the dmd backend. FYI gdb-7.10 has been frozen, so I'm going to start submitting a new batch of patches in to further push D support. If you're lucky, you won't notice anything when you switch to gdb-7.11. However, you'll be missing out on quite a lot. :) |
|
My opinion is that the compiler should not be backwards compatible with older debuggers. But no one seems to think that here so in that case debug support will never improve for dmd, alienating most features I have trained gdb to do. |
|
It's been a while since 2015. The backwards compatibility issue may no longer be relevant. |
This allows gdb to correctly build a scope map of all modules, which can be used in conjunction with the D-specific name lookup routines in my fork (works by looking up the current enclosed module, and then seeing if the given name is part of it).
Though perhaps this shouldn't be merged until gdb catches up.
Also, will need to emit struct/class/enum names in the same way.
@MartinNowak - FYI, this implements half of my propsosal (the other half is implementing
DW_TAG_imported_declaration)