aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2009-08-03 12:39:01 +0000
committerVladimir Prus <vladimir@codesourcery.com>2009-08-03 12:39:01 +0000
commit48cb2d85819efcb448e7b635e0a5da776f5bfd8c (patch)
tree48ad67af6be4c92c46688853d2e165cd1e867783 /gdb/testsuite
parent3c1179ff511933179e64e854ac7b39c8003d9868 (diff)
downloadgdb-48cb2d85819efcb448e7b635e0a5da776f5bfd8c.zip
gdb-48cb2d85819efcb448e7b635e0a5da776f5bfd8c.tar.gz
gdb-48cb2d85819efcb448e7b635e0a5da776f5bfd8c.tar.bz2
Implement -break-commands
* breakpoint.c (get_breakpoint, breakpoint_set_commands): New. (commands_command): Use breakpoint_set_commands. * breakpoint.h (get_breakpoint, breakpoint_set_commands): Declare. * mi/mi-cmds.h (mi_cmd_break_commands): New. * mi/mi-cmds.c: Register -break-commands. * mi/mi-cmd-break.c (mi_cmd_break_commands, mi_read_next_line) (mi_command_line_array, mi_command_line_array_cnt) (mi_command_line_array_ptr): New.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.mi/mi-break.exp26
-rw-r--r--gdb/testsuite/lib/mi-support.exp13
3 files changed, 39 insertions, 6 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d1e38f3..32a421b 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-03 Vladimir Prus <vladimir@codesourcery.com>
+
+ * lib/mi-support.exp (mi_list_breakpoints): Make it work.
+ * gdb.mi/mi-break.exp (test_breakpoint_commands): New.
+ Call it.
+
2009-07-31 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* configure.ac: Run gdb.cell tests when appropriate.
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index 4b8d101..619727d 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -197,6 +197,30 @@ proc test_disabled_creation {} {
"test disabled creation: cleanup"
}
+proc test_breakpoint_commands {} {
+ global line_callee2_body
+ global hex
+ global fullname
+
+ mi_create_breakpoint "basics.c:callee2" 7 keep callee2 ".*basics.c" $line_callee2_body $hex \
+ "breakpoint commands: insert breakpoint at basics.c:callee2"
+
+ mi_gdb_test "-break-commands 7 \"print 10\" \"continue\"" \
+ "\\^done" \
+ "breakpoint commands: set commands"
+
+ mi_gdb_test "-break-info 7" \
+ "\\^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=\"7\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\",times=\"0\",script=\{\"print 10\",\"continue\"\},original-location=\".*\"\}.*\\\]\}" \
+ "breakpoint commands: check that commands are set"
+
+ mi_gdb_test "-break-commands 7" \
+ "\\^done" \
+ "breakpoint commands: clear commands"
+
+ mi_list_breakpoints [list [list 7 "keep" "callee2" "basics.c" "$line_callee2_body" $hex]] \
+ "breakpoint commands: check that commands are cleared"
+}
+
test_tbreak_creation_and_listing
test_rbreak_creation_and_listing
@@ -206,5 +230,7 @@ test_error
test_disabled_creation
+test_breakpoint_commands
+
mi_gdb_exit
return 0
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 9b4c464..e691232 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1170,21 +1170,22 @@ proc mi_list_breakpoints { expected test } {
set body ""
set first 1
- foreach item $children {
+ foreach item $expected {
if {$first == 0} {
set body "$body,"
+ set first 0
}
- 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 file [lindex $item 3]
+ set line [lindex $item 4]
+ set address [lindex $item 5]
+ 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\\\]\}" \
+ verbose -log "Expecting: 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