Skip to content
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

Offset non-leaf-frame addresses? #31

Open
jld opened this issue Jun 29, 2020 · 4 comments
Open

Offset non-leaf-frame addresses? #31

jld opened this issue Jun 29, 2020 · 4 comments

Comments

@jld
Copy link

jld commented Jun 29, 2020

I don't know if this belongs in fix-stacks or in the code in Gecko that's printing the stacks, but getting the correct line info for non-leaf frames requires offsetting the return address to somewhere inside the preceding call instruction. Otherwise, the resolved line is for the code after the call, which might also be before it in the source due to optimizations; I'm currently having this problem with fix-stacks and a crashed Firefox debug build. Usually subtracting 1 is enough, but for ARM in Thumb mode it's necessary to subtract 2 (to clear the Thumb bit and then subtract 1).

See also bug 1642516.

@froydnj
Copy link

froydnj commented Jun 29, 2020

IIUC, this issue would be fixed in Gecko code; fix-stacks should just be performing address -> function name/file/line translation.

gabrielesvelto pushed a commit to gabrielesvelto/fix-stacks that referenced this issue Feb 3, 2021
@mstange
Copy link
Collaborator

mstange commented Jul 27, 2022

Both representations are valid IMO. In this case, the easiest solution for fix-stacks is probably to say "the input stack is pc + return addresses, fix-stacks needs to do the subtraction during symbol lookup".

@Gankra
Copy link

Gankra commented Jul 27, 2022

nb, rust-minidump exposes this distinction as "instruction" (the instruction that is currently logically executing, what you want for backtrace) vs "resume address" (where the function would resume executing, basically return address but not, because of the top frame).

https://docs.rs/minidump-processor/latest/minidump_processor/struct.StackFrame.html#structfield.instruction

https://docs.rs/minidump-processor/latest/minidump_processor/struct.StackFrame.html#structfield.resume_address

@Gankra
Copy link

Gankra commented Jul 27, 2022

you can find the code we use for this at the bottom of every platform's stackwalker file, as it's the final step of computing a frame (and then we use that result to symbolicate and unwind it): https://github.com/rust-minidump/rust-minidump/blob/9639d293172461aea19885d963c4015770fe294d/minidump-processor/src/stackwalker/arm64.rs#L514-L516

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants