[Lldb-commits] [lldb] [lldb][API] Add Find(Ranges)InMemory() to Process SB API (PR #95007)
Miro Bucko via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 10 11:40:05 PDT 2024
================
@@ -0,0 +1,31 @@
+import lldb
+
+SINGLE_INSTANCE_PATTERN = "there_is_only_one_of_me"
+DOUBLE_INSTANCE_PATTERN = "there_is_exactly_two_of_me"
+
+
+def GetAddressRanges(test_base):
+ mem_regions = test_base.process.GetMemoryRegions()
+ test_base.assertTrue(len(mem_regions) > 0, "Make sure there are memory regions")
+ addr_ranges = lldb.SBAddressRangeList()
+ for i in range(mem_regions.GetSize()):
+ region_info = lldb.SBMemoryRegionInfo()
+ if not mem_regions.GetMemoryRegionAtIndex(i, region_info):
+ continue
+ if not (region_info.IsReadable() and region_info.IsWritable()):
+ continue
+ if region_info.IsExecutable():
+ continue
+ if not region_info.GetName() or region_info.GetName() != "[heap]":
----------------
mbucko wrote:
The above example doesn't have a name which also satisfies the condition so it should work. I mainly wanted to remove regions such as "[stack]" and "/some/path/lib.o" ...
https://github.com/llvm/llvm-project/pull/95007
More information about the lldb-commits
mailing list