-
Notifications
You must be signed in to change notification settings - Fork 13k
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 regression with impl
on nightly
#33192
Comments
Yes, this is intentional, and was done in #32293. As I understand, the PR added a new (hopefully much better) name generation scheme to rustc, and migrated symbol name generation to the new scheme. Debug name generation still uses the old scheme and needs to be migrated. |
@sanxiyn is right. This is an area where quite a bit of work is happening at the moment because we are restructuring some things for incremental compilation. We could also think about handling this case of inherent impls/methods like it's done for object oriented languages, i.e. make the method DIE a child entry of the struct DIE. |
Making the method DIEs children of struct DIEs would work fine for gdb; and it would be a reasonably clear and faithful translation. So +1 to that. |
OK, so I made a proof of concept for this and LLVM seems to handle it just fine. However, this approach does not scale to trait implementations as one type can implement multiple methods with the same name from different traits... I'll implement it this way for inherent impls anyway, for now. Still cleaner than the (now broken) "parallel namespace" solution. |
While implementing this properly, I found another wrinkle in the story: |
Don't worry too much about what DWARF says. It's fairly normal to extend DWARF in this way; very little is truly forbidden. One way to look at it is that you're defining what the DWARF binding for Rust should be. If you'd rather to back to using a namespace, that would also be fine for gdb. The main issue here was that the name of that namespace changed from the type's name to |
debuginfo: Make DW_TAG_subroutine DIEs for inherent methods children of their self-type DIEs. Fixes #33192
I have a function in an
impl
like:With nightly, I get DWARF like this:
There are a few problems with this.
First, the namespace
{{impl}}
does not seem very useful. In 1.8 the namespace was namedHasMethods
, after the struct -- this made it quite easy for gdb to find methods associated with a type.Second, the
{{impl}}
in the linkage_name also seems peculiar. This is also another situation where the linkage name attribute differs from the real linkage name -- rendering the attribute useless.if this change was intentional, then I think gdb will need some other way to find the methods in an
impl
of a particular type. I don't see any way to get that information now.The text was updated successfully, but these errors were encountered: