aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-03-29 20:37:19 +0000
committerDaniel Jacobowitz <drow@false.org>2005-03-29 20:37:19 +0000
commit887503049333627249f06ae0c7c44d66dc62ffc6 (patch)
treed608eedd05d79d4f50ffd72c11f16d88805a2c19 /gdb/testsuite
parent15b6c49f149f84ce4a75e93c8429daac2678e758 (diff)
downloadgdb-887503049333627249f06ae0c7c44d66dc62ffc6.zip
gdb-887503049333627249f06ae0c7c44d66dc62ffc6.tar.gz
gdb-887503049333627249f06ae0c7c44d66dc62ffc6.tar.bz2
* c-valprint.c (c_value_print): Fix up some formatting. Use
check_typedef. testsuite/ * gdb.base/ptr-typedef.exp, gdb.base/ptr-typedef.c: New files.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/ptr-typedef.c44
-rw-r--r--gdb/testsuite/gdb.base/ptr-typedef.exp41
3 files changed, 89 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9d3f469..0e8dfdf 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2005-03-29 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gdb.base/ptr-typedef.exp, gdb.base/ptr-typedef.c: New files.
+
2005-03-27 Andreas Schwab <schwab@suse.de>
* gdb.base/bigcore.c (main): Add missing mode argument in open
diff --git a/gdb/testsuite/gdb.base/ptr-typedef.c b/gdb/testsuite/gdb.base/ptr-typedef.c
new file mode 100644
index 0000000..6cf2fd4
--- /dev/null
+++ b/gdb/testsuite/gdb.base/ptr-typedef.c
@@ -0,0 +1,44 @@
+/* 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. */
+
+struct foo {
+ int x;
+};
+
+typedef struct foo *foz;
+
+struct foo *foo_ptr;
+foz foz_ptr;
+
+int
+marker1 (void)
+{
+ return foo_ptr == foz_ptr;
+}
+
+int
+main (void)
+{
+ struct foo the_foo;
+ foo_ptr = &the_foo;
+ foz_ptr = &the_foo;
+
+ return marker1 ();
+}
diff --git a/gdb/testsuite/gdb.base/ptr-typedef.exp b/gdb/testsuite/gdb.base/ptr-typedef.exp
new file mode 100644
index 0000000..c91c23c
--- /dev/null
+++ b/gdb/testsuite/gdb.base/ptr-typedef.exp
@@ -0,0 +1,41 @@
+# 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.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set testfile ptr-typedef
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto marker1] {
+ untested "Couldn't run to marker1"
+}
+
+gdb_test "print foo_ptr" "\\\$$decimal = \\\(struct foo \\\*\\\) $hex"
+gdb_test "print foz_ptr" "\\\$$decimal = \\\(foz\\\) $hex"