Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: gdb/testsuite/lib/gdbserver-support.exp

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/testsuite/lib/gdb.exp ('k') | gdb/testsuite/lib/go.exp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/lib/gdbserver-support.exp
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index 275f33c7712964daab0c2185e897dd45f43c8c6e..ee66e48260a237fd03ccf31eaf3812842fcd66a7 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -69,6 +69,10 @@ proc gdb_target_cmd { targetname serialport } {
verbose "Set target to $targetname"
return 0
}
+ -re "Remote debugging using stdio.*$gdb_prompt $" {
+ verbose "Set target to $targetname"
+ return 0
+ }
-re "Remote target $targetname connected to.*$gdb_prompt $" {
verbose "Set target to $targetname"
return 0
@@ -182,6 +186,12 @@ proc gdbserver_download_current_prog { } {
return $gdbserver_server_exec
}
+# Default routine to compute the argument to "target remote".
+
+proc gdbserver_default_get_remote_address { host port } {
+ return "$host$port"
+}
+
# Start a gdbserver process with initial OPTIONS and trailing ARGUMENTS.
# The port will be filled in between them automatically.
#
@@ -205,6 +215,15 @@ proc gdbserver_start { options arguments } {
set debughost "localhost:"
}
+ # Some boards use a different value for the port that is passed to
+ # gdbserver and the port that is passed to the "target remote" command.
+ # One example is the stdio gdbserver support.
+ if [target_info exists gdb,get_remote_address] {
+ set get_remote_address [target_info gdb,get_remote_address]
+ } else {
+ set get_remote_address gdbserver_default_get_remote_address
+ }
+
# Extract the protocol
if [target_info exists gdb_protocol] {
set protocol [target_info gdb_protocol]
@@ -216,9 +235,6 @@ proc gdbserver_start { options arguments } {
# Loop till we find a free port.
while 1 {
- # Export the host:port pair.
- set gdbport $debughost$portnum
-
# Fire off the debug agent.
set gdbserver_command "$gdbserver"
@@ -234,9 +250,9 @@ proc gdbserver_start { options arguments } {
if { $options != "" } {
append gdbserver_command " $options"
}
-
- append gdbserver_command " :$portnum"
-
+ if { $portnum != "" } {
+ append gdbserver_command " :$portnum"
+ }
if { $arguments != "" } {
append gdbserver_command " $arguments"
}
@@ -274,7 +290,7 @@ proc gdbserver_start { options arguments } {
}
}
- return [list $protocol $gdbport]
+ return [list $protocol [$get_remote_address $debughost $portnum]]
}
# Start a gdbserver process running SERVER_EXEC, and connect GDB
@@ -339,14 +355,19 @@ proc gdbserver_reconnect { } {
return [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
}
-# Start and connect to a gdbserver in extended mode.
+# Start and connect to a gdbserver in extended mode. Note this frobs
+# $gdbserver_protocol, so should be used only from a board that
+# usually connects in target remote mode.
proc gdbserver_start_extended { } {
global gdbserver_protocol
global gdbserver_gdbport
global use_gdb_stub
set res [gdbserver_start "--multi" ""]
- set gdbserver_protocol "extended-[lindex $res 0]"
+ set gdbserver_protocol [lindex $res 0]
+ if { [string first "extended-" $gdbserver_protocol] != 0} {
+ set gdbserver_protocol "extended-$gdbserver_protocol"
+ }
set gdbserver_gdbport [lindex $res 1]
# Even if the board file is testing with target remote, our caller
@@ -356,3 +377,32 @@ proc gdbserver_start_extended { } {
return [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
}
+
+# Start and connect to a gdbserver in extended/multi mode. Unlike
+# gdbserver_start_extended, this does not frob $gdbserver_protocol.
+
+proc gdbserver_start_multi { } {
+ global gdbserver_protocol
+ global gdbserver_gdbport
+
+ set res [gdbserver_start "--multi" ""]
+ set gdbserver_protocol [lindex $res 0]
+ set gdbserver_gdbport [lindex $res 1]
+
+ return [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
+}
+
+# Start a gdbserver process in multi/extended mode, and have GDB
+# connect to it (MI version). Return 0 on success, or non-zero on
+# failure.
+
+proc mi_gdbserver_start_multi { } {
+ global gdbserver_protocol
+ global gdbserver_gdbport
+
+ set res [gdbserver_start "--multi" ""]
+ set gdbserver_protocol [lindex $res 0]
+ set gdbserver_gdbport [lindex $res 1]
+
+ return [mi_gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
+}
« no previous file with comments | « gdb/testsuite/lib/gdb.exp ('k') | gdb/testsuite/lib/go.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698