summaryrefslogtreecommitdiffstats
path: root/libunwindstack/tests
diff options
context:
space:
mode:
authorFlorian Mayer <fmayer@google.com>2019-01-23 13:35:40 +0000
committerChristopher Ferris <cferris@google.com>2019-01-24 16:29:36 -0800
commitc479e4e789df355a25508a0ed38791978253a2e3 (patch)
treeeaf739ac359890f90d55ac395a2c968a65338660 /libunwindstack/tests
parent10b0a155ee73bedca2d1bd9fefac2727b42ebf08 (diff)
downloadsystem_core-c479e4e789df355a25508a0ed38791978253a2e3.tar.gz
system_core-c479e4e789df355a25508a0ed38791978253a2e3.tar.bz2
system_core-c479e4e789df355a25508a0ed38791978253a2e3.zip
Fix crash in libunwindstack.
Bug: 122657596 Test: New unit test that crashes without this change. Change-Id: I5d978530a833345def94a58805d7ee93b23382bb
Diffstat (limited to 'libunwindstack/tests')
-rw-r--r--libunwindstack/tests/UnwinderTest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/libunwindstack/tests/UnwinderTest.cpp b/libunwindstack/tests/UnwinderTest.cpp
index 49aeeb378..d88531f2b 100644
--- a/libunwindstack/tests/UnwinderTest.cpp
+++ b/libunwindstack/tests/UnwinderTest.cpp
@@ -749,6 +749,23 @@ TEST_F(UnwinderTest, speculative_frame_not_removed_pc_bad) {
EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
}
+// Verify that a speculative frame does not cause a crash when it wasn't
+// really added due to a filter.
+TEST_F(UnwinderTest, speculative_frame_check_with_no_frames) {
+ regs_.set_pc(0x23000);
+ regs_.set_sp(0x10000);
+ regs_.FakeSetReturnAddress(0x23100);
+ regs_.FakeSetReturnAddressValid(true);
+
+ Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
+
+ std::vector<std::string> skip_names{"libanother.so"};
+ unwinder.Unwind(&skip_names);
+ EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
+
+ ASSERT_EQ(0U, unwinder.NumFrames());
+}
+
// Verify that an unwind stops when a frame is in given suffix.
TEST_F(UnwinderTest, map_ignore_suffixes) {
ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));