aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/watchpoint
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/watchpoint')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py71
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py52
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py97
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py58
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py86
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py26
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py238
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py107
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py123
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py54
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py88
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c13
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py89
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py65
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py35
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py69
24 files changed, 1020 insertions, 376 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
index 933f21a90bbf..6a68730e08ed 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
@@ -5,14 +5,15 @@ Test lldb watchpoint that uses '-s size' to watch a pointed location with size.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class HelloWatchLocationTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,18 +24,31 @@ class HelloWatchLocationTestCase(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.')
# This is for verifying that watch location works.
- self.violating_func = "do_bad_thing_with_location";
- # Build dictionary to have unique executable names for each test method.
+ self.violating_func = "do_bad_thing_with_location"
+ # 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=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(triple = re.compile('^mips')) # Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet
- @expectedFailureAll(archs=['s390x']) # SystemZ also currently supports only one H/W watchpoint
- @expectedFailureAll(oslist=["linux"], archs=["arm", "aarch64"], bugnumber="llvm.org/pr27795")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Most of the MIPS boards provide only one H/W watchpoints, and S/W
+ # watchpoints are not supported yet
+ @expectedFailureAll(triple=re.compile('^mips'))
+ # SystemZ also currently supports only one H/W watchpoint
+ @expectedFailureAll(archs=['s390x'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ "arm",
+ "aarch64"],
+ bugnumber="llvm.org/pr27795")
@skipIfDarwin
def test_hello_watchlocation(self):
"""Test watching a location with '-s size' option."""
@@ -44,7 +58,8 @@ class HelloWatchLocationTestCase(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, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1, loc_exact=False)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -52,48 +67,56 @@ class HelloWatchLocationTestCase(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 pointed to by 'g_char_ptr'.
- self.expect("watchpoint set expression -w write -s 1 -- g_char_ptr", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 1', 'type = w'])
+ self.expect(
+ "watchpoint set expression -w write -s 1 -- g_char_ptr",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 1',
+ 'type = w'])
# Get a hold of the watchpoint id just created, it is used later on to
# match the watchpoint id which is expected to be fired.
- match = re.match("Watchpoint created: Watchpoint (.*):", self.res.GetOutput().splitlines()[0])
+ match = re.match(
+ "Watchpoint created: Watchpoint (.*):",
+ self.res.GetOutput().splitlines()[0])
if match:
expected_wp_id = int(match.group(1), 0)
else:
- self.fail("Grokking watchpoint id faailed!")
+ self.fail("Grokking watchpoint id faailed!")
self.runCmd("expr unsigned val = *g_char_ptr; val")
self.expect(self.res.GetOutput().splitlines()[0], exe=False,
- endstr = ' = 0')
+ endstr=' = 0')
self.runCmd("watchpoint set expression -w write -s 4 -- &threads[0]")
# 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), but
# only once. The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped',
- 'stop reason = watchpoint %d' % expected_wp_id])
+ substrs=['stopped',
+ 'stop reason = watchpoint %d' % expected_wp_id])
- # Switch to the thread stopped due to watchpoint and issue some commands.
+ # Switch to the thread stopped due to watchpoint and issue some
+ # commands.
self.switch_to_thread_with_stop_reason(lldb.eStopReasonWatchpoint)
self.runCmd("thread backtrace")
self.expect("frame info",
- substrs = [self.violating_func])
+ substrs=[self.violating_func])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
self.runCmd("thread backtrace all")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
index 5214c7f5e089..c74452fd375e 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
@@ -5,16 +5,17 @@ Test my first lldb 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 HelloWatchpointTestCase(TestBase):
- def getCategories (self):
+ def getCategories(self):
return ['basic_process']
mydir = TestBase.compute_mydir(__file__)
@@ -25,14 +26,19 @@ class HelloWatchpointTestCase(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.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.')
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
self.exe_name = 'a.out'
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")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_hello_watchpoint_using_watchpoint_set(self):
"""Test a simple sequence of watchpoint creation and watchpoint hit."""
self.build(dictionary=self.d)
@@ -42,7 +48,8 @@ class HelloWatchpointTestCase(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)
@@ -50,36 +57,45 @@ class HelloWatchpointTestCase(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'.
# There should be only one watchpoint hit (see main.c).
- 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)])
# 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), but
# only once. The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped',
- 'stop reason = watchpoint'])
+ substrs=['stopped',
+ 'stop reason = watchpoint'])
self.runCmd("process continue")
# Don't expect the read of 'global' to trigger a stop exception.
process = self.dbg.GetSelectedTarget().GetProcess()
if process.GetState() == lldb.eStateStopped:
- self.assertFalse(lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint))
+ self.assertFalse(
+ lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonWatchpoint))
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
new file mode 100644
index 000000000000..2e58cb893b73
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
@@ -0,0 +1,97 @@
+"""
+Test watchpoint slots we should not be able to install multiple watchpoints
+within same word boundary. We should be able to install individual watchpoints
+on any of the bytes, half-word, or word. This is only for ARM/AArch64 targets.
+"""
+
+from __future__ import print_function
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class WatchpointSlotsTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ # This is a arm and aarch64 specific test case. No other architectures tested.
+ @skipIf(archs=no_match(['arm', 'aarch64']))
+ def test_multiple_watchpoints_on_same_word(self):
+
+ 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)
+
+ # Detect line number after which we are going to increment arrayName.
+ loc_line = line_number('main.c', '// About to write byteArray')
+
+ # Set a breakpoint on the line detected above.
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", loc_line, num_expected_locations=1, loc_exact=True)
+
+ # Run the program.
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped', 'stop reason = breakpoint'])
+
+ # Delete breakpoint we just hit.
+ self.expect("breakpoint delete 1", substrs=['1 breakpoints deleted'])
+
+ # Set a watchpoint at byteArray[0]
+ self.expect("watchpoint set variable byteArray[0]", WATCHPOINT_CREATED,
+ substrs=['Watchpoint created','size = 1'])
+
+ # Use the '-v' option to do verbose listing of the watchpoint.
+ # The hit count should be 0 initially.
+ self.expect("watchpoint list -v 1", substrs=['hit_count = 0'])
+
+ # Try setting a watchpoint at byteArray[1]
+ self.expect("watchpoint set variable byteArray[1]", error=True,
+ substrs=['Watchpoint creation failed'])
+
+ self.runCmd("process continue")
+
+ # We should be stopped due to the watchpoint.
+ # The stop reason of the thread should be watchpoint.
+ self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
+ substrs=['stopped', 'stop reason = watchpoint 1'])
+
+ # Delete the watchpoint we hit above successfully.
+ self.expect("watchpoint delete 1", substrs=['1 watchpoints deleted'])
+
+ # Set a watchpoint at byteArray[3]
+ self.expect("watchpoint set variable byteArray[3]", WATCHPOINT_CREATED,
+ substrs=['Watchpoint created','size = 1'])
+
+ # Resume inferior.
+ self.runCmd("process continue")
+
+ # We should be stopped due to the watchpoint.
+ # The stop reason of the thread should be watchpoint.
+ self.expect("thread list -v", STOPPED_DUE_TO_WATCHPOINT,
+ substrs=['stopped', 'stop reason = watchpoint 3'])
+
+ # Resume inferior.
+ self.runCmd("process continue")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c
new file mode 100644
index 000000000000..fd14a9b353fc
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c
@@ -0,0 +1,29 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+#include <stdint.h>
+
+uint64_t pad0 = 0;
+uint8_t byteArray[4] = {0};
+uint64_t pad1 = 0;
+
+int main(int argc, char** argv) {
+
+ int i;
+
+ for (i = 0; i < 4; i++)
+ {
+ printf("About to write byteArray[%d] ...\n", i); // About to write byteArray
+ pad0++;
+ byteArray[i] = 7;
+ pad1++;
+ }
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile
new file mode 100644
index 000000000000..314f1cb2f077
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py
new file mode 100644
index 000000000000..c21355a2e8f9
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py
@@ -0,0 +1,58 @@
+"""
+Test handling of cases when a single instruction triggers multiple watchpoints
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MultipleHitsTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ @skipIf(bugnumber="llvm.org/pr30758", oslist=["linux"], archs=["arm", "aarch64"])
+ def test(self):
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target and target.IsValid(), VALID_TARGET)
+
+ bp = target.BreakpointCreateByName("main")
+ self.assertTrue(bp and bp.IsValid(), "Breakpoint is valid")
+
+ process = target.LaunchSimple(None, None,
+ self.get_process_working_directory())
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
+
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertIsNotNone(thread)
+
+ frame = thread.GetFrameAtIndex(0)
+ self.assertTrue(frame and frame.IsValid(), "Frame is valid")
+
+ buf = frame.FindValue("buf", lldb.eValueTypeVariableGlobal)
+ self.assertTrue(buf and buf.IsValid(), "buf is valid")
+
+ for i in [0, target.GetAddressByteSize()]:
+ member = buf.GetChildAtIndex(i)
+ self.assertTrue(member and member.IsValid(), "member is valid")
+
+ error = lldb.SBError()
+ watch = member.Watch(True, True, True, error)
+ self.assertTrue(error.Success())
+
+ process.Continue();
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
+ self.assertEqual(thread.GetStopReason(), lldb.eStopReasonWatchpoint)
+
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp
new file mode 100644
index 000000000000..430c02cc052a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp
@@ -0,0 +1,29 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+#include <stdint.h>
+alignas(16) uint8_t buf[32];
+// This uses inline assembly to generate an instruction that writes to a large
+// block of memory. If it fails on your compiler/architecture, please add
+// appropriate code to generate a large write to "buf". If you cannot write at
+// least 2*sizeof(void*) bytes with a single instruction, you will have to skip
+// this test.
+
+int main() {
+#if defined(__i386__) || defined(__x86_64__)
+ asm volatile ("movdqa %%xmm0, %0" : : "m"(buf));
+#elif defined(__arm__)
+ asm volatile ("stm %0, { r0, r1, r2, r3 }" : : "r"(buf));
+#elif defined(__aarch64__)
+ asm volatile ("stp x0, x1, %0" : : "m"(buf));
+#elif defined(__mips__)
+ asm volatile ("lw $2, %0" : : "m"(buf));
+#endif
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
index af8306c9a20e..78273d6ec69c 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
@@ -5,28 +5,35 @@ Test that lldb watchpoint works for multiple threads.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointForMultipleThreadsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchpoint_multiple_threads(self):
"""Test that lldb watchpoint works for multiple threads."""
self.build()
self.setTearDownCleanup()
self.hello_multiple_threads()
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchpoint_multiple_threads_wp_set_and_then_delete(self):
"""Test that lldb watchpoint works for multiple threads, and after the watchpoint is deleted, the watchpoint event should no longer fires."""
self.build()
@@ -39,14 +46,21 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.first_stop = line_number(self.source, '// Set break point at this line')
+ self.first_stop = line_number(
+ self.source, '// Set break point at this line')
def hello_multiple_threads(self):
"""Test that lldb watchpoint works for multiple threads."""
- self.runCmd("file %s" % os.path.join(os.getcwd(), 'a.out'), CURRENT_EXECUTABLE_SET)
+ self.runCmd(
+ "file %s" %
+ os.path.join(
+ os.getcwd(),
+ 'a.out'),
+ 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.first_stop, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.first_stop, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -54,17 +68,22 @@ class WatchpointForMultipleThreadsTestCase(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 variable 'g_val'.
- self.expect("watchpoint set variable -w write g_val", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w'])
+ self.expect(
+ "watchpoint set variable -w write g_val",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w'])
# 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'])
while True:
self.runCmd("process continue")
@@ -80,14 +99,20 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
def hello_multiple_threads_wp_set_and_then_delete(self):
"""Test that lldb watchpoint works for multiple threads, and after the watchpoint is deleted, the watchpoint event should no longer fires."""
- self.runCmd("file %s" % os.path.join(os.getcwd(), 'a.out'), CURRENT_EXECUTABLE_SET)
+ self.runCmd(
+ "file %s" %
+ os.path.join(
+ os.getcwd(),
+ 'a.out'),
+ 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.first_stop, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.first_stop, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -95,17 +120,22 @@ class WatchpointForMultipleThreadsTestCase(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 variable 'g_val'.
- self.expect("watchpoint set variable -w write g_val", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w'])
+ self.expect(
+ "watchpoint set variable -w write g_val",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w'])
# 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'])
watchpoint_stops = 0
while True:
@@ -120,13 +150,17 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
self.runCmd("thread backtrace all")
watchpoint_stops += 1
if watchpoint_stops > 1:
- self.fail("Watchpoint hits not supposed to exceed 1 by design!")
- # Good, we verified that the watchpoint works! Now delete the watchpoint.
+ self.fail(
+ "Watchpoint hits not supposed to exceed 1 by design!")
+ # Good, we verified that the watchpoint works! Now delete the
+ # watchpoint.
if self.TraceOn():
- print("watchpoint_stops=%d at the moment we delete the watchpoint" % watchpoint_stops)
+ print(
+ "watchpoint_stops=%d at the moment we delete the watchpoint" %
+ watchpoint_stops)
self.runCmd("watchpoint delete 1")
self.expect("watchpoint list -v",
- substrs = ['No watchpoints currently set.'])
+ substrs=['No watchpoints currently set.'])
continue
else:
self.fail("The stop reason should be either break or watchpoint")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
index 22011f11352c..f1d7acfcc5ec 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
@@ -3,7 +3,6 @@
from __future__ import print_function
-
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -17,10 +16,19 @@ class TestStepOverWatchpoint(TestBase):
def getCategories(self):
return ['basic_process']
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=['aarch64', 'arm'], bugnumber="llvm.org/pr26031")
- @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=["linux"],
+ archs=[
+ 'aarch64',
+ 'arm'],
+ bugnumber="llvm.org/pr26031")
+ @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(self):
"""Test stepping over watchpoints."""
self.build()
@@ -73,9 +81,10 @@ class TestStepOverWatchpoint(TestBase):
lldb.eValueTypeVariableGlobal)
self.assertTrue(write_value, "Failed to find write value.")
- # Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet
+ # Most of the MIPS boards provide only one H/W watchpoints, and S/W
+ # watchpoints are not supported yet
arch = self.getArchitecture()
- if re.match("^mips",arch):
+ if re.match("^mips", arch):
self.runCmd("watchpoint delete 1")
# resolve_location=True, read=False, write=True
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
index 21f1fb68426b..d30741497635 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
@@ -5,13 +5,14 @@ Test that a variable watchpoint should only hit when in scope.
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class WatchedVariableHitWhenInScopeTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,7 +21,7 @@ class WatchedVariableHitWhenInScopeTestCase(TestBase):
# This test depends on not tracking watchpoint expression hits if we have
# left the watchpoint scope. We will provide such an ability at some point
# but the way this was done was incorrect, and it is unclear that for the
- # most part that's not what folks mostly want, so we have to provide a
+ # most part that's not what folks mostly want, so we have to provide a
# clearer API to express this.
#
@@ -42,7 +43,8 @@ class WatchedVariableHitWhenInScopeTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped in main.
- lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
+ lldbutil.run_break_set_by_symbol(
+ self, "main", num_expected_locations=-1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -50,34 +52,34 @@ class WatchedVariableHitWhenInScopeTestCase(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 watchpoint for 'c.a'.
# There should be only one watchpoint hit (see main.c).
self.expect("watchpoint set variable c.a", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w'])
+ substrs=['Watchpoint created', 'size = 4', 'type = w'])
# 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), but
# only once. The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped',
- 'stop reason = watchpoint'])
+ substrs=['stopped',
+ 'stop reason = watchpoint'])
self.runCmd("process continue")
# Don't expect the read of 'global' to trigger a stop exception.
# 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 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
index 4ce05af96e2e..7a9904c53f83 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
+++ b/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
index ee276dd5687f..5b89f14dd853 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
+++ b/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
index f6ea4fc16861..16a34428ad70 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
+++ b/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,10 +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)
-# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-# (self.source, self.line))#
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -53,46 +61,60 @@ 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(
+ 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,10 +124,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)
-# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-# (self.source, self.line))#
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -113,31 +133,40 @@ 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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py
index 575a5160d219..ae5913a500e0 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py
+++ b/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
index 64e01e5cb937..5a16856149ba 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
+++ b/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'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py
new file mode 100644
index 000000000000..aac001e9db5a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py
@@ -0,0 +1,88 @@
+"""
+Test that the SBWatchpoint::SetEnable API works.
+"""
+
+import os
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test import lldbplatform, lldbplatformutil
+
+
+class TestWatchpointSetEnable(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ def test_disable_works (self):
+ """Set a watchpoint, disable it, and make sure it doesn't get hit."""
+ self.build()
+ self.do_test(False)
+
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ def test_disable_enable_works (self):
+ """Set a watchpoint, disable it, and make sure it doesn't get hit."""
+ self.build()
+ self.do_test(True)
+
+ def do_test(self, test_enable):
+ """Set a watchpoint, disable it and make sure it doesn't get hit."""
+
+ exe = 'a.out'
+
+ exe = os.path.join(os.getcwd(), exe)
+ main_file_spec = lldb.SBFileSpec("main.c")
+
+ # Create a target by the debugger.
+ self.target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.target, VALID_TARGET)
+ cwd = os.getcwd()
+
+
+ bkpt_before = self.target.BreakpointCreateBySourceRegex("Set a breakpoint here", main_file_spec)
+ self.assertEqual(bkpt_before.GetNumLocations(), 1, "Failed setting the before breakpoint.")
+
+ bkpt_after = self.target.BreakpointCreateBySourceRegex("We should have stopped", main_file_spec)
+ self.assertEqual(bkpt_after.GetNumLocations(), 1, "Failed setting the after breakpoint.")
+
+ process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, bkpt_before)
+ self.assertTrue(thread.IsValid(), "We didn't stop at the before breakpoint.")
+
+ ret_val = lldb.SBCommandReturnObject()
+ self.dbg.GetCommandInterpreter().HandleCommand("watchpoint set variable -w write global_var", ret_val)
+ self.assertTrue(ret_val.Succeeded(), "Watchpoint set variable did not return success.")
+
+ wp = self.target.FindWatchpointByID(1)
+ self.assertTrue(wp.IsValid(), "Didn't make a valid watchpoint.")
+ self.assertTrue(wp.GetWatchAddress() != lldb.LLDB_INVALID_ADDRESS, "Watch address is invalid")
+
+ wp.SetEnabled(False)
+ self.assertTrue(not wp.IsEnabled(), "The watchpoint thinks it is still enabled")
+
+ process.Continue()
+
+ stop_reason = thread.GetStopReason()
+
+ self.assertEqual(stop_reason, lldb.eStopReasonBreakpoint, "We didn't stop at our breakpoint.")
+
+ if test_enable:
+ wp.SetEnabled(True)
+ self.assertTrue(wp.IsEnabled(), "The watchpoint thinks it is still disabled.")
+ process.Continue()
+ stop_reason = thread.GetStopReason()
+ self.assertEqual(stop_reason, lldb.eStopReasonWatchpoint, "We didn't stop at our watchpoint")
+
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c
new file mode 100644
index 000000000000..dcbc766c5949
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+
+int global_var = 10;
+
+int
+main()
+{
+ printf("Set a breakpoint here: %d.\n", global_var);
+ global_var = 20;
+ printf("We should have stopped on the previous line: %d.\n", global_var);
+ global_var = 30;
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
index fdeb4b8fa3b5..02180a127a8e 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
@@ -3,13 +3,14 @@
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 TestWatchpointEvents (TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,71 +22,99 @@ class TestWatchpointEvents (TestBase):
self.main_source = "main.c"
@add_test_categories(['pyapi'])
- @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_with_python_api(self):
"""Test that adding, deleting and modifying watchpoints sends the appropriate events."""
self.build()
-
+
exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
- break_in_main = target.BreakpointCreateBySourceRegex ('// Put a breakpoint here.', self.main_source_spec)
+ break_in_main = target.BreakpointCreateBySourceRegex(
+ '// Put a breakpoint here.', self.main_source_spec)
self.assertTrue(break_in_main, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at first breakpoint in main.")
+ self.fail("Failed to stop at first breakpoint in main.")
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
- local_var = frame.FindVariable ("local_var")
- self.assertTrue (local_var.IsValid())
+ local_var = frame.FindVariable("local_var")
+ self.assertTrue(local_var.IsValid())
self.listener = lldb.SBListener("com.lldb.testsuite_listener")
self.target_bcast = target.GetBroadcaster()
- self.target_bcast.AddListener (self.listener, lldb.SBTarget.eBroadcastBitWatchpointChanged)
- self.listener.StartListeningForEvents (self.target_bcast, lldb.SBTarget.eBroadcastBitWatchpointChanged)
+ self.target_bcast.AddListener(
+ self.listener, lldb.SBTarget.eBroadcastBitWatchpointChanged)
+ self.listener.StartListeningForEvents(
+ self.target_bcast, lldb.SBTarget.eBroadcastBitWatchpointChanged)
error = lldb.SBError()
local_watch = local_var.Watch(True, False, True, error)
if not error.Success():
- self.fail ("Failed to make watchpoint for local_var: %s"%(error.GetCString()))
+ self.fail(
+ "Failed to make watchpoint for local_var: %s" %
+ (error.GetCString()))
- self.GetWatchpointEvent (lldb.eWatchpointEventTypeAdded)
- # Now change some of the features of this watchpoint and make sure we get events:
+ self.GetWatchpointEvent(lldb.eWatchpointEventTypeAdded)
+ # Now change some of the features of this watchpoint and make sure we
+ # get events:
local_watch.SetEnabled(False)
- self.GetWatchpointEvent (lldb.eWatchpointEventTypeDisabled)
+ self.GetWatchpointEvent(lldb.eWatchpointEventTypeDisabled)
+
+ local_watch.SetEnabled(True)
+ self.GetWatchpointEvent(lldb.eWatchpointEventTypeEnabled)
local_watch.SetIgnoreCount(10)
- self.GetWatchpointEvent (lldb.eWatchpointEventTypeIgnoreChanged)
+ self.GetWatchpointEvent(lldb.eWatchpointEventTypeIgnoreChanged)
+
+ condition = "1 == 2"
+ local_watch.SetCondition(condition)
+ self.GetWatchpointEvent(lldb.eWatchpointEventTypeConditionChanged)
- local_watch.SetCondition ("1 == 2")
- self.GetWatchpointEvent (lldb.eWatchpointEventTypeConditionChanged)
+ self.assertTrue(local_watch.GetCondition() == condition,
+ 'make sure watchpoint condition is "' + condition + '"')
- def GetWatchpointEvent (self, event_type):
+ def GetWatchpointEvent(self, event_type):
# We added a watchpoint so we should get a watchpoint added event.
event = lldb.SBEvent()
- success = self.listener.WaitForEvent (1, event)
- self.assertTrue(success == True, "Successfully got watchpoint event")
- self.assertTrue (lldb.SBWatchpoint.EventIsWatchpointEvent(event), "Event is a watchpoint event.")
- found_type = lldb.SBWatchpoint.GetWatchpointEventTypeFromEvent (event)
- self.assertTrue (found_type == event_type, "Event is not correct type, expected: %d, found: %d"%(event_type, found_type))
+ success = self.listener.WaitForEvent(1, event)
+ self.assertTrue(success, "Successfully got watchpoint event")
+ self.assertTrue(
+ lldb.SBWatchpoint.EventIsWatchpointEvent(event),
+ "Event is a watchpoint event.")
+ found_type = lldb.SBWatchpoint.GetWatchpointEventTypeFromEvent(event)
+ self.assertTrue(
+ found_type == event_type,
+ "Event is not correct type, expected: %d, found: %d" %
+ (event_type,
+ found_type))
# There shouldn't be another event waiting around:
- found_event = self.listener.PeekAtNextEventForBroadcasterWithType (self.target_bcast, lldb.SBTarget.eBroadcastBitBreakpointChanged, event)
+ found_event = self.listener.PeekAtNextEventForBroadcasterWithType(
+ self.target_bcast, lldb.SBTarget.eBroadcastBitBreakpointChanged, event)
if found_event:
print("Found an event I didn't expect: ", event)
- self.assertTrue (not found_event, "Only one event per change.")
+ self.assertTrue(not found_event, "Only one event per change.")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
index c66ddb512884..3f301fd9f1a9 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
@@ -5,25 +5,29 @@ Test displayed value of a vector variable while doing watchpoint operations
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 TestValueOfVectorVariableTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_value_of_vector_variable_using_watchpoint_set(self):
"""Test verify displayed value of vector variable."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
self.value_of_vector_variable_with_watchpoint_set()
-
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -39,10 +43,12 @@ class TestValueOfVectorVariableTestCase(TestBase):
# Set break to get a frame
self.runCmd("b main")
-
+
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# Value of a vector variable should be displayed correctly
- self.expect("watchpoint set variable global_vector", WATCHPOINT_CREATED,
- substrs = ['new value: (1, 2, 3, 4)'])
+ self.expect(
+ "watchpoint set variable global_vector",
+ WATCHPOINT_CREATED,
+ substrs=['new value: (1, 2, 3, 4)'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
index 735a5678c4f9..1a94276c58e8 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
@@ -5,13 +5,14 @@ Test lldb watchpoint that uses 'watchpoint set -w write -s size' to watch a poin
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 WatchLocationUsingWatchpointSetTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,14 +23,24 @@ class WatchLocationUsingWatchpointSetTestCase(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.')
# This is for verifying that watch location works.
- self.violating_func = "do_bad_thing_with_location";
- # Build dictionary to have unique executable names for each test method.
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=['aarch64', 'arm'], bugnumber="llvm.org/pr26031")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ self.violating_func = "do_bad_thing_with_location"
+ # Build dictionary to have unique executable names for each test
+ # method.
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ 'aarch64',
+ 'arm'],
+ bugnumber="llvm.org/pr26031")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchlocation_using_watchpoint_set(self):
"""Test watching a location with 'watchpoint set expression -w write -s size' option."""
self.build()
@@ -39,7 +50,8 @@ class WatchLocationUsingWatchpointSetTestCase(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)
@@ -47,45 +59,52 @@ class WatchLocationUsingWatchpointSetTestCase(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 pointed to by 'g_char_ptr' and
# with offset as 7.
# The main.cpp, by design, misbehaves by not following the agreed upon
# protocol of only accessing the allowable index range of [0, 6].
- self.expect("watchpoint set expression -w write -s 1 -- g_char_ptr + 7", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 1', 'type = w'])
+ self.expect(
+ "watchpoint set expression -w write -s 1 -- g_char_ptr + 7",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 1',
+ 'type = w'])
self.runCmd("expr unsigned val = g_char_ptr[7]; val")
self.expect(self.res.GetOutput().splitlines()[0], exe=False,
- endstr = ' = 0')
+ endstr=' = 0')
# 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), but
# only once. The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped',
- 'stop reason = watchpoint',
- self.violating_func])
+ substrs=['stopped',
+ 'stop reason = watchpoint',
+ self.violating_func])
- # Switch to the thread stopped due to watchpoint and issue some commands.
+ # Switch to the thread stopped due to watchpoint and issue some
+ # commands.
self.switch_to_thread_with_stop_reason(lldb.eStopReasonWatchpoint)
self.runCmd("thread backtrace")
self.runCmd("expr unsigned val = g_char_ptr[7]; val")
self.expect(self.res.GetOutput().splitlines()[0], exe=False,
- endstr = ' = 99')
+ endstr=' = 99')
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be the same as the number of threads that
# stopped on a watchpoint.
- threads = lldbutil.get_stopped_threads(self.process(), lldb.eStopReasonWatchpoint)
+ threads = lldbutil.get_stopped_threads(
+ self.process(), lldb.eStopReasonWatchpoint)
self.expect("watchpoint list -v",
- substrs = ['hit_count = %d' % len(threads)])
+ substrs=['hit_count = %d' % len(threads)])
self.runCmd("thread backtrace all")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
index 43597ec28f59..7460a1c09476 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
@@ -5,13 +5,14 @@ Test error cases for the 'watchpoint set' command to make sure it errors out whe
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class WatchpointSetErrorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,10 +23,11 @@ class WatchpointSetErrorTestCase(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.')
- # Build dictionary to have unique executable names for each test method.
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
+ # Build dictionary to have unique executable names for each test
+ # method.
- @expectedFailureAll(oslist=["windows"])
def test_error_cases_with_watchpoint_set(self):
"""Test error cases with the 'watchpoint set' command."""
self.build()
@@ -35,7 +37,8 @@ class WatchpointSetErrorTestCase(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)
@@ -43,27 +46,29 @@ class WatchpointSetErrorTestCase(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'])
# Try some error conditions:
# 'watchpoint set' is now a multiword command.
self.expect("watchpoint set",
- substrs = ['The following subcommands are supported:',
- 'expression',
- 'variable'])
+ substrs=['The following subcommands are supported:',
+ 'expression',
+ 'variable'])
self.runCmd("watchpoint set variable -w read_write", check=False)
# 'watchpoint set expression' with '-w' or '-s' specified now needs
# an option terminator and a raw expression after that.
self.expect("watchpoint set expression -w write --", error=True,
- startstr = 'error: ')
+ startstr='error: ')
# It's an error if the expression did not evaluate to an address.
- self.expect("watchpoint set expression MyAggregateDataType", error=True,
- startstr = 'error: expression did not evaluate to an address')
+ self.expect(
+ "watchpoint set expression MyAggregateDataType",
+ error=True,
+ startstr='error: expression did not evaluate to an address')
# Wrong size parameter is an error.
self.expect("watchpoint set variable -s -128", error=True,
- substrs = ['invalid enumeration value'])
+ substrs=['invalid enumeration value'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
index 55e36649ce10..e342e34667fe 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
@@ -7,12 +7,14 @@ when they are packed in a 8-byte region.
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 WatchpointSizeTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@@ -29,23 +31,35 @@ class WatchpointSizeTestCase(TestBase):
self.exe_name = 'a.out'
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_byte_size_watchpoints_with_byte_selection(self):
"""Test to selectively watch different bytes in a 8-byte array."""
self.run_watchpoint_size_test('byteArray', 8, '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
+ # 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_two_byte_watchpoints_with_word_selection(self):
"""Test to selectively watch different words in an 8-byte word array."""
self.run_watchpoint_size_test('wordArray', 4, '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
+ # 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_four_byte_watchpoints_with_dword_selection(self):
"""Test to selectively watch two double words in an 8-byte dword array."""
self.run_watchpoint_size_test('dwordArray', 2, '4')
@@ -61,8 +75,8 @@ class WatchpointSizeTestCase(TestBase):
loc_line = line_number('main.c', '// About to write ' + arrayName)
# Set a breakpoint on the line detected above.
- lldbutil.run_break_set_by_file_and_line (self, "main.c",loc_line,
- num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", loc_line, num_expected_locations=1, loc_exact=True)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -71,46 +85,55 @@ class WatchpointSizeTestCase(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'])
# Set a read_write type watchpoint arrayName
- watch_loc=arrayName+"[" + str(i) + "]"
- self.expect("watchpoint set variable -w read_write " + watch_loc,
+ watch_loc = arrayName + "[" + str(i) + "]"
+ self.expect(
+ "watchpoint set variable -w read_write " +
+ watch_loc,
WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = ' + watchsize, 'type = rw'])
+ substrs=[
+ 'Watchpoint created',
+ 'size = ' +
+ watchsize,
+ 'type = rw'])
# 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'])
+ self.expect("watchpoint list -v", substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped due to the watchpoint.
# The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped', 'stop reason = watchpoint'])
+ substrs=['stopped', 'stop reason = watchpoint'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
self.runCmd("process continue")
# We should be stopped due to the watchpoint.
# The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped', 'stop reason = watchpoint'])
+ substrs=['stopped', 'stop reason = watchpoint'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
# Verify hit_count has been updated after value has been read.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 2'])
+ substrs=['hit_count = 2'])
- # Delete the watchpoint immediately, but set auto-confirm to true first.
+ # 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.'])
+ self.expect(
+ "watchpoint delete",
+ substrs=['All watchpoints removed.'])
# Restore the original setting of auto-confirm.
self.runCmd("settings clear auto-confirm")