199451b44SJordan Rupprecht""" 299451b44SJordan RupprechtTest setting breakpoints using a scripted resolver 399451b44SJordan Rupprecht""" 499451b44SJordan Rupprecht 599451b44SJordan Rupprechtimport os 699451b44SJordan Rupprechtimport lldb 799451b44SJordan Rupprechtimport lldbsuite.test.lldbutil as lldbutil 899451b44SJordan Rupprechtfrom lldbsuite.test.decorators import * 999451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import * 1099451b44SJordan Rupprecht 1199451b44SJordan Rupprecht 1299451b44SJordan Rupprechtclass TestScriptedResolver(TestBase): 1399451b44SJordan Rupprecht NO_DEBUG_INFO_TESTCASE = True 1499451b44SJordan Rupprecht 15ab05d913Stcwg @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") 1699451b44SJordan Rupprecht def test_scripted_resolver(self): 1799451b44SJordan Rupprecht """Use a scripted resolver to set a by symbol name breakpoint""" 1899451b44SJordan Rupprecht self.build() 1999451b44SJordan Rupprecht self.do_test() 2099451b44SJordan Rupprecht 21ab05d913Stcwg @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") 2299451b44SJordan Rupprecht def test_search_depths(self): 2399451b44SJordan Rupprecht """Make sure we are called at the right depths depending on what we return 2499451b44SJordan Rupprecht from __get_depth__""" 2599451b44SJordan Rupprecht self.build() 2699451b44SJordan Rupprecht self.do_test_depths() 2799451b44SJordan Rupprecht 28ab05d913Stcwg @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") 2999451b44SJordan Rupprecht def test_command_line(self): 3099451b44SJordan Rupprecht """Test setting a resolver breakpoint from the command line""" 3199451b44SJordan Rupprecht self.build() 3299451b44SJordan Rupprecht self.do_test_cli() 3399451b44SJordan Rupprecht 3499451b44SJordan Rupprecht def test_bad_command_lines(self): 3599451b44SJordan Rupprecht """Make sure we get appropriate errors when we give invalid key/value 3699451b44SJordan Rupprecht options""" 3799451b44SJordan Rupprecht self.build() 3899451b44SJordan Rupprecht self.do_test_bad_options() 3999451b44SJordan Rupprecht 40185ef697STatyana Krasnukha def test_copy_from_dummy_target(self): 41185ef697STatyana Krasnukha """Make sure we don't crash during scripted breakpoint copy from dummy target""" 42185ef697STatyana Krasnukha self.build() 43185ef697STatyana Krasnukha self.do_test_copy_from_dummy_target() 44185ef697STatyana Krasnukha 4599451b44SJordan Rupprecht def make_target_and_import(self): 46185ef697STatyana Krasnukha target = self.make_target() 47185ef697STatyana Krasnukha self.import_resolver_script() 48185ef697STatyana Krasnukha return target 49185ef697STatyana Krasnukha 50185ef697STatyana Krasnukha def make_target(self): 51185ef697STatyana Krasnukha return lldbutil.run_to_breakpoint_make_target(self) 52185ef697STatyana Krasnukha 53185ef697STatyana Krasnukha def import_resolver_script(self): 5499451b44SJordan Rupprecht interp = self.dbg.GetCommandInterpreter() 5599451b44SJordan Rupprecht error = lldb.SBError() 5699451b44SJordan Rupprecht 5799451b44SJordan Rupprecht script_name = os.path.join(self.getSourceDir(), "resolver.py") 5899451b44SJordan Rupprecht source_name = os.path.join(self.getSourceDir(), "main.c") 5999451b44SJordan Rupprecht 6099451b44SJordan Rupprecht command = "command script import " + script_name 6199451b44SJordan Rupprecht result = lldb.SBCommandReturnObject() 6299451b44SJordan Rupprecht interp.HandleCommand(command, result) 632238dcc3SJonas Devlieghere self.assertTrue( 642238dcc3SJonas Devlieghere result.Succeeded(), "com scr imp failed: %s" % (result.GetError()) 652238dcc3SJonas Devlieghere ) 6699451b44SJordan Rupprecht 6799451b44SJordan Rupprecht def make_extra_args(self): 6899451b44SJordan Rupprecht json_string = '{"symbol":"break_on_me", "test1": "value1"}' 6999451b44SJordan Rupprecht json_stream = lldb.SBStream() 7099451b44SJordan Rupprecht json_stream.Print(json_string) 7199451b44SJordan Rupprecht extra_args = lldb.SBStructuredData() 7299451b44SJordan Rupprecht error = extra_args.SetFromJSON(json_stream) 73779bbbf2SDave Lee self.assertSuccess(error, "Error making SBStructuredData") 7499451b44SJordan Rupprecht return extra_args 7599451b44SJordan Rupprecht 7699451b44SJordan Rupprecht def do_test(self): 7799451b44SJordan Rupprecht """This reads in a python file and sets a breakpoint using it.""" 7899451b44SJordan Rupprecht 7999451b44SJordan Rupprecht target = self.make_target_and_import() 8099451b44SJordan Rupprecht extra_args = self.make_extra_args() 8199451b44SJordan Rupprecht 8299451b44SJordan Rupprecht file_list = lldb.SBFileSpecList() 8399451b44SJordan Rupprecht module_list = lldb.SBFileSpecList() 8499451b44SJordan Rupprecht 8599451b44SJordan Rupprecht # Make breakpoints with this resolver using different filters, first ones that will take: 8699451b44SJordan Rupprecht right = [] 8799451b44SJordan Rupprecht # one with no file or module spec - this one should fire: 882238dcc3SJonas Devlieghere right.append( 892238dcc3SJonas Devlieghere target.BreakpointCreateFromScript( 902238dcc3SJonas Devlieghere "resolver.Resolver", extra_args, module_list, file_list 912238dcc3SJonas Devlieghere ) 922238dcc3SJonas Devlieghere ) 9399451b44SJordan Rupprecht 9499451b44SJordan Rupprecht # one with the right source file and no module - should also fire: 9599451b44SJordan Rupprecht file_list.Append(lldb.SBFileSpec("main.c")) 962238dcc3SJonas Devlieghere right.append( 972238dcc3SJonas Devlieghere target.BreakpointCreateFromScript( 982238dcc3SJonas Devlieghere "resolver.Resolver", extra_args, module_list, file_list 992238dcc3SJonas Devlieghere ) 1002238dcc3SJonas Devlieghere ) 10199451b44SJordan Rupprecht # Make sure the help text shows up in the "break list" output: 1022238dcc3SJonas Devlieghere self.expect( 1032238dcc3SJonas Devlieghere "break list", 1042238dcc3SJonas Devlieghere substrs=["I am a python breakpoint resolver"], 1052238dcc3SJonas Devlieghere msg="Help is listed in break list", 1062238dcc3SJonas Devlieghere ) 10799451b44SJordan Rupprecht 10899451b44SJordan Rupprecht # one with the right source file and right module - should also fire: 10999451b44SJordan Rupprecht module_list.Append(lldb.SBFileSpec("a.out")) 1102238dcc3SJonas Devlieghere right.append( 1112238dcc3SJonas Devlieghere target.BreakpointCreateFromScript( 1122238dcc3SJonas Devlieghere "resolver.Resolver", extra_args, module_list, file_list 1132238dcc3SJonas Devlieghere ) 1142238dcc3SJonas Devlieghere ) 11599451b44SJordan Rupprecht 11699451b44SJordan Rupprecht # And one with no source file but the right module: 11799451b44SJordan Rupprecht file_list.Clear() 1182238dcc3SJonas Devlieghere right.append( 1192238dcc3SJonas Devlieghere target.BreakpointCreateFromScript( 1202238dcc3SJonas Devlieghere "resolver.Resolver", extra_args, module_list, file_list 1212238dcc3SJonas Devlieghere ) 1222238dcc3SJonas Devlieghere ) 12399451b44SJordan Rupprecht 12499451b44SJordan Rupprecht # Make sure these all got locations: 12599451b44SJordan Rupprecht for i in range(0, len(right)): 126*9c246882SJordan Rupprecht self.assertGreaterEqual( 127*9c246882SJordan Rupprecht right[i].GetNumLocations(), 1, "Breakpoint %d has no locations." % (i) 1282238dcc3SJonas Devlieghere ) 12999451b44SJordan Rupprecht 13099451b44SJordan Rupprecht # Now some ones that won't take: 13199451b44SJordan Rupprecht 13299451b44SJordan Rupprecht module_list.Clear() 13399451b44SJordan Rupprecht file_list.Clear() 13499451b44SJordan Rupprecht wrong = [] 13599451b44SJordan Rupprecht 13699451b44SJordan Rupprecht # one with the wrong module - should not fire: 13799451b44SJordan Rupprecht module_list.Append(lldb.SBFileSpec("noSuchModule")) 1382238dcc3SJonas Devlieghere wrong.append( 1392238dcc3SJonas Devlieghere target.BreakpointCreateFromScript( 1402238dcc3SJonas Devlieghere "resolver.Resolver", extra_args, module_list, file_list 1412238dcc3SJonas Devlieghere ) 1422238dcc3SJonas Devlieghere ) 14399451b44SJordan Rupprecht 14499451b44SJordan Rupprecht # one with the wrong file - also should not fire: 14599451b44SJordan Rupprecht file_list.Clear() 14699451b44SJordan Rupprecht module_list.Clear() 14799451b44SJordan Rupprecht file_list.Append(lldb.SBFileSpec("noFileOfThisName.xxx")) 1482238dcc3SJonas Devlieghere wrong.append( 1492238dcc3SJonas Devlieghere target.BreakpointCreateFromScript( 1502238dcc3SJonas Devlieghere "resolver.Resolver", extra_args, module_list, file_list 1512238dcc3SJonas Devlieghere ) 1522238dcc3SJonas Devlieghere ) 15399451b44SJordan Rupprecht 15499451b44SJordan Rupprecht # Now make sure the CU level iteration obeys the file filters: 15599451b44SJordan Rupprecht file_list.Clear() 15699451b44SJordan Rupprecht module_list.Clear() 15799451b44SJordan Rupprecht file_list.Append(lldb.SBFileSpec("no_such_file.xxx")) 1582238dcc3SJonas Devlieghere wrong.append( 1592238dcc3SJonas Devlieghere target.BreakpointCreateFromScript( 1602238dcc3SJonas Devlieghere "resolver.ResolverCUDepth", extra_args, module_list, file_list 1612238dcc3SJonas Devlieghere ) 1622238dcc3SJonas Devlieghere ) 16399451b44SJordan Rupprecht 16499451b44SJordan Rupprecht # And the Module filters: 16599451b44SJordan Rupprecht file_list.Clear() 16699451b44SJordan Rupprecht module_list.Clear() 16799451b44SJordan Rupprecht module_list.Append(lldb.SBFileSpec("NoSuchModule.dylib")) 1682238dcc3SJonas Devlieghere wrong.append( 1692238dcc3SJonas Devlieghere target.BreakpointCreateFromScript( 1702238dcc3SJonas Devlieghere "resolver.ResolverCUDepth", extra_args, module_list, file_list 1712238dcc3SJonas Devlieghere ) 1722238dcc3SJonas Devlieghere ) 17399451b44SJordan Rupprecht 17499451b44SJordan Rupprecht # Now make sure the Function level iteration obeys the file filters: 17599451b44SJordan Rupprecht file_list.Clear() 17699451b44SJordan Rupprecht module_list.Clear() 17799451b44SJordan Rupprecht file_list.Append(lldb.SBFileSpec("no_such_file.xxx")) 1782238dcc3SJonas Devlieghere wrong.append( 1792238dcc3SJonas Devlieghere target.BreakpointCreateFromScript( 1802238dcc3SJonas Devlieghere "resolver.ResolverFuncDepth", extra_args, module_list, file_list 1812238dcc3SJonas Devlieghere ) 1822238dcc3SJonas Devlieghere ) 18399451b44SJordan Rupprecht 18499451b44SJordan Rupprecht # And the Module filters: 18599451b44SJordan Rupprecht file_list.Clear() 18699451b44SJordan Rupprecht module_list.Clear() 18799451b44SJordan Rupprecht module_list.Append(lldb.SBFileSpec("NoSuchModule.dylib")) 1882238dcc3SJonas Devlieghere wrong.append( 1892238dcc3SJonas Devlieghere target.BreakpointCreateFromScript( 1902238dcc3SJonas Devlieghere "resolver.ResolverFuncDepth", extra_args, module_list, file_list 1912238dcc3SJonas Devlieghere ) 1922238dcc3SJonas Devlieghere ) 19399451b44SJordan Rupprecht 19499451b44SJordan Rupprecht # Make sure these didn't get locations: 19599451b44SJordan Rupprecht for i in range(0, len(wrong)): 1962238dcc3SJonas Devlieghere self.assertEqual( 1972238dcc3SJonas Devlieghere wrong[i].GetNumLocations(), 0, "Breakpoint %d has locations." % (i) 1982238dcc3SJonas Devlieghere ) 19999451b44SJordan Rupprecht 20099451b44SJordan Rupprecht # Now run to main and ensure we hit the breakpoints we should have: 20199451b44SJordan Rupprecht 20299451b44SJordan Rupprecht lldbutil.run_to_breakpoint_do_run(self, target, right[0]) 20399451b44SJordan Rupprecht 20499451b44SJordan Rupprecht # Test the hit counts: 20599451b44SJordan Rupprecht for i in range(0, len(right)): 2062238dcc3SJonas Devlieghere self.assertEqual( 2072238dcc3SJonas Devlieghere right[i].GetHitCount(), 1, "Breakpoint %d has the wrong hit count" % (i) 2082238dcc3SJonas Devlieghere ) 20999451b44SJordan Rupprecht 21099451b44SJordan Rupprecht for i in range(0, len(wrong)): 2112238dcc3SJonas Devlieghere self.assertEqual( 2122238dcc3SJonas Devlieghere wrong[i].GetHitCount(), 0, "Breakpoint %d has the wrong hit count" % (i) 2132238dcc3SJonas Devlieghere ) 21499451b44SJordan Rupprecht 21599451b44SJordan Rupprecht def do_test_depths(self): 21699451b44SJordan Rupprecht """This test uses a class variable in resolver.Resolver which gets set to 1 if we saw 21799451b44SJordan Rupprecht compile unit and 2 if we only saw modules. If the search depth is module, you get passed just 21899451b44SJordan Rupprecht the modules with no comp_unit. If the depth is comp_unit you get comp_units. So we can use 21999451b44SJordan Rupprecht this to test that our callback gets called at the right depth.""" 22099451b44SJordan Rupprecht 22199451b44SJordan Rupprecht target = self.make_target_and_import() 22299451b44SJordan Rupprecht extra_args = self.make_extra_args() 22399451b44SJordan Rupprecht 22499451b44SJordan Rupprecht file_list = lldb.SBFileSpecList() 22599451b44SJordan Rupprecht module_list = lldb.SBFileSpecList() 22699451b44SJordan Rupprecht module_list.Append(lldb.SBFileSpec("a.out")) 22799451b44SJordan Rupprecht 22899451b44SJordan Rupprecht # Make a breakpoint that has no __get_depth__, check that that is converted to eSearchDepthModule: 2292238dcc3SJonas Devlieghere bkpt = target.BreakpointCreateFromScript( 2302238dcc3SJonas Devlieghere "resolver.Resolver", extra_args, module_list, file_list 2312238dcc3SJonas Devlieghere ) 232*9c246882SJordan Rupprecht self.assertGreater(bkpt.GetNumLocations(), 0, "Resolver got no locations.") 2332238dcc3SJonas Devlieghere self.expect( 2342238dcc3SJonas Devlieghere "script print(resolver.Resolver.got_files)", 2352238dcc3SJonas Devlieghere substrs=["2"], 2362238dcc3SJonas Devlieghere msg="Was only passed modules", 2372238dcc3SJonas Devlieghere ) 23899451b44SJordan Rupprecht 23999451b44SJordan Rupprecht # Make a breakpoint that asks for modules, check that we didn't get any files: 2402238dcc3SJonas Devlieghere bkpt = target.BreakpointCreateFromScript( 2412238dcc3SJonas Devlieghere "resolver.ResolverModuleDepth", extra_args, module_list, file_list 2422238dcc3SJonas Devlieghere ) 243*9c246882SJordan Rupprecht self.assertGreater( 244*9c246882SJordan Rupprecht bkpt.GetNumLocations(), 0, "ResolverModuleDepth got no locations." 2452238dcc3SJonas Devlieghere ) 2462238dcc3SJonas Devlieghere self.expect( 2472238dcc3SJonas Devlieghere "script print(resolver.Resolver.got_files)", 2482238dcc3SJonas Devlieghere substrs=["2"], 2492238dcc3SJonas Devlieghere msg="Was only passed modules", 2502238dcc3SJonas Devlieghere ) 25199451b44SJordan Rupprecht 25299451b44SJordan Rupprecht # Make a breakpoint that asks for compile units, check that we didn't get any files: 2532238dcc3SJonas Devlieghere bkpt = target.BreakpointCreateFromScript( 2542238dcc3SJonas Devlieghere "resolver.ResolverCUDepth", extra_args, module_list, file_list 2552238dcc3SJonas Devlieghere ) 256*9c246882SJordan Rupprecht self.assertGreater( 257*9c246882SJordan Rupprecht bkpt.GetNumLocations(), 0, "ResolverCUDepth got no locations." 258*9c246882SJordan Rupprecht ) 2592238dcc3SJonas Devlieghere self.expect( 2602238dcc3SJonas Devlieghere "script print(resolver.Resolver.got_files)", 2612238dcc3SJonas Devlieghere substrs=["1"], 2622238dcc3SJonas Devlieghere msg="Was passed compile units", 2632238dcc3SJonas Devlieghere ) 26499451b44SJordan Rupprecht 26599451b44SJordan Rupprecht # Make a breakpoint that returns a bad value - we should convert that to "modules" so check that: 2662238dcc3SJonas Devlieghere bkpt = target.BreakpointCreateFromScript( 2672238dcc3SJonas Devlieghere "resolver.ResolverBadDepth", extra_args, module_list, file_list 2682238dcc3SJonas Devlieghere ) 269*9c246882SJordan Rupprecht self.assertGreater( 270*9c246882SJordan Rupprecht bkpt.GetNumLocations(), 0, "ResolverBadDepth got no locations." 2712238dcc3SJonas Devlieghere ) 2722238dcc3SJonas Devlieghere self.expect( 2732238dcc3SJonas Devlieghere "script print(resolver.Resolver.got_files)", 2742238dcc3SJonas Devlieghere substrs=["2"], 2752238dcc3SJonas Devlieghere msg="Was only passed modules", 2762238dcc3SJonas Devlieghere ) 27799451b44SJordan Rupprecht 27899451b44SJordan Rupprecht # Make a breakpoint that searches at function depth: 2792238dcc3SJonas Devlieghere bkpt = target.BreakpointCreateFromScript( 2802238dcc3SJonas Devlieghere "resolver.ResolverFuncDepth", extra_args, module_list, file_list 2812238dcc3SJonas Devlieghere ) 282*9c246882SJordan Rupprecht self.assertGreater( 283*9c246882SJordan Rupprecht bkpt.GetNumLocations(), 0, "ResolverFuncDepth got no locations." 2842238dcc3SJonas Devlieghere ) 2852238dcc3SJonas Devlieghere self.expect( 2862238dcc3SJonas Devlieghere "script print(resolver.Resolver.got_files)", 2872238dcc3SJonas Devlieghere substrs=["3"], 2882238dcc3SJonas Devlieghere msg="Was only passed modules", 2892238dcc3SJonas Devlieghere ) 2902238dcc3SJonas Devlieghere self.expect( 2912238dcc3SJonas Devlieghere "script print(resolver.Resolver.func_list)", 2922238dcc3SJonas Devlieghere substrs=["test_func", "break_on_me", "main"], 2932238dcc3SJonas Devlieghere msg="Saw all the functions", 2942238dcc3SJonas Devlieghere ) 29599451b44SJordan Rupprecht 29699451b44SJordan Rupprecht def do_test_cli(self): 29799451b44SJordan Rupprecht target = self.make_target_and_import() 29899451b44SJordan Rupprecht 2992238dcc3SJonas Devlieghere lldbutil.run_break_set_by_script( 3002238dcc3SJonas Devlieghere self, "resolver.Resolver", extra_options="-k symbol -v break_on_me" 3012238dcc3SJonas Devlieghere ) 30299451b44SJordan Rupprecht 30399451b44SJordan Rupprecht # Make sure setting a resolver breakpoint doesn't pollute further breakpoint setting 30499451b44SJordan Rupprecht # by checking the description of a regular file & line breakpoint to make sure it 30599451b44SJordan Rupprecht # doesn't mention the Python Resolver function: 30699451b44SJordan Rupprecht bkpt_no = lldbutil.run_break_set_by_file_and_line(self, "main.c", 12) 30799451b44SJordan Rupprecht bkpt = target.FindBreakpointByID(bkpt_no) 30899451b44SJordan Rupprecht strm = lldb.SBStream() 30999451b44SJordan Rupprecht bkpt.GetDescription(strm, False) 31099451b44SJordan Rupprecht used_resolver = "I am a python breakpoint resolver" in strm.GetData() 3112238dcc3SJonas Devlieghere self.assertFalse( 3122238dcc3SJonas Devlieghere used_resolver, 3132238dcc3SJonas Devlieghere "Found the resolver description in the file & line breakpoint description.", 3142238dcc3SJonas Devlieghere ) 31599451b44SJordan Rupprecht 31699451b44SJordan Rupprecht # Also make sure the breakpoint was where we expected: 31799451b44SJordan Rupprecht bp_loc = bkpt.GetLocationAtIndex(0) 31899451b44SJordan Rupprecht bp_sc = bp_loc.GetAddress().GetSymbolContext(lldb.eSymbolContextEverything) 31999451b44SJordan Rupprecht bp_se = bp_sc.GetLineEntry() 32099451b44SJordan Rupprecht self.assertEqual(bp_se.GetLine(), 12, "Got the right line number") 3212238dcc3SJonas Devlieghere self.assertEqual( 3222238dcc3SJonas Devlieghere bp_se.GetFileSpec().GetFilename(), "main.c", "Got the right filename" 3232238dcc3SJonas Devlieghere ) 32499451b44SJordan Rupprecht 32599451b44SJordan Rupprecht def do_test_bad_options(self): 32699451b44SJordan Rupprecht target = self.make_target_and_import() 32799451b44SJordan Rupprecht 3282238dcc3SJonas Devlieghere self.expect( 3292238dcc3SJonas Devlieghere "break set -P resolver.Resolver -k a_key", 3302238dcc3SJonas Devlieghere error=True, 3312238dcc3SJonas Devlieghere msg="Missing value at end", 3322238dcc3SJonas Devlieghere substrs=['Key: "a_key" missing value'], 3332238dcc3SJonas Devlieghere ) 3342238dcc3SJonas Devlieghere self.expect( 3352238dcc3SJonas Devlieghere "break set -P resolver.Resolver -v a_value", 3362238dcc3SJonas Devlieghere error=True, 3372238dcc3SJonas Devlieghere msg="Missing key at end", 3382238dcc3SJonas Devlieghere substrs=['Value: "a_value" missing matching key'], 3392238dcc3SJonas Devlieghere ) 3402238dcc3SJonas Devlieghere self.expect( 3412238dcc3SJonas Devlieghere "break set -P resolver.Resolver -v a_value -k a_key -v another_value", 3422238dcc3SJonas Devlieghere error=True, 3432238dcc3SJonas Devlieghere msg="Missing key among args", 3442238dcc3SJonas Devlieghere substrs=['Value: "a_value" missing matching key'], 3452238dcc3SJonas Devlieghere ) 3462238dcc3SJonas Devlieghere self.expect( 3472238dcc3SJonas Devlieghere "break set -P resolver.Resolver -k a_key -k a_key -v another_value", 3482238dcc3SJonas Devlieghere error=True, 3492238dcc3SJonas Devlieghere msg="Missing value among args", 3502238dcc3SJonas Devlieghere substrs=['Key: "a_key" missing value'], 3512238dcc3SJonas Devlieghere ) 352185ef697STatyana Krasnukha 353185ef697STatyana Krasnukha def do_test_copy_from_dummy_target(self): 354185ef697STatyana Krasnukha # Import breakpoint scripted resolver. 355185ef697STatyana Krasnukha self.import_resolver_script() 356185ef697STatyana Krasnukha 357185ef697STatyana Krasnukha # Create a scripted breakpoint. 3582238dcc3SJonas Devlieghere self.runCmd( 3592238dcc3SJonas Devlieghere "breakpoint set -P resolver.Resolver -k symbol -v break_on_me", 3602238dcc3SJonas Devlieghere BREAKPOINT_CREATED, 3612238dcc3SJonas Devlieghere ) 362185ef697STatyana Krasnukha 363185ef697STatyana Krasnukha # This is the function to remove breakpoints from the dummy target 364185ef697STatyana Krasnukha # to get a clean state for the next test case. 365185ef697STatyana Krasnukha def cleanup(): 3662238dcc3SJonas Devlieghere self.runCmd("breakpoint delete -D -f", check=False) 3672238dcc3SJonas Devlieghere self.runCmd("breakpoint list", check=False) 368185ef697STatyana Krasnukha 369185ef697STatyana Krasnukha # Execute the cleanup function during test case tear down. 370185ef697STatyana Krasnukha self.addTearDownHook(cleanup) 371185ef697STatyana Krasnukha 372185ef697STatyana Krasnukha # Check that target creating doesn't crash. 373185ef697STatyana Krasnukha target = self.make_target() 374