diff options
author | Felix Lee <felix+log1@specifixinc.com> | 2004-11-05 08:53:19 +0000 |
---|---|---|
committer | Felix Lee <felix+log1@specifixinc.com> | 2004-11-05 08:53:19 +0000 |
commit | c789492af8b3c73d26252b03759b38b0d711db74 (patch) | |
tree | 9271bda84825ad6f23d52b1e1a6164eaa29cba05 /gdb/testsuite | |
parent | d3ed111c8cc83e844ac33720f2c29688a70c8dcb (diff) | |
download | gdb-c789492af8b3c73d26252b03759b38b0d711db74.zip gdb-c789492af8b3c73d26252b03759b38b0d711db74.tar.gz gdb-c789492af8b3c73d26252b03759b38b0d711db74.tar.bz2 |
2004-11-05 Felix Lee <felix+log1@specifixinc.com>
* gdb.base/cursal.exp: New file.
* gdb.base/cursal.c: New file.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/cursal.c | 39 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/cursal.exp | 80 |
3 files changed, 124 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0bc5456..21fd8e3 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-11-05 Felix Lee <felix+log1@specifixinc.com> + + * gdb.base/cursal.exp: New file. + * gdb.base/cursal.c: New file. + 2004-11-03 Andrew Cagney <cagney@gnu.org> * gdb.base/savedregs.exp, gdb.base/savedregs.c: New files. diff --git a/gdb/testsuite/gdb.base/cursal.c b/gdb/testsuite/gdb.base/cursal.c new file mode 100644 index 0000000..b9d28c6 --- /dev/null +++ b/gdb/testsuite/gdb.base/cursal.c @@ -0,0 +1,39 @@ +/* Copyright 2004 Free Software Foundation, Inc. + + This file is part of GDB. + + 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. */ + + +void +func2 () +{ + int v2 = 2; +} + +void +func1 () +{ + func2 (); +} + + +int +main () +{ + int v0 = 0; + func1 (); +} diff --git a/gdb/testsuite/gdb.base/cursal.exp b/gdb/testsuite/gdb.base/cursal.exp new file mode 100644 index 0000000..c3ddc55 --- /dev/null +++ b/gdb/testsuite/gdb.base/cursal.exp @@ -0,0 +1,80 @@ +# Copyright 2004 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. + +if $tracelevel { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile "cursal" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != ""} { + untested "Couldn't compile $srcfile" + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "set listsize 1" \ + ".*" + +# initial sal should be first statement in main +gdb_test "list" \ + "v0 = 0;" \ + "list before run" + +if {! [runto_main]} { + return -1 +} + +gdb_test "list" \ + "v0 = 0;" \ + "list in main" + +if {! [runto "func2"]} { + return -1 +} + +gdb_test "list" \ + "v2 = 2;" \ + "list in func2" + +# make sure backtrace doesn't change current source location. +gdb_test "backtrace" \ + ".*" +gdb_test "list -1" \ + "v2 = 2;" \ + "list after backtrace" + +# check the window +gdb_test "set listsize 3" \ + ".*" +if {! [runto_main]} { + return -1 +} +gdb_test "list" \ + "func1 \\(\\);" \ + "list size 3" + +return 0 |