Loading libunwindstack/DwarfEhFrameWithHdr.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,9 @@ bool DwarfEhFrameWithHdr<AddressType>::GetFdeOffsetBinary(uint64_t pc, uint64_t* while (first < last) { size_t current = (first + last) / 2; const FdeInfo* info = GetFdeInfoFromIndex(current); if (info == nullptr) { return false; } if (pc == info->pc) { *fde_offset = info->offset; return true; Loading @@ -127,6 +130,9 @@ bool DwarfEhFrameWithHdr<AddressType>::GetFdeOffsetBinary(uint64_t pc, uint64_t* } if (last != 0) { const FdeInfo* info = GetFdeInfoFromIndex(last - 1); if (info == nullptr) { return false; } *fde_offset = info->offset; return true; } Loading libunwindstack/tests/DwarfEhFrameWithHdrTest.cpp +13 −4 Original line number Diff line number Diff line Loading @@ -205,6 +205,14 @@ TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetBinary_verify) { } } TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetBinary_index_fail) { this->eh_frame_->TestSetTableEntrySize(0x10); this->eh_frame_->TestSetFdeCount(10); uint64_t fde_offset; EXPECT_FALSE(this->eh_frame_->GetFdeOffsetBinary(0x1000, &fde_offset, 10)); } TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetSequential) { this->eh_frame_->TestSetFdeCount(10); this->eh_frame_->TestSetEntriesDataOffset(0x100); Loading Loading @@ -414,10 +422,11 @@ TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeFromPc_fde_not_found) { REGISTER_TYPED_TEST_CASE_P(DwarfEhFrameWithHdrTest, Init, GetFdeInfoFromIndex_expect_cache_fail, GetFdeInfoFromIndex_read_pcrel, GetFdeInfoFromIndex_read_datarel, GetFdeInfoFromIndex_cached, GetFdeOffsetBinary_verify, GetFdeOffsetSequential, GetFdeOffsetSequential_last_element, GetFdeOffsetSequential_end_check, GetFdeOffsetFromPc_fail_fde_count, GetFdeOffsetFromPc_binary_search, GetFdeOffsetFromPc_sequential_search, GetCieFde32, GetCieFde64, GetFdeFromPc_fde_not_found); GetFdeOffsetBinary_index_fail, GetFdeOffsetSequential, GetFdeOffsetSequential_last_element, GetFdeOffsetSequential_end_check, GetFdeOffsetFromPc_fail_fde_count, GetFdeOffsetFromPc_binary_search, GetFdeOffsetFromPc_sequential_search, GetCieFde32, GetCieFde64, GetFdeFromPc_fde_not_found); typedef ::testing::Types<uint32_t, uint64_t> DwarfEhFrameWithHdrTestTypes; INSTANTIATE_TYPED_TEST_CASE_P(, DwarfEhFrameWithHdrTest, DwarfEhFrameWithHdrTestTypes); Loading Loading
libunwindstack/DwarfEhFrameWithHdr.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,9 @@ bool DwarfEhFrameWithHdr<AddressType>::GetFdeOffsetBinary(uint64_t pc, uint64_t* while (first < last) { size_t current = (first + last) / 2; const FdeInfo* info = GetFdeInfoFromIndex(current); if (info == nullptr) { return false; } if (pc == info->pc) { *fde_offset = info->offset; return true; Loading @@ -127,6 +130,9 @@ bool DwarfEhFrameWithHdr<AddressType>::GetFdeOffsetBinary(uint64_t pc, uint64_t* } if (last != 0) { const FdeInfo* info = GetFdeInfoFromIndex(last - 1); if (info == nullptr) { return false; } *fde_offset = info->offset; return true; } Loading
libunwindstack/tests/DwarfEhFrameWithHdrTest.cpp +13 −4 Original line number Diff line number Diff line Loading @@ -205,6 +205,14 @@ TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetBinary_verify) { } } TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetBinary_index_fail) { this->eh_frame_->TestSetTableEntrySize(0x10); this->eh_frame_->TestSetFdeCount(10); uint64_t fde_offset; EXPECT_FALSE(this->eh_frame_->GetFdeOffsetBinary(0x1000, &fde_offset, 10)); } TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetSequential) { this->eh_frame_->TestSetFdeCount(10); this->eh_frame_->TestSetEntriesDataOffset(0x100); Loading Loading @@ -414,10 +422,11 @@ TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeFromPc_fde_not_found) { REGISTER_TYPED_TEST_CASE_P(DwarfEhFrameWithHdrTest, Init, GetFdeInfoFromIndex_expect_cache_fail, GetFdeInfoFromIndex_read_pcrel, GetFdeInfoFromIndex_read_datarel, GetFdeInfoFromIndex_cached, GetFdeOffsetBinary_verify, GetFdeOffsetSequential, GetFdeOffsetSequential_last_element, GetFdeOffsetSequential_end_check, GetFdeOffsetFromPc_fail_fde_count, GetFdeOffsetFromPc_binary_search, GetFdeOffsetFromPc_sequential_search, GetCieFde32, GetCieFde64, GetFdeFromPc_fde_not_found); GetFdeOffsetBinary_index_fail, GetFdeOffsetSequential, GetFdeOffsetSequential_last_element, GetFdeOffsetSequential_end_check, GetFdeOffsetFromPc_fail_fde_count, GetFdeOffsetFromPc_binary_search, GetFdeOffsetFromPc_sequential_search, GetCieFde32, GetCieFde64, GetFdeFromPc_fde_not_found); typedef ::testing::Types<uint32_t, uint64_t> DwarfEhFrameWithHdrTestTypes; INSTANTIATE_TYPED_TEST_CASE_P(, DwarfEhFrameWithHdrTest, DwarfEhFrameWithHdrTestTypes); Loading