-# Copyright 1999-2015 Free Software Foundation, Inc.
+# Copyright 1999-2016 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
set mi_gdb_prompt "\[(\]gdb\[)\] \r\n"
}
-global mi_inferior_spawn_id
global mi_inferior_tty_name
set MIFLAGS "-i=mi"
global gdb_prompt
global mi_gdb_prompt
global timeout
- global gdb_spawn_id
+ global gdb_spawn_id inferior_spawn_id
global MIFLAGS
gdb_stop_suppressing_tests
}
}
- # Create the new PTY for the inferior process.
- if { $separate_inferior_pty } {
- spawn -pty
- global mi_inferior_spawn_id
- global mi_inferior_tty_name
- set mi_inferior_spawn_id $spawn_id
- set mi_inferior_tty_name $spawn_out(slave,name)
- }
-
set res [remote_spawn host "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS $MIFLAGS [host_info gdb_opts]"]
if { $res < 0 || $res == "" } {
perror "Spawning $GDB failed."
warning "Couldn't set the width to 0."
}
}
- # If allowing the inferior to have its own PTY then assign the inferior
- # its own terminal device here.
+
+ # Create the new PTY for the inferior process.
if { $separate_inferior_pty } {
+ spawn -pty
+ global mi_inferior_tty_name
+ set inferior_spawn_id $spawn_id
+ set mi_inferior_tty_name $spawn_out(slave,name)
+
send_gdb "102-inferior-tty-set $mi_inferior_tty_name\n"
gdb_expect 10 {
-re ".*102\\\^done\r\n$mi_gdb_prompt$" {
}
}
+ if {![info exists inferior_spawn_id]} {
+ set inferior_spawn_id $gdb_spawn_id
+ }
+
mi_detect_async
return 0
if { $result == 0 } {
if [ info exists ipattern ] {
if { ![target_info exists gdb,noinferiorio] } {
- if { [target_info gdb_protocol] == "remote"
- || [target_info gdb_protocol] == "extended-remote"
- || [target_info protocol] == "sim"} {
-
- gdb_expect {
- -re "$ipattern" {
- pass "$message inferior output"
- }
- timeout {
- fail "$message inferior output (timeout)"
- set result 1
- }
+ global gdb_spawn_id inferior_spawn_id
+
+ set sid "$inferior_spawn_id $gdb_spawn_id"
+ gdb_expect {
+ -i "$sid" -re "$ipattern" {
+ pass "$message inferior output"
}
- } else {
- global mi_inferior_spawn_id
- expect {
- -i $mi_inferior_spawn_id -re "$ipattern" {
- pass "$message inferior output"
- }
- timeout {
- fail "$message inferior output (timeout)"
- set result 1
- }
+ timeout {
+ fail "$message inferior output (timeout)"
+ set result 1
}
}
} else {
# to better handle RUN.
send_gdb "jump *$start\n"
warning "Using CLI jump command, expect run-to-main FAIL"
+ gdb_expect {
+ -re "${run_match}&\"jump \\*${start}\\n\"\[\r\n\]+~\"Continuing at 0x\[0-9A-Fa-f\]+\\n.\"\[\r\n\]+\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\r\n${mi_gdb_prompt}" {}
+ }
return 0
}
set prompt_re "$mi_gdb_prompt$"
}
- set r "reason=\"signal-received\",signal-name=\"0\",signal-meaning=\"Signal 0\""
-
+ set r_nonstop "reason=\"signal-received\",signal-name=\"0\",signal-meaning=\"Signal 0\""
+ set r_allstop "reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\""
+ set r "(${r_nonstop}|${r_allstop})"
set any "\[^\n\]*"
# A signal can land anywhere, just ignore the location
}
foreach file $args {
- gdb_download [shlib_target_file $file]
+ gdb_remote_download target [shlib_target_file $file]
}
# Even if the target supplies full paths for shared libraries,
mi_gdb_test "set solib-search-path [file dirname [lindex $args 0]]" "\^done" ""
}
-proc mi_reverse_list { list } {
- if { [llength $list] <= 1 } {
- return $list
- }
- set tail [lrange $list 1 [llength $list]]
- set rtail [mi_reverse_list $tail]
- lappend rtail [lindex $list 0]
- return $rtail
-}
-
-proc mi_check_thread_states { xstates test } {
+proc mi_check_thread_states { states test } {
global expect_out
- set states [mi_reverse_list $xstates]
set pattern ".*\\^done,threads=\\\["
foreach s $states {
set pattern "${pattern}(.*)state=\"$s\""
#
# All arguments for the breakpoint may be specified using the options
# number, type, disp, enabled, addr, func, file, fullanme, line,
-# thread-groups, times, ignore, script, and original-location.
+# thread-groups, cond, evaluated-by, times, ignore, script,
+# and original-location.
#
# Only if -script and -ignore are given will they appear in the output.
# Otherwise, this procedure will skip them using ".*".
parse_args {{number .*} {type .*} {disp .*} {enabled .*} {addr .*}
{func .*} {file .*} {fullname .*} {line .*}
{thread-groups \\\[.*\\\]} {times .*} {ignore 0}
- {script ""} {original-location .*}}
+ {script ""} {original-location .*} {cond ""} {evaluated-by ""}}
set attr_list {}
foreach attr [list number type disp enabled addr func file \
- fullname line thread-groups times] {
+ fullname line thread-groups] {
lappend attr_list $attr [set $attr]
}
set result "bkpt={[mi_build_kv_pairs $attr_list]"
# There are always exceptions.
+
+ # If COND is not preset, do not output it.
+ if {[string length $cond] > 0} {
+ append result ","
+ append result [mi_build_kv_pairs [list "cond" $cond]]
+
+ # When running on a remote, GDB may output who is evaluating
+ # breakpoint conditions.
+ if {[string length ${evaluated-by}] > 0} {
+ append result [mi_build_kv_pairs \
+ [list "evaluated-by" ${evaluated-by}]]
+ } else {
+ append result {(,evaluated-by=".*")?}
+ }
+ }
+
+ append result ","
+ append result [mi_build_kv_pairs [list "times" $times]]
+
# If SCRIPT and IGNORE are not present, do not output them.
if {$ignore != 0} {
append result ","
# Assemble the final regexp.
return "BreakpointTable={nr_rows=\"$nr\",nr_cols=\"$nc\",$header,$body}"
}
+
+# Return a 1 for configurations that do not support Python scripting.
+# Note: This also sets various globals that specify which version of Python
+# is in use. See skip_python_tests_prompt.
+
+proc mi_skip_python_tests {} {
+ global mi_gdb_prompt
+ return [skip_python_tests_prompt "$mi_gdb_prompt$"]
+}
+
+# Check whether we're testing with the remote or extended-remote
+# targets.
+
+proc mi_is_target_remote {} {
+ global mi_gdb_prompt
+
+ return [gdb_is_target_remote_prompt "$mi_gdb_prompt"]
+}