More robust stack walks when the IP address in the context frame is invalid (or not in a known module).
This is achieved by: 1. Extending the span of the scan for return address in the conext frame. Initially, I wanted to extend the span of the scan for all frames but then I noticed that there is code for ARM already that is extending the search only for the context frame. This kind of makes sense so I decided to reuse the same idea everywhere. 2. Attempting to restore the EBP chain after a successful scan for return address so that the stackwalker can switch back to FRAME_TRUST_CFI for the rest of the frames when possible. I also fixed the lint errors in the files touched. Review URL: https://breakpad.appspot.com/605002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1193 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
@@ -102,10 +102,9 @@ StackwalkerAMD64::StackwalkerAMD64(const SystemInfo* system_info,
|
||||
(sizeof(cfi_register_map_) / sizeof(cfi_register_map_[0]))) {
|
||||
}
|
||||
|
||||
uint64_t StackFrameAMD64::ReturnAddress() const
|
||||
{
|
||||
uint64_t StackFrameAMD64::ReturnAddress() const {
|
||||
assert(context_validity & StackFrameAMD64::CONTEXT_VALID_RIP);
|
||||
return context.rip;
|
||||
return context.rip;
|
||||
}
|
||||
|
||||
StackFrame* StackwalkerAMD64::GetContextFrame() {
|
||||
@@ -154,7 +153,8 @@ StackFrameAMD64* StackwalkerAMD64::GetCallerByStackScan(
|
||||
uint64_t last_rsp = last_frame->context.rsp;
|
||||
uint64_t caller_rip_address, caller_rip;
|
||||
|
||||
if (!ScanForReturnAddress(last_rsp, &caller_rip_address, &caller_rip)) {
|
||||
if (!ScanForReturnAddress(last_rsp, &caller_rip_address, &caller_rip,
|
||||
frames.size() == 1 /* is_context_frame */)) {
|
||||
// No plausible return address was found.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user