summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-04-24 08:46:19 +0000
committerVladimir Prus <vladimir@codesourcery.com>2008-04-24 08:46:19 +0000
commitd24317b4805503c9a018e77ee4683c87678f11ff (patch)
tree981f80990040cea599ebdfba3192cbe7637677aa
parent879d3736b8868261db20ec0720af378e8a37365a (diff)
downloadbinutils-gdb-d24317b4805503c9a018e77ee4683c87678f11ff.tar.gz
* breakpoint.c (print_one_breakpoint_location): In MI
mode, report the location string the breakpoint was originally created with.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/breakpoint.c9
-rw-r--r--gdb/testsuite/ChangeLog23
-rw-r--r--gdb/testsuite/gdb.mi/mi-break.exp14
-rw-r--r--gdb/testsuite/gdb.mi/mi-pending.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-simplerun.exp14
-rw-r--r--gdb/testsuite/gdb.mi/mi-syn-frame.exp11
-rw-r--r--gdb/testsuite/gdb.mi/mi-until.exp3
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-display.exp10
-rw-r--r--gdb/testsuite/gdb.mi/mi-watch.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi2-break.exp14
-rw-r--r--gdb/testsuite/gdb.mi/mi2-simplerun.exp14
-rw-r--r--gdb/testsuite/gdb.mi/mi2-syn-frame.exp11
-rw-r--r--gdb/testsuite/gdb.mi/mi2-until.exp3
-rw-r--r--gdb/testsuite/gdb.mi/mi2-var-display.exp10
-rw-r--r--gdb/testsuite/gdb.mi/mi2-watch.exp2
-rw-r--r--gdb/testsuite/lib/mi-support.exp36
17 files changed, 112 insertions, 72 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5d03f7f7b55..f9742dcf7db 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-24 Vladimir Prus <vladimir@codesourcery.com>
+
+ * breakpoint.c (print_one_breakpoint_location): In MI
+ mode, report the location string the breakpoint was
+ originally created with.
+
2008-04-23 Maxim Grigoriev <maxim2405@gmail.com>
* Makefile.in (xtensa-tdep.o): Update dependencies.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0c977923fc8..1ba957080e7 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3696,6 +3696,15 @@ print_one_breakpoint_location (struct breakpoint *b,
print_command_lines (uiout, l, 4);
do_cleanups (script_chain);
}
+
+ if (ui_out_is_mi_like_p (uiout) && !part_of_multiple)
+ {
+ if (b->addr_string)
+ ui_out_field_string (uiout, "original-location", b->addr_string);
+ else if (b->exp_string)
+ ui_out_field_string (uiout, "original-location", b->exp_string);
+ }
+
do_cleanups (bkpt_chain);
do_cleanups (old_chain);
}
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e8c1531aab5..37855d52702 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,24 @@
+2008-04-24 Vladimir Prus <vladimir@codesourcery.com>
+
+ * lib/mi-support.exp (mi_runto_helper): Adjust
+ for the original-location field.
+ (mi_create_breakpoint, mi_list_breakpoints): New.
+ * gdb.mi/mi-break.exp: Adjust.
+ * gdb.mi/mi2-break.exp: Adjust.
+ * gdb.mi/mi-pending.exp: Adjust.
+ * gdb.mi/mi-simplerun.exp: Adjust.
+ * gdb.mi/mi2-simplerun.exp: Adjust.
+ * gdb.mi/mi-syn-frame.exp: Adjust.
+ * gdb.mi/mi2-syn-frame.exp: Adjust.
+ * gdb.mi/mi-until.exp: Adjust.
+ * gdb.mi/mi2-until.exp: Adjust.
+ * gdb.mi/mi-var-display.exp: Adjust.
+ * gdb.mi/mi2-var-display.exp: Adjust.
+ * gdb.mi/mi-watch.exp: Adjust.
+ * gdb.mi/mi2-watch.exp: Adjust.
+
2008-04-23 Paolo Bonzini <bonzini@gnu.org>
-
+
* aclocal.m4: Add override.m4.
* configure: Regenerate.
@@ -13,7 +32,7 @@
* gdb.dwarf2/dw2-compressed.S, gdb.dwarf2/dw2-compressed.exp: New
files.
-
+
2008-04-18 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/atomic_enum: New test program.
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index c0f5132ebe0..f2f5b03ae0d 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -78,25 +78,21 @@ proc test_tbreak_creation_and_listing {} {
# -break-insert -t srcfile:$line_callee4_head
# -break-list
- mi_gdb_test "222-break-insert -t main" \
- "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\}" \
+ mi_create_breakpoint "-t main" 1 del main ".*basics.c" $line_main_body $hex \
"break-insert -t operation"
- mi_gdb_test "333-break-insert -t basics.c:callee2" \
- "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\",times=\"0\"\}" \
+ mi_create_breakpoint "-t basics.c:callee2" 2 del callee2 ".*basics.c" $line_callee2_body $hex \
"insert temp breakpoint at basics.c:callee2"
- mi_gdb_test "444-break-insert -t basics.c:$line_callee3_head" \
- "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",${fullname},line=\"$line_callee3_body\",times=\"0\"\}" \
+ mi_create_breakpoint "-t basics.c:$line_callee3_head" 3 del callee3 ".*basics.c" $line_callee3_body $hex \
"insert temp breakpoint at basics.c:\$line_callee3_head"
# Getting the quoting right is tricky. That is "\"<file>\":$line_callee4_head"
- mi_gdb_test "555-break-insert -t \"\\\"${srcfile}\\\":$line_callee4_head\"" \
- "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",${fullname},line=\"$line_callee4_body\",times=\"0\"\}" \
+ mi_create_breakpoint "-t \"\\\"${srcfile}\\\":$line_callee4_head\"" 4 del callee4 ".*basics.c" $line_callee4_body $hex \
"insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head"
mi_gdb_test "666-break-list" \
- "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\}.*\\\]\}" \
+ "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\",original-location=\".*\"\}.*\\\]\}" \
"list of breakpoints"
mi_gdb_test "777-break-delete" \
diff --git a/gdb/testsuite/gdb.mi/mi-pending.exp b/gdb/testsuite/gdb.mi/mi-pending.exp
index f2e6b95fa5f..5e5096fc638 100644
--- a/gdb/testsuite/gdb.mi/mi-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-pending.exp
@@ -64,7 +64,7 @@ if [target_info exists gdb_stub] {
# Set pending breakpoint via MI
mi_gdb_test "-break-insert -f pendfunc1" \
- ".*\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"<PENDING>\",pending=\"pendfunc1\",times=\"0\"\}"\
+ ".*\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"<PENDING>\",pending=\"pendfunc1\",times=\"0\",original-location=\"pendfunc1\"\}"\
"MI pending breakpoint on pendfunc1"
mi_run_cmd
diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp
index f2edfca40fe..6ad8235f436 100644
--- a/gdb/testsuite/gdb.mi/mi-simplerun.exp
+++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp
@@ -68,24 +68,20 @@ proc test_breakpoints_creation_and_listing {} {
# -break-disable
# -break-info
- mi_gdb_test "200-break-insert main" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
+ mi_create_breakpoint "main" 1 keep main ".*basics.c" $line_main_body $hex \
"break-insert operation"
- mi_gdb_test "201-break-insert basics.c:callee2" \
- "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",times=\"0\"\}" \
+ mi_create_breakpoint "basics.c:callee2" 2 keep callee2 ".*basics.c" $line_callee2_body $hex \
"insert breakpoint at basics.c:callee2"
- mi_gdb_test "202-break-insert basics.c:$line_callee3_head" \
- "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_body\",times=\"0\"\}" \
+ mi_create_breakpoint "basics.c:$line_callee3_head" 3 keep callee3 ".*basics.c" $line_callee3_body $hex \
"insert breakpoint at basics.c:\$line_callee3_head"
- mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":$line_callee4_head\"" \
- "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\",times=\"0\"\}" \
+ mi_create_breakpoint "\"\\\"${srcfile}\\\":$line_callee4_head\"" 4 keep callee4 ".*basics.c" $line_callee4_body $hex \
"insert breakpoint at \"<fullfilename>\":\$line_callee4_head"
mi_gdb_test "204-break-list" \
- "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
+ "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\",original-location=\".*\"\},.*\}\\\]\}" \
"list of breakpoints"
mi_gdb_test "205-break-disable 2 3 4" \
diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
index aa68cea8899..7b993f40daf 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
@@ -39,10 +39,8 @@ mi_gdb_exit
mi_gdb_start
mi_run_to_main
-mi_gdb_test "400-break-insert foo" \
- "400\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\",times=\"0\"\}" \
- "insert breakpoint foo"
-
+mi_create_breakpoint "foo" 2 keep foo ".*mi-syn-frame.c" $decimal $hex \
+ "insert breakpoint foo"
#
# Call foo() by hand, where we'll hit a breakpoint.
@@ -73,9 +71,8 @@ mi_gdb_test "404-stack-list-frames 0 0" \
# Call have_a_very_merry_interrupt() which will eventually raise a signal
# that's caught by handler() which calls subroutine().
-mi_gdb_test "405-break-insert subroutine" \
- "405\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",line=\"$decimal\",times=\"0\"\}" \
- "insert breakpoint subroutine"
+mi_create_breakpoint "subroutine" 3 keep subroutine ".*mi-syn-frame.c" $decimal $hex \
+ "insert breakpoint subroutine"
mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
"406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
diff --git a/gdb/testsuite/gdb.mi/mi-until.exp b/gdb/testsuite/gdb.mi/mi-until.exp
index dbdd1c177a2..f1edc0dc116 100644
--- a/gdb/testsuite/gdb.mi/mi-until.exp
+++ b/gdb/testsuite/gdb.mi/mi-until.exp
@@ -50,8 +50,7 @@ proc test_running_to_foo {} {
global mi_gdb_prompt
global hex
- mi_gdb_test "200-break-insert 10" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"foo\",file=\".*until.c\",line=\"10\",times=\"0\"\}" \
+ mi_create_breakpoint "10" 1 "keep" foo ".*until.c" 10 ".*" \
"break-insert operation"
mi_run_cmd
diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp
index 1d1fd8aadb4..0836b4972db 100644
--- a/gdb/testsuite/gdb.mi/mi-var-display.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-display.exp
@@ -42,9 +42,8 @@ mi_gdb_load ${binfile}
set line_dct_end [gdb_get_line_number "{int a = 0;}"]
-mi_gdb_test "200-break-insert $srcfile:$line_dct_end" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_end\",times=\"0\"\}" \
- "break-insert operation"
+mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \
+ "break-insert operation"
mi_run_cmd
mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \
@@ -371,9 +370,8 @@ mi_gdb_test "-var-delete weird" \
set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"]
-mi_gdb_test "200-break-insert $line_dst_incr_a_2" \
- "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_incr_a_2\",times=\"0\"\}" \
- "break-insert operation"
+mi_create_breakpoint "$line_dst_incr_a_2" 2 keep do_special_tests ".*var-cmd.c" $line_dst_incr_a_2 $hex \
+ "break-insert operation 2"
mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \
".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \
diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp
index dd999bc7f04..352017291c1 100644
--- a/gdb/testsuite/gdb.mi/mi-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch.exp
@@ -59,7 +59,7 @@ proc test_watchpoint_creation_and_listing {type} {
"break-watch operation"
mi_gdb_test "222-break-list" \
- "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
+ "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\",original-location=\"C\"\}\\\]\}" \
"list of watchpoints"
}
diff --git a/gdb/testsuite/gdb.mi/mi2-break.exp b/gdb/testsuite/gdb.mi/mi2-break.exp
index 97dca4ff530..33d972039b3 100644
--- a/gdb/testsuite/gdb.mi/mi2-break.exp
+++ b/gdb/testsuite/gdb.mi/mi2-break.exp
@@ -79,25 +79,21 @@ proc test_tbreak_creation_and_listing {} {
# -break-insert -t srcfile:$line_callee4_head
# -break-list
- mi_gdb_test "222-break-insert -t main" \
- "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\}" \
+ mi_create_breakpoint "-t main" 1 del main ".*basics.c" $line_main_body $hex \
"break-insert -t operation"
- mi_gdb_test "333-break-insert -t basics.c:callee2" \
- "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\",times=\"0\"\}" \
+ mi_create_breakpoint "-t basics.c:callee2" 2 del callee2 ".*basics.c" $line_callee2_body $hex \
"insert temp breakpoint at basics.c:callee2"
- mi_gdb_test "444-break-insert -t basics.c:$line_callee3_head" \
- "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",${fullname},line=\"$line_callee3_body\",times=\"0\"\}" \
+ mi_create_breakpoint "-t basics.c:$line_callee3_head" 3 del callee3 ".*basics.c" $line_callee3_body $hex \
"insert temp breakpoint at basics.c:\$line_callee3_head"
# Getting the quoting right is tricky. That is "\"<file>\":$line_callee4_head"
- mi_gdb_test "555-break-insert -t \"\\\"${srcfile}\\\":$line_callee4_head\"" \
- "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",${fullname},line=\"$line_callee4_body\",times=\"0\"\}" \
+ mi_create_breakpoint "-t \"\\\"${srcfile}\\\":$line_callee4_head\"" 4 del callee4 ".*basics.c" $line_callee4_body $hex \
"insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head"
mi_gdb_test "666-break-list" \
- "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\}.*\\\]\}" \
+ "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\",original-location=\".*\"\}.*\\\]\}" \
"list of breakpoints"
mi_gdb_test "777-break-delete" \
diff --git a/gdb/testsuite/gdb.mi/mi2-simplerun.exp b/gdb/testsuite/gdb.mi/mi2-simplerun.exp
index 3f0a1aa374f..7c7ad9bf2c4 100644
--- a/gdb/testsuite/gdb.mi/mi2-simplerun.exp
+++ b/gdb/testsuite/gdb.mi/mi2-simplerun.exp
@@ -68,24 +68,20 @@ proc test_breakpoints_creation_and_listing {} {
# -break-disable
# -break-info
- mi_gdb_test "200-break-insert main" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
+ mi_create_breakpoint "main" 1 keep main ".*basics.c" $line_main_body $hex \
"break-insert operation"
- mi_gdb_test "201-break-insert basics.c:callee2" \
- "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",times=\"0\"\}" \
+ mi_create_breakpoint "basics.c:callee2" 2 keep callee2 ".*basics.c" $line_callee2_body $hex \
"insert breakpoint at basics.c:callee2"
- mi_gdb_test "202-break-insert basics.c:$line_callee3_head" \
- "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_body\",times=\"0\"\}" \
+ mi_create_breakpoint "basics.c:$line_callee3_head" 3 keep callee3 ".*basics.c" $line_callee3_body $hex \
"insert breakpoint at basics.c:\$line_callee3_head"
- mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":$line_callee4_head\"" \
- "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\",times=\"0\"\}" \
+ mi_create_breakpoint "\"\\\"${srcfile}\\\":$line_callee4_head\"" 4 keep callee4 ".*basics.c" $line_callee4_body $hex \
"insert breakpoint at \"<fullfilename>\":\$line_callee4_head"
mi_gdb_test "204-break-list" \
- "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
+ "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\",original-location=\".*\"\},.*\}\\\]\}" \
"list of breakpoints"
mi_gdb_test "205-break-disable 2 3 4" \
diff --git a/gdb/testsuite/gdb.mi/mi2-syn-frame.exp b/gdb/testsuite/gdb.mi/mi2-syn-frame.exp
index db767a87369..1e814026e0c 100644
--- a/gdb/testsuite/gdb.mi/mi2-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi2-syn-frame.exp
@@ -41,10 +41,8 @@ mi_gdb_exit
mi_gdb_start
mi_run_to_main
-mi_gdb_test "400-break-insert foo" \
- "400\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\",times=\"0\"\}" \
- "insert breakpoint foo"
-
+mi_create_breakpoint "foo" 2 keep foo ".*mi-syn-frame.c" $decimal $hex \
+ "insert breakpoint foo"
#
# Call foo() by hand, where we'll hit a breakpoint.
@@ -77,9 +75,8 @@ mi_gdb_test "404-stack-list-frames 0 0" \
# Call have_a_very_merry_interrupt() which will eventually raise a signal
# that's caught by handler() which calls subroutine().
-mi_gdb_test "405-break-insert subroutine" \
- "405\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",line=\"$decimal\",times=\"0\"\}" \
- "insert breakpoint subroutine"
+mi_create_breakpoint "subroutine" 3 keep subroutine ".*mi-syn-frame.c" $decimal $hex \
+ "insert breakpoint subroutine"
mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
"406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
diff --git a/gdb/testsuite/gdb.mi/mi2-until.exp b/gdb/testsuite/gdb.mi/mi2-until.exp
index a6da82a506d..64d165fb6ee 100644
--- a/gdb/testsuite/gdb.mi/mi2-until.exp
+++ b/gdb/testsuite/gdb.mi/mi2-until.exp
@@ -51,8 +51,7 @@ proc test_running_to_foo {} {
global mi_gdb_prompt
global hex
- mi_gdb_test "200-break-insert 10" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"foo\",file=\".*until.c\",line=\"10\",times=\"0\"\}" \
+ mi_create_breakpoint "10" 1 "keep" foo ".*until.c" 10 ".*" \
"break-insert operation"
mi_run_cmd
diff --git a/gdb/testsuite/gdb.mi/mi2-var-display.exp b/gdb/testsuite/gdb.mi/mi2-var-display.exp
index 60d0d787773..2ae1fc589e4 100644
--- a/gdb/testsuite/gdb.mi/mi2-var-display.exp
+++ b/gdb/testsuite/gdb.mi/mi2-var-display.exp
@@ -42,9 +42,8 @@ mi_gdb_load ${binfile}
set line_dct_end [gdb_get_line_number "{int a = 0;}"]
-mi_gdb_test "200-break-insert $srcfile:$line_dct_end" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_end\",times=\"0\"\}" \
- "break-insert operation"
+mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \
+ "break-insert operation"
mi_run_cmd
mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \
@@ -370,9 +369,8 @@ mi_gdb_test "-var-delete weird" \
set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"]
-mi_gdb_test "200-break-insert $line_dst_incr_a_2" \
- "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_incr_a_2\",times=\"0\"\}" \
- "break-insert operation"
+mi_create_breakpoint "$line_dst_incr_a_2" 2 keep do_special_tests ".*var-cmd.c" $line_dst_incr_a_2 $hex \
+ "break-insert operation 2"
mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \
".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \
diff --git a/gdb/testsuite/gdb.mi/mi2-watch.exp b/gdb/testsuite/gdb.mi/mi2-watch.exp
index 6e3fce94279..f3e4e00f11a 100644
--- a/gdb/testsuite/gdb.mi/mi2-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi2-watch.exp
@@ -59,7 +59,7 @@ proc test_watchpoint_creation_and_listing {type} {
"break-watch operation"
mi_gdb_test "222-break-list" \
- "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
+ "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\",original-location=\"C\"\}\\\]\}" \
"list of watchpoints"
}
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 2b1ead818ee..2fd6b6c83a9 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -875,7 +875,7 @@ proc mi_runto_helper {func run_or_continue} {
set test "mi runto $func"
mi_gdb_test "200-break-insert -t $func" \
- "200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \
+ "200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",line=\"\[0-9\]*\",times=\"0\",original-location=\".*\"\}" \
"breakpoint at $func"
if {![regexp {number="[0-9]+"} $expect_out(buffer) str]
@@ -1059,6 +1059,40 @@ proc mi0_continue_to { bkptno func args file line test } {
"$func" "$args" "$file" "$line" "" "$test"
}
+# Creates a breakpoint and checks the reported fields are as expected
+proc mi_create_breakpoint { location number disp func file line address test } {
+ verbose -log "Expecting: 222\\^done,bkpt=\{number=\"$number\",type=\"breakpoint\",disp=\"$disp\",enabled=\"y\",addr=\"$address\",func=\"$func\",file=\"$file\",fullname=\".*\",line=\"$line\",times=\"0\",original-location=\".*\"\}"
+ mi_gdb_test "222-break-insert $location" \
+ "222\\^done,bkpt=\{number=\"$number\",type=\"breakpoint\",disp=\"$disp\",enabled=\"y\",addr=\"$address\",func=\"$func\",file=\"$file\",fullname=\".*\",line=\"$line\",times=\"0\",original-location=\".*\"\}" \
+ $test
+}
+
+proc mi_list_breakpoints { expected test } {
+ set fullname ".*"
+
+ set body ""
+ set first 1
+
+ foreach item $children {
+ if {$first == 0} {
+ set body "$body,"
+ }
+ set number disp func file line address
+ set number [lindex $item 0]
+ set disp [lindex $item 1]
+ set func [lindex $item 2]
+ set line [lindex $item 3]
+ set address [lindex $item 4]
+ set body "$body,bkpt=\{number=\"$number\",type=\"breakpoint\",disp=\"$disp\",enabled=\"y\",addr=\"$address\",func=\"$func\",file=\"$file\",${fullname},line=\"$line\",times=\"0\",original-location=\".*\"\}"
+ set first 0
+ }
+
+ verbose -log "Expecint: 666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[$body\\\]\}" \
+ mi_gdb_test "666-break-list" \
+ "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[$body\\\]\}" \
+ $test
+}
+
# Creates varobj named NAME for EXPRESSION.
# Name cannot be "-".
proc mi_create_varobj { name expression testname } {