mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-01-24 18:11:10 +00:00
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:
parent
110c99fbd5
commit
e61b76c679
|
@ -53,6 +53,9 @@ class IosExceptionMinidumpGenerator : public MinidumpGenerator {
|
||||||
// Get the crashing program counter from the exception.
|
// Get the crashing program counter from the exception.
|
||||||
uint32_t GetPCFromException();
|
uint32_t GetPCFromException();
|
||||||
|
|
||||||
|
// Get the crashing link register from the exception.
|
||||||
|
uint32_t GetLRFromException();
|
||||||
|
|
||||||
// Write a virtual thread context for the crashing site.
|
// Write a virtual thread context for the crashing site.
|
||||||
bool WriteCrashingContext(MDLocationDescriptor *register_location);
|
bool WriteCrashingContext(MDLocationDescriptor *register_location);
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,8 @@ bool IosExceptionMinidumpGenerator::WriteCrashingContext(
|
||||||
context_ptr->context_flags = MD_CONTEXT_ARM_FULL;
|
context_ptr->context_flags = MD_CONTEXT_ARM_FULL;
|
||||||
context_ptr->iregs[7] = kExpectedFinalFp; // FP
|
context_ptr->iregs[7] = kExpectedFinalFp; // FP
|
||||||
context_ptr->iregs[13] = kExpectedFinalSp; // SP
|
context_ptr->iregs[13] = kExpectedFinalSp; // SP
|
||||||
uint32_t pc = GetPCFromException();
|
context_ptr->iregs[14] = GetLRFromException(); // LR
|
||||||
context_ptr->iregs[14] = pc; // LR
|
context_ptr->iregs[15] = GetPCFromException(); // PC
|
||||||
context_ptr->iregs[15] = pc; // PC
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
assert(false);
|
assert(false);
|
||||||
|
@ -93,6 +92,10 @@ uint32_t IosExceptionMinidumpGenerator::GetPCFromException() {
|
||||||
return [[return_addresses_ objectAtIndex:0] unsignedIntegerValue];
|
return [[return_addresses_ objectAtIndex:0] unsignedIntegerValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t IosExceptionMinidumpGenerator::GetLRFromException() {
|
||||||
|
return [[return_addresses_ objectAtIndex:1] unsignedIntegerValue];
|
||||||
|
}
|
||||||
|
|
||||||
bool IosExceptionMinidumpGenerator::WriteExceptionStream(
|
bool IosExceptionMinidumpGenerator::WriteExceptionStream(
|
||||||
MDRawDirectory *exception_stream) {
|
MDRawDirectory *exception_stream) {
|
||||||
#ifdef HAS_ARM_SUPPORT
|
#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]);
|
scoped_array<uint8_t> stack_memory(new uint8_t[size]);
|
||||||
uint32_t sp = size - 4;
|
uint32_t sp = size - 4;
|
||||||
uint32_t fp = 0;
|
uint32_t fp = 0;
|
||||||
uint32_t lr = [[return_addresses_ lastObject] unsignedIntegerValue];
|
uint32_t lr = 0;
|
||||||
for (int current_frame = frame_count - 2;
|
for (int current_frame = frame_count - 1;
|
||||||
current_frame >= 0;
|
current_frame > 0;
|
||||||
--current_frame) {
|
--current_frame) {
|
||||||
AppendToMemory(stack_memory.get(), sp, fp);
|
|
||||||
sp -= 4;
|
|
||||||
fp = sp;
|
|
||||||
AppendToMemory(stack_memory.get(), sp, lr);
|
AppendToMemory(stack_memory.get(), sp, lr);
|
||||||
sp -= 4;
|
sp -= 4;
|
||||||
|
AppendToMemory(stack_memory.get(), sp, fp);
|
||||||
|
fp = sp;
|
||||||
|
sp -= 4;
|
||||||
lr = [[return_addresses_ objectAtIndex:current_frame] unsignedIntegerValue];
|
lr = [[return_addresses_ objectAtIndex:current_frame] unsignedIntegerValue];
|
||||||
}
|
}
|
||||||
if (!memory.Copy(stack_memory.get(), size))
|
if (!memory.Copy(stack_memory.get(), size))
|
||||||
return false;
|
return false;
|
||||||
assert(sp == kExpectedFinalSp);
|
assert(sp == kExpectedFinalSp);
|
||||||
assert(fp == kExpectedFinalFp);
|
assert(fp == kExpectedFinalFp);
|
||||||
assert(lr == GetPCFromException());
|
assert(lr == GetLRFromException());
|
||||||
thread->stack.start_of_memory_range = sp;
|
thread->stack.start_of_memory_range = sp;
|
||||||
thread->stack.memory = memory.location();
|
thread->stack.memory = memory.location();
|
||||||
memory_blocks_.push_back(thread->stack);
|
memory_blocks_.push_back(thread->stack);
|
||||||
|
|
Loading…
Reference in a new issue