diff --git a/lldb/packages/Python/lldbsuite/test/concurrent_base.py b/lldb/packages/Python/lldbsuite/test/concurrent_base.py --- a/lldb/packages/Python/lldbsuite/test/concurrent_base.py +++ b/lldb/packages/Python/lldbsuite/test/concurrent_base.py @@ -144,7 +144,13 @@ # Initialize the (single) watchpoint on the global variable (g_watchme) if num_watchpoint_threads + num_delay_watchpoint_threads > 0: - self.runCmd("watchpoint set variable g_watchme") + try: + self.runCmd("watchpoint set variable g_watchme") + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise + for w in self.inferior_target.watchpoint_iter(): self.thread_watchpoint = w self.assertTrue( diff --git a/lldb/test/API/commands/watchpoints/hello_watchpoint/TestMyFirstWatchpoint.py b/lldb/test/API/commands/watchpoints/hello_watchpoint/TestMyFirstWatchpoint.py --- a/lldb/test/API/commands/watchpoints/hello_watchpoint/TestMyFirstWatchpoint.py +++ b/lldb/test/API/commands/watchpoints/hello_watchpoint/TestMyFirstWatchpoint.py @@ -53,16 +53,21 @@ # 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)]) + try: + self.expect( + "watchpoint set variable -w write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = w', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise # Use the '-v' option to do verbose listing of the watchpoint. # The hit count should be 0 initially. diff --git a/lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py b/lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py --- a/lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py +++ b/lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py @@ -35,13 +35,18 @@ lldbutil.run_to_source_breakpoint(self, line, self.main_spec) # 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']) + try: + self.expect( + "watchpoint set variable -w write g_val", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = w']) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise # Use the '-v' option to do verbose listing of the watchpoint. # The hit count should be 0 initially. @@ -70,13 +75,18 @@ lldbutil.run_to_source_breakpoint(self, "After running the thread", self.main_spec) # 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']) + try: + self.expect( + "watchpoint set variable -w write g_val", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = w']) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise # Use the '-v' option to do verbose listing of the watchpoint. # The hit count should be 0 initially. diff --git a/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py b/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py --- a/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py +++ b/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py @@ -54,6 +54,8 @@ # resolve_location=True, read=True, write=False read_watchpoint = read_value.Watch(True, True, False, error) + if not read_watchpoint and error.GetCString() == 'Target supports (0) hardware watchpoint slots.\n': + self.skipTest('Watchpoints are not supported') self.assertTrue(error.Success(), "Error while setting watchpoint: %s" % error.GetCString()) diff --git a/lldb/test/API/commands/watchpoints/watchpoint_commands/TestWatchpointCommands.py b/lldb/test/API/commands/watchpoints/watchpoint_commands/TestWatchpointCommands.py --- a/lldb/test/API/commands/watchpoints/watchpoint_commands/TestWatchpointCommands.py +++ b/lldb/test/API/commands/watchpoints/watchpoint_commands/TestWatchpointCommands.py @@ -59,16 +59,21 @@ # 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)]) + try: + self.expect( + "watchpoint set variable -w read_write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = rw', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise # Use the '-v' option to do verbose listing of the watchpoint. # The hit count should be 0 initially. @@ -112,16 +117,21 @@ # 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)]) + try: + self.expect( + "watchpoint set variable -w read_write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = rw', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise # Delete the watchpoint immediately, but set auto-confirm to true # first. @@ -186,16 +196,21 @@ # 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)]) + try: + self.expect( + "watchpoint set variable -w read_write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = rw', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise # Set the ignore count of the watchpoint immediately. self.expect("watchpoint ignore -i 2", @@ -243,16 +258,21 @@ # 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)]) + try: + self.expect( + "watchpoint set variable -w read_write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = rw', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise # Use the '-v' option to do verbose listing of the watchpoint. # The hit count should be 0 initially. @@ -312,16 +332,21 @@ # 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)]) + try: + self.expect( + "watchpoint set variable -w read_write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = rw', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise # Immediately, we disable the watchpoint. We won't be stopping due to a # watchpoint after this. diff --git a/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandLLDB.py b/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandLLDB.py --- a/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandLLDB.py +++ b/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandLLDB.py @@ -53,16 +53,21 @@ '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)]) + try: + self.expect( + "watchpoint set variable -w write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = w', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise self.runCmd('watchpoint command add 1 -o "expr -- cookie = 777"') @@ -117,16 +122,21 @@ '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)]) + try: + self.expect( + "watchpoint set variable -w write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = w', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise self.runCmd('watchpoint command add 1 -o "watchpoint disable 1"') diff --git a/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py b/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py --- a/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py +++ b/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py @@ -54,16 +54,21 @@ '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)]) + try: + self.expect( + "watchpoint set variable -w write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = w', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise self.runCmd( 'watchpoint command add -s python 1 -o \'frame.EvaluateExpression("cookie = 777")\'') @@ -117,16 +122,21 @@ '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)]) + try: + self.expect( + "watchpoint set variable -w write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = w', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise cmd_script_file = os.path.join(self.getSourceDir(), "watchpoint_command.py") diff --git a/lldb/test/API/commands/watchpoints/watchpoint_commands/condition/TestWatchpointConditionCmd.py b/lldb/test/API/commands/watchpoints/watchpoint_commands/condition/TestWatchpointConditionCmd.py --- a/lldb/test/API/commands/watchpoints/watchpoint_commands/condition/TestWatchpointConditionCmd.py +++ b/lldb/test/API/commands/watchpoints/watchpoint_commands/condition/TestWatchpointConditionCmd.py @@ -54,16 +54,21 @@ # 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)]) + try: + self.expect( + "watchpoint set variable -w write global", + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = 4', + 'type = w', + '%s:%d' % + (self.source, + self.decl)]) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise self.runCmd("watchpoint modify -c 'global==5'") diff --git a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py --- a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py +++ b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py @@ -21,6 +21,8 @@ error = lldb.SBError() first_watch = first_var.Watch(True, False, True, error) + if not first_watch and error.GetCString() == 'Target supports (0) hardware watchpoint slots.\n': + self.skipTest('Watchpoints are not supported') if not error.Success(): self.fail( "Failed to make watchpoint for x1: %s" % diff --git a/lldb/test/API/commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py b/lldb/test/API/commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py --- a/lldb/test/API/commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py +++ b/lldb/test/API/commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py @@ -47,6 +47,8 @@ ret_val = lldb.SBCommandReturnObject() self.dbg.GetCommandInterpreter().HandleCommand("watchpoint set variable -w write global_var", ret_val) + if not ret_val.Succeeded() and '\nerror: Target supports (0) hardware watchpoint slots.\n' in ret_val.GetError(): + self.skipTest('Watchpoints are not supported') self.assertTrue(ret_val.Succeeded(), "Watchpoint set variable did not return success.") wp = self.target.FindWatchpointByID(1) diff --git a/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py b/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py --- a/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py +++ b/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py @@ -64,6 +64,8 @@ error = lldb.SBError() local_watch = local_var.Watch(True, False, True, error) if not error.Success(): + if error.GetCString() == 'Target supports (0) hardware watchpoint slots.\n': + self.skipTest('Watchpoints are not supported') self.fail( "Failed to make watchpoint for local_var: %s" % (error.GetCString())) diff --git a/lldb/test/API/commands/watchpoints/watchpoint_on_vectors/TestValueOfVectorVariable.py b/lldb/test/API/commands/watchpoints/watchpoint_on_vectors/TestValueOfVectorVariable.py --- a/lldb/test/API/commands/watchpoints/watchpoint_on_vectors/TestValueOfVectorVariable.py +++ b/lldb/test/API/commands/watchpoints/watchpoint_on_vectors/TestValueOfVectorVariable.py @@ -41,7 +41,12 @@ 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)']) + try: + self.expect( + "watchpoint set variable global_vector", + WATCHPOINT_CREATED, + substrs=['new value: (1, 2, 3, 4)']) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise diff --git a/lldb/test/API/commands/watchpoints/watchpoint_set_command/TestWatchLocationWithWatchSet.py b/lldb/test/API/commands/watchpoints/watchpoint_set_command/TestWatchLocationWithWatchSet.py --- a/lldb/test/API/commands/watchpoints/watchpoint_set_command/TestWatchLocationWithWatchSet.py +++ b/lldb/test/API/commands/watchpoints/watchpoint_set_command/TestWatchLocationWithWatchSet.py @@ -59,16 +59,21 @@ # 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.runCmd("expr unsigned val = g_char_ptr[7]; val") - self.expect(self.res.GetOutput().splitlines()[0], exe=False, - endstr=' = 0') + try: + 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') + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise # Use the '-v' option to do verbose listing of the watchpoint. # The hit count should be 0 initially. diff --git a/lldb/test/API/commands/watchpoints/watchpoint_size/TestWatchpointSizes.py b/lldb/test/API/commands/watchpoints/watchpoint_size/TestWatchpointSizes.py --- a/lldb/test/API/commands/watchpoints/watchpoint_size/TestWatchpointSizes.py +++ b/lldb/test/API/commands/watchpoints/watchpoint_size/TestWatchpointSizes.py @@ -71,15 +71,20 @@ # Set a read_write type watchpoint arrayName watch_loc = arrayName + "[" + str(i) + "]" - self.expect( - "watchpoint set variable -w read_write " + - watch_loc, - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = ' + - watchsize, - 'type = rw']) + try: + self.expect( + "watchpoint set variable -w read_write " + + watch_loc, + WATCHPOINT_CREATED, + substrs=[ + 'Watchpoint created', + 'size = ' + + watchsize, + 'type = rw']) + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + self.skipTest('Watchpoints are not supported') + raise # Use the '-v' option to do verbose listing of the watchpoint. # The hit count should be 0 initially. diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py --- a/lldb/test/API/functionalities/completion/TestCompletion.py +++ b/lldb/test/API/functionalities/completion/TestCompletion.py @@ -304,7 +304,12 @@ self.build() lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp")) - self.runCmd('watchpoint set variable ptr_fooo') + try: + self.runCmd('watchpoint set variable ptr_fooo') + except: + if "\nerror: Target supports (0) hardware watchpoint slots.\n" in self.res.GetError(): + return + raise for subcommand in subcommands: self.complete_from_to('watchpoint ' + subcommand + ' ', ['1']) diff --git a/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py b/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py --- a/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py +++ b/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py @@ -58,6 +58,8 @@ value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal) error = lldb.SBError() watchpoint = value.Watch(True, True, True, error) + if not watchpoint and error.GetCString() == 'Target supports (0) hardware watchpoint slots.\n': + self.skipTest('Watchpoints are not supported') self.assertTrue(value and watchpoint, "Successfully found the variable and set a watchpoint") self.DebugSBValue(value) diff --git a/lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py b/lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py --- a/lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py +++ b/lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py @@ -58,6 +58,8 @@ value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal) error = lldb.SBError() watchpoint = value.Watch(True, True, True, error) + if not watchpoint and error.GetCString() == 'Target supports (0) hardware watchpoint slots.\n': + self.skipTest('Watchpoints are not supported') self.assertTrue(value and watchpoint, "Successfully found the variable and set a watchpoint") self.DebugSBValue(value) diff --git a/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py b/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py --- a/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py +++ b/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py @@ -61,6 +61,8 @@ value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal) error = lldb.SBError() watchpoint = value.Watch(True, False, True, error) + if not watchpoint and error.GetCString() == 'Target supports (0) hardware watchpoint slots.\n': + self.skipTest('Watchpoints are not supported') self.assertTrue(value and watchpoint, "Successfully found the variable and set a watchpoint") self.DebugSBValue(value) diff --git a/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py b/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py --- a/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py +++ b/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py @@ -64,6 +64,8 @@ value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal) error = lldb.SBError() watchpoint = value.Watch(True, False, True, error) + if not watchpoint and error.GetCString() == 'Target supports (0) hardware watchpoint slots.\n': + self.skipTest('Watchpoints are not supported') self.assertTrue(value and watchpoint, "Successfully found the variable and set a watchpoint") self.DebugSBValue(value) diff --git a/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py b/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py --- a/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py +++ b/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py @@ -64,6 +64,8 @@ # Watch for write to *g_char_ptr. error = lldb.SBError() watchpoint = value.WatchPointee(True, False, True, error) + if not watchpoint and error.GetCString() == 'Target supports (0) hardware watchpoint slots.\n': + self.skipTest('Watchpoints are not supported') self.assertTrue(value and watchpoint, "Successfully found the pointer and set a watchpoint") self.DebugSBValue(value) diff --git a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py --- a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -64,6 +64,8 @@ error = lldb.SBError() watchpoint = target.WatchAddress( value.GetValueAsUnsigned(), 1, False, True, error) + if not watchpoint and error.GetCString() == 'Target supports (0) hardware watchpoint slots.\n': + self.skipTest('Watchpoints are not supported') self.assertTrue(value and watchpoint, "Successfully found the pointer and set a watchpoint") self.DebugSBValue(value) @@ -139,5 +141,7 @@ watchpoint = target.WatchAddress( value.GetValueAsUnsigned(), 365, False, True, error) self.assertFalse(watchpoint) + if error.GetCString() == 'Target supports (0) hardware watchpoint slots.\n': + self.skipTest('Watchpoints are not supported') self.expect(error.GetCString(), exe=False, substrs=['watch size of %d is not supported' % 365]) diff --git a/lldb/test/Shell/Subprocess/Inputs/check-follow-parent-wp.lldbinit b/lldb/test/Shell/Subprocess/Inputs/check-follow-parent-wp.lldbinit new file mode 100644 --- /dev/null +++ b/lldb/test/Shell/Subprocess/Inputs/check-follow-parent-wp.lldbinit @@ -0,0 +1,3 @@ +process launch -s +watchpoint set variable g_val +# CHECK: error: Target supports (0) hardware watchpoint slots. diff --git a/lldb/test/Shell/Subprocess/clone-follow-parent-wp.test b/lldb/test/Shell/Subprocess/clone-follow-parent-wp.test --- a/lldb/test/Shell/Subprocess/clone-follow-parent-wp.test +++ b/lldb/test/Shell/Subprocess/clone-follow-parent-wp.test @@ -2,7 +2,9 @@ # clone() tests fails on arm64 Linux, PR #49899 # UNSUPPORTED: system-linux && target-aarch64 # RUN: %clangxx_host -g %p/Inputs/fork.cpp -DTEST_CLONE -o %t -# RUN: %lldb -b -s %s %t | FileCheck %s +# RUN: (%lldb -b -s %p/Inputs/check-follow-parent-wp.lldbinit %t || true) 2>&1 \ +# RUN: | FileCheck %p/Inputs/check-follow-parent-wp.lldbinit \ +# RUN: || %lldb -b -s %s %t | FileCheck %s process launch -s watchpoint set variable -w write g_val # CHECK: Watchpoint created: diff --git a/lldb/test/Shell/Subprocess/fork-follow-parent-wp.test b/lldb/test/Shell/Subprocess/fork-follow-parent-wp.test --- a/lldb/test/Shell/Subprocess/fork-follow-parent-wp.test +++ b/lldb/test/Shell/Subprocess/fork-follow-parent-wp.test @@ -1,7 +1,9 @@ # REQUIRES: native && dbregs-set # UNSUPPORTED: system-windows # RUN: %clangxx_host -g %p/Inputs/fork.cpp -DTEST_FORK=fork -o %t -# RUN: %lldb -b -s %s %t | FileCheck %s +# RUN: (%lldb -b -s %p/Inputs/check-follow-parent-wp.lldbinit %t || true) 2>&1 \ +# RUN: | FileCheck %p/Inputs/check-follow-parent-wp.lldbinit \ +# RUN: || %lldb -b -s %s %t | FileCheck %s process launch -s watchpoint set variable -w write g_val # CHECK: Watchpoint created: diff --git a/lldb/test/Shell/Subprocess/vfork-follow-parent-wp.test b/lldb/test/Shell/Subprocess/vfork-follow-parent-wp.test --- a/lldb/test/Shell/Subprocess/vfork-follow-parent-wp.test +++ b/lldb/test/Shell/Subprocess/vfork-follow-parent-wp.test @@ -2,7 +2,9 @@ # UNSUPPORTED: system-windows # UNSUPPORTED: system-darwin # RUN: %clangxx_host -g %p/Inputs/fork.cpp -DTEST_FORK=vfork -o %t -# RUN: %lldb -b -s %s %t | FileCheck %s +# RUN: (%lldb -b -s %p/Inputs/check-follow-parent-wp.lldbinit %t || true) 2>&1 \ +# RUN: | FileCheck %p/Inputs/check-follow-parent-wp.lldbinit \ +# RUN: || %lldb -b -s %s %t | FileCheck %s process launch -s watchpoint set variable -w write g_val # CHECK: Watchpoint created: