From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27870 invoked by alias); 27 Jun 2008 16:25:56 -0000 Received: (qmail 27860 invoked by uid 22791); 27 Jun 2008 16:25:55 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 27 Jun 2008 16:25:38 +0000 Received: (qmail 1440 invoked from network); 27 Jun 2008 16:25:36 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 27 Jun 2008 16:25:36 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: gdbserver server testing docs, and mention --disable-packet in gdbserver/README, Date: Fri, 27 Jun 2008 16:41:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_FSRZIBJnSCqquKH" Message-Id: <200806271725.41558.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-06/txt/msg00503.txt.bz2 --Boundary-00=_FSRZIBJnSCqquKH Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1232 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 --Boundary-00=_FSRZIBJnSCqquKH Content-Type: text/x-diff; charset="utf-8"; name="gdbserver_testing.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdbserver_testing.diff" Content-length: 4857 gdb/doc/: 2008-06-27 Pedro Alves * gdbint.textinfo (Using the Testsuite): Mention testing against GDBserver. gdb/gdbserver/: 2008-06-27 Pedro Alves * 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] +} --Boundary-00=_FSRZIBJnSCqquKH--