diff options
Diffstat (limited to 'src/client/linux/handler')
-rw-r--r-- | src/client/linux/handler/exception_handler_unittest.cc | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/client/linux/handler/exception_handler_unittest.cc b/src/client/linux/handler/exception_handler_unittest.cc index 2a080607..be49ef09 100644 --- a/src/client/linux/handler/exception_handler_unittest.cc +++ b/src/client/linux/handler/exception_handler_unittest.cc @@ -873,17 +873,37 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryNullPointer) { ASSERT_GT(st.st_size, 0); // Read the minidump. Locate the exception record and the - // memory list, and then ensure that there is a memory region + // memory list, and then ensure that there is no memory region // in the memory list that covers the instruction pointer from // the exception record. Minidump minidump(minidump_path); ASSERT_TRUE(minidump.Read()); MinidumpException* exception = minidump.GetException(); - MinidumpMemoryList* memory_list = minidump.GetMemoryList(); ASSERT_TRUE(exception); + + MinidumpContext* exception_context = exception->GetContext(); + ASSERT_TRUE(exception_context); + + uint64_t instruction_pointer; + ASSERT_TRUE(exception_context->GetInstructionPointer(&instruction_pointer)); + EXPECT_EQ(instruction_pointer, 0); + + MinidumpMemoryList* memory_list = minidump.GetMemoryList(); ASSERT_TRUE(memory_list); - ASSERT_EQ(static_cast<unsigned int>(1), memory_list->region_count()); + + unsigned int region_count = memory_list->region_count(); + ASSERT_GE(region_count, 1); + + for (unsigned int region_index = 0; + region_index < region_count; + ++region_index) { + MinidumpMemoryRegion* region = + memory_list->GetMemoryRegionAtIndex(region_index); + uint64_t region_base = region->GetBase(); + EXPECT_FALSE(instruction_pointer >= region_base && + instruction_pointer < region_base + region->GetSize()); + } unlink(minidump_path.c_str()); } |