-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix reporting of callee saved registers with nongnu libuwind #527
Conversation
The callee saved registers were not preserved for GC stackwalk with nongnu libunwind that does not provide context pointers. Fixed by adding an extra space to MachState to preserve them. To avoid large amounts of copy&pasted code, introduced macro to enumerate all callee saved registers, similar to existing macro to enumerate all argument registers. This macro makes the code to copy the register values between different structures more compact, and less prone to typos.
CALLEE_SAVED_REGISTER(Rbx) \ | ||
CALLEE_SAVED_REGISTER(Rbp) | ||
|
||
#define NUM_CALLEE_SAVED_REGISTERS 8 |
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.
I think this should be 6 instead of 8?
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.
Good catch! The memory corruptions from this typo would not be fun to trace down.
b7f15e1
to
b3a674a
Compare
Addressed code review feedback. @sergiy-k PTAL |
}; | ||
|
||
struct CalleeSavedRegistersPointers { | ||
#define CALLEE_SAVED_REGISTER(regname) PTR_TADDR regname; |
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.
I think this needs to be p##regname instead of regname like in other places. Otherwise it will cause a build break.
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.
Yes, I forgot to commit the change - it is fixed now.
LGTM. |
LGTM |
Fix reporting of callee saved registers with nongnu libuwind
The callee saved registers were not preserved for GC stackwalk with nongnu
libunwind that does not provide context pointers. Fixed by adding an extra
space to MachState to preserve them.
To avoid large amounts of copy&pasted code, introduced macro to enumerate
all callee saved registers, similar to existing macro to enumerate all
argument registers. This macro makes the code to copy the register values
between different structures more compact, and less prone to typos.
This is fixing #512