diff options
author | Doug Evans <dje@google.com> | 2011-12-16 19:06:38 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2011-12-16 19:06:38 +0000 |
commit | e0f9f062204827dd5f8a01ab9252ec29273cd3b0 (patch) | |
tree | b59a5c9d50f4d48b63a75b4d1a63213eee7c7c1d /gdb/testsuite | |
parent | e77616d77a34e00c99d803b2324e17ece340ac5e (diff) | |
download | gdb-e0f9f062204827dd5f8a01ab9252ec29273cd3b0.zip gdb-e0f9f062204827dd5f8a01ab9252ec29273cd3b0.tar.gz gdb-e0f9f062204827dd5f8a01ab9252ec29273cd3b0.tar.bz2 |
* NEWS: Add entry for stdio gdbserver.
gdbserver/
* linux-low.c (linux_create_inferior): If stdio connection,
redirect stdin from /dev/null, stdout to stderr.
* remote-utils.c (remote_is_stdio): New static global.
(remote_connection_is_stdio): New function.
(remote_prepare): Handle stdio connection.
(remote_open): Ditto.
(remote_close): Don't close stdin for stdio connections.
(read_prim,write_prim): New functions. Replace all calls to
read/write to these.
* server.c (main): Watch for "-" argument. Move call to
remote_prepare before start_inferior.
* server.h (STDIO_CONNECTION_NAME): New macro.
(remote_connection_is_stdio): Declare.
doc/
* gdb.texinfo (Server): Document -/stdio argument to gdbserver.
testsuite/
* lib/gdbserver-support.exp (gdb_target_cmd): Recognize stdio
gdbserver output.
(gdbserver_default_get_remote_address): New function.
(gdbserver_start): Call gdb,get_remote_address to compute argument
to "target remote" command.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdbserver-support.exp | 30 |
2 files changed, 31 insertions, 7 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4bb605e..e5f795a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2011-12-16 Doug Evans <dje@google.com> + + * lib/gdbserver-support.exp (gdb_target_cmd): Recognize stdio + gdbserver output. + (gdbserver_default_get_remote_address): New function. + (gdbserver_start): Call gdb,get_remote_address to compute argument + to "target remote" command. + 2011-12-16 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-function.exp: Change "on" to "full" for diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp index 22c7860..4e739c5 100644 --- a/gdb/testsuite/lib/gdbserver-support.exp +++ b/gdb/testsuite/lib/gdbserver-support.exp @@ -70,6 +70,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 @@ -183,6 +187,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. # @@ -206,6 +216,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] @@ -217,9 +236,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" @@ -235,9 +251,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" } @@ -275,7 +291,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 |