This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdbserver server testing docs, and mention --disable-packet in gdbserver/README,


Hi,

 --disable-packet was just added to gdbserver.  This is a developer
only  feature, to emulate testing against stubs that don't support
optional features.  A complement to disabling packets on the GDB side.

Since it isn't a switch intended for the user to use, it's not reported
with gdbserver --help.  This makes it described nowhere but the code, and
as we, know, an undocumented feature, si almost as good as no feature, so,
I wanted to add a small blurb about it somewhere.  gdbserver's README
file seemed like a good place, if you already know what you're looking
for.  The internal manual in the testing section looks like the right
place to put testing related documentation.  Then, I figured that
we might as well describe how to do a testsuite run against a local
GDBserver.  But, by doing that, I'd have to either inline a board file
in the manual, point at the wiki page containing it, or import the
board file into the code base.  I chose the later.  What do you think
about it?  Daniel, I think this is your board file.  If you're
willing to put it in the sources, shall it have a license/copyright
notice?

What do you think about it?  And what about the rest of the patch?
Is it useful to have?

-- 
Pedro Alves
gdb/doc/:
2008-06-27  Pedro Alves  <pedro@codesourcery.com>

	* gdbint.textinfo (Using the Testsuite): Mention testing against GDBserver.

gdb/gdbserver/:
2008-06-27  Pedro Alves  <pedro@codesourcery.com>

	* README: Explain how to do a local testsuite run against
	GDBserver.  Mention the --disable-packet command line switch.
	* native-gdbserver.exp: New file.

---
 gdb/doc/gdbint.texinfo             |   14 +++++++++
 gdb/gdbserver/README               |   20 +++++++++++++
 gdb/gdbserver/native-gdbserver.exp |   54 +++++++++++++++++++++++++++++++++++++
 3 files changed, 88 insertions(+)

Index: src/gdb/doc/gdbint.texinfo
===================================================================
--- src.orig/gdb/doc/gdbint.texinfo	2008-06-27 14:37:44.000000000 +0100
+++ src/gdb/doc/gdbint.texinfo	2008-06-27 17:13:29.000000000 +0100
@@ -6874,6 +6874,20 @@ will give a result of ``UNRESOLVED'', li
 UNRESOLVED: gdb.base/example.exp: This test script does not work on a remote host.
 @end smallexample
 
+When making changes to the remote protocol and its implementation, you
+should run the testsuite against @sc{gdbserver}.  See
+@file{gdb/gdbserver/README} for details on how to run the testsuite
+against a @sc{gdbserver} running on your local machine.
+
+Sometimes, you'll be making changes that need to be tested against
+remote servers that don't support certain optional packets.  E.g., You
+want to do some change that would affect stubs that don't support any
+thread related optional packets.  Since @sc{gdbserver} supports
+threads, testing against it may not be exercising all the relevant
+@value{GDBN} code paths.  @sc{gdbserver} has some support to help in
+these situations, by enabling the user to disable optional packets.
+See @file{gdb/gdbserver/README} for details.
+
 @section Testsuite Organization
 
 @cindex test suite organization
Index: src/gdb/gdbserver/README
===================================================================
--- src.orig/gdb/gdbserver/README	2008-06-27 16:36:31.000000000 +0100
+++ src/gdb/gdbserver/README	2008-06-27 16:50:35.000000000 +0100
@@ -122,6 +122,26 @@ gdbserver that way.  In a Bourne shell, 
 	% path-to-gdbserver-sources/configure your-target-name
 	% make
 
+Running GDBserver on your local machine for GDB regression testing:
+
+	* Create an empty file named site.exp.
+	* Create a directory named boards in the same location as site.exp.
+	* Copy the file named native-gdbserver.exp to the boards directory.
+	* Set the DEJAGNU environment variable to point to the empty site.exp.
+	* Run the testsuite with:
+	  make check-gdb RUNTESTFLAGS="--target_board native-gdbserver".
+
+Disabling optional packets:
+
+Sometimes, while making changes to the remote procotocol
+implementation it may be useful to test the behaviour of GDB against
+remote servers that don't support certain features.  To help in those
+situations, GDBserver accepts a command line option that allows
+disabling some optional packets.  Invoke GDBserver as below to see the list
+of packets you can disable.
+
+	target> gdbserver --disable-packet
+
 Using GDBreplay:
 
 A special hacked down version of gdbserver can be used to replay remote
Index: src/gdb/gdbserver/native-gdbserver.exp
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ src/gdb/gdbserver/native-gdbserver.exp	2008-06-27 16:52:39.000000000 +0100
@@ -0,0 +1,54 @@
+# gdbserver running native.
+
+load_generic_config "gdbserver"
+process_multilib_options ""
+
+# The default compiler for this target.
+set_board_info compiler "[find_gcc]"
+
+# This gdbserver can only run a process once per session.
+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
+
+# Can't do hardware watchpoints, in general.
+set_board_info gdb,no_hardware_watchpoints 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
+
+  set baseboard [lindex [split $board "/"] 0]
+
+  set board_info($baseboard,isremote) 0
+  set result [remote_spawn $board $cmd]
+  set board_info($baseboard,isremote) 1
+
+  return $result
+}
+
+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]
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]