[Lldb-commits] [lldb] 1b0a802 - [GDBRemote] Handle 'heap' memory region info type (#105883)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 4 07:03:02 PDT 2024
Author: Felipe de Azevedo Piovezan
Date: 2024-09-04T07:02:55-07:00
New Revision: 1b0a80249399dadfe0c3f682fff77bf9eb666535
URL: https://github.com/llvm/llvm-project/commit/1b0a80249399dadfe0c3f682fff77bf9eb666535
DIFF: https://github.com/llvm/llvm-project/commit/1b0a80249399dadfe0c3f682fff77bf9eb666535.diff
LOG: [GDBRemote] Handle 'heap' memory region info type (#105883)
This should cause the memory region info "is stack" field to be set to
"no".
Added:
Modified:
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 0297fe363f69e1..55d76ca8532d39 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1638,6 +1638,8 @@ Status GDBRemoteCommunicationClient::GetMemoryRegionInfo(
for (llvm::StringRef entry : llvm::split(value, ',')) {
if (entry == "stack")
region_info.SetIsStackMemory(MemoryRegionInfo::eYes);
+ else if (entry == "heap")
+ region_info.SetIsStackMemory(MemoryRegionInfo::eNo);
}
} else if (name == "error") {
StringExtractorGDBRemote error_extractor(value);
diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index 18020c8e43fe06..ce5ab2cf508293 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -364,6 +364,15 @@ TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfo) {
EXPECT_TRUE(result.get().Success());
EXPECT_EQ(MemoryRegionInfo::eYes, region_info.GetMemoryTagged());
EXPECT_EQ(MemoryRegionInfo::eYes, region_info.IsStackMemory());
+
+ result = std::async(std::launch::async, [&] {
+ return client.GetMemoryRegionInfo(addr, region_info);
+ });
+
+ HandlePacket(server, "qMemoryRegionInfo:a000",
+ "start:a000;size:2000;type:heap;");
+ EXPECT_TRUE(result.get().Success());
+ EXPECT_EQ(MemoryRegionInfo::eNo, region_info.IsStackMemory());
}
TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfoInvalidResponse) {
More information about the lldb-commits
mailing list