aboutsummaryrefslogtreecommitdiff
path: root/src/client/ios
diff options
context:
space:
mode:
authorqsr@chromium.org <qsr@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-05-03 15:04:12 +0000
committerqsr@chromium.org <qsr@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-05-03 15:04:12 +0000
commite61b76c6793de8085c2ea512d1e45e8c8016bd5c (patch)
treec8c541905d3f76084be14f3be63dda87b2f29b44 /src/client/ios
parentAdd GYP file for tools\windows\symupload. (diff)
downloadbreakpad-e61b76c6793de8085c2ea512d1e45e8c8016bd5c.tar.xz
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
Diffstat (limited to 'src/client/ios')
-rw-r--r--src/client/ios/handler/ios_exception_minidump_generator.h3
-rw-r--r--src/client/ios/handler/ios_exception_minidump_generator.mm21
2 files changed, 15 insertions, 9 deletions
diff --git a/src/client/ios/handler/ios_exception_minidump_generator.h b/src/client/ios/handler/ios_exception_minidump_generator.h
index 59f24819..fd2f0149 100644
--- a/src/client/ios/handler/ios_exception_minidump_generator.h
+++ b/src/client/ios/handler/ios_exception_minidump_generator.h
@@ -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);
diff --git a/src/client/ios/handler/ios_exception_minidump_generator.mm b/src/client/ios/handler/ios_exception_minidump_generator.mm
index 912c4312..764e893c 100644
--- a/src/client/ios/handler/ios_exception_minidump_generator.mm
+++ b/src/client/ios/handler/ios_exception_minidump_generator.mm
@@ -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,14 +138,14 @@ 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);
+ AppendToMemory(stack_memory.get(), sp, lr);
sp -= 4;
+ AppendToMemory(stack_memory.get(), sp, fp);
fp = sp;
- AppendToMemory(stack_memory.get(), sp, lr);
sp -= 4;
lr = [[return_addresses_ objectAtIndex:current_frame] unsignedIntegerValue];
}
@@ -150,7 +153,7 @@ bool IosExceptionMinidumpGenerator::WriteThreadStream(mach_port_t thread_id,
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);