Skip to content
Snippets Groups Projects
Commit ab19de87 authored by Doug Evans's avatar Doug Evans
Browse files

Fix wrapper.exp testcase with stdio gdbserver.

	* lib/gdbserver-support.exp (gdbserver_default_get_remote_address):
	Add comment.
	(gdbserver_default_get_comm_port): New function.
	(gdbserver_start): Check if board file provided
	"gdbserver,get_comm_port" and use it if so.
	* boards/native-stdio-gdbserver.exp (sockethost): Set to "".
	(gdb,socketport): Set to "stdio".
	(gdbserver,get_comm_port): Set to ${board}_get_comm_port.
	(stdio_gdbserver_template): Delete.
	(${board}_get_remote_address): Update.
	(${board}_build_remote_cmd): Delete.
	(${board}_get_comm_port): New function.
	(${board}_spawn): Update.
	* boards/remote-stdio-gdbserver.exp (${board}_build_remote_cmd):
	Delete.
	(${board}_get_remote_address): Update.
	(${board}_get_comm_port): New function.
parent fc98a809
No related branches found
No related tags found
No related merge requests found
2014-04-16 Doug Evans <dje@google.com>
* lib/gdbserver-support.exp (gdbserver_default_get_remote_address):
Add comment.
(gdbserver_default_get_comm_port): New function.
(gdbserver_start): Check if board file provided
"gdbserver,get_comm_port" and use it if so.
* boards/native-stdio-gdbserver.exp (sockethost): Set to "".
(gdb,socketport): Set to "stdio".
(gdbserver,get_comm_port): Set to ${board}_get_comm_port.
(stdio_gdbserver_template): Delete.
(${board}_get_remote_address): Update.
(${board}_build_remote_cmd): Delete.
(${board}_get_comm_port): New function.
(${board}_spawn): Update.
* boards/remote-stdio-gdbserver.exp (${board}_build_remote_cmd):
Delete.
(${board}_get_remote_address): Update.
(${board}_get_comm_port): New function.
2014-04-16 Andrew Burgess <aburgess@broadcom.com>
 
* gdb.base/memattr.exp: Improve regexps to handle memory regions
......@@ -29,60 +29,28 @@ set_board_info gdb,do_reload_on_run 1
# There's no support for argument-passing (yet).
set_board_info noargs 1
# Hack into sockethost to pass our peculiar remote connection string.
set_board_info sockethost "stdio"
set_board_info gdb,socketport ""
# Hack the host,port to pass our peculiar remote connection string.
set_board_info sockethost ""
set_board_info gdb,socketport "stdio"
set_board_info gdb,get_remote_address ${board}_get_remote_address
set_board_info gdbserver,get_comm_port ${board}_get_comm_port
set_board_info use_gdb_stub 1
set_board_info exit_is_reliable 1
# We will be using the standard GDB remote protocol.
set_board_info gdb_protocol "remote"
# The argument to pass to "target remote".
# We build this once we know how the testsuite will start gdbserver.
set stdio_gdbserver_template "| @GDBSERVER_PROG@ @ARGS@ stdio @PROG_AND_ARGS@"
# Used to pass a value between ${board}_spawn and ${board}_get_remote_address.
set stdio_gdbserver_command "--unset--"
proc ${board}_get_remote_address { host port } {
global stdio_gdbserver_command
return $stdio_gdbserver_command
return "| $stdio_gdbserver_command"
}
proc ${board}_build_remote_cmd { cmd } {
global stdio_gdbserver_template
# First parse $cmd, picking out the various pieces.
set gdbserver_prog [lindex $cmd 0]
set args ""
set len [llength $cmd]
for { set i 1 } { $i < $len } { incr i } {
set elm [lindex $cmd $i]
switch -- $elm {
--multi {
set args "$args $elm"
}
--once {
set args "$args $elm"
}
default {
break
}
}
}
set prog_and_args [lrange $cmd $i end]
set buf $stdio_gdbserver_template
regsub {@GDBSERVER_PROG@} $buf $gdbserver_prog buf
regsub {@ARGS@} $buf $args buf
regsub {@PROG_AND_ARGS@} $buf $prog_and_args buf
return $buf
proc ${board}_get_comm_port { port } {
return $port
}
proc ${board}_spawn { board cmd } {
......@@ -90,12 +58,10 @@ proc ${board}_spawn { board cmd } {
verbose -log "${board}_spawn: $board $cmd"
# Convert the command to start gdbserver to something to pass to
# "target remote | ..." and save it for later retrieval by
# Save the command to start gdbserver for later retrieval by
# ${board}_get_remote_address.
global stdio_gdbserver_command
set stdio_gdbserver_command [${board}_build_remote_cmd $cmd]
verbose -log "gdbserver_command: $stdio_gdbserver_command"
set stdio_gdbserver_command $cmd
set baseboard [lindex [split $board "/"] 0]
......
......@@ -73,40 +73,14 @@ proc get_remote_login { } {
return $result
}
proc ${board}_build_remote_cmd { cmd } {
set stdio_gdbserver_template "| @RSH_CMD@ @GDBSERVER_PROG@ @ARGS@ stdio @PROG_AND_ARGS@"
# First parse $cmd, picking out the various pieces.
set gdbserver_prog [lindex $cmd 0]
set args ""
set len [llength $cmd]
for { set i 1 } { $i < $len } { incr i } {
set elm [lindex $cmd $i]
switch $elm {
--multi {
set args "$args $elm"
}
--once {
set args "$args $elm"
}
default {
break
}
}
}
set prog_and_args [lrange $cmd $i end]
set buf $stdio_gdbserver_template
proc ${board}_get_remote_address { host port } {
global stdio_gdbserver_command
set rsh_cmd "[board_info [target_info name] rsh_prog] [get_remote_login]"
regsub {@RSH_CMD@} $buf $rsh_cmd buf
regsub {@GDBSERVER_PROG@} $buf $gdbserver_prog buf
regsub {@ARGS@} $buf $args buf
regsub {@PROG_AND_ARGS@} $buf $prog_and_args buf
return "| $rsh_cmd $stdio_gdbserver_command"
}
return $buf
proc ${board}_get_comm_port { port } {
return $port
}
proc ${board}_download { board host dest } {
......
......@@ -189,9 +189,17 @@ proc gdbserver_download_current_prog { } {
# Default routine to compute the argument to "target remote".
proc gdbserver_default_get_remote_address { host port } {
# Historically HOST included the trailing ":".
# To avoid breaking any board files out there we leave things alone.
return "$host$port"
}
# Default routine to compute the "comm" argument for gdbserver.
proc gdbserver_default_get_comm_port { port } {
return ":$port"
}
# Start a gdbserver process with initial OPTIONS and trailing ARGUMENTS.
# The port will be filled in between them automatically.
#
......@@ -223,6 +231,11 @@ proc gdbserver_start { options arguments } {
} else {
set get_remote_address gdbserver_default_get_remote_address
}
if [target_info exists gdbserver,get_comm_port] {
set get_comm_port [target_info gdbserver,get_comm_port]
} else {
set get_comm_port gdbserver_default_get_comm_port
}
# Extract the protocol
if [target_info exists gdb_protocol] {
......@@ -251,7 +264,7 @@ proc gdbserver_start { options arguments } {
append gdbserver_command " $options"
}
if { $portnum != "" } {
append gdbserver_command " :$portnum"
append gdbserver_command " [$get_comm_port $portnum]"
}
if { $arguments != "" } {
append gdbserver_command " $arguments"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment