@@ -319,21 +319,31 @@ def sort_stopped_threads(
319319# Utility functions for setting breakpoints
320320# ==================================================
321321
322+ g_use_break_add = True
323+ def set_use_break_add (use_it ):
324+ global g_use_break_add
325+ g_use_break_add = use_it
326+
327+ def get_use_break_add ():
328+ global g_use_break_add
329+ return g_use_break_add
322330
323331def run_break_set_by_script (
324332 test , class_name , extra_options = None , num_expected_locations = 1
325333):
326334 """Set a scripted breakpoint. Check that it got the right number of locations."""
327335 test .assertTrue (class_name is not None , "Must pass in a class name." )
328- command = "breakpoint set -P " + class_name
336+ if get_use_break_add ():
337+ command = f"breakpoint add scripted -P { class_name } "
338+ else :
339+ command = "breakpoint set -P " + class_name
329340 if extra_options is not None :
330341 command += " " + extra_options
331342
332343 break_results = run_break_set_command (test , command )
333344 check_breakpoint_result (test , break_results , num_locations = num_expected_locations )
334345 return get_bpno_from_match (break_results )
335346
336-
337347def run_break_set_by_file_and_line (
338348 test ,
339349 file_name ,
@@ -353,10 +363,16 @@ def run_break_set_by_file_and_line(
353363 If loc_exact is true, we check that there is one location, and that location must be at the input file and line number.
354364 """
355365
356- if file_name is None :
357- command = "breakpoint set -l %d" % (line_number )
366+ if get_use_break_add ():
367+ if file_name is None :
368+ command = f"breakpoint add file { line_number } "
369+ else :
370+ command = f"breakpoint add file -f { file_name } -l { line_number } "
358371 else :
359- command = 'breakpoint set -f "%s" -l %d' % (file_name , line_number )
372+ if file_name is None :
373+ command = "breakpoint set -l %d" % (line_number )
374+ else :
375+ command = 'breakpoint set -f "%s" -l %d' % (file_name , line_number )
360376
361377 if module_name :
362378 command += " --shlib '%s'" % (module_name )
@@ -395,14 +411,20 @@ def run_break_set_by_symbol(
395411
396412 If sym_exact is true, then the output symbol must match the input exactly, otherwise we do a substring match.
397413 """
398- command = 'breakpoint set -n "%s"' % (symbol )
414+ if get_use_break_add ():
415+ command = f"breakpoint add name"
416+ else :
417+ command = 'breakpoint set -n "%s"' % (symbol )
399418
400419 if module_name :
401420 command += " --shlib '%s'" % (module_name )
402421
403422 if extra_options :
404423 command += " " + extra_options
405424
425+ if get_use_break_add ():
426+ command += f" -- '{ symbol } '"
427+
406428 break_results = run_break_set_command (test , command )
407429
408430 if num_expected_locations == 1 and sym_exact :
@@ -426,7 +448,10 @@ def run_break_set_by_selector(
426448):
427449 """Set a breakpoint by selector. Common options are the same as run_break_set_by_file_and_line."""
428450
429- command = 'breakpoint set -S "%s"' % (selector )
451+ if get_use_break_add ():
452+ command = f"breakpoint add name --match-style selector '{ selector } '"
453+ else :
454+ command = 'breakpoint set -S "%s"' % (selector )
430455
431456 if module_name :
432457 command += ' --shlib "%s"' % (module_name )
@@ -458,7 +483,10 @@ def run_break_set_by_regexp(
458483):
459484 """Set a breakpoint by regular expression match on symbol name. Common options are the same as run_break_set_by_file_and_line."""
460485
461- command = 'breakpoint set -r "%s"' % (regexp )
486+ if get_use_break_add ():
487+ command = f"breakpoint add name --match-style regex '{ regexp } '"
488+ else :
489+ command = 'breakpoint set -r "%s"' % (regexp )
462490 if extra_options :
463491 command += " " + extra_options
464492
@@ -473,10 +501,16 @@ def run_break_set_by_source_regexp(
473501 test , regexp , extra_options = None , num_expected_locations = - 1
474502):
475503 """Set a breakpoint by source regular expression. Common options are the same as run_break_set_by_file_and_line."""
476- command = 'breakpoint set -p "%s"' % (regexp )
504+ if get_use_break_add ():
505+ command = "breakpoint add pattern"
506+ else :
507+ command = 'breakpoint set -p "%s"' % (regexp )
477508 if extra_options :
478509 command += " " + extra_options
479510
511+ if get_use_break_add ():
512+ command += f" -- { regexp } "
513+
480514 break_results = run_break_set_command (test , command )
481515
482516 check_breakpoint_result (test , break_results , num_locations = num_expected_locations )
@@ -493,7 +527,11 @@ def run_break_set_by_file_colon_line(
493527 extra_options = None ,
494528 num_expected_locations = - 1 ,
495529):
496- command = 'breakpoint set -y "%s"' % (specifier )
530+ if get_use_break_add ():
531+ command = f"breakpoint add file '{ specifier } '"
532+ else :
533+ command = 'breakpoint set -y "%s"' % (specifier )
534+
497535 if extra_options :
498536 command += " " + extra_options
499537
0 commit comments