From 4af8174278106efad4825c07290bf189a9eaa4d2 Mon Sep 17 00:00:00 2001 From: Tobias Sargeant Date: Thu, 23 Feb 2017 14:08:54 +0000 Subject: Use the correct PC when determining whether to skip storing a stack. This addresses a bug in commit 049a1532 that meant that the PC of the crashing thread was always used to determine whether to include a stack, instead of using the PC of the thread in question. BUG=664460 Change-Id: Idcbd5db751e5c00941a1be28607389961c0c75d7 Reviewed-on: https://chromium-review.googlesource.com/446499 Reviewed-by: Robert Sesek --- src/client/linux/minidump_writer/minidump_writer.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/client') diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc index cdd0a1cc..5c2a339e 100644 --- a/src/client/linux/minidump_writer/minidump_writer.cc +++ b/src/client/linux/minidump_writer/minidump_writer.cc @@ -273,7 +273,7 @@ class MinidumpWriter { } bool FillThreadStack(MDRawThread* thread, uintptr_t stack_pointer, - int max_stack_len, uint8_t** stack_copy) { + uintptr_t pc, int max_stack_len, uint8_t** stack_copy) { *stack_copy = NULL; const void* stack; size_t stack_len; @@ -309,7 +309,6 @@ class MinidumpWriter { } uintptr_t low_addr = principal_mapping->system_mapping_info.start_addr; uintptr_t high_addr = principal_mapping->system_mapping_info.end_addr; - uintptr_t pc = UContextReader::GetInstructionPointer(ucontext_); if ((pc < low_addr || pc > high_addr) && !dumper_->StackHasPointerToMapping(*stack_copy, stack_len, stack_pointer_offset, @@ -376,7 +375,9 @@ class MinidumpWriter { !dumper_->IsPostMortem()) { uint8_t* stack_copy; const uintptr_t stack_ptr = UContextReader::GetStackPointer(ucontext_); - if (!FillThreadStack(&thread, stack_ptr, -1, &stack_copy)) + if (!FillThreadStack(&thread, stack_ptr, + UContextReader::GetInstructionPointer(ucontext_), + -1, &stack_copy)) return false; // Copy 256 bytes around crashing instruction pointer to minidump. @@ -442,8 +443,9 @@ class MinidumpWriter { int max_stack_len = -1; // default to no maximum for this thread if (minidump_size_limit_ >= 0 && i >= kLimitBaseThreadCount) max_stack_len = extra_thread_stack_len; - if (!FillThreadStack(&thread, info.stack_pointer, max_stack_len, - &stack_copy)) + if (!FillThreadStack(&thread, info.stack_pointer, + info.GetInstructionPointer(), max_stack_len, + &stack_copy)) return false; TypedMDRVA cpu(&minidump_writer_); -- cgit v1.2.1