This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Share gdbservre setting for board files native-*gdbserver.exp
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Fri, 5 Jul 2013 17:08:11 +0800
- Subject: [PATCH] Share gdbservre setting for board files native-*gdbserver.exp
Hi,
native-gdbserver.exp, native-extended-gdbserver.exp and native-stdio.exp
duplicate some bits, and this patch is to move this duplication to a new
file board/gdbserver.exp. Other board files can use it via
'load_board_description "gdbserver"'.
Note that I notice that ${board}_upload is not defined in
native-extended-gdbserver.exp, I am not sure it is intentional or just an
oversight.
With the patch applied, I tried board files native-stdio-gdbserver,
native-gdbserver, native-extended-gdbserver and
native-stdio-gdbserver. They still behave correctly.
gdb/testsuite:
2013-07-05 Yao Qi <yao@codesourcery.com>
* boards/native-extended-gdbserver.exp: Move invoke of
process_multilib_options to gdbserver.exp.
Move set_board_info 'compiler', 'gdb,noinferiorio',
'gdb,nofileio', 'gdb_server_prog' and 'gdb,predefined_tsv' to
gdbserver.exp.
Move proc ${board}_download and ${board}_file to
gdbserver.exp.
* boards/native-gdbserver.exp: Likewise.
* boards/native-stdio-gdbserver.exp: Likewise.
* boards/gdbserver.exp: New file.
---
gdb/testsuite/boards/gdbserver.exp | 46 ++++++++++++++++++++
gdb/testsuite/boards/native-extended-gdbserver.exp | 30 +------------
gdb/testsuite/boards/native-gdbserver.exp | 28 +-----------
gdb/testsuite/boards/native-stdio-gdbserver.exp | 28 +-----------
4 files changed, 49 insertions(+), 83 deletions(-)
create mode 100644 gdb/testsuite/boards/gdbserver.exp
diff --git a/gdb/testsuite/boards/gdbserver.exp b/gdb/testsuite/boards/gdbserver.exp
new file mode 100644
index 0000000..4946c78
--- /dev/null
+++ b/gdb/testsuite/boards/gdbserver.exp
@@ -0,0 +1,46 @@
+# Copyright 2011-2013 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is shared for other dejagnu "board files" which are used
+# to run the testsuite with gdbserver.
+
+process_multilib_options ""
+
+# The default compiler for this target.
+set_board_info compiler "[find_gcc]"
+
+# Test the copy of gdbserver in the build directory.
+set_board_info gdb_server_prog "../gdbserver/gdbserver"
+
+# Can't do input (or output) in the current gdbserver.
+set_board_info gdb,noinferiorio 1
+
+# gdbserver does not intercept target file operations and perform them
+# on the host.
+set_board_info gdb,nofileio 1
+
+# The predefined TSVs in GDBserver.
+set_board_info gdb,predefined_tsv "\\\$trace_timestamp"
+
+proc ${board}_file { dest op args } {
+ if { $op == "delete" } {
+ return 0
+ }
+ return [eval [list standard_file $dest $op] $args]
+}
+
+proc ${board}_download { board host dest } {
+ return $host
+}
diff --git a/gdb/testsuite/boards/native-extended-gdbserver.exp b/gdb/testsuite/boards/native-extended-gdbserver.exp
index d4bc06a..8cb9eff 100644
--- a/gdb/testsuite/boards/native-extended-gdbserver.exp
+++ b/gdb/testsuite/boards/native-extended-gdbserver.exp
@@ -21,6 +21,7 @@
# bash$ make check RUNTESTFLAGS="--target_board=native-extended-gdbserver"
load_generic_config "extended-gdbserver"
+load_board_description "gdbserver"
# By default, dejagnu makes the board remote unless the board name
# matches localhost. Force it to be NOT remote.
@@ -28,26 +29,11 @@ global board
global board_info
set board_info($board,isremote) 0
-process_multilib_options ""
-
-# The default compiler for this target.
-set_board_info compiler "[find_gcc]"
-
-# Can't do input (or output) in the current gdbserver.
-set_board_info gdb,noinferiorio 1
-
-# gdbserver does not intercept target file operations and perform them
-# on the host.
-set_board_info gdb,nofileio 1
-
set_board_info sockethost "localhost:"
# We will be using the extended GDB remote protocol.
set_board_info gdb_protocol "extended-remote"
-# Test the copy of gdbserver in the build directory.
-set_board_info gdb_server_prog "../gdbserver/gdbserver"
-
send_user "configuring for gdbserver local testing (extended-remote)\n"
# We must load this explicitly here, and rename the procedures we want
@@ -132,17 +118,3 @@ proc mi_gdb_load { arg } {
return 0
}
-
-proc ${board}_download { board host dest } {
- return $host
-}
-
-proc ${board}_file { dest op args } {
- if { $op == "delete" } {
- return 0
- }
- return [eval [list standard_file $dest $op] $args]
-}
-
-# The predefined TSVs in GDBserver.
-set_board_info gdb,predefined_tsv "\\\$trace_timestamp"
diff --git a/gdb/testsuite/boards/native-gdbserver.exp b/gdb/testsuite/boards/native-gdbserver.exp
index e32f346..ec26b83 100644
--- a/gdb/testsuite/boards/native-gdbserver.exp
+++ b/gdb/testsuite/boards/native-gdbserver.exp
@@ -21,10 +21,7 @@
# bash$ make check RUNTESTFLAGS="--target_board=native-gdbserver"
load_generic_config "gdbserver"
-process_multilib_options ""
-
-# The default compiler for this target.
-set_board_info compiler "[find_gcc]"
+load_board_description "gdbserver"
# This gdbserver can only run a process once per session.
set_board_info gdb,do_reload_on_run 1
@@ -32,20 +29,11 @@ set_board_info gdb,do_reload_on_run 1
# There's no support for argument-passing (yet).
set_board_info noargs 1
-# Can't do input (or output) in the current gdbserver.
-set_board_info gdb,noinferiorio 1
-
-# gdbserver does not intercept target file operations and perform them
-# on the host.
-set_board_info gdb,nofileio 1
-
set_board_info sockethost "localhost:"
set_board_info use_gdb_stub 1
# We will be using the standard GDB remote protocol.
set_board_info gdb_protocol "remote"
-# Test the copy of gdbserver in the build directory.
-set_board_info gdb_server_prog "../gdbserver/gdbserver"
proc ${board}_spawn { board cmd } {
global board_info
@@ -71,20 +59,6 @@ proc ${board}_exec { hostname program args } {
return $result
}
-proc ${board}_download { board host dest } {
- return $host
-}
-
proc ${board}_upload {dest srcfile args} {
return $srcfile
}
-
-proc ${board}_file { dest op args } {
- if { $op == "delete" } {
- return 0
- }
- return [eval [list standard_file $dest $op] $args]
-}
-
-# The predefined TSVs in GDBserver.
-set_board_info gdb,predefined_tsv "\\\$trace_timestamp"
diff --git a/gdb/testsuite/boards/native-stdio-gdbserver.exp b/gdb/testsuite/boards/native-stdio-gdbserver.exp
index 765ed1b..e931b09 100644
--- a/gdb/testsuite/boards/native-stdio-gdbserver.exp
+++ b/gdb/testsuite/boards/native-stdio-gdbserver.exp
@@ -21,10 +21,7 @@
# bash$ make check RUNTESTFLAGS="--target_board=native-stdio-gdbserver"
load_generic_config "gdbserver"
-process_multilib_options ""
-
-# The default compiler for this target.
-set_board_info compiler "[find_gcc]"
+load_board_description "gdbserver"
# This gdbserver can only run a process once per session.
set_board_info gdb,do_reload_on_run 1
@@ -32,13 +29,6 @@ set_board_info gdb,do_reload_on_run 1
# There's no support for argument-passing (yet).
set_board_info noargs 1
-# Can't do input (or output) in the current gdbserver.
-set_board_info gdb,noinferiorio 1
-
-# gdbserver does not intercept target file operations and perform them
-# on the host.
-set_board_info gdb,nofileio 1
-
# Hack into sockethost to pass our peculiar remote connection string.
set_board_info sockethost "stdio"
set_board_info gdb,socketport ""
@@ -47,8 +37,6 @@ set_board_info use_gdb_stub 1
# We will be using the standard GDB remote protocol.
set_board_info gdb_protocol "remote"
-# Test the copy of gdbserver in the build directory.
-set_board_info gdb_server_prog "../gdbserver/gdbserver"
# The argument to pass to "target remote".
# We build this once we know how the testsuite will start gdbserver.
@@ -133,20 +121,6 @@ proc ${board}_exec { hostname program args } {
return $result
}
-proc ${board}_download { board host dest } {
- return $host
-}
-
proc ${board}_upload {dest srcfile args} {
return $srcfile
}
-
-proc ${board}_file { dest op args } {
- if { $op == "delete" } {
- return 0
- }
- return [eval [list standard_file $dest $op] $args]
-}
-
-# The predefined TSVs in GDBserver.
-set_board_info gdb,predefined_tsv "\\\$trace_timestamp"
--
1.7.7.6