Fix minidump generation from exception.

Review URL: https://breakpad.appspot.com/583002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1169 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
qsr@chromium.org 2013-05-03 15:04:12 +00:00
parent 110c99fbd5
commit e61b76c679
2 changed files with 16 additions and 10 deletions

View file

@ -53,6 +53,9 @@ class IosExceptionMinidumpGenerator : public MinidumpGenerator {
// Get the crashing program counter from the exception.
uint32_t GetPCFromException();
// Get the crashing link register from the exception.
uint32_t GetLRFromException();
// Write a virtual thread context for the crashing site.
bool WriteCrashingContext(MDLocationDescriptor *register_location);

View file

@ -79,9 +79,8 @@ bool IosExceptionMinidumpGenerator::WriteCrashingContext(
context_ptr->context_flags = MD_CONTEXT_ARM_FULL;
context_ptr->iregs[7] = kExpectedFinalFp; // FP
context_ptr->iregs[13] = kExpectedFinalSp; // SP
uint32_t pc = GetPCFromException();
context_ptr->iregs[14] = pc; // LR
context_ptr->iregs[15] = pc; // PC
context_ptr->iregs[14] = GetLRFromException(); // LR
context_ptr->iregs[15] = GetPCFromException(); // PC
return true;
#else
assert(false);
@ -93,6 +92,10 @@ uint32_t IosExceptionMinidumpGenerator::GetPCFromException() {
return [[return_addresses_ objectAtIndex:0] unsignedIntegerValue];
}
uint32_t IosExceptionMinidumpGenerator::GetLRFromException() {
return [[return_addresses_ objectAtIndex:1] unsignedIntegerValue];
}
bool IosExceptionMinidumpGenerator::WriteExceptionStream(
MDRawDirectory *exception_stream) {
#ifdef HAS_ARM_SUPPORT
@ -135,22 +138,22 @@ bool IosExceptionMinidumpGenerator::WriteThreadStream(mach_port_t thread_id,
scoped_array<uint8_t> stack_memory(new uint8_t[size]);
uint32_t sp = size - 4;
uint32_t fp = 0;
uint32_t lr = [[return_addresses_ lastObject] unsignedIntegerValue];
for (int current_frame = frame_count - 2;
current_frame >= 0;
uint32_t lr = 0;
for (int current_frame = frame_count - 1;
current_frame > 0;
--current_frame) {
AppendToMemory(stack_memory.get(), sp, fp);
sp -= 4;
fp = sp;
AppendToMemory(stack_memory.get(), sp, lr);
sp -= 4;
AppendToMemory(stack_memory.get(), sp, fp);
fp = sp;
sp -= 4;
lr = [[return_addresses_ objectAtIndex:current_frame] unsignedIntegerValue];
}
if (!memory.Copy(stack_memory.get(), size))
return false;
assert(sp == kExpectedFinalSp);
assert(fp == kExpectedFinalFp);
assert(lr == GetPCFromException());
assert(lr == GetLRFromException());
thread->stack.start_of_memory_range = sp;
thread->stack.memory = memory.location();
memory_blocks_.push_back(thread->stack);