From: Manoj Iyer <manjo@austin.ibm.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFC] new GDB server testcase
Date: Wed, 04 May 2005 18:39:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.58.0505041329440.30511@lazy> (raw)
In-Reply-To: <20050504144044.GA14120@nevyn.them.org>
Daniel,
I added the testcases to server-run.exp and extended server.c to include a
nested function call so that I can test backtrace. Here is a patch. Please
review and comment. Following the patch is the results of the testcase
execution on x86.
2005-05-02 Manoj Iyer <manjo@austin.ibm.com>
* gdb.server/server-run.exp: Added new testcases
* gdb.server/server.c: Added nested function call for backtrace
testing.
=========Start Patch ===========================================
diff -Naurp old/src/gdb/testsuite/gdb.server/server-run.exp new/src/gdb/testsuite/gdb.server/server-run.exp
--- old/src/gdb/testsuite/gdb.server/server-run.exp 2005-05-04 10:34:16.000000000 -0500
+++ new/src/gdb/testsuite/gdb.server/server-run.exp 2005-05-04 13:26:09.000000000 -0500
@@ -38,5 +38,34 @@ gdb_start
gdbserver_load $binfile ""
gdb_reinitialize_dir $srcdir/$subdir
-gdb_breakpoint main
-gdb_test "continue" "Breakpoint.* main .*" "continue to main"
+gdb_test "br main" "Breakpoint 1.*at.* file .*$srcfile, line \[0-9\]+.*"
+
+gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, main.*at .*$srcfile:\[0-9\].*"
+
+send_gdb "list \n"
+gdb_expect {
+ -re ".*main.*\{.*$gdb_prompt $" {
+ pass "list commands can display source code" }
+ timeout { fail "list command failed to display source code" }
+}
+
+
+gdb_test "br function3" "Breakpoint 2.*at.* file .*$srcfile, line \[0-9\]+.*"
+
+gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, function3.*at .*$srcfile:\[0-9\].*"
+
+send_gdb "backtrace\n"
+gdb_expect_list "backtrace" ".*$gdb_prompt $" {
+ "#0.*function3.*at.*server.c:\[0-9\]+"
+ "#1.*function2.*at.*server.c:\[0-9\]+"
+ "#2.*function1.*at.*server.c:\[0-9\]+"
+ "#3.*main.*at.*server.c:\[0-9\]+"
+}
+
+gdb_test "step" "function4.*at .*$srcfile:\[0-9\]+.*"
+
+gdb_test "step 3" ".*${decimal}.*y = x.* y;.*"
+
+gdb_test "print x" ".*3.*"
+
+gdb_exit
diff -Naurp old/src/gdb/testsuite/gdb.server/server.c new/src/gdb/testsuite/gdb.server/server.c
--- old/src/gdb/testsuite/gdb.server/server.c 2005-05-04 10:34:16.000000000 -0500
+++ new/src/gdb/testsuite/gdb.server/server.c 2005-05-04 13:26:11.000000000 -0500
@@ -17,8 +17,42 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
+static void
+function4()
+{
+
+ int x = 1;
+ int y = 2;
+
+ x = x + y;
+ y = x * y;
+ return;
+}
+
+
+static void
+function3()
+{
+ function4();
+}
+
+
+static void
+function2()
+{
+ function3();
+}
+
+
+static void
+function1()
+{
+ function2();
+}
+
int
main (int argc, char **argv)
{
- return 0;
+ function1();
+ return 0;
}
================= End Patch ======================================
============= Test Result =============================================
Test Run By manjo on Wed May 4 13:23:25 2005
Native configuration is i686-pc-linux-gnu
=== gdb tests ===
Schedule of variations:
unix
Running target unix
Using ./../../dejagnu/baseboards/unix.exp as board description file for target.
Using ./../../dejagnu/config/unix.exp as generic interface file for target.
Using ./config/unix.exp as tool-and-target-specific interface file.
Running ./gdb.server/server-run.exp ...
Executing on host: gcc ./gdb.server/server.c -g -lm -o /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/gdb.server/server (timeout = 300)
spawn gcc ./gdb.server/server.c -g -lm -o /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/gdb.server/server
spawn /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/../../gdb/gdb -nw -nx
GNU gdb 6.3.50.20050421-cvs
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
(gdb) set height 0
(gdb) set width 0
(gdb) spawn /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/../../gdb/gdbserver/gdbserver :2346 /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/gdb.server/server
Process /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/gdb.server/server created; pid = 18079
Listening on port 2346
file /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/gdb.se rver/server
Reading symbols from /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/gdb.server/server...done.
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) target remote localhost:2346
Remote debugging using localhost:2346
Remote debugging from host 127.0.0.1
0x40000c20 in ?? ()
(gdb) dir
Reinitialize source path to empty? (y or n) y
Source directories searched: $cdir:$cwd
(gdb) dir ./gdb.server
Source directories searched: /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/./gdb.server:$cdir:$cwd
(gdb) br main
Breakpoint 1 at 0x80483af: file gdb.server/server.c, line 56.
(gdb) PASS: gdb.server/server-run.exp: br main
continue
Continuing.
Breakpoint 1, main (argc=1, argv=0xbffff7f4) at gdb.server/server.c:56
56 function1();
(gdb) PASS: gdb.server/server-run.exp: continue
list
51 }
52
53 int
54 main (int argc, char **argv)
55 {
56 function1();
57 return 0;
58 }
(gdb) PASS: gdb.server/server-run.exp: list commands can display source code
br function3
Breakpoint 2 at 0x804837e: file gdb.server/server.c, line 36.
(gdb) PASS: gdb.server/server-run.exp: br function3
continue
Continuing.
Breakpoint 2, function3 () at gdb.server/server.c:36
36 function4();
(gdb) PASS: gdb.server/server-run.exp: continue
backtrace
#0 function3 () at gdb.server/server.c:36
#1 0x08048390 in function2 () at gdb.server/server.c:43
#2 0x0804839d in function1 () at gdb.server/server.c:50
#3 0x080483b4 in main (argc=1, argv=0xbffff7f4) at gdb.server/server.c:56
(gdb) PASS: gdb.server/server-run.exp: backtrace
step
function4 () at gdb.server/server.c:24
24 int x = 1;
(gdb) PASS: gdb.server/server-run.exp: step
step 3
28 y = x * y;
(gdb) PASS: gdb.server/server-run.exp: step 3
print x
$1 = 3
(gdb) PASS: gdb.server/server-run.exp: print x
testcase ./gdb.server/server-run.exp completed in 1 seconds
=== gdb Summary ===
# of expected passes 9
Executing on host: /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/../../gdb/gdb -nw --command gdb_cmd (timeout = 300)
spawn /home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/../../gdb/gdb -nw --command gdb_cmd
GNU gdb 6.3.50.20050421-cvs
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
/home/manjo/projects/gdb/mainline/2005-04-21/src/gdb/testsuite/../../gdb/gdb version 6.3.50.20050421-cvs -nx
runtest completed at Wed May 4 13:23:27 2005
====================== End Test Result =======================
Thanks
-----
manjo
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Cogito ergo sum +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
On Wed, 4 May 2005, Daniel Jacobowitz wrote:
> On Wed, May 04, 2005 at 09:24:20AM -0500, Manoj Iyer wrote:
> >
> > I wrote a testcase for testing basic gdbserver functionality over TCP
> > connection. I will add more cases like step, print, etc once the testcase
> > is approved.
>
> Thanks for doing this.
>
> Can you find a better name than "basictest.exp"? Is there a reason not
> to add these basic tests to server-run.exp?
>
> > /* File: test basic remote debug functionality through TCP connection. */
> > /* Author: Manoj Iyer <manjo@austin.ibm.com> */
>
> This needs a copyright notice.
>
> > #include <stdio.h>
> > #include <stdlib.h>
>
> Why are you using stdio? We have no easy way to get at the program's
> output.
>
> >
> > main()
> > {
> > printf("hello gdb\n");
> > function1();
> > }
>
> That's not valid C, though many compilers will accept it. "int main"
> and "return 0" please.
>
> >
> > ======================================================================
> >
> > ======================= basictest.exp ===============================
>
> Please use server-run.exp as a template instead of whatever you were
> using. For instance, use skip_gdbserver_tests, and don't use
> gdb_suppress_entire_file.
>
> > gdb_exit
> > global gdbport
> >
> > set ret [gdbserver_spawn $binfile ""]
> > set gdbport [lindex $ret 1]
> >
> > gdb_start
> >
> > send_gdb "file $binfile \n "
> >
> > gdb_target_cmd "remote" $gdbport
>
> ... and don't duplicate any of that. gdbserver_load. I went to a lot
> of trouble to write the infrastructure, so please use it :-)
>
> --
> Daniel Jacobowitz
> CodeSourcery, LLC
>
next prev parent reply other threads:[~2005-05-04 18:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-04 14:27 Manoj Iyer
2005-05-04 14:43 ` Daniel Jacobowitz
2005-05-04 18:39 ` Manoj Iyer [this message]
2005-05-04 18:46 ` Daniel Jacobowitz
2005-05-04 21:59 ` Manoj Iyer
2005-05-04 22:07 ` Daniel Jacobowitz
2005-05-05 16:23 ` Manoj Iyer
2005-05-05 16:27 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.58.0505041329440.30511@lazy \
--to=manjo@austin.ibm.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox