summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2019-12-28 14:47:51 +0100
committerMed Ismail Bennani <medismail.bennani@gmail.com>2020-01-04 03:11:15 +0100
commitdf71f92fbb7c96cfd36d247ae6fb6929cb9bce35 (patch)
tree9f5a580a7637de248c390bfb16e2a6d4832e58b1 /lldb/packages/Python/lldbsuite
parent05a4cf26365f10ae0cb2ad76f2babfb5ed929fdc (diff)
downloadbcm5719-llvm-df71f92fbb7c96cfd36d247ae6fb6929cb9bce35.tar.gz
bcm5719-llvm-df71f92fbb7c96cfd36d247ae6fb6929cb9bce35.zip
[lldb/Command] Add --force option for `watchpoint delete` command
Currently, there is no option to delete all the watchpoint without LLDB asking for a confirmation. Besides making the watchpoint delete command homogeneous with the breakpoint delete command, this option could also become handy to trigger automated watchpoint deletion i.e. using breakpoint actions. rdar://42560586 Differential Revision: https://reviews.llvm.org/D72096 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/TestWatchpointCommands.py45
1 files changed, 25 insertions, 20 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/TestWatchpointCommands.py b/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/TestWatchpointCommands.py
index 27c332b68bb..a428d18f12c 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/TestWatchpointCommands.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/TestWatchpointCommands.py
@@ -105,24 +105,9 @@ class WatchpointCommandsTestCase(TestBase):
@expectedFailureAll(archs=['s390x'])
def test_rw_watchpoint_delete(self):
"""Test delete watchpoint and expect not to stop for watchpoint."""
- self.build(dictionary=self.d)
- self.setTearDownCleanup(dictionary=self.d)
-
- exe = self.getBuildArtifact(self.exe_name)
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line(
- self, None, self.line, num_expected_locations=1)
-
- # Run the program.
- self.runCmd("run", RUN_SUCCEEDED)
-
- # We should be stopped again due to the breakpoint.
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs=['stopped',
- 'stop reason = breakpoint'])
+ self.build()
+ lldbutil.run_to_line_breakpoint(self, lldb.SBFileSpec(self.source),
+ self.line)
# Now let's set a read_write-type watchpoint for 'global'.
# There should be two watchpoint hits (see main.c).
@@ -145,8 +130,28 @@ class WatchpointCommandsTestCase(TestBase):
# Restore the original setting of auto-confirm.
self.runCmd("settings clear auto-confirm")
- # Use the '-v' option to do verbose listing of the watchpoint.
- self.runCmd("watchpoint list -v")
+ target = self.dbg.GetSelectedTarget()
+ self.assertTrue(target and not target.GetNumWatchpoints())
+
+ # Now let's set a read_write-type watchpoint for 'global'.
+ # There should be two watchpoint hits (see main.c).
+ self.expect(
+ "watchpoint set variable -w read_write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = rw',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
+
+
+ # Delete the watchpoint immediately using the force option.
+ self.expect("watchpoint delete --force",
+ substrs=['All watchpoints removed.'])
+
+ self.assertTrue(target and not target.GetNumWatchpoints())
self.runCmd("process continue")
OpenPOWER on IntegriCloud