From 02a6c448c32c37aae834bc25e92db97bfac32524 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Mon, 11 Mar 2019 14:43:33 -0700 Subject: Add support for displaying soname in an apk. Changes: - Change GetSoname to always returns a std::string. - Added new unit tests for the soname printing. - Modify the GetElf() function to save the same elf when we see rosegment linkers that split the read-only and read-write across a map. This avoids creating multiple elf objects for each map. - Fixed a few offline unwind tests. Bug: 29218999 Test: Unit tests pass. Change-Id: Iad7c38b5c2957a8c5fd4ba94ebec335bafcad57d --- libunwindstack/tests/ElfInterfaceTest.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'libunwindstack/tests/ElfInterfaceTest.cpp') diff --git a/libunwindstack/tests/ElfInterfaceTest.cpp b/libunwindstack/tests/ElfInterfaceTest.cpp index 7239749c6..d895863bb 100644 --- a/libunwindstack/tests/ElfInterfaceTest.cpp +++ b/libunwindstack/tests/ElfInterfaceTest.cpp @@ -555,9 +555,7 @@ void ElfInterfaceTest::Soname() { ASSERT_TRUE(elf->Init(&load_bias)); EXPECT_EQ(0U, load_bias); - std::string name; - ASSERT_TRUE(elf->GetSoname(&name)); - ASSERT_STREQ("fake_soname.so", name.c_str()); + ASSERT_EQ("fake_soname.so", elf->GetSoname()); } TEST_F(ElfInterfaceTest, elf32_soname) { @@ -578,8 +576,7 @@ void ElfInterfaceTest::SonameAfterDtNull() { ASSERT_TRUE(elf->Init(&load_bias)); EXPECT_EQ(0U, load_bias); - std::string name; - ASSERT_FALSE(elf->GetSoname(&name)); + ASSERT_EQ("", elf->GetSoname()); } TEST_F(ElfInterfaceTest, elf32_soname_after_dt_null) { @@ -600,8 +597,7 @@ void ElfInterfaceTest::SonameSize() { ASSERT_TRUE(elf->Init(&load_bias)); EXPECT_EQ(0U, load_bias); - std::string name; - ASSERT_FALSE(elf->GetSoname(&name)); + ASSERT_EQ("", elf->GetSoname()); } TEST_F(ElfInterfaceTest, elf32_soname_size) { @@ -624,8 +620,7 @@ void ElfInterfaceTest::SonameMissingMap() { ASSERT_TRUE(elf->Init(&load_bias)); EXPECT_EQ(0U, load_bias); - std::string name; - ASSERT_FALSE(elf->GetSoname(&name)); + ASSERT_EQ("", elf->GetSoname()); } TEST_F(ElfInterfaceTest, elf32_soname_missing_map) { -- cgit v1.2.3