-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Set the dwarf linkage_name to the mangled name #46899
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
5a94a48
to
990a5cc
Compare
📌 Commit 990a5cc has been approved by |
@michaelwoerister np, and thanks for clarifying its correct! So, one last component I thought should be remedied here is the following addition: diff --git a/src/librustc_trans/debuginfo/namespace.rs b/src/librustc_trans/debuginfo/namespace.rs
index 47e2b8c461..8324077e29 100644
--- a/src/librustc_trans/debuginfo/namespace.rs
+++ b/src/librustc_trans/debuginfo/namespace.rs
@@ -58,7 +58,8 @@ pub fn item_namespace(ccx: &CrateContext, def_id: DefId) -> DIScope {
let namespace_name = match def_key.disambiguated_data.data {
DefPathData::CrateRoot => ccx.tcx().crate_name(def_id.krate).as_str(),
- data => data.as_interned_str()
+ DefPathData::Module(module) => module,
+ _ => return parent_scope,
};
let namespace_name = CString::new(namespace_name.as_bytes()).unwrap(); What this does is drop the So, in our example above, this would yield I believe we should do this. One immediate benefit is it won't show up in autocomplete (which you can't use anyway, since the current parser won't accept However, this had the side effect of sending me down a rabbit hole w.r.t. namespaces, debugging info, gdb, and rusts "universal method call syntax". I wrote up a large thing here, but I don't think it's the time or place at the moment to paste here, probably another issue is better. But it basically it has to do with apparently a known issue with the symbol names for trait impls and generics, e.g., one of these is the symbol table name for a
E.g., they only differ in hash, but really we'd like to see the type parameter reified/instantiated with the appropriate u32/u64 (or whatever it was impl'd for) The solution here will be probably complicated, and may involve drastically changing rusts symbol name output, but I think in the future its really important to get right. Also would like to thank @eddyb on irc for long and fruitful discussion about some of the complexities involved here, was very interesting :) |
…woerister Set the dwarf linkage_name to the mangled name ref #46453 @michaelwoerister or anyone else who knows, i'm not sure if this is the correct instance to pass here (or how to get the correct one precisely): https://github.com//m4b/rust/blob/5a94a48678ec0a20ea6a63a783e63546bf9459b1/src/librustc_trans/debuginfo/namespace.rs#L36 So don't merge this yet, I'd like to learn about correct instance first; however, I think this already fixes a bunch of weirdness i'm seeing debugging from time to time, not to mention backtraces in gdb via `bt` are now ~readable~ meaningful 🎉 E.g.: new: ``` (gdb) bt #0 <inline::Foo as core::convert::From<()>>::from () at /home/m4b/tmp/bad_debug/inline.rs:11 #1 0x000055555555a35d in inline::deadbeef () at /home/m4b/tmp/bad_debug/inline.rs:16 #2 0x000055555555a380 in inline::main () at /home/m4b/tmp/bad_debug/inline.rs:20 ``` old: ``` (gdb) bt #0 inline::{{impl}}::from () at /home/m4b/tmp/bad_debug/inline.rs:11 #1 0x000055555555b0ed in inline::deadbeef () at /home/m4b/tmp/bad_debug/inline.rs:16 #2 0x000055555555b120 in inline::main () at /home/m4b/tmp/bad_debug/inline.rs:20 ```
☀️ Test successful - status-appveyor, status-travis |
ref #46453
@michaelwoerister or anyone else who knows, i'm not sure if this is the correct instance to pass here (or how to get the correct one precisely): https://github.com//m4b/rust/blob/5a94a48678ec0a20ea6a63a783e63546bf9459b1/src/librustc_trans/debuginfo/namespace.rs#L36
So don't merge this yet, I'd like to learn about correct instance first; however, I think this already fixes a bunch of weirdness i'm seeing debugging from time to time, not to mention backtraces in gdb via
bt
are nowreadablemeaningful 🎉E.g.:
new:
old: