* [RFC] new GDB server testcase
@ 2005-05-04 14:27 Manoj Iyer
2005-05-04 14:43 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Manoj Iyer @ 2005-05-04 14:27 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3451 bytes --]
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.
========================================================================
2005-05-04 Manoj Iyer <manjo@austin.ibm.com>
* gdb.server/basictest.c: New testcase
* gdb.server/basictest.exp: New testcase
============= basictest.c =========================
/* File: test basic remote debug functionality through TCP connection. */
/* Author: Manoj Iyer <manjo@austin.ibm.com> */
#include <stdio.h>
#include <stdlib.h>
static void
function3()
{
printf("In function 3\n");
exit(0);
}
static void
function2()
{
function3();
}
static void
function1()
{
function2();
}
main()
{
printf("hello gdb\n");
function1();
}
======================================================================
======================= basictest.exp ===============================
# This testcase is part of GDB, the GNU debugger.
# Copyright 2005 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 2 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Test the remote TCP debug functionality of GDB.
# Author: Manoj Iyer <manjo@austin.ibm.com>
load_lib gdbserver-support.exp
set testfile "basictest"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
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
send_gdb "list \n"
gdb_expect {
-re ".*function1.*main.*\{.*printf.*$gdb_prompt $" {
pass "list commands can display source code" }
timeout { fail "list command failed to display source code" }
}
gdb_test "br main" "Breakpoint 1.*at.* file .*$srcfile, line \[0-9\]+.*"
gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, main.*at .*$srcfile:\[0-9\].*"
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 .*basictest.c:\[0-9\]+"
"#1.*function2.*at .*basictest.c:\[0-9\]+"
"#2.*function1.*at .*basictest.c:\[0-9\]+"
"#3.*main.*at .*basictest.c:\[0-9\]+"
}
============================ basictest.exp ====================
-----
manjo
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Cogito ergo sum +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[-- Attachment #2: expect script (new testcase) --]
[-- Type: TEXT/PLAIN, Size: 2278 bytes --]
# This testcase is part of GDB, the GNU debugger.
# Copyright 2005 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 2 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Test the remote TCP debug functionality of GDB.
# Author: Manoj Iyer <manjo@austin.ibm.com>
load_lib gdbserver-support.exp
set testfile "basictest"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
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
send_gdb "list \n"
gdb_expect {
-re ".*function1.*main.*\{.*printf.*$gdb_prompt $" {
pass "list commands can display source code" }
timeout { fail "list command failed to display source code" }
}
gdb_test "br main" "Breakpoint 1.*at.* file .*$srcfile, line \[0-9\]+.*"
gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, main.*at .*$srcfile:\[0-9\].*"
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 .*basictest.c:\[0-9\]+"
"#1.*function2.*at .*basictest.c:\[0-9\]+"
"#2.*function1.*at .*basictest.c:\[0-9\]+"
"#3.*main.*at .*basictest.c:\[0-9\]+"
}
[-- Attachment #3: C source code (New testcase) --]
[-- Type: TEXT/x-csrc, Size: 448 bytes --]
/* File: test basic remote debug functionality through TCP connection. */
/* Author: Manoj Iyer <manjo@austin.ibm.com> */
#include <stdio.h>
#include <stdlib.h>
static void
function3()
{
printf("In function 3\n");
exit(0);
}
static void
function2()
{
function3();
}
static void
function1()
{
function2();
}
main()
{
printf("hello gdb\n");
function1();
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] new GDB server testcase
2005-05-04 14:27 [RFC] new GDB server testcase Manoj Iyer
@ 2005-05-04 14:43 ` Daniel Jacobowitz
2005-05-04 18:39 ` Manoj Iyer
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2005-05-04 14:43 UTC (permalink / raw)
To: Manoj Iyer; +Cc: gdb-patches
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] new GDB server testcase
2005-05-04 14:43 ` Daniel Jacobowitz
@ 2005-05-04 18:39 ` Manoj Iyer
2005-05-04 18:46 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Manoj Iyer @ 2005-05-04 18:39 UTC (permalink / raw)
To: gdb-patches
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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] new GDB server testcase
2005-05-04 18:39 ` Manoj Iyer
@ 2005-05-04 18:46 ` Daniel Jacobowitz
2005-05-04 21:59 ` Manoj Iyer
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2005-05-04 18:46 UTC (permalink / raw)
To: Manoj Iyer; +Cc: gdb-patches
On Wed, May 04, 2005 at 01:36:48PM -0500, Manoj Iyer wrote:
> -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\].*"
Why not use gdb_breakpoint? Is it because you want to test that the
breakpoint was placed in the right file? If so, you need to use a
regular expression for the breakpoint number as below. I'd rather just
use gdb_breakpoint though.
> +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" }
> +}
Why not use gdb_test for this?
> +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\]+"
> +}
Try to avoid using send_gdb directly. You can construct the pattern in
a variable and use gdb_test.
> +gdb_test "step" "function4.*at .*$srcfile:\[0-9\]+.*"
> +
> +gdb_test "step 3" ".*${decimal}.*y = x.* y;.*"
That's a lot of wildcards. Can't you put a marker comment on the lines
you want to reach?
> +gdb_test "print x" ".*3.*"
Please be more precise. "\$\[0-9\]* = 3" should be enough.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] new GDB server testcase
2005-05-04 18:46 ` Daniel Jacobowitz
@ 2005-05-04 21:59 ` Manoj Iyer
2005-05-04 22:07 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Manoj Iyer @ 2005-05-04 21:59 UTC (permalink / raw)
To: gdb-patches
Daniel,
> > +gdb_test "step" "function4.*at .*$srcfile:\[0-9\]+.*"
> > +
> > +gdb_test "step 3" ".*${decimal}.*y = x.* y;.*"
>
> That's a lot of wildcards. Can't you put a marker comment on the lines
> you want to reach?
>
I want to test vanilla step and step with value separately, this is why I
did what I did. Also, I referred some of the existing testcases and
followed the style of doing things there. Anyways here is the patch with
most of the mods.
2005-05-05 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.
Common subdirectories: ./new/src/gdb/testsuite/gdb.server/CVS and ./old/src/gdb/testsuite/gdb.server/CVS
diff ./new/src/gdb/testsuite/gdb.server/server-run.exp ./old/src/gdb/testsuite/gdb.server/server-run.exp
41d40
< # test setting a breakpoint
43,65c42
<
< gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, main.*at.*$srcfile:\[0-9\].*"
<
< # test if list command displays source code
< gdb_test "list\n" ".*main.*\{.*"
<
< # set breakpoint at a function and test backtrace command
< gdb_test "break function3" "Breakpoint 2 at.*file .*$srcfile, line \[0-9\]+.*"
<
< gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, function3.*at.*$srcfile:\[0-9\].*"
<
< gdb_test "backtrace" "\#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\]+"
<
< # test vanilla step
< gdb_test "step" "function4.*at .*$srcfile:\[0-9\]+.*"
<
< # test step with a count
< gdb_test "step 3" ".*${decimal}.*y = x.* y;.*"
<
< # test if print command can display value of variable.
< gdb_test "print x" ".\[0-9\]* = 3.*"
<
< gdb_exit
---
> gdb_test "continue" "Breakpoint.* main .*" "continue to main"
diff ./new/src/gdb/testsuite/gdb.server/server.c ./old/src/gdb/testsuite/gdb.server/server.c
20,52d19
< 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();
< }
<
56,57c23
< function1();
< return 0;
---
> return 0;
Thanks
Manjo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] new GDB server testcase
2005-05-04 21:59 ` Manoj Iyer
@ 2005-05-04 22:07 ` Daniel Jacobowitz
2005-05-05 16:23 ` Manoj Iyer
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2005-05-04 22:07 UTC (permalink / raw)
To: Manoj Iyer; +Cc: gdb-patches
On Wed, May 04, 2005 at 04:57:02PM -0500, Manoj Iyer wrote:
> Daniel,
>
>
> > > +gdb_test "step" "function4.*at .*$srcfile:\[0-9\]+.*"
> > > +
> > > +gdb_test "step 3" ".*${decimal}.*y = x.* y;.*"
> >
> > That's a lot of wildcards. Can't you put a marker comment on the lines
> > you want to reach?
> >
>
> I want to test vanilla step and step with value separately, this is why I
> did what I did. Also, I referred some of the existing testcases and
> followed the style of doing things there. Anyways here is the patch with
> most of the mods.
".*${decimal}.*y = x.* y;.*" is line noise. I would prefer something like:
gdb_test "step 3" "/\* marker for second step \*/\[\r\n\]+"
A trailing .* is to be avoided when possible; it means that warnings or
error messages could appear after the step and still pass. They can
already appear before the step, which is an unfortunate problem with
the way GDB's tests are written.
>
> 2005-05-05 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.
>
> Common subdirectories: ./new/src/gdb/testsuite/gdb.server/CVS and ./old/src/gdb/testsuite/gdb.server/CVS
> diff ./new/src/gdb/testsuite/gdb.server/server-run.exp ./old/src/gdb/testsuite/gdb.server/server-run.exp
> 41d40
> < # test setting a breakpoint
> 43,65c42
> <
Bad diff, please do read diffs before you mail them.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] new GDB server testcase
2005-05-04 22:07 ` Daniel Jacobowitz
@ 2005-05-05 16:23 ` Manoj Iyer
2005-05-05 16:27 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Manoj Iyer @ 2005-05-05 16:23 UTC (permalink / raw)
To: gdb-patches
When I have an output in a test as this:
(gdb)
step
function4 () at gdb.server/server.c:24
24 int x = 1;
(gdb)
What should I test for in the gdb_test command?
gdb_test "step" "function4 \(\) at .*$srcfile:\[0-9\]+."
or
gdb_test "step" ".*.\[0-9\].*int x \= 1\;
Its not working for me in either case currently, unless I use a ".*" at
the end, which I am trying to avoid (as per daniel's suggestion).
-----
manjo
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Cogito ergo sum +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
On Wed, 4 May 2005, Daniel Jacobowitz wrote:
> On Wed, May 04, 2005 at 04:57:02PM -0500, Manoj Iyer wrote:
> > Daniel,
> >
> >
> > > > +gdb_test "step" "function4.*at .*$srcfile:\[0-9\]+.*"
> > > > +
> > > > +gdb_test "step 3" ".*${decimal}.*y = x.* y;.*"
> > >
> > > That's a lot of wildcards. Can't you put a marker comment on the lines
> > > you want to reach?
> > >
> >
> > I want to test vanilla step and step with value separately, this is why I
> > did what I did. Also, I referred some of the existing testcases and
> > followed the style of doing things there. Anyways here is the patch with
> > most of the mods.
>
> ".*${decimal}.*y = x.* y;.*" is line noise. I would prefer something like:
>
> gdb_test "step 3" "/\* marker for second step \*/\[\r\n\]+"
>
> A trailing .* is to be avoided when possible; it means that warnings or
> error messages could appear after the step and still pass. They can
> already appear before the step, which is an unfortunate problem with
> the way GDB's tests are written.
>
> >
> > 2005-05-05 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.
> >
> > Common subdirectories: ./new/src/gdb/testsuite/gdb.server/CVS and ./old/src/gdb/testsuite/gdb.server/CVS
> > diff ./new/src/gdb/testsuite/gdb.server/server-run.exp ./old/src/gdb/testsuite/gdb.server/server-run.exp
> > 41d40
> > < # test setting a breakpoint
> > 43,65c42
> > <
>
> Bad diff, please do read diffs before you mail them.
>
>
> --
> Daniel Jacobowitz
> CodeSourcery, LLC
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] new GDB server testcase
2005-05-05 16:23 ` Manoj Iyer
@ 2005-05-05 16:27 ` Daniel Jacobowitz
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2005-05-05 16:27 UTC (permalink / raw)
To: Manoj Iyer; +Cc: gdb-patches
On Thu, May 05, 2005 at 11:19:17AM -0500, Manoj Iyer wrote:
>
> When I have an output in a test as this:
>
> (gdb)
> step
> function4 () at gdb.server/server.c:24
> 24 int x = 1;
> (gdb)
>
> What should I test for in the gdb_test command?
>
> gdb_test "step" "function4 \(\) at .*$srcfile:\[0-9\]+."
>
> or
>
> gdb_test "step" ".*.\[0-9\].*int x \= 1\;
>
>
> Its not working for me in either case currently, unless I use a ".*" at
> the end, which I am trying to avoid (as per daniel's suggestion).
Well, you can test for either. But the second one ought to work
(though you have some more backslashes than you need). When you have
matching troubles, put "exp_internal 1" in front of the line giving you
trouble.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-05-05 16:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-04 14:27 [RFC] new GDB server testcase Manoj Iyer
2005-05-04 14:43 ` Daniel Jacobowitz
2005-05-04 18:39 ` Manoj Iyer
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox