Uh oh!
There was an error while loading. Please reload this page.
Implement debuginfo path remapping - #38348
Conversation
rust-highfive
commented
Dec 13, 2016
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
alexcrichton
commented
Dec 14, 2016
alexcrichton
commented
Dec 14, 2016
(note that I'd like to discuss in tools triage tmw, but seems good to me) |
michaelwoerister
commented
Dec 14, 2016
Yes, let's discuss it at the meeting. |
brson
commented
Dec 14, 2016
Seems like functionality we need. Thanks @sanxiyn! Can this be used to let us create seperate Is this unstable? Can it be tested? No test cases here. |
brson
commented
Dec 14, 2016
Can we get negative test cases too, for when this feature isn't supported? Does it e.g. work on windows? |
michaelwoerister
commented
Dec 14, 2016
Separate debuginfo is a different problem. GDB has ways of handling this: https://www.sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html |
michaelwoerister
commented
Dec 14, 2016
6a201be to
d65e2f1Comparemichaelwoerister
commented
Dec 15, 2016
Here is a summary of what we discussed in the tools meeting:
A usability concerns that was raised:
Also, as @brson said, there should be an auto-test for this. A codegen test that checks the generated LLVM IR would probably work best. @sanxiyn Are you still up to this? |
vadimcn
commented
Dec 15, 2016
Also, I wanted to note that we should be careful if the prefix includes more than just the root source directory. I am finding stuff like this (below) in debug info of a Rust binary. A naive matching of and |
vadimcn
commented
Dec 15, 2016
codyps
commented
Dec 20, 2016
Are those actually paths? They look like library names, which are typically more restricted. As I've noted in the issue, to actually be fool-proof here we need to allow each path to be a separate argument. |
infinity0
commented
Dec 28, 2016
Does this mean paths that contain The reason I ask is because we at the reproducible builds project are in the process of specifying the format of a standardised environment variable for this, that different compilers can all support, and we are trying to decide (e.g.) what to use as a separator characters. It would be good to get many different compiler writers' opinions on this. We also have the constraint that multiple mappings would have to be joined up into a single string, for this envvar. |
vadimcn
commented
Dec 29, 2016
Yeah, looks like we forgot about Windows drive letters :( In today's Tools Team meeting we've discussed several options (none of which is particularly appealing):
A couple more that occurred to me later:
|
michaelwoerister
commented
Jan 2, 2017
We should probably just avoid getting into the whole cross-platform shell/filename escaping business. I'd be for either going the json-file route or just allow an arbitrary number of |
michaelwoerister
commented
Jan 2, 2017
That's a very good point. |
infinity0
commented
Jan 6, 2017
I still think it's fine just having one argument If this is still not convincing to the Rust team, then I suggest that instead of doing complex position-based logic, you define It would allow things like |
michaelwoerister
commented
Jan 6, 2017
That's pretty much what I had in mind. |
jsgf
commented
Jan 14, 2017
A couple of points:
|
Yes, and this is the same behaviour as GCC. If one wanted This should be fine - if both At the Reproducible Builds project we have some interest in getting multiple build tools to adopt the same approach (roughly what's been described here, and what GCC does), and adding this complexity would likely hinder adoption. |
100% OK with matching gcc behaviour. I guess the user could include the '/' if they wanted to enforce matching directory boundaries. |
| for (old, new) in sess.opts.debug_prefix_map.clone() { | ||
| if path.starts_with(&old) { | ||
| return new + &path[old.len()..]; | ||
| } |
There was a problem hiding this comment.
It seems unnecessary to clone the whole map first; it would be better to iterate references, then only clone the "new" once we've found a match.
| file_metadata_(cx, path, file_name, &work_dir) | ||
| let sess = cx.sess(); | ||
| let remap_file_name = remap_path(sess, file_name); |
There was a problem hiding this comment.
This ends up matching against a full path rather than the path passed on the command line. The let file_name expression above ends up using the full_path parameter if its present (which it always appears to be) rather than the relative path (which it goes to some lengths to make relative to work_dir). I'm not sure what the larger intent is here, but the effect is that this doesn't work as expected.
It looks like this was done deliberately in 24e7491 by @luser. This suggests that path remapping should be done in absolute space - though the code is pretty inconsistent. If full_path is None, then I think the resulting path will be relative.
| // Include the debug_assertions flag into dependency tracking, since it | ||
| // can influence whether overflow checks are done or not. | ||
| debug_assertions: bool [TRACKED], | ||
| debug_prefix_map: Option<(String, String)> [TRACKED], |
There was a problem hiding this comment.
This only allows a single remapping. It needs to allow an arbitrary number of remappings to be useful.
alexcrichton
commented
Feb 4, 2017
I haven't been following this too closely, but was a conclusion of how to implement this reached? (just triaging some old PRs) |
michaelwoerister
commented
Feb 6, 2017
@alexcrichton No, not yet, mostly due to my being busy with other things and not properly following up over at #38322. I have an idea what it could look like, I just need to write it up and confirm that it is what people except. |
nrc
commented
Apr 5, 2017
triage: we discussed at tools team meeting @michaelwoerister has not had a chance to look at this yet, but still intends to, hopefully next week |
bors
commented
Apr 12, 2017
☔ The latest upstream changes (presumably #41237) made this pull request unmergeable. Please resolve the merge conflicts. |
carols10cents
commented
Apr 17, 2017
Friendly ping-- there's some merge conflicts. Also have you had a chance to look at this @michaelwoerister ? Just want to keep this on your radar! |
arielb1
commented
Apr 18, 2017
infinity0
commented
Apr 18, 2017
That PR was just an initial attempt, but I believe @michaelwoerister had some more fleshed-out ideas later. We continued the discussion in #38322 and I'm waiting on his reply. In the meantime I submitted some patches to GCC that includes a change to make the mapping algorithm a bit more predictable, as described in #38322#273499873. |
michaelwoerister
commented
Apr 18, 2017
This is literally the next thing on my TODO list. Expect a PR from me later this week. |
michaelwoerister
commented
Apr 19, 2017
I posted an updated description of the approach I envision here: #38322 (comment) |
carols10cents
commented
Apr 24, 2017
@michaelwoerister so is this pr still needed or is it going to be replaced with a different PR? |
Fix#38322.