[Lldb-commits] [lldb] [lldb][API] Add Find(Ranges)InMemory() to Process SB API (PR #95007)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 10 09:46:36 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r f26bc5f0c421c7a01a1a611249dd7483b749bab5...da8f23bf675abbb6742987e41939710ccb1c18ac lldb/test/API/python_api/find_in_memory/TestFindInMemory.py lldb/test/API/python_api/find_in_memory/TestFindRangesInMemory.py lldb/test/API/python_api/find_in_memory/address_ranges_helper.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- TestFindInMemory.py 2024-06-10 16:41:58.000000 +0000
+++ TestFindInMemory.py 2024-06-10 16:46:00.243494 +0000
@@ -6,21 +6,25 @@
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
from address_ranges_helper import GetAddressRanges
from address_ranges_helper import SINGLE_INSTANCE_PATTERN
+
class FindInMemoryTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
def setUp(self):
TestBase.setUp(self)
self.build()
- self.target, self.process, self.thread, self.bp = (
- lldbutil.run_to_source_breakpoint(
- self, "break here", lldb.SBFileSpec("main.cpp")
- )
+ (
+ self.target,
+ self.process,
+ self.thread,
+ self.bp,
+ ) = lldbutil.run_to_source_breakpoint(
+ self, "break here", lldb.SBFileSpec("main.cpp")
)
self.assertTrue(self.bp.IsValid())
def test_find_in_memory_ok(self):
"""Make sure a match exists in the heap memory and the right address ranges are provided"""
--- TestFindRangesInMemory.py 2024-06-10 16:41:58.000000 +0000
+++ TestFindRangesInMemory.py 2024-06-10 16:46:00.278882 +0000
@@ -15,14 +15,17 @@
def setUp(self):
TestBase.setUp(self)
self.build()
- self.target, self.process, self.thread, self.bp = (
- lldbutil.run_to_source_breakpoint(
- self, "break here", lldb.SBFileSpec("main.cpp")
- )
+ (
+ self.target,
+ self.process,
+ self.thread,
+ self.bp,
+ ) = lldbutil.run_to_source_breakpoint(
+ self, "break here", lldb.SBFileSpec("main.cpp")
)
self.assertTrue(self.bp.IsValid())
def test_find_ranges_in_memory_two_matches(self):
"""Make sure two matches exist in the heap memory and the right address ranges are provided"""
--- address_ranges_helper.py 2024-06-10 16:41:58.000000 +0000
+++ address_ranges_helper.py 2024-06-10 16:46:00.297741 +0000
@@ -1,9 +1,10 @@
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()
``````````
</details>
https://github.com/llvm/llvm-project/pull/95007
More information about the lldb-commits
mailing list