Skip to content

Commit 1b0a802

Browse files
[GDBRemote] Handle 'heap' memory region info type (#105883)
This should cause the memory region info "is stack" field to be set to "no".
1 parent 7732d8e commit 1b0a802

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,6 +1638,8 @@ Status GDBRemoteCommunicationClient::GetMemoryRegionInfo(
16381638
for (llvm::StringRef entry : llvm::split(value, ',')) {
16391639
if (entry == "stack")
16401640
region_info.SetIsStackMemory(MemoryRegionInfo::eYes);
1641+
else if (entry == "heap")
1642+
region_info.SetIsStackMemory(MemoryRegionInfo::eNo);
16411643
}
16421644
} else if (name == "error") {
16431645
StringExtractorGDBRemote error_extractor(value);

lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,15 @@ TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfo) {
364364
EXPECT_TRUE(result.get().Success());
365365
EXPECT_EQ(MemoryRegionInfo::eYes, region_info.GetMemoryTagged());
366366
EXPECT_EQ(MemoryRegionInfo::eYes, region_info.IsStackMemory());
367+
368+
result = std::async(std::launch::async, [&] {
369+
return client.GetMemoryRegionInfo(addr, region_info);
370+
});
371+
372+
HandlePacket(server, "qMemoryRegionInfo:a000",
373+
"start:a000;size:2000;type:heap;");
374+
EXPECT_TRUE(result.get().Success());
375+
EXPECT_EQ(MemoryRegionInfo::eNo, region_info.IsStackMemory());
367376
}
368377

369378
TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfoInvalidResponse) {

0 commit comments

Comments
 (0)