1 # Copyright (C) 2010-2020 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # This file is part of the GDB testsuite. It tests the mechanism
17 # exposing breakpoints to Python.
19 load_lib gdb-python.exp
23 set options {debug c++}
25 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${options}] } {
29 # Skip all tests if Python scripting is not enabled.
30 if { [skip_python_tests] } { continue }
32 proc_with_prefix test_bkpt_basic { } {
33 global srcfile testfile hex decimal
35 # Start with a fresh gdb.
36 clean_restart ${testfile}
38 # We should start with no breakpoints.
39 gdb_test "python print (gdb.breakpoints())" "\\(\\)"
41 if ![runto_main] then {
42 fail "cannot run to main."
46 # Now there should be one breakpoint: main.
47 gdb_py_test_silent_cmd "python blist = gdb.breakpoints()" \
48 "Get Breakpoint List" 0
49 gdb_test "python print (blist\[0\])" \
50 "<gdb.Breakpoint object at $hex>" "Check obj exists @main"
51 gdb_test "python print (blist\[0\].location)" \
52 "main." "Check breakpoint location @main"
53 gdb_test "python print (blist\[0\].pending)" "False" \
54 "Check pending status of main breakpoint"
56 set mult_line [gdb_get_line_number "Break at multiply."]
57 gdb_breakpoint ${mult_line}
58 gdb_continue_to_breakpoint "Break at multiply" \
59 ".*Break at multiply.*"
61 # Check that the Python breakpoint code noted the addition of a
62 # breakpoint "behind the scenes".
63 gdb_py_test_silent_cmd "python blist = gdb.breakpoints()" \
64 "Get Breakpoint List" 0
65 gdb_test "python print (len(blist))" \
66 "2" "Check for two breakpoints"
67 gdb_test "python print (blist\[0\])" \
68 "<gdb.Breakpoint object at $hex>" "Check obj exists @main 2"
69 gdb_test "python print (blist\[0\].location)" \
70 "main." "Check breakpoint location @main 2"
71 gdb_test "python print (blist\[1\])" \
72 "<gdb.Breakpoint object at $hex>" "Check obj exists @mult_line"
74 gdb_test "python print (blist\[1\].location)" \
75 "py-breakpoint\.c:${mult_line}*" \
76 "check breakpoint location @mult_line"
78 # Check hit and ignore counts.
79 gdb_test "python print (blist\[1\].hit_count)" \
80 "1" "Check breakpoint hit count @1"
81 gdb_py_test_silent_cmd "python blist\[1\].ignore_count = 4" \
82 "Set breakpoint hit count" 0
83 gdb_continue_to_breakpoint "Break at multiply @6" \
84 ".*Break at multiply.*"
85 gdb_test "python print (blist\[1\].hit_count)" \
86 "6" "Check breakpoint hit count @6"
87 gdb_test "print result" \
88 " = 545" "Check expected variable result after 6 iterations"
90 # Test breakpoint is enabled and disabled correctly..
91 gdb_breakpoint [gdb_get_line_number "Break at add."]
92 gdb_continue_to_breakpoint "Break at add 1" ".*Break at add.*"
93 gdb_test "python print (blist\[1\].enabled)" \
94 "True" "Check breakpoint enabled."
95 gdb_py_test_silent_cmd "python blist\[1\].enabled = False" \
96 "Set breakpoint disabled." 0
97 gdb_continue_to_breakpoint "Break at add 2" ".*Break at add.*"
98 gdb_py_test_silent_cmd "python blist\[1\].enabled = True" \
99 "Set breakpoint enabled." 0
100 gdb_continue_to_breakpoint "Break at multiply after re-enable" \
101 ".*Break at multiply.*"
103 # Test other getters and setters.
104 gdb_py_test_silent_cmd "python blist = gdb.breakpoints()" \
105 "Get Breakpoint List" 0
106 gdb_test "python print (blist\[1\].thread)" \
107 "None" "Check breakpoint thread"
108 gdb_test "python print (blist\[1\].type == gdb.BP_BREAKPOINT)" \
109 "True" "Check breakpoint type"
110 gdb_test "python print (blist\[0\].number)" \
111 "1" "Check breakpoint number 0"
112 gdb_test "python print (blist\[1\].number)" \
113 "2" "Check breakpoint number 1"
114 gdb_test "python print (blist\[2\].number)" \
115 "3" "Check breakpoint number 2"
118 proc_with_prefix test_bkpt_deletion { } {
119 global srcfile testfile hex decimal
121 # Start with a fresh gdb.
122 clean_restart ${testfile}
124 if ![runto_main] then {
125 fail "cannot run to main."
129 # Test breakpoints are deleted correctly.
130 set deltst_location [gdb_get_line_number "Break at multiply."]
131 set end_location [gdb_get_line_number "Break at end."]
132 gdb_py_test_silent_cmd "python dp1 = gdb.Breakpoint (\"$deltst_location\")" \
134 gdb_breakpoint [gdb_get_line_number "Break at end."]
135 gdb_py_test_silent_cmd "python del_list = gdb.breakpoints()" \
136 "Get Breakpoint List" 0
137 gdb_test "python print (len(del_list))" \
138 "3" "Number of breakpoints before delete"
139 gdb_continue_to_breakpoint "Break at multiply." \
140 ".*$srcfile:$deltst_location.*"
141 gdb_py_test_silent_cmd "python dp1.delete()" \
142 "Delete Breakpoint" 0
143 gdb_test "python print (dp1.number)" \
144 "RuntimeError: Breakpoint 2 is invalid.*" \
145 "Check breakpoint invalidated"
146 gdb_py_test_silent_cmd "python del_list = gdb.breakpoints()" \
147 "Get Breakpoint List" 0
148 gdb_test "python print (len(del_list))" \
149 "2" "Number of breakpoints after delete"
150 gdb_continue_to_breakpoint "Break at end." \
151 ".*$srcfile:$end_location.*"
154 proc_with_prefix test_bkpt_cond_and_cmds { } {
155 global srcfile testfile hex decimal
157 # Start with a fresh gdb.
158 clean_restart ${testfile}
160 if ![runto_main] then {
161 fail "cannot run to main."
165 # Test conditional setting.
166 set bp_location1 [gdb_get_line_number "Break at multiply."]
167 gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (\"$bp_location1\")" \
169 gdb_continue_to_breakpoint "Break at multiply" \
170 ".*Break at multiply.*"
171 gdb_py_test_silent_cmd "python bp1.condition = \"i == 5\"" \
173 gdb_test "python print (bp1.condition)" "i == 5" \
174 "Test conditional has been set"
175 gdb_continue_to_breakpoint "Break at multiply @5" \
176 ".*Break at multiply.*"
178 "5" "Test conditional breakpoint stopped after five iterations"
179 gdb_py_test_silent_cmd "python bp1.condition = None" \
181 gdb_test "python print (bp1.condition)" \
182 "None" "Test conditional read"
183 gdb_continue_to_breakpoint "Break at multiply @6" \
184 ".*Break at multiply.*"
186 "6" "Test breakpoint stopped after six iterations"
189 gdb_breakpoint [gdb_get_line_number "Break at add."]
190 set test {commands $bpnum}
191 gdb_test_multiple $test $test { -re "\r\n>$" { pass $test } }
192 set test {print "Command for breakpoint has been executed."}
193 gdb_test_multiple $test $test { -re "\r\n>$" { pass $test } }
194 set test {print result}
195 gdb_test_multiple $test $test { -re "\r\n>$" { pass $test } }
198 gdb_py_test_silent_cmd "python blist = gdb.breakpoints()" \
199 "Get Breakpoint List" 0
200 gdb_py_test_silent_cmd "python last_bp = blist\[len(blist)-1\]" \
201 "Find last breakpoint" 0
202 gdb_test "python print (last_bp.commands)" \
203 "print \"Command for breakpoint has been executed.\".*print result"
205 gdb_test_no_output "python last_bp.commands = 'echo hi\\necho there'" \
207 # Note the length is 3 because the string ends in a \n.
208 gdb_test "python print (len(last_bp.commands.split('\\n')))" "3" \
209 "check number of lines in commands"
212 proc_with_prefix test_bkpt_invisible { } {
213 global srcfile testfile hex decimal
215 # Start with a fresh gdb.
216 clean_restart ${testfile}
218 if ![runto_main] then {
219 fail "cannot run to main."
224 set ibp_location [gdb_get_line_number "Break at multiply."]
225 gdb_py_test_silent_cmd "python ibp = gdb.Breakpoint(\"$ibp_location\", internal=False)" \
226 "Set invisible breakpoint" 0
227 gdb_py_test_silent_cmd "python ilist = gdb.breakpoints()" \
228 "Get Breakpoint List" 0
229 gdb_test "python print (ilist\[0\])" \
230 "<gdb.Breakpoint object at $hex>" "Check invisible bp obj exists 1"
231 gdb_test "python print (ilist\[0\].location)" \
232 "py-breakpoint\.c:$ibp_location*" "Check breakpoint location 1"
233 gdb_test "python print (ilist\[0\].visible)" \
234 "True" "Check breakpoint visibility 1"
235 gdb_test "info breakpoints" "py-breakpoint\.c:$ibp_location.*" \
236 "Check info breakpoints shows visible breakpoints"
238 gdb_py_test_silent_cmd "python ibp = gdb.Breakpoint(\"$ibp_location\", internal=True)" \
239 "Set invisible breakpoint" 0
240 gdb_py_test_silent_cmd "python ilist = gdb.breakpoints()" \
241 "Get Breakpoint List" 0
242 gdb_test "python print (ilist\[0\])" \
243 "<gdb.Breakpoint object at $hex>" "Check invisible bp obj exists 2"
244 gdb_test "python print (ilist\[0\].location)" \
245 "py-breakpoint\.c:$ibp_location*" "Check breakpoint location 2"
246 gdb_test "python print (ilist\[0\].visible)" \
247 "False" "Check breakpoint visibility 2"
248 gdb_test "info breakpoints" "No breakpoints or watchpoints.*" \
249 "Check info breakpoints does not show invisible breakpoints"
250 gdb_test "maint info breakpoints" \
251 "py-breakpoint\.c:$ibp_location.*" \
252 "Check maint info breakpoints shows invisible breakpoints"
255 proc_with_prefix test_watchpoints { } {
256 global srcfile testfile hex decimal
258 # Start with a fresh gdb.
259 clean_restart ${testfile}
261 # Disable hardware watchpoints if necessary.
262 if [target_info exists gdb,no_hardware_watchpoints] {
263 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
266 if ![runto_main] then {
267 fail "cannot run to main."
271 gdb_py_test_silent_cmd "python wp1 = gdb.Breakpoint (\"result\", type=gdb.BP_WATCHPOINT, wp_class=gdb.WP_WRITE )" \
273 gdb_test "python print (wp1.pending)" "False"
274 gdb_test "continue" \
275 ".*\[Ww\]atchpoint.*result.*Old value = 0.*New value = 25.*main.*" \
276 "Test watchpoint write"
279 proc_with_prefix test_bkpt_internal { } {
280 global srcfile testfile hex decimal
282 # Start with a fresh gdb.
283 clean_restart ${testfile}
285 # Disable hardware watchpoints if necessary.
286 if [target_info exists gdb,no_hardware_watchpoints] {
287 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
289 if ![runto_main] then {
290 fail "cannot run to main."
294 gdb_py_test_silent_cmd "python wp1 = gdb.Breakpoint (\"result\", type=gdb.BP_WATCHPOINT, wp_class=gdb.WP_WRITE, internal=True )" \
296 gdb_test "info breakpoints" \
297 "No breakpoints or watchpoints.*" \
298 "Check info breakpoints does not show invisible breakpoints"
299 gdb_test "maint info breakpoints" \
300 ".*watchpoint.*result.*" \
301 "Check maint info breakpoints shows invisible breakpoints"
302 gdb_test "continue" \
303 ".*\[Ww\]atchpoint.*result.*Old value = 0.*New value = 25.*" \
304 "Test watchpoint write"
307 proc_with_prefix test_bkpt_eval_funcs { } {
308 global srcfile testfile hex decimal
310 # Start with a fresh gdb.
311 clean_restart ${testfile}
313 # Disable hardware watchpoints if necessary.
314 if [target_info exists gdb,no_hardware_watchpoints] {
315 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
317 if ![runto_main] then {
318 fail "cannot run to main."
323 gdb_py_test_multiple "Sub-class a breakpoint" \
325 "class bp_eval (gdb.Breakpoint):" "" \
328 " def stop (self):" "" \
329 " self.count = self.count + 1" "" \
330 " self.inf_i = gdb.parse_and_eval(\"i\")" "" \
331 " if self.inf_i == 3:" "" \
336 gdb_py_test_multiple "Sub-class a second breakpoint" \
338 "class bp_also_eval (gdb.Breakpoint):" "" \
340 " def stop (self):" "" \
341 " self.count = self.count + 1" "" \
342 " if self.count == 9:" "" \
347 gdb_py_test_multiple "Sub-class a third breakpoint" \
349 "class basic (gdb.Breakpoint):" "" \
353 set bp_location2 [gdb_get_line_number "Break at multiply."]
354 set end_location [gdb_get_line_number "Break at end."]
355 gdb_py_test_silent_cmd "python eval_bp1 = bp_eval(\"$bp_location2\")" \
357 gdb_py_test_silent_cmd "python also_eval_bp1 = bp_also_eval(\"$bp_location2\")" \
359 gdb_py_test_silent_cmd "python never_eval_bp1 = bp_also_eval(\"$end_location\")" \
361 gdb_continue_to_breakpoint "Break at multiply, i==3" \
362 ".*$srcfile:$bp_location2.*"
364 "3" "Check inferior value matches python accounting"
365 gdb_test "python print (eval_bp1.inf_i)" \
366 "3" "Check python accounting matches inferior"
367 gdb_test "python print (also_eval_bp1.count)" "4" \
368 "Check non firing same-location also_eval_bp1 function was also called at each stop."
369 gdb_test "python print (eval_bp1.count)" "4" \
370 "Check non firing same-location eval_bp1 function was also called at each stop."
373 set cond_bp [gdb_get_line_number "Break at multiply."]
374 gdb_py_test_silent_cmd "python eval_bp1 = bp_eval(\"$cond_bp\")" \
376 set test_cond {cond $bpnum}
377 gdb_test "$test_cond \"foo==3\"" \
378 "Only one stop condition allowed. There is currently a Python.*" \
379 "Check you cannot add a CLI condition to a Python breakpoint that has defined stop"
380 gdb_py_test_silent_cmd "python eval_bp2 = basic(\"$cond_bp\")" \
382 gdb_py_test_silent_cmd "python eval_bp2.condition = \"1==1\"" \
384 gdb_py_test_multiple "Construct an eval function" \
386 "def stop_func ():" "" \
390 gdb_test "python eval_bp2.stop = stop_func" \
391 "RuntimeError: Only one stop condition allowed. There is currently a GDB.*" \
392 "assign stop function to a breakpoint that has a condition"
395 gdb_breakpoint [gdb_get_line_number "Break at multiply."]
396 gdb_py_test_silent_cmd "python check_eval = bp_eval(\"$bp_location2\")" \
398 gdb_test "python print (check_eval.count)" "0" \
399 "Test that evaluate function has not been yet executed (ie count = 0)"
400 gdb_continue_to_breakpoint "Break at multiply, count==1" \
401 ".*$srcfile:$bp_location2.*"
402 gdb_test "python print (check_eval.count)" "1" \
403 "Test that evaluate function is run when location also has normal bp"
405 gdb_py_test_multiple "Sub-class a watchpoint" \
407 "class wp_eval (gdb.Breakpoint):" "" \
408 " def stop (self):" "" \
409 " self.result = gdb.parse_and_eval(\"result\")" "" \
410 " if self.result == 788:" "" \
416 gdb_py_test_silent_cmd "python wp1 = wp_eval (\"result\", type=gdb.BP_WATCHPOINT, wp_class=gdb.WP_WRITE)" \
418 gdb_test "continue" \
419 ".*\[Ww\]atchpoint.*result.*Old value =.*New value = 788.*" \
420 "Test watchpoint write"
421 gdb_test "python print (never_eval_bp1.count)" "0" \
422 "Check that this unrelated breakpoints eval function was never called."
425 proc_with_prefix test_bkpt_temporary { } {
426 global srcfile testfile hex decimal
428 # Start with a fresh gdb.
429 clean_restart ${testfile}
431 if ![runto_main] then {
432 fail "cannot run to main."
437 gdb_py_test_multiple "Sub-class and check temporary breakpoint" \
439 "class temp_bp (gdb.Breakpoint):" "" \
441 " def stop (self):" "" \
442 " self.count = self.count + 1" "" \
445 set ibp_location [gdb_get_line_number "Break at multiply."]
446 gdb_py_test_silent_cmd "python ibp = temp_bp(\"$ibp_location\", temporary=True)" \
447 "Set temporary breakpoint" 0
448 gdb_test "info breakpoints" \
449 "2.*breakpoint.*del.*py-breakpoint\.c:$ibp_location.*" \
450 "Check info breakpoints shows breakpoint with temporary status"
451 gdb_test "python print (ibp.location)" "py-breakpoint\.c:$ibp_location*" \
452 "Check temporary breakpoint location"
453 gdb_test "python print (ibp.temporary)" "True" \
454 "Check breakpoint temporary status"
455 gdb_continue_to_breakpoint "Break at multiply." \
456 ".*$srcfile:$ibp_location.*"
457 gdb_test "python print (ibp.count)" "1" \
458 "Check temporary stop callback executed before deletion."
459 gdb_test "python print (ibp.temporary)" "RuntimeError: Breakpoint 2 is invalid.*" \
460 "Check temporary breakpoint is deleted after being hit"
461 gdb_test "info breakpoints" "No breakpoints or watchpoints.*" \
462 "Check info breakpoints shows temporary breakpoint is deleted"
465 # Test address locations.
467 proc_with_prefix test_bkpt_address {} {
468 global gdb_prompt decimal srcfile
470 # Delete all breakpoints
473 gdb_test "python gdb.Breakpoint(\"*main\")" \
474 ".*Breakpoint ($decimal)+ at .*$srcfile, line ($decimal)+\."
476 gdb_py_test_silent_cmd \
477 "python main_loc = gdb.parse_and_eval(\"main\").address" \
478 "eval address of main" 0
480 # Python 2 vs 3 ... Check `int' first. If that fails, try `long'.
481 gdb_test_multiple "python main_addr = int(main_loc)" "int value of main" {
482 -re "Traceback.*$gdb_prompt $" {
483 gdb_test_no_output "python main_addr = long(main_loc)" \
486 -re "$gdb_prompt $" {
487 pass "int value of main"
491 # Include whitespace in the linespec to double-check proper
492 # grokking of argument to gdb.Breakpoint.
493 gdb_test "python gdb.Breakpoint(\" *{}\".format(str(main_addr)))" \
494 ".*Breakpoint ($decimal)+ at .*$srcfile, line ($decimal)+\."
497 proc_with_prefix test_bkpt_pending {} {
499 gdb_breakpoint "nosuchfunction" allow-pending
500 gdb_test "python print (gdb.breakpoints()\[0\].pending)" "True" \
501 "Check pending status of pending breakpoint"
504 # Helper proc to install an event listener for a given breakpoint
505 # event. NAME is the name of the event to listen for.
506 proc connect_event {name} {
507 set lambda "lambda x: note_event(\"$name\")"
508 gdb_test_no_output "python gdb.events.$name.connect($lambda)" \
509 "install $name event listener"
512 # Helper proc to check that the most recently emitted breakpoint event
514 proc check_last_event {expected} {
515 gdb_test "python print (last_bp_event)" $expected \
516 "check for $expected event"
519 proc_with_prefix test_bkpt_events {} {
522 clean_restart ${testfile}
524 gdb_py_test_multiple "Create event handler" \
526 "def note_event(arg):" "" \
527 " global last_bp_event" "" \
528 " last_bp_event = arg" "" \
530 gdb_test_no_output "python last_bp_event = None"
532 connect_event breakpoint_created
533 connect_event breakpoint_modified
534 connect_event breakpoint_deleted
536 gdb_breakpoint [gdb_get_line_number "Break at add."]
537 check_last_event breakpoint_created
538 gdb_test_no_output "disable 1"
539 check_last_event breakpoint_modified
540 gdb_test_no_output "delete 1"
541 check_last_event breakpoint_deleted
544 proc_with_prefix test_bkpt_explicit_loc {} {
545 global srcfile testfile
547 # Start with a fresh gdb.
548 clean_restart ${testfile}
550 if ![runto_main] then {
551 fail "cannot run to main."
557 set bp_location1 [gdb_get_line_number "Break at multiply."]
558 set bp_location2 [gdb_get_line_number "Break at add."]
560 gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (line=$bp_location1)" \
561 "set explicit breakpoint by line" 0
562 gdb_continue_to_breakpoint "break at multiply for explicit line" \
563 ".*Break at multiply.*"
565 gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (line=\"+1\")" \
566 "set explicit breakpoint by relative line" 0
567 gdb_continue_to_breakpoint "break at add for relative line" \
571 gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (line=\"-1\")" \
572 "set explicit breakpoint by relative negative line" 0
573 gdb_continue_to_breakpoint "break at multiply for negative line" \
574 ".*Break at multiply.*"
577 gdb_test "python bp1 = gdb.Breakpoint (line=bp1)" \
578 "RuntimeError: Line keyword should be an integer or a string.*" \
579 "set explicit breakpoint by invalid line type"
582 gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (function=\"add\")" \
583 "set explicit breakpoint by function" 0
584 gdb_continue_to_breakpoint "break at function add for function" \
585 ".*Break at function add.*"
588 gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (source=\"$srcfile\", function=\"add\")" \
589 "set explicit breakpoint by source file and function" 0
590 gdb_continue_to_breakpoint "break at function add for source and function" \
591 ".*Break at function add.*"
594 gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (source=\"$srcfile\", line=\"$bp_location2\")" \
595 "set explicit breakpoint by source file and line number" 0
596 gdb_continue_to_breakpoint "break at add for source and line" \
600 gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (\"-source $srcfile -line $bp_location2\")" \
601 "set explicit breakpoint by source file and line number in spec" 0
602 gdb_continue_to_breakpoint "break at add for source and line in spec" \
606 gdb_test "python bp1 = gdb.Breakpoint (source=\"$srcfile\")" \
607 "RuntimeError: Specifying a source must also include a line, label or function.*" \
608 "set invalid explicit breakpoint by source only"
610 gdb_test "python bp1 = gdb.Breakpoint (source=\"foo.c\", line=\"5\")" \
611 "No source file named foo.*" \
612 "set invalid explicit breakpoint by missing source and line"
613 gdb_test "python bp1 = gdb.Breakpoint (source=\"$srcfile\", line=\"900\")" \
614 "No line 900 in file \"$srcfile\".*" \
615 "set invalid explicit breakpoint by source and invalid line"
616 gdb_test "python bp1 = gdb.Breakpoint (function=\"blah\")" \
617 "Function \"blah\" not defined.*" \
618 "set invalid explicit breakpoint by missing function"
621 gdb_test "catch throw" "Catchpoint .* \\(throw\\)"
622 gdb_test "python print (gdb.breakpoints())" \
624 "catch throw is not a breakpoint"
627 proc_with_prefix test_bkpt_qualified {} {
628 global decimal hex testfile
630 # Start with a fresh gdb.
631 clean_restart ${testfile}
633 set one_location_re "Breakpoint $decimal at $hex:.*line $decimal."
634 set two_location_re "Breakpoint $decimal at $hex:.*2 locations."
636 if ![runto_main] then {
637 fail "cannot run to main."
641 # Test the default value of "qualified".
644 "python gdb.Breakpoint(\"multiply\")" \
646 "qualified implicitly false"
648 # Test qualified=False.
651 "python gdb.Breakpoint(\"multiply\", qualified=False)" \
655 # Test qualified=True.
658 "python gdb.Breakpoint(\"multiply\", qualified=True)" \
662 # Test qualified=True with an explicit function.
665 "python gdb.Breakpoint(function=\"multiply\", qualified=True)" \
667 "qualified true and explicit"
669 # Test qualified=False with an explicit function.
672 "python gdb.Breakpoint(function=\"multiply\", qualified=False)" \
674 "qualified false and explicit"
676 # Test -q in the spec string.
679 "python gdb.Breakpoint(\"-q multiply\")" \
683 # Test -q in the spec string with explicit location.
686 "python gdb.Breakpoint(\"-q -function multiply\")" \
688 "-q in spec string with explicit location"
690 # Test -q in the spec string and qualified=False (-q should win).
693 "python gdb.Breakpoint(\"-q multiply\", qualified=False)" \
695 "-q in spec string and qualified false"
698 proc_with_prefix test_bkpt_probe {} {
699 global decimal hex testfile srcfile
701 if { [prepare_for_testing "failed to prepare" ${testfile}-probes \
702 ${srcfile} {debug c++ additional_flags=-DUSE_PROBES}] } {
706 if ![runto_main] then {
707 fail "cannot run to main."
712 "python gdb.Breakpoint(\"-probe test:result_updated\")" \
713 "Breakpoint $decimal at $hex" \
714 "-probe in spec string"
719 test_bkpt_cond_and_cmds
728 test_bkpt_explicit_loc