[Lldb-commits] [lldb] b97afc9 - [lldb] Update MemoryRegionInfo ctors in unit tests
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 11 14:13:48 PDT 2021
Author: Jonas Devlieghere
Date: 2021-08-11T14:13:41-07:00
New Revision: b97afc9dc0e96116b1369e4dbbcf9ada698b8802
URL: https://github.com/llvm/llvm-project/commit/b97afc9dc0e96116b1369e4dbbcf9ada698b8802
DIFF: https://github.com/llvm/llvm-project/commit/b97afc9dc0e96116b1369e4dbbcf9ada698b8802.diff
LOG: [lldb] Update MemoryRegionInfo ctors in unit tests
Added:
Modified:
lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp
lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
lldb/unittests/Process/minidump/MinidumpParserTest.cpp
Removed:
################################################################################
diff --git a/lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp b/lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp
index 66db61ff65969..bc714e26fbfdf 100644
--- a/lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp
+++ b/lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp
@@ -91,6 +91,7 @@ INSTANTIATE_TEST_SUITE_P(
MemoryRegionInfo::eYes, MemoryRegionInfo::eNo,
MemoryRegionInfo::eYes, ConstString("[abc]"),
MemoryRegionInfo::eDontKnow, 0,
+ MemoryRegionInfo::eDontKnow,
MemoryRegionInfo::eDontKnow),
},
"unexpected /proc/{pid}/maps exec permission char"),
@@ -98,12 +99,12 @@ INSTANTIATE_TEST_SUITE_P(
std::make_tuple(
"55a4512f7000-55a451b68000 rw-p 00000000 00:00 0 [heap]",
MemoryRegionInfos{
- MemoryRegionInfo(make_range(0x55a4512f7000, 0x55a451b68000),
- MemoryRegionInfo::eYes, MemoryRegionInfo::eYes,
- MemoryRegionInfo::eNo, MemoryRegionInfo::eYes,
- ConstString("[heap]"),
- MemoryRegionInfo::eDontKnow, 0,
- MemoryRegionInfo::eDontKnow),
+ MemoryRegionInfo(
+ make_range(0x55a4512f7000, 0x55a451b68000),
+ MemoryRegionInfo::eYes, MemoryRegionInfo::eYes,
+ MemoryRegionInfo::eNo, MemoryRegionInfo::eYes,
+ ConstString("[heap]"), MemoryRegionInfo::eDontKnow, 0,
+ MemoryRegionInfo::eDontKnow, MemoryRegionInfo::eDontKnow),
},
""),
// Multiple entries
@@ -112,18 +113,18 @@ INSTANTIATE_TEST_SUITE_P(
"ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 "
"[vsyscall]",
MemoryRegionInfos{
- MemoryRegionInfo(make_range(0x7fc090021000, 0x7fc094000000),
- MemoryRegionInfo::eNo, MemoryRegionInfo::eNo,
- MemoryRegionInfo::eNo, MemoryRegionInfo::eYes,
- ConstString(nullptr),
- MemoryRegionInfo::eDontKnow, 0,
- MemoryRegionInfo::eDontKnow),
+ MemoryRegionInfo(
+ make_range(0x7fc090021000, 0x7fc094000000),
+ MemoryRegionInfo::eNo, MemoryRegionInfo::eNo,
+ MemoryRegionInfo::eNo, MemoryRegionInfo::eYes,
+ ConstString(nullptr), MemoryRegionInfo::eDontKnow, 0,
+ MemoryRegionInfo::eDontKnow, MemoryRegionInfo::eDontKnow),
MemoryRegionInfo(
make_range(0xffffffffff600000, 0xffffffffff601000),
MemoryRegionInfo::eYes, MemoryRegionInfo::eNo,
MemoryRegionInfo::eYes, MemoryRegionInfo::eYes,
ConstString("[vsyscall]"), MemoryRegionInfo::eDontKnow, 0,
- MemoryRegionInfo::eDontKnow),
+ MemoryRegionInfo::eDontKnow, MemoryRegionInfo::eDontKnow),
},
"")));
@@ -144,12 +145,12 @@ INSTANTIATE_TEST_SUITE_P(
"1111-2222 rw-p 00000000 00:00 0 [foo]\n"
"0/0 rw-p 00000000 00:00 0",
MemoryRegionInfos{
- MemoryRegionInfo(make_range(0x1111, 0x2222),
- MemoryRegionInfo::eYes, MemoryRegionInfo::eYes,
- MemoryRegionInfo::eNo, MemoryRegionInfo::eYes,
- ConstString("[foo]"),
- MemoryRegionInfo::eDontKnow, 0,
- MemoryRegionInfo::eDontKnow),
+ MemoryRegionInfo(
+ make_range(0x1111, 0x2222), MemoryRegionInfo::eYes,
+ MemoryRegionInfo::eYes, MemoryRegionInfo::eNo,
+ MemoryRegionInfo::eYes, ConstString("[foo]"),
+ MemoryRegionInfo::eDontKnow, 0, MemoryRegionInfo::eDontKnow,
+ MemoryRegionInfo::eDontKnow),
},
"malformed /proc/{pid}/smaps entry, missing dash between address "
"range"),
@@ -164,12 +165,12 @@ INSTANTIATE_TEST_SUITE_P(
std::make_tuple(
"1111-2222 rw-p 00000000 00:00 0 [foo]",
MemoryRegionInfos{
- MemoryRegionInfo(make_range(0x1111, 0x2222),
- MemoryRegionInfo::eYes, MemoryRegionInfo::eYes,
- MemoryRegionInfo::eNo, MemoryRegionInfo::eYes,
- ConstString("[foo]"),
- MemoryRegionInfo::eDontKnow, 0,
- MemoryRegionInfo::eDontKnow),
+ MemoryRegionInfo(
+ make_range(0x1111, 0x2222), MemoryRegionInfo::eYes,
+ MemoryRegionInfo::eYes, MemoryRegionInfo::eNo,
+ MemoryRegionInfo::eYes, ConstString("[foo]"),
+ MemoryRegionInfo::eDontKnow, 0, MemoryRegionInfo::eDontKnow,
+ MemoryRegionInfo::eDontKnow),
},
""),
// Single region with flags, other lines ignored
@@ -183,7 +184,8 @@ INSTANTIATE_TEST_SUITE_P(
make_range(0x1111, 0x2222), MemoryRegionInfo::eYes,
MemoryRegionInfo::eYes, MemoryRegionInfo::eNo,
MemoryRegionInfo::eYes, ConstString("[foo]"),
- MemoryRegionInfo::eDontKnow, 0, MemoryRegionInfo::eYes),
+ MemoryRegionInfo::eDontKnow, 0, MemoryRegionInfo::eYes,
+ MemoryRegionInfo::eDontKnow),
},
""),
// Whitespace ignored
@@ -195,7 +197,8 @@ INSTANTIATE_TEST_SUITE_P(
MemoryRegionInfo::eYes, MemoryRegionInfo::eNo,
MemoryRegionInfo::eYes, ConstString(nullptr),
MemoryRegionInfo::eDontKnow, 0,
- MemoryRegionInfo::eYes),
+ MemoryRegionInfo::eYes,
+ MemoryRegionInfo::eDontKnow),
},
""),
// VmFlags line means it has flag info, but nothing is set
@@ -207,7 +210,8 @@ INSTANTIATE_TEST_SUITE_P(
MemoryRegionInfo::eYes, MemoryRegionInfo::eNo,
MemoryRegionInfo::eYes, ConstString(nullptr),
MemoryRegionInfo::eDontKnow, 0,
- MemoryRegionInfo::eNo),
+ MemoryRegionInfo::eNo,
+ MemoryRegionInfo::eDontKnow),
},
""),
// Handle some pages not having a flags line
@@ -218,17 +222,18 @@ INSTANTIATE_TEST_SUITE_P(
"3333-4444 r-xp 00000000 00:00 0 [bar]\n"
"VmFlags: mt",
MemoryRegionInfos{
- MemoryRegionInfo(make_range(0x1111, 0x2222),
- MemoryRegionInfo::eYes, MemoryRegionInfo::eYes,
- MemoryRegionInfo::eNo, MemoryRegionInfo::eYes,
- ConstString("[foo]"),
- MemoryRegionInfo::eDontKnow, 0,
- MemoryRegionInfo::eDontKnow),
+ MemoryRegionInfo(
+ make_range(0x1111, 0x2222), MemoryRegionInfo::eYes,
+ MemoryRegionInfo::eYes, MemoryRegionInfo::eNo,
+ MemoryRegionInfo::eYes, ConstString("[foo]"),
+ MemoryRegionInfo::eDontKnow, 0, MemoryRegionInfo::eDontKnow,
+ MemoryRegionInfo::eDontKnow),
MemoryRegionInfo(
make_range(0x3333, 0x4444), MemoryRegionInfo::eYes,
MemoryRegionInfo::eNo, MemoryRegionInfo::eYes,
MemoryRegionInfo::eYes, ConstString("[bar]"),
- MemoryRegionInfo::eDontKnow, 0, MemoryRegionInfo::eYes),
+ MemoryRegionInfo::eDontKnow, 0, MemoryRegionInfo::eYes,
+ MemoryRegionInfo::eDontKnow),
},
""),
// Handle no pages having a flags line (older kernels)
@@ -240,18 +245,18 @@ INSTANTIATE_TEST_SUITE_P(
"KernelPageSize: 4 kB\n"
"MMUPageSize: 4 kB\n",
MemoryRegionInfos{
- MemoryRegionInfo(make_range(0x1111, 0x2222),
- MemoryRegionInfo::eYes, MemoryRegionInfo::eYes,
- MemoryRegionInfo::eNo, MemoryRegionInfo::eYes,
- ConstString(nullptr),
- MemoryRegionInfo::eDontKnow, 0,
- MemoryRegionInfo::eDontKnow),
- MemoryRegionInfo(make_range(0x3333, 0x4444),
- MemoryRegionInfo::eYes, MemoryRegionInfo::eNo,
- MemoryRegionInfo::eYes, MemoryRegionInfo::eYes,
- ConstString(nullptr),
- MemoryRegionInfo::eDontKnow, 0,
- MemoryRegionInfo::eDontKnow),
+ MemoryRegionInfo(
+ make_range(0x1111, 0x2222), MemoryRegionInfo::eYes,
+ MemoryRegionInfo::eYes, MemoryRegionInfo::eNo,
+ MemoryRegionInfo::eYes, ConstString(nullptr),
+ MemoryRegionInfo::eDontKnow, 0, MemoryRegionInfo::eDontKnow,
+ MemoryRegionInfo::eDontKnow),
+ MemoryRegionInfo(
+ make_range(0x3333, 0x4444), MemoryRegionInfo::eYes,
+ MemoryRegionInfo::eNo, MemoryRegionInfo::eYes,
+ MemoryRegionInfo::eYes, ConstString(nullptr),
+ MemoryRegionInfo::eDontKnow, 0, MemoryRegionInfo::eDontKnow,
+ MemoryRegionInfo::eDontKnow),
},
"")));
diff --git a/lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp b/lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
index 128dac7a21c39..0460b3fc1359b 100644
--- a/lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
+++ b/lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
@@ -138,7 +138,8 @@ static MemoryRegionInfo MakeRegionInfo(lldb::addr_t base, lldb::addr_t size,
MemoryRegionInfo::eYes, MemoryRegionInfo::eYes, MemoryRegionInfo::eYes,
ConstString(), MemoryRegionInfo::eNo, 0,
/*memory_tagged=*/
- tagged ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo);
+ tagged ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo,
+ MemoryRegionInfo::eDontKnow);
}
TEST(MemoryTagManagerAArch64MTETest, MakeTaggedRange) {
diff --git a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp
index e3f23c5fe33ad..95e2cf30b3dae 100644
--- a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp
+++ b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -376,18 +376,19 @@ TEST_F(MinidumpParserTest, GetMemoryRegionInfo) {
EXPECT_THAT(
parser->BuildMemoryRegions(),
- testing::Pair(testing::ElementsAre(
- MemoryRegionInfo({0x0, 0x10000}, no, no, no, no,
- ConstString(), unknown, 0, unknown),
- MemoryRegionInfo({0x10000, 0x21000}, yes, yes, no, yes,
- ConstString(), unknown, 0, unknown),
- MemoryRegionInfo({0x40000, 0x1000}, yes, no, no, yes,
- ConstString(), unknown, 0, unknown),
- MemoryRegionInfo({0x7ffe0000, 0x1000}, yes, no, no, yes,
- ConstString(), unknown, 0, unknown),
- MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, yes,
- ConstString(), unknown, 0, unknown)),
- true));
+ testing::Pair(
+ testing::ElementsAre(
+ MemoryRegionInfo({0x0, 0x10000}, no, no, no, no, ConstString(),
+ unknown, 0, unknown, unknown),
+ MemoryRegionInfo({0x10000, 0x21000}, yes, yes, no, yes,
+ ConstString(), unknown, 0, unknown, unknown),
+ MemoryRegionInfo({0x40000, 0x1000}, yes, no, no, yes,
+ ConstString(), unknown, 0, unknown, unknown),
+ MemoryRegionInfo({0x7ffe0000, 0x1000}, yes, no, no, yes,
+ ConstString(), unknown, 0, unknown, unknown),
+ MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, yes,
+ ConstString(), unknown, 0, unknown, unknown)),
+ true));
}
TEST_F(MinidumpParserTest, GetMemoryRegionInfoFromMemoryList) {
@@ -412,9 +413,9 @@ TEST_F(MinidumpParserTest, GetMemoryRegionInfoFromMemoryList) {
testing::Pair(
testing::ElementsAre(
MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, yes,
- ConstString(), unknown, 0, unknown),
+ ConstString(), unknown, 0, unknown, unknown),
MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, yes,
- ConstString(), unknown, 0, unknown)),
+ ConstString(), unknown, 0, unknown, unknown)),
false));
}
@@ -428,9 +429,9 @@ TEST_F(MinidumpParserTest, GetMemoryRegionInfoFromMemory64List) {
testing::Pair(
testing::ElementsAre(
MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, yes,
- ConstString(), unknown, 0, unknown),
+ ConstString(), unknown, 0, unknown, unknown),
MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, yes,
- ConstString(), unknown, 0, unknown)),
+ ConstString(), unknown, 0, unknown, unknown)),
false));
}
@@ -455,22 +456,23 @@ TEST_F(MinidumpParserTest, GetMemoryRegionInfoLinuxMaps) {
ConstString app_process("/system/bin/app_process");
ConstString linker("/system/bin/linker");
ConstString liblog("/system/lib/liblog.so");
- EXPECT_THAT(parser->BuildMemoryRegions(),
- testing::Pair(
- testing::ElementsAre(
- MemoryRegionInfo({0x400d9000, 0x2000}, yes, no, yes, yes,
- app_process, unknown, 0, unknown),
- MemoryRegionInfo({0x400db000, 0x1000}, yes, no, no, yes,
- app_process, unknown, 0, unknown),
- MemoryRegionInfo({0x400dc000, 0x1000}, yes, yes, no, yes,
- ConstString(), unknown, 0, unknown),
- MemoryRegionInfo({0x400ec000, 0x1000}, yes, no, no, yes,
- ConstString(), unknown, 0, unknown),
- MemoryRegionInfo({0x400ee000, 0x1000}, yes, yes, no, yes,
- linker, unknown, 0, unknown),
- MemoryRegionInfo({0x400fc000, 0x1000}, yes, yes, yes, yes,
- liblog, unknown, 0, unknown)),
- true));
+ EXPECT_THAT(
+ parser->BuildMemoryRegions(),
+ testing::Pair(
+ testing::ElementsAre(
+ MemoryRegionInfo({0x400d9000, 0x2000}, yes, no, yes, yes,
+ app_process, unknown, 0, unknown, unknown),
+ MemoryRegionInfo({0x400db000, 0x1000}, yes, no, no, yes,
+ app_process, unknown, 0, unknown, unknown),
+ MemoryRegionInfo({0x400dc000, 0x1000}, yes, yes, no, yes,
+ ConstString(), unknown, 0, unknown, unknown),
+ MemoryRegionInfo({0x400ec000, 0x1000}, yes, no, no, yes,
+ ConstString(), unknown, 0, unknown, unknown),
+ MemoryRegionInfo({0x400ee000, 0x1000}, yes, yes, no, yes, linker,
+ unknown, 0, unknown, unknown),
+ MemoryRegionInfo({0x400fc000, 0x1000}, yes, yes, yes, yes, liblog,
+ unknown, 0, unknown, unknown)),
+ true));
}
TEST_F(MinidumpParserTest, GetMemoryRegionInfoLinuxMapsError) {
@@ -486,11 +488,12 @@ TEST_F(MinidumpParserTest, GetMemoryRegionInfoLinuxMapsError) {
llvm::Succeeded());
// Test that when a /proc/maps region fails to parse
// we handle the error and continue with the rest.
- EXPECT_THAT(parser->BuildMemoryRegions(),
- testing::Pair(testing::ElementsAre(MemoryRegionInfo(
- {0x400fc000, 0x1000}, yes, yes, yes, yes,
- ConstString(nullptr), unknown, 0, unknown)),
- true));
+ EXPECT_THAT(
+ parser->BuildMemoryRegions(),
+ testing::Pair(testing::ElementsAre(MemoryRegionInfo(
+ {0x400fc000, 0x1000}, yes, yes, yes, yes,
+ ConstString(nullptr), unknown, 0, unknown, unknown)),
+ true));
}
// Windows Minidump tests
More information about the lldb-commits
mailing list