-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add a fallback for stacktrace printing for older Windows versions. #50526
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Kimundi (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. |
I'd like to see an enum in |
Good points. Will do. |
} | ||
} | ||
|
||
fn set_frames_ex( |
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.
You should be able to make this generic by passing the STACKFRAME
type, the init_frame
function and a closure which calls StackWalk and returns the relevant information.
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.
Done, thank you very much!
This is my first real foray into rust generics, so please let me know if I did anything particularly wrong here.
) == c::TRUE | ||
{ | ||
let addr = frame.AddrPC.Offset; | ||
if addr == frame.AddrReturn.Offset || addr == 0 || frame.AddrReturn.Offset == 0 |
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.
This logic shouldn't be used. set_frames_64
and set_frames_ex
should walk the stack in the same way.
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.
Removed the cumbersome logic.
Genericalized. |
It's better now. I would prefer a solution without the extra traits though. So
And something similar could be done to remove the other added traits. |
Ping from triage, @moxian ! Will you have time to revisit this soon? |
@ triage: Sorry this is taking so long. @ Zoxc: I removed the extra traits in printing functions, but couldn't figure out how to do the stack walking without the trait. [1] I assumed by |
I've pushed a commit which abstracts over stalk walking using a macro. A macro allows avoiding duplicating the setup of the stack frame structure, so I just used that for the entire thing. I've yet to test that this code works on Windows 7/10. That should be done and then we can get @alexcrichton to rubber stamp this. |
I can confirm that this works on Windows 7 - both msvc and gnu variants. |
@bors: r+ Looks great to me! |
📌 Commit cfabe858a681de1227b054df0ab59d73f9c53227 has been approved by |
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message
|
@pietroalbini Will do today (or maybe tomorrow - depending on your timezone). |
PR rust-lang#47252 switched stack inspection functions of dbghelp.dll to their newer alternatives that also capture inlined context. Unfortunately, said new alternatives are not present in older dbghelp.dll versions. In particular Windows 7 at the time of writing has dbghelp.dll version 6.1.7601 from 2010, that lacks StackWalkEx and friends. Fixes rust-lang#50138
.. rather than having them be one giant match statement.
.. and pass them around in BacktraceContext.
Done. |
@bors: r+ |
📌 Commit be7f619 has been approved by |
⌛ Testing commit be7f619 with merge 090a7110e08eee03f71a6fb95a1c9baa2b61733e... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
1 similar comment
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Add a fallback for stacktrace printing for older Windows versions. Some time ago we switched stack inspection functions of dbghelp.dll to their newer alternatives that also capture inlined context. Unfortunately, said new alternatives are not present in older dbghelp.dll versions. In particular Windows 7 at the time of writing has dbghelp.dll version 6.1.7601 from 2010, that lacks StackWalkEx and friends. Tested on my Windows 7 - both msvc and gnu versions produce a readable stacktrace. Fixes #50138
☀️ Test successful - status-appveyor, status-travis |
Fix backtraces for inlined functions on Windows Fixes an regression introduced in rust-lang#50526 r? @alexcrichton
Fix backtraces for inlined functions on Windows Fixes an regression introduced in rust-lang#50526 r? @alexcrichton
Some time ago we switched stack inspection functions of dbghelp.dll to their newer alternatives that also capture inlined context.
Unfortunately, said new alternatives are not present in older dbghelp.dll versions.
In particular Windows 7 at the time of writing has dbghelp.dll version 6.1.7601 from 2010, that lacks StackWalkEx and friends.
Tested on my Windows 7 - both msvc and gnu versions produce a readable stacktrace.
Fixes #50138