# First check mixed explicit/parsed linespecs.
mi_gdb_test "-break-insert --function main $srcfile:$line_callee3_head" \
- ".*Garbage following explicit linespec"
+ ".*Garbage following explicit location.*"
# Insert some breakpoints and list them
# Also, disable some so they do not interfere with other tests
set milogfile [standard_output_file "milog.txt"]
-mi_gdb_test "-gdb-set logging file $milogfile" ".*"
+mi_gdb_test "-gdb-set logging file $milogfile" "\\^done" \
+ "-gdb-set logging file"
mi_gdb_test "-gdb-set logging overwrite on" ".*"
}
}
-mi_gdb_test "set var *(unsigned int *) ${main_addr} = ${main_insn}" \
- ".*=memory-changed,thread-group=\"i${decimal}\".addr=\"${main_addr}\",len=\"0x4\",type=\"code\".*\\^done"
+regsub ^0x0* $main_addr "" main_addr
+mi_gdb_test "set var *(unsigned int *) 0x${main_addr} = ${main_insn}" \
+ ".*=memory-changed,thread-group=\"i${decimal}\".addr=\"0x0*${main_addr}\",len=\"0x4\",type=\"code\".*\\^done"
mi_gdb_exit
return 0
# gdb_test_multiple (or an MI equivalent)
mi_gdb_test "102-break-delete" "102\\^done.*"
-mi_gdb_test "print done = 1" { = 1"}
+set re [list \
+ [string_list_to_regexp ~ {"} $] \
+ $decimal \
+ [string_list_to_regexp " = 1" \\ n {"} \r\n ^ done]]
+set re [join $re ""]
+mi_gdb_test "print done = 1" $re
mi_gdb_test "103-exec-continue --all" "\[^\n\]*\r\n$running_re"
gdb_expect {
set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
-mi_gdb_test "source ${remote_python_file}" "load python file"
+set cmd "source ${remote_python_file}"
+set re [string_list_to_regexp & {"} $cmd \\ n {"} \r\n ^ done]
+mi_gdb_test $cmd $re "load python file"
mi_continue_to_line [gdb_get_line_number {MI breakpoint here} ${srcfile}] \
"step to breakpoint"
mi_delete_varobj nscont "delete varobj"
}
-mi_gdb_test "-enable-pretty-printing" ""
+mi_gdb_test "-enable-pretty-printing" "\\^done"
mi_create_varobj_checked string string_1 \
"struct string_repr" \
"choose default visualizer"
}
-mi_gdb_test "python exception_flag = True" ""
+set cmd "python exception_flag = True"
+set re [string_list_to_regexp & {"} $cmd \\ n {"} \r\n ^ done]
+mi_gdb_test $cmd $re
mi_create_dynamic_varobj nstype2 nstype2 1 \
"create nstype2 varobj"
return $readnow_p
}
-# mi_gdb_test COMMAND PATTERN MESSAGE [IPATTERN] -- send a command to gdb;
+# mi_gdb_test COMMAND [PATTERN [MESSAGE [IPATTERN]]] -- send a command to gdb;
# test the result.
#
# COMMAND is the command to execute, send to GDB with send_gdb. If
# this is the null string no command is sent.
# PATTERN is the pattern to match for a PASS, and must NOT include
# the \r\n sequence immediately before the gdb prompt.
+# If not specified, .* is used.
# MESSAGE is the message to be printed. (If this is the empty string,
# then sometimes we don't call pass or fail at all; I don't
# understand this at all.)
+# If not specified, COMMAND is used.
# IPATTERN is the pattern to match for the inferior's output. This parameter
# is optional. If present, it will produce a PASS if the match is
# successful, and a FAIL if unsuccessful.
global inferior_exited_re async
upvar timeout timeout
- set command [lindex $args 0]
- set pattern [lindex $args 1]
- set message [lindex $args 2]
+ if { [llength $args] >= 1 } then {
+ set command [lindex $args 0]
+ } else {
+ error "Not enough arguments in mi_gdb_test"
+ }
+
+ if { [llength $args] >= 2 } then {
+ set pattern [lindex $args 1]
+ } else {
+ set pattern ".*"
+ }
+
+ if { [llength $args] >= 3 } then {
+ set message [lindex $args 2]
+ } else {
+ set message $command
+ }
if [llength $args]==4 {
set ipattern [lindex $args 3]
set question_string "^FOOBAR$"
}
+ if { [llength $args] >= 6 } {
+ error "Too many arguments in mi_gdb_test"
+ }
+
if $verbose>2 then {
send_user "Sending \"$command\" to gdb\n"
send_user "Looking to match \"$pattern\"\n"