-
Notifications
You must be signed in to change notification settings - Fork 65
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
Track original wasm instructions location #71
Conversation
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 is the idea here that we would use the resulting offsets map to modify the DWARF in place outside of walrus
the same way a linker might?
A few comments/questions/suggestions in line below.
The wasm DWARF will need the |
@fitzgen additional info (based on standup meeting), DWARF transform logic is currently located at https://github.com/yurydelendik/wtmaps-utils in the |
So I whipped up a smoke test to check that inserting That is, going from
The I rebased this branch on top of master and added a commit that contains this failing test: @yurydelendik could you look into why the test's assertions about the code transforms are failing? |
Is this PR / feature planned to be revived? Currently |
@RReverser yes this feature is somethign we definitely want, but this PR is quite bit rotted at this point. |
ac129c4
to
61fe12e
Compare
Rebased and changed logic to use |
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.
Looks great, thanks for including that smoke test, Yury.
So the idea is that InstrLocId
is not necessarily a code section offset, and users can customize its representation with config.on_instr_pos
? Why would someone want to use something else? What would we be losing by only supporting code section offsets?
If tools can read/write debug location format, they can allow better integration.
At this point nothing. Right now it is module bytecode offset (I would prefer to extend bytecode to entire |
Gotcha. Can you fix the fuzz targets? Then we can merge this 👍 https://travis-ci.org/rustwasm/walrus/jobs/601361918#L950
Just the |
61fe12e
to
9d77db2
Compare
Thanks! |
Woot, this was fast. Thanks! |
@fitzgen Do you plan to make a wasm-bindgen release with these changes? |
@RReverser we can publish a new walrus and use that in wasm-bindgen, but I suspect what you're really interested in is using this to fix up llvm's emitted DWARF, right? If so, then that requires writing a little bit more than what this PR provided. That code could theoretically go in either walrus or We will need |
I guess I'm confused, I thought that's what this PR is doing? If not:
I had an idea that these operations could be done in Then the rest of it is as easy as reading DWARF custom sections of Wasm into |
@RReverser There is a project started at https://github.com/yurydelendik/wtmaps-utils that will demonstrate the scope of the work needs to accomplish the task -- it is not trivial. |
This is basically what those |
Looking at convert.rs in wdwarf, a lot of it is copied from gimli. Is there a way we can adapt gimli's convert to do what you need? I had originally thought that transformations would work by calling gimli's convert, and then mutating the resulting |
@philipc yes, that's an ideal situation. This project is created to identify what needs to be done for this use case (on gimli or user side). I'm planning to resume a work on it soon. Let's create an issue at wdwarf or gimli repo to continue this discussion. I'll just mention that this is a problem not just translation of address, but changed data to still has be a valid DWARF:
|
AFAIK the things listed here are already taken care of by |
@fitzgen I've looked into what you meant by implementing If walrus could just produce a map of original -> final locations, then it seems much easier to reuse I've tried to experiment with this in a wasm-bindgen branch, but looks like there are some incompatibilities with new walrus, particularly in |
As I mentioned above, I think walrus is the place this should live, not wasm-bindgen.
We could do that, but I also don't think that doing each section one at a time is bad, because then we can easily do each section in parallel. |
It feels like something that should be done inside gimli, as it 1) knows more about sections and can parallelise work better and 2) could use such parallelisation on other platforms too. |
Work toward #67