summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py238
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py107
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py118
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py7
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py54
5 files changed, 340 insertions, 184 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
index 4ce05af96e2..7a9904c53f8 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
@@ -5,13 +5,14 @@ Test watchpoint list, enable, disable, and delete commands.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointCommandsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,27 +23,37 @@ class WatchpointCommandsTestCase(TestBase):
# Our simple source filename.
self.source = 'main.c'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
- self.line2 = line_number(self.source, '// Set 2nd break point for disable_then_enable test case.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
+ self.line2 = line_number(
+ self.source,
+ '// Set 2nd break point for disable_then_enable test case.')
# And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
- # Build dictionary to have unique executable names for each test method.
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = self.testMethodName
self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_rw_watchpoint(self):
"""Test read_write watchpoint and expect to stop two times."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
-
+
exe = os.path.join(os.getcwd(), 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)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -50,60 +61,72 @@ class WatchpointCommandsTestCase(TestBase):
# 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'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# 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)])
+ self.expect(
+ "watchpoint set variable -w read_write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = rw',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['Number of supported hardware watchpoints:',
- 'hit_count = 0'])
+ substrs=['Number of supported hardware watchpoints:',
+ 'hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (read_write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (read_write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
self.runCmd("process continue")
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 2.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 2'])
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ substrs=['hit_count = 2'])
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @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 = os.path.join(os.getcwd(), 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)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -111,19 +134,27 @@ class WatchpointCommandsTestCase(TestBase):
# 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'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# 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, but set auto-confirm to true first.
+ 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, but set auto-confirm to true
+ # first.
self.runCmd("settings set auto-confirm true")
self.expect("watchpoint delete",
- substrs = ['All watchpoints removed.'])
+ substrs=['All watchpoints removed.'])
# Restore the original setting of auto-confirm.
self.runCmd("settings clear auto-confirm")
@@ -135,21 +166,26 @@ class WatchpointCommandsTestCase(TestBase):
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ substrs=['exited'])
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_rw_watchpoint_set_ignore_count(self):
"""Test watchpoint ignore count and expect to not to stop at all."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
-
+
exe = os.path.join(os.getcwd(), 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)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -157,49 +193,61 @@ class WatchpointCommandsTestCase(TestBase):
# 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'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# 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)])
+ self.expect(
+ "watchpoint set variable -w read_write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = rw',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
# Set the ignore count of the watchpoint immediately.
self.expect("watchpoint ignore -i 2",
- substrs = ['All watchpoints ignored.'])
+ substrs=['All watchpoints ignored.'])
# Use the '-v' option to do verbose listing of the watchpoint.
# Expect to find an ignore_count of 2.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0', 'ignore_count = 2'])
+ substrs=['hit_count = 0', 'ignore_count = 2'])
self.runCmd("process continue")
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
# Use the '-v' option to do verbose listing of the watchpoint.
# Expect to find a hit_count of 2 as well.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 2', 'ignore_count = 2'])
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ substrs=['hit_count = 2', 'ignore_count = 2'])
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_rw_disable_after_first_stop(self):
"""Test read_write watchpoint but disable it after the first stop."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
-
+
exe = os.path.join(os.getcwd(), 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)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -207,49 +255,60 @@ class WatchpointCommandsTestCase(TestBase):
# 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'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# 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)])
+ self.expect(
+ "watchpoint set variable -w read_write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = rw',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['state = enabled', 'hit_count = 0'])
+ substrs=['state = enabled', 'hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (read_write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
# Before continuing, we'll disable the watchpoint, which means we won't
# stop again after this.
self.runCmd("watchpoint disable")
self.expect("watchpoint list -v",
- substrs = ['state = disabled', 'hit_count = 1'])
+ substrs=['state = disabled', 'hit_count = 1'])
self.runCmd("process continue")
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ substrs=['hit_count = 1'])
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_rw_disable_then_enable(self):
"""Test read_write watchpoint, disable initially, then enable it."""
self.build(dictionary=self.d)
@@ -259,8 +318,10 @@ class WatchpointCommandsTestCase(TestBase):
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)
- lldbutil.run_break_set_by_file_and_line (self, None, self.line2, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line2, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -268,14 +329,21 @@ class WatchpointCommandsTestCase(TestBase):
# 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'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# 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)])
+ self.expect(
+ "watchpoint set variable -w read_write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = rw',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
# Immediately, we disable the watchpoint. We won't be stopping due to a
# watchpoint after this.
@@ -284,36 +352,36 @@ class WatchpointCommandsTestCase(TestBase):
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['state = disabled', 'hit_count = 0'])
+ substrs=['state = disabled', 'hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the breakpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stop reason = breakpoint'])
+ substrs=['stop reason = breakpoint'])
# Before continuing, we'll enable the watchpoint, which means we will
# stop again after this.
self.runCmd("watchpoint enable")
self.expect("watchpoint list -v",
- substrs = ['state = enabled', 'hit_count = 0'])
+ substrs=['state = enabled', 'hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (read_write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
self.runCmd("process continue")
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
index ee276dd5687..5b89f14dd85 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
@@ -5,13 +5,14 @@ Test 'watchpoint command'.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointLLDBCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,26 +23,36 @@ class WatchpointLLDBCommandTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
- # Build dictionary to have unique executable names for each test method.
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = 'a%d.out' % self.test_number
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchpoint_command(self):
"""Test 'watchpoint command'."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
-
+
exe = os.path.join(os.getcwd(), 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)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -49,44 +60,58 @@ class WatchpointLLDBCommandTestCase(TestBase):
# 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'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
self.runCmd('watchpoint command add 1 -o "expr -- cookie = 777"')
# List the watchpoint command we just added.
self.expect("watchpoint command list 1",
- substrs = ['expr -- cookie = 777'])
+ substrs=['expr -- cookie = 777'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
# Check that the watchpoint snapshoting mechanism is working.
self.expect("watchpoint list -v",
- substrs = ['old value:', ' = 0',
- 'new value:', ' = 1'])
+ substrs=['old value:', ' = 0',
+ 'new value:', ' = 1'])
- # The watchpoint command "forced" our global variable 'cookie' to become 777.
+ # The watchpoint command "forced" our global variable 'cookie' to
+ # become 777.
self.expect("frame variable --show-globals cookie",
- substrs = ['(int32_t)', 'cookie = 777'])
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ substrs=['(int32_t)', 'cookie = 777'])
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchpoint_command_can_disable_a_watchpoint(self):
"""Test that 'watchpoint command' action can disable a watchpoint after it is triggered."""
self.build(dictionary=self.d)
@@ -96,7 +121,8 @@ class WatchpointLLDBCommandTestCase(TestBase):
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)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -104,39 +130,46 @@ class WatchpointLLDBCommandTestCase(TestBase):
# 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'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
self.runCmd('watchpoint command add 1 -o "watchpoint disable 1"')
# List the watchpoint command we just added.
self.expect("watchpoint command list 1",
- substrs = ['watchpoint disable 1'])
+ substrs=['watchpoint disable 1'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
# Check that the watchpoint has been disabled.
self.expect("watchpoint list -v",
- substrs = ['disabled'])
+ substrs=['disabled'])
self.runCmd("process continue")
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
index f6ea4fc1686..494ea2e4a54 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
@@ -5,13 +5,14 @@ Test 'watchpoint command'.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointPythonCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,17 +23,26 @@ class WatchpointPythonCommandTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
- # Build dictionary to have unique executable names for each test method.
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
+ @skipIfFreeBSD # timing out on buildbot
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
def test_watchpoint_command(self):
"""Test 'watchpoint command'."""
self.build(dictionary=self.d)
@@ -42,7 +52,8 @@ class WatchpointPythonCommandTestCase(TestBase):
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)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
# (self.source, self.line))#
@@ -53,46 +64,62 @@ class WatchpointPythonCommandTestCase(TestBase):
# 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'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
-
- self.runCmd('watchpoint command add -s python 1 -o \'frame.EvaluateExpression("cookie = 777")\'')
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
+
+ self.runCmd(
+ 'watchpoint command add -s python 1 -o \'frame.EvaluateExpression("cookie = 777")\'')
# List the watchpoint command we just added.
self.expect("watchpoint command list 1",
- substrs = ['frame.EvaluateExpression', 'cookie = 777'])
+ substrs=['frame.EvaluateExpression', 'cookie = 777'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
# Check that the watchpoint snapshoting mechanism is working.
self.expect("watchpoint list -v",
- substrs = ['old value:', ' = 0',
- 'new value:', ' = 1'])
+ substrs=['old value:', ' = 0',
+ 'new value:', ' = 1'])
- # The watchpoint command "forced" our global variable 'cookie' to become 777.
+ # The watchpoint command "forced" our global variable 'cookie' to
+ # become 777.
self.expect("frame variable --show-globals cookie",
- substrs = ['(int32_t)', 'cookie = 777'])
-
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(bugnumber="llvm.org/pr28055: continue in watchpoint commands disables the watchpoint")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
+ substrs=['(int32_t)', 'cookie = 777'])
+
+ @skipIfFreeBSD # timing out on buildbot
+ @expectedFailureAll(
+ bugnumber="llvm.org/pr28055: continue in watchpoint commands disables the watchpoint")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
def test_continue_in_watchpoint_command(self):
"""Test continue in a watchpoint command."""
self.build(dictionary=self.d)
@@ -102,7 +129,8 @@ class WatchpointPythonCommandTestCase(TestBase):
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)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
# (self.source, self.line))#
@@ -113,31 +141,39 @@ class WatchpointPythonCommandTestCase(TestBase):
# 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'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
cmd_script_file = os.path.join(os.getcwd(), "watchpoint_command.py")
- self.runCmd("command script import '%s'"%(cmd_script_file))
+ self.runCmd("command script import '%s'" % (cmd_script_file))
- self.runCmd('watchpoint command add -F watchpoint_command.watchpoint_command')
+ self.runCmd(
+ 'watchpoint command add -F watchpoint_command.watchpoint_command')
# List the watchpoint command we just added.
self.expect("watchpoint command list 1",
- substrs = ['watchpoint_command.watchpoint_command'])
+ substrs=['watchpoint_command.watchpoint_command'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
# We should have hit the watchpoint once, set cookie to 888, then continued to the
# second hit and set it to 999
self.expect("frame variable --show-globals cookie",
- substrs = ['(int32_t)', 'cookie = 999'])
+ substrs=['(int32_t)', 'cookie = 999'])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py
index 575a5160d21..ae5913a500e 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py
@@ -1,7 +1,9 @@
import lldb
num_hits = 0
-def watchpoint_command (frame, wp, dict):
+
+
+def watchpoint_command(frame, wp, dict):
global num_hits
if num_hits == 0:
print ("I stopped the first time")
@@ -9,6 +11,5 @@ def watchpoint_command (frame, wp, dict):
num_hits += 1
frame.thread.process.Continue()
else:
- print ("I stopped the %d time"%(num_hits))
+ print ("I stopped the %d time" % (num_hits))
frame.EvaluateExpression("cookie = 999")
-
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
index 64e01e5cb93..5a16856149b 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
@@ -5,13 +5,14 @@ Test watchpoint modify command to set condition on a watchpoint.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointConditionCmdTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,16 +23,25 @@ class WatchpointConditionCmdTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
- # Build dictionary to have unique executable names for each test method.
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchpoint_cond(self):
"""Test watchpoint condition."""
self.build(dictionary=self.d)
@@ -41,7 +51,8 @@ class WatchpointConditionCmdTestCase(TestBase):
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)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -49,32 +60,39 @@ class WatchpointConditionCmdTestCase(TestBase):
# 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'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
# With a condition of 'global==5'.
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
self.runCmd("watchpoint modify -c 'global==5'")
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0', 'global==5'])
+ substrs=['hit_count = 0', 'global==5'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
self.expect("frame variable --show-globals global",
- substrs = ['(int32_t)', 'global = 5'])
+ substrs=['(int32_t)', 'global = 5'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 2.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 5'])
+ substrs=['hit_count = 5'])
OpenPOWER on IntegriCloud