-# Copyright 1999, 2001, 2004, 2006, 2007, 2008, 2009
+# Copyright 1999, 2001, 2004, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# containing function call, the internal breakpoint created to handle
# function call would be reported, messing up MI output.
mi_gdb_test "-var-create V * return_1()" \
- "\\^done,name=\"V\",numchild=\"0\",value=\"1\",type=\"int\"" \
+ "\\^done,name=\"V\",numchild=\"0\",value=\"1\",type=\"int\",has_more=\"0\"" \
"create varobj for function call"
mi_gdb_test "-var-update *" \
"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"
+
+ mi_run_to_main
+
+ mi_create_breakpoint "basics.c:callee2" 9 keep callee2 ".*basics.c" $line_callee2_body $hex \
+ "breakpoint commands: insert breakpoint at basics.c:callee2, again"
+
+ mi_gdb_test "-break-commands 9 \"set \$i=0\" \"while \$i<10\" \"print \$i\" \"set \$i=\$i+1\" \"end\" \"continue\" " \
+ "\\^done" \
+ "breakpoint commands: set commands"
+
+ mi_gdb_test "-exec-continue" \
+ ".*\\\$1 = 0.*\\\$10 = 9.*\\*running.*\\*stopped,reason=\"exited-normally\".*" \
+ "test hitting breakpoint with commands"
+
+
+}
+
test_tbreak_creation_and_listing
test_rbreak_creation_and_listing
test_disabled_creation
+test_breakpoint_commands
+
mi_gdb_exit
return 0