Loading debuggerd/libdebuggerd/test/tombstone_test.cpp +70 −70 Original line number Diff line number Diff line Loading @@ -220,21 +220,21 @@ TEST_F(TombstoneTest, multiple_maps) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); map.start = 0xa534000; map.end = 0xa535000; map.offset = 0x3000; map.load_base = 0x2000; map.load_bias = 0x2000; map.flags = PROT_EXEC; map_mock_->AddMap(map); map.start = 0xa634000; map.end = 0xa635000; map.offset = 0; map.load_base = 0; map.load_bias = 0; map.flags = PROT_READ | PROT_WRITE | PROT_EXEC; map.name = "/system/lib/fake.so"; map_mock_->AddMap(map); Loading @@ -244,19 +244,19 @@ TEST_F(TombstoneTest, multiple_maps) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map:\n" #if defined(__LP64__) " 00000000'0a234000-00000000'0a234fff --- 0 1000\n" " 00000000'0a334000-00000000'0a334fff r-- f000 1000\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load base 0x2000)\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load bias 0x2000)\n" " 00000000'0a634000-00000000'0a634fff rwx 0 1000 /system/lib/fake.so\n"; #else " 0a234000-0a234fff --- 0 1000\n" " 0a334000-0a334fff r-- f000 1000\n" " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load base 0x2000)\n" " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load bias 0x2000)\n" " 0a634000-0a634fff rwx 0 1000 /system/lib/fake.so\n"; #endif ASSERT_STREQ(expected_dump, tombstone_contents.c_str()); Loading @@ -274,21 +274,21 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_before) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); map.start = 0xa534000; map.end = 0xa535000; map.offset = 0x3000; map.load_base = 0x2000; map.load_bias = 0x2000; map.flags = PROT_EXEC; map_mock_->AddMap(map); map.start = 0xa634000; map.end = 0xa635000; map.offset = 0; map.load_base = 0; map.load_bias = 0; map.flags = PROT_READ | PROT_WRITE | PROT_EXEC; map.name = "/system/lib/fake.so"; map_mock_->AddMap(map); Loading @@ -304,17 +304,17 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_before) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map: (fault address prefixed with --->)\n" #if defined(__LP64__) "--->Fault address falls at 00000000'00001000 before any mapped regions\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load base 0x2000)\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load bias 0x2000)\n" " 00000000'0a634000-00000000'0a634fff rwx 0 1000 /system/lib/fake.so\n"; #else "--->Fault address falls at 00001000 before any mapped regions\n" " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load base 0x2000)\n" " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load bias 0x2000)\n" " 0a634000-0a634fff rwx 0 1000 /system/lib/fake.so\n"; #endif ASSERT_STREQ(expected_dump, tombstone_contents.c_str()); Loading @@ -332,21 +332,21 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_between) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); map.start = 0xa534000; map.end = 0xa535000; map.offset = 0x3000; map.load_base = 0x2000; map.load_bias = 0x2000; map.flags = PROT_EXEC; map_mock_->AddMap(map); map.start = 0xa634000; map.end = 0xa635000; map.offset = 0; map.load_base = 0; map.load_bias = 0; map.flags = PROT_READ | PROT_WRITE | PROT_EXEC; map.name = "/system/lib/fake.so"; map_mock_->AddMap(map); Loading @@ -362,17 +362,17 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_between) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map: (fault address prefixed with --->)\n" #if defined(__LP64__) " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n" "--->Fault address falls at 00000000'0a533000 between mapped regions\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load base 0x2000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load bias 0x2000)\n" " 00000000'0a634000-00000000'0a634fff rwx 0 1000 /system/lib/fake.so\n"; #else " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n" " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n" "--->Fault address falls at 0a533000 between mapped regions\n" " 0a534000-0a534fff --x 3000 1000 (load base 0x2000)\n" " 0a534000-0a534fff --x 3000 1000 (load bias 0x2000)\n" " 0a634000-0a634fff rwx 0 1000 /system/lib/fake.so\n"; #endif ASSERT_STREQ(expected_dump, tombstone_contents.c_str()); Loading @@ -390,21 +390,21 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_in_map) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); map.start = 0xa534000; map.end = 0xa535000; map.offset = 0x3000; map.load_base = 0x2000; map.load_bias = 0x2000; map.flags = PROT_EXEC; map_mock_->AddMap(map); map.start = 0xa634000; map.end = 0xa635000; map.offset = 0; map.load_base = 0; map.load_bias = 0; map.flags = PROT_READ | PROT_WRITE | PROT_EXEC; map.name = "/system/lib/fake.so"; map_mock_->AddMap(map); Loading @@ -420,15 +420,15 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_in_map) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map: (fault address prefixed with --->)\n" #if defined(__LP64__) " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n" "--->00000000'0a534000-00000000'0a534fff --x 3000 1000 (load base 0x2000)\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n" "--->00000000'0a534000-00000000'0a534fff --x 3000 1000 (load bias 0x2000)\n" " 00000000'0a634000-00000000'0a634fff rwx 0 1000 /system/lib/fake.so\n"; #else " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n" "--->0a534000-0a534fff --x 3000 1000 (load base 0x2000)\n" " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n" "--->0a534000-0a534fff --x 3000 1000 (load bias 0x2000)\n" " 0a634000-0a634fff rwx 0 1000 /system/lib/fake.so\n"; #endif ASSERT_STREQ(expected_dump, tombstone_contents.c_str()); Loading @@ -446,21 +446,21 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_after) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); map.start = 0xa534000; map.end = 0xa535000; map.offset = 0x3000; map.load_base = 0x2000; map.load_bias = 0x2000; map.flags = PROT_EXEC; map_mock_->AddMap(map); map.start = 0xa634000; map.end = 0xa635000; map.offset = 0; map.load_base = 0; map.load_bias = 0; map.flags = PROT_READ | PROT_WRITE | PROT_EXEC; map.name = "/system/lib/fake.so"; map_mock_->AddMap(map); Loading @@ -480,16 +480,16 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_after) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map: (fault address prefixed with --->)\n" #if defined(__LP64__) " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load base 0x2000)\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load bias 0x2000)\n" " 00000000'0a634000-00000000'0a634fff rwx 0 1000 /system/lib/fake.so\n" "--->Fault address falls at 00001234'5a534040 after any mapped regions\n"; #else " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load base 0x2000)\n" " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load bias 0x2000)\n" " 0a634000-0a634fff rwx 0 1000 /system/lib/fake.so\n" "--->Fault address falls at 0f534040 after any mapped regions\n"; #endif Loading @@ -508,7 +508,7 @@ TEST_F(TombstoneTest, multiple_maps_getsiginfo_fail) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); Loading @@ -520,12 +520,12 @@ TEST_F(TombstoneTest, multiple_maps_getsiginfo_fail) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map:\n" #if defined(__LP64__) " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n"; " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n"; #else " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n"; " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n"; #endif ASSERT_STREQ(expected_dump, tombstone_contents.c_str()); Loading debuggerd/libdebuggerd/tombstone.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -466,11 +466,11 @@ static void dump_all_maps(Backtrace* backtrace, BacktraceMap* map, log_t* log, p line += " (BuildId: " + build_id + ")"; } } if (it->load_base != 0) { if (it->load_bias != 0) { if (space_needed) { line += ' '; } line += StringPrintf(" (load base 0x%" PRIxPTR ")", it->load_base); line += StringPrintf(" (load bias 0x%" PRIxPTR ")", it->load_bias); } _LOG(log, logtype::MAPS, "%s\n", line.c_str()); } Loading libbacktrace/Backtrace.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -84,10 +84,8 @@ std::string Backtrace::FormatFrameData(size_t frame_num) { } std::string Backtrace::FormatFrameData(const backtrace_frame_data_t* frame) { uintptr_t relative_pc; std::string map_name; if (BacktraceMap::IsValid(frame->map)) { relative_pc = BacktraceMap::GetRelativePc(frame->map, frame->pc); if (!frame->map.name.empty()) { map_name = frame->map.name.c_str(); if (map_name[0] == '[' && map_name[map_name.size() - 1] == ']') { Loading @@ -99,10 +97,9 @@ std::string Backtrace::FormatFrameData(const backtrace_frame_data_t* frame) { } } else { map_name = "<unknown>"; relative_pc = frame->pc; } std::string line(StringPrintf("#%02zu pc %" PRIPTR " ", frame->num, relative_pc)); std::string line(StringPrintf("#%02zu pc %" PRIPTR " ", frame->num, frame->rel_pc)); line += map_name; // Special handling for non-zero offset maps, we need to print that // information. Loading libbacktrace/UnwindCurrent.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,11 @@ bool UnwindCurrent::UnwindFromContext(size_t num_ignore_frames, ucontext_t* ucon backtrace_frame_data_t* prev = &frames_.at(num_frames-1); prev->stack_size = frame->sp - prev->sp; } if (BacktraceMap::IsValid(frame->map)) { frame->rel_pc = frame->pc - frame->map.start + frame->map.load_bias; } else { frame->rel_pc = frame->pc; } num_frames++; } else { num_ignore_frames--; Loading libbacktrace/UnwindMap.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ bool UnwindMapRemote::GenerateMap() { map.start = unw_map.start; map.end = unw_map.end; map.offset = unw_map.offset; map.load_base = unw_map.load_base; map.load_bias = unw_map.load_base; map.flags = unw_map.flags; map.name = unw_map.path; Loading Loading @@ -106,7 +106,7 @@ bool UnwindMapLocal::GenerateMap() { map.start = unw_map.start; map.end = unw_map.end; map.offset = unw_map.offset; map.load_base = unw_map.load_base; map.load_bias = unw_map.load_base; map.flags = unw_map.flags; map.name = unw_map.path; Loading Loading
debuggerd/libdebuggerd/test/tombstone_test.cpp +70 −70 Original line number Diff line number Diff line Loading @@ -220,21 +220,21 @@ TEST_F(TombstoneTest, multiple_maps) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); map.start = 0xa534000; map.end = 0xa535000; map.offset = 0x3000; map.load_base = 0x2000; map.load_bias = 0x2000; map.flags = PROT_EXEC; map_mock_->AddMap(map); map.start = 0xa634000; map.end = 0xa635000; map.offset = 0; map.load_base = 0; map.load_bias = 0; map.flags = PROT_READ | PROT_WRITE | PROT_EXEC; map.name = "/system/lib/fake.so"; map_mock_->AddMap(map); Loading @@ -244,19 +244,19 @@ TEST_F(TombstoneTest, multiple_maps) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map:\n" #if defined(__LP64__) " 00000000'0a234000-00000000'0a234fff --- 0 1000\n" " 00000000'0a334000-00000000'0a334fff r-- f000 1000\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load base 0x2000)\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load bias 0x2000)\n" " 00000000'0a634000-00000000'0a634fff rwx 0 1000 /system/lib/fake.so\n"; #else " 0a234000-0a234fff --- 0 1000\n" " 0a334000-0a334fff r-- f000 1000\n" " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load base 0x2000)\n" " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load bias 0x2000)\n" " 0a634000-0a634fff rwx 0 1000 /system/lib/fake.so\n"; #endif ASSERT_STREQ(expected_dump, tombstone_contents.c_str()); Loading @@ -274,21 +274,21 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_before) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); map.start = 0xa534000; map.end = 0xa535000; map.offset = 0x3000; map.load_base = 0x2000; map.load_bias = 0x2000; map.flags = PROT_EXEC; map_mock_->AddMap(map); map.start = 0xa634000; map.end = 0xa635000; map.offset = 0; map.load_base = 0; map.load_bias = 0; map.flags = PROT_READ | PROT_WRITE | PROT_EXEC; map.name = "/system/lib/fake.so"; map_mock_->AddMap(map); Loading @@ -304,17 +304,17 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_before) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map: (fault address prefixed with --->)\n" #if defined(__LP64__) "--->Fault address falls at 00000000'00001000 before any mapped regions\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load base 0x2000)\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load bias 0x2000)\n" " 00000000'0a634000-00000000'0a634fff rwx 0 1000 /system/lib/fake.so\n"; #else "--->Fault address falls at 00001000 before any mapped regions\n" " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load base 0x2000)\n" " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load bias 0x2000)\n" " 0a634000-0a634fff rwx 0 1000 /system/lib/fake.so\n"; #endif ASSERT_STREQ(expected_dump, tombstone_contents.c_str()); Loading @@ -332,21 +332,21 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_between) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); map.start = 0xa534000; map.end = 0xa535000; map.offset = 0x3000; map.load_base = 0x2000; map.load_bias = 0x2000; map.flags = PROT_EXEC; map_mock_->AddMap(map); map.start = 0xa634000; map.end = 0xa635000; map.offset = 0; map.load_base = 0; map.load_bias = 0; map.flags = PROT_READ | PROT_WRITE | PROT_EXEC; map.name = "/system/lib/fake.so"; map_mock_->AddMap(map); Loading @@ -362,17 +362,17 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_between) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map: (fault address prefixed with --->)\n" #if defined(__LP64__) " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n" "--->Fault address falls at 00000000'0a533000 between mapped regions\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load base 0x2000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load bias 0x2000)\n" " 00000000'0a634000-00000000'0a634fff rwx 0 1000 /system/lib/fake.so\n"; #else " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n" " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n" "--->Fault address falls at 0a533000 between mapped regions\n" " 0a534000-0a534fff --x 3000 1000 (load base 0x2000)\n" " 0a534000-0a534fff --x 3000 1000 (load bias 0x2000)\n" " 0a634000-0a634fff rwx 0 1000 /system/lib/fake.so\n"; #endif ASSERT_STREQ(expected_dump, tombstone_contents.c_str()); Loading @@ -390,21 +390,21 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_in_map) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); map.start = 0xa534000; map.end = 0xa535000; map.offset = 0x3000; map.load_base = 0x2000; map.load_bias = 0x2000; map.flags = PROT_EXEC; map_mock_->AddMap(map); map.start = 0xa634000; map.end = 0xa635000; map.offset = 0; map.load_base = 0; map.load_bias = 0; map.flags = PROT_READ | PROT_WRITE | PROT_EXEC; map.name = "/system/lib/fake.so"; map_mock_->AddMap(map); Loading @@ -420,15 +420,15 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_in_map) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map: (fault address prefixed with --->)\n" #if defined(__LP64__) " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n" "--->00000000'0a534000-00000000'0a534fff --x 3000 1000 (load base 0x2000)\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n" "--->00000000'0a534000-00000000'0a534fff --x 3000 1000 (load bias 0x2000)\n" " 00000000'0a634000-00000000'0a634fff rwx 0 1000 /system/lib/fake.so\n"; #else " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n" "--->0a534000-0a534fff --x 3000 1000 (load base 0x2000)\n" " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n" "--->0a534000-0a534fff --x 3000 1000 (load bias 0x2000)\n" " 0a634000-0a634fff rwx 0 1000 /system/lib/fake.so\n"; #endif ASSERT_STREQ(expected_dump, tombstone_contents.c_str()); Loading @@ -446,21 +446,21 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_after) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); map.start = 0xa534000; map.end = 0xa535000; map.offset = 0x3000; map.load_base = 0x2000; map.load_bias = 0x2000; map.flags = PROT_EXEC; map_mock_->AddMap(map); map.start = 0xa634000; map.end = 0xa635000; map.offset = 0; map.load_base = 0; map.load_bias = 0; map.flags = PROT_READ | PROT_WRITE | PROT_EXEC; map.name = "/system/lib/fake.so"; map_mock_->AddMap(map); Loading @@ -480,16 +480,16 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_after) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map: (fault address prefixed with --->)\n" #if defined(__LP64__) " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load base 0x2000)\n" " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 00000000'0a534000-00000000'0a534fff --x 3000 1000 (load bias 0x2000)\n" " 00000000'0a634000-00000000'0a634fff rwx 0 1000 /system/lib/fake.so\n" "--->Fault address falls at 00001234'5a534040 after any mapped regions\n"; #else " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load base 0x2000)\n" " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n" " 0a534000-0a534fff --x 3000 1000 (load bias 0x2000)\n" " 0a634000-0a634fff rwx 0 1000 /system/lib/fake.so\n" "--->Fault address falls at 0f534040 after any mapped regions\n"; #endif Loading @@ -508,7 +508,7 @@ TEST_F(TombstoneTest, multiple_maps_getsiginfo_fail) { map.start = 0xa434000; map.end = 0xa435000; map.offset = 0x1000; map.load_base = 0xd000; map.load_bias = 0xd000; map.flags = PROT_WRITE; map_mock_->AddMap(map); Loading @@ -520,12 +520,12 @@ TEST_F(TombstoneTest, multiple_maps_getsiginfo_fail) { std::string tombstone_contents; ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0); ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents)); const char* expected_dump = \ const char* expected_dump = "\nmemory map:\n" #if defined(__LP64__) " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load base 0xd000)\n"; " 00000000'0a434000-00000000'0a434fff -w- 1000 1000 (load bias 0xd000)\n"; #else " 0a434000-0a434fff -w- 1000 1000 (load base 0xd000)\n"; " 0a434000-0a434fff -w- 1000 1000 (load bias 0xd000)\n"; #endif ASSERT_STREQ(expected_dump, tombstone_contents.c_str()); Loading
debuggerd/libdebuggerd/tombstone.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -466,11 +466,11 @@ static void dump_all_maps(Backtrace* backtrace, BacktraceMap* map, log_t* log, p line += " (BuildId: " + build_id + ")"; } } if (it->load_base != 0) { if (it->load_bias != 0) { if (space_needed) { line += ' '; } line += StringPrintf(" (load base 0x%" PRIxPTR ")", it->load_base); line += StringPrintf(" (load bias 0x%" PRIxPTR ")", it->load_bias); } _LOG(log, logtype::MAPS, "%s\n", line.c_str()); } Loading
libbacktrace/Backtrace.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -84,10 +84,8 @@ std::string Backtrace::FormatFrameData(size_t frame_num) { } std::string Backtrace::FormatFrameData(const backtrace_frame_data_t* frame) { uintptr_t relative_pc; std::string map_name; if (BacktraceMap::IsValid(frame->map)) { relative_pc = BacktraceMap::GetRelativePc(frame->map, frame->pc); if (!frame->map.name.empty()) { map_name = frame->map.name.c_str(); if (map_name[0] == '[' && map_name[map_name.size() - 1] == ']') { Loading @@ -99,10 +97,9 @@ std::string Backtrace::FormatFrameData(const backtrace_frame_data_t* frame) { } } else { map_name = "<unknown>"; relative_pc = frame->pc; } std::string line(StringPrintf("#%02zu pc %" PRIPTR " ", frame->num, relative_pc)); std::string line(StringPrintf("#%02zu pc %" PRIPTR " ", frame->num, frame->rel_pc)); line += map_name; // Special handling for non-zero offset maps, we need to print that // information. Loading
libbacktrace/UnwindCurrent.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,11 @@ bool UnwindCurrent::UnwindFromContext(size_t num_ignore_frames, ucontext_t* ucon backtrace_frame_data_t* prev = &frames_.at(num_frames-1); prev->stack_size = frame->sp - prev->sp; } if (BacktraceMap::IsValid(frame->map)) { frame->rel_pc = frame->pc - frame->map.start + frame->map.load_bias; } else { frame->rel_pc = frame->pc; } num_frames++; } else { num_ignore_frames--; Loading
libbacktrace/UnwindMap.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ bool UnwindMapRemote::GenerateMap() { map.start = unw_map.start; map.end = unw_map.end; map.offset = unw_map.offset; map.load_base = unw_map.load_base; map.load_bias = unw_map.load_base; map.flags = unw_map.flags; map.name = unw_map.path; Loading Loading @@ -106,7 +106,7 @@ bool UnwindMapLocal::GenerateMap() { map.start = unw_map.start; map.end = unw_map.end; map.offset = unw_map.offset; map.load_base = unw_map.load_base; map.load_bias = unw_map.load_base; map.flags = unw_map.flags; map.name = unw_map.path; Loading