aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2023-09-21 10:21:53 +0000
committerDavid Spickett <david.spickett@linaro.org>2023-09-21 10:35:15 +0000
commit75e862077834c06e574d34e8958dd2ee7cc1d334 (patch)
tree24b227451022b0ad2f0a22aecbdaf94aad9bf876 /lldb/test/API/python_api
parent618e5d2c2d8e0c288c37b883ece553ca4f994c2e (diff)
downloadllvm-75e862077834c06e574d34e8958dd2ee7cc1d334.zip
llvm-75e862077834c06e574d34e8958dd2ee7cc1d334.tar.gz
llvm-75e862077834c06e574d34e8958dd2ee7cc1d334.tar.bz2
Reland "[lldb] Add 'modify' type watchpoints, make it default (#66308)"
This reverts commit a7b78cac9a77e3ef6bbbd8ab1a559891dc693401. With updates to the tests. TestWatchTaggedAddress.py: Updated the expected watchpoint types, though I'm not sure there should be a differnt default for the two ways of setting them, that needs to be confirmed. TestStepOverWatchpoint.py: Skipped this everywhere because I think what used to happen is you couldn't put 2 watchpoints on the same address (after alignment). I guess that this is now allowed because modify watchpoints aren't accounted for, but likely should be. Needs investigating.
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/default-constructor/sb_target.py5
-rw-r--r--lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py20
2 files changed, 16 insertions, 9 deletions
diff --git a/lldb/test/API/python_api/default-constructor/sb_target.py b/lldb/test/API/python_api/default-constructor/sb_target.py
index 2ba72d39..1acf102 100644
--- a/lldb/test/API/python_api/default-constructor/sb_target.py
+++ b/lldb/test/API/python_api/default-constructor/sb_target.py
@@ -53,7 +53,10 @@ def fuzz_obj(obj):
obj.GetByteOrder()
obj.GetTriple()
error = lldb.SBError()
- obj.WatchAddress(123, 8, True, True, error)
+ wp_opts = lldb.SBWatchpointOptions()
+ wp_opts.SetWatchpointTypeRead(True)
+ wp_opts.SetWatchpointTypeWrite(lldb.eWatchpointWriteTypeOnModify)
+ obj.WatchpointCreateByAddress(123, 8, wp_opts, error)
obj.GetBroadcaster()
obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief)
obj.Clear()
diff --git a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
index 79124b3..bf31819 100644
--- a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
+++ b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
@@ -1,5 +1,5 @@
"""
-Use lldb Python SBtarget.WatchAddress() API to create a watchpoint for write of '*g_char_ptr'.
+Use lldb Python SBtarget.WatchpointCreateByAddress() API to create a watchpoint for write of '*g_char_ptr'.
"""
import lldb
@@ -8,7 +8,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-class TargetWatchAddressAPITestCase(TestBase):
+class TargetWatchpointCreateByAddressPITestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
def setUp(self):
@@ -22,7 +22,7 @@ class TargetWatchAddressAPITestCase(TestBase):
self.violating_func = "do_bad_thing_with_location"
def test_watch_address(self):
- """Exercise SBTarget.WatchAddress() API to set a watchpoint."""
+ """Exercise SBTarget.WatchpointCreateByAddress() API to set a watchpoint."""
self.build()
exe = self.getBuildArtifact("a.out")
@@ -51,8 +51,10 @@ class TargetWatchAddressAPITestCase(TestBase):
)
# Watch for write to *g_char_ptr.
error = lldb.SBError()
- watchpoint = target.WatchAddress(
- value.GetValueAsUnsigned(), 1, False, True, error
+ wp_opts = lldb.SBWatchpointOptions()
+ wp_opts.SetWatchpointTypeWrite(lldb.eWatchpointWriteTypeOnModify)
+ watchpoint = target.WatchpointCreateByAddress(
+ value.GetValueAsUnsigned(), 1, wp_opts, error
)
self.assertTrue(
value and watchpoint, "Successfully found the pointer and set a watchpoint"
@@ -90,7 +92,7 @@ class TargetWatchAddressAPITestCase(TestBase):
@skipIf(archs=["mips", "mipsel", "mips64", "mips64el"])
@skipIf(archs=["s390x"]) # Likewise on SystemZ
def test_watch_address_with_invalid_watch_size(self):
- """Exercise SBTarget.WatchAddress() API but pass an invalid watch_size."""
+ """Exercise SBTarget.WatchpointCreateByAddress() API but pass an invalid watch_size."""
self.build()
exe = self.getBuildArtifact("a.out")
@@ -124,8 +126,10 @@ class TargetWatchAddressAPITestCase(TestBase):
if self.getArchitecture() not in ["arm64", "arm64e", "arm64_32"]:
# Watch for write to *g_char_ptr.
error = lldb.SBError()
- watchpoint = target.WatchAddress(
- value.GetValueAsUnsigned(), 365, False, True, error
+ wp_opts = lldb.SBWatchpointOptions()
+ wp_opts.SetWatchpointTypeWrite(lldb.eWatchpointWriteTypeOnModify)
+ watchpoint = target.WatchpointCreateByAddress(
+ value.GetValueAsUnsigned(), 365, wp_opts, error
)
self.assertFalse(watchpoint)
self.expect(