summaryrefslogtreecommitdiffstats
path: root/libunwindstack/tests/ElfTest.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2018-05-17 18:37:38 -0700
committerChristopher Ferris <cferris@google.com>2018-05-21 21:33:02 +0000
commitd299a7ab588cba9038124613ac086635f96a47d4 (patch)
treefa2dd345a0fb772e7afc4702f90a4068aa1daa09 /libunwindstack/tests/ElfTest.cpp
parent7905b1e16286653679b7ff9b595f3ed7de5e182f (diff)
downloadcore-d299a7ab588cba9038124613ac086635f96a47d4.tar.gz
core-d299a7ab588cba9038124613ac086635f96a47d4.tar.bz2
core-d299a7ab588cba9038124613ac086635f96a47d4.zip
Fix bug when doing signal handler lookup.
The new lld linker uses all non-zero offset executable maps. There was a bug when trying to find if the stack is in a signal handler that caused the code to read the wrong place in the elf. Fixed by not adding the elf offset to the relative pc. Also fixed the unwind_for_offline tool to dump multiple stacks if necessary. Added new offline unit test that would have failed with the old code. Bug: 79936827 Test: Ran unit tests and libbacktrace unit tests. Test: Dumped backtraces of system pids. Test: Ran 137-cfi art test. Change-Id: Iaca8c18c2a314902e64c3f72831234297e8dcb1b Merged-In: Iaca8c18c2a314902e64c3f72831234297e8dcb1b (cherry picked from commit 239425b9fa91ae13d18cf8158b31663876d07acf)
Diffstat (limited to 'libunwindstack/tests/ElfTest.cpp')
-rw-r--r--libunwindstack/tests/ElfTest.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libunwindstack/tests/ElfTest.cpp b/libunwindstack/tests/ElfTest.cpp
index f9028c4a5..aecbf6dcb 100644
--- a/libunwindstack/tests/ElfTest.cpp
+++ b/libunwindstack/tests/ElfTest.cpp
@@ -133,7 +133,7 @@ TEST_F(ElfTest, elf_invalid) {
ASSERT_FALSE(elf.GetFunctionName(0, &name, &func_offset));
bool finished;
- ASSERT_FALSE(elf.Step(0, 0, 0, nullptr, nullptr, &finished));
+ ASSERT_FALSE(elf.Step(0, 0, nullptr, nullptr, &finished));
}
TEST_F(ElfTest, elf32_invalid_machine) {
@@ -330,7 +330,7 @@ TEST_F(ElfTest, step_in_signal_map) {
elf.FakeSetValid(true);
elf.FakeSetLoadBias(0);
bool finished;
- ASSERT_TRUE(elf.Step(0x1000, 0x1000, 0x2000, &regs, &process_memory, &finished));
+ ASSERT_TRUE(elf.Step(0x3000, 0x1000, &regs, &process_memory, &finished));
EXPECT_FALSE(finished);
EXPECT_EQ(15U, regs.pc());
EXPECT_EQ(13U, regs.sp());
@@ -370,7 +370,7 @@ TEST_F(ElfTest, step_in_interface) {
EXPECT_CALL(*interface, Step(0x1000, 0, &regs, &process_memory, &finished))
.WillOnce(::testing::Return(true));
- ASSERT_TRUE(elf.Step(0x1004, 0x1000, 0x2000, &regs, &process_memory, &finished));
+ ASSERT_TRUE(elf.Step(0x1004, 0x1000, &regs, &process_memory, &finished));
}
TEST_F(ElfTest, step_in_interface_non_zero_load_bias) {
@@ -388,7 +388,7 @@ TEST_F(ElfTest, step_in_interface_non_zero_load_bias) {
EXPECT_CALL(*interface, Step(0x7300, 0x4000, &regs, &process_memory, &finished))
.WillOnce(::testing::Return(true));
- ASSERT_TRUE(elf.Step(0x7304, 0x7300, 0x2000, &regs, &process_memory, &finished));
+ ASSERT_TRUE(elf.Step(0x7304, 0x7300, &regs, &process_memory, &finished));
}
TEST_F(ElfTest, get_global_invalid_elf) {