]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.base/ptype.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / ptype.exp
index 8ef738e28abb9011016b964352c53715037c8256..b0ce0a1a6e36e799689a05ac64c42cf7b52b6a59 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1999,
-# 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002,
+# 2003, 2007 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
@@ -31,10 +31,21 @@ set prms_id 0
 set bug_id 0
 
 set testfile "ptype"
-set srcfile ${testfile}.c
+set srcfile0 ${testfile}.c
+set srcfile1 ${testfile}1.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile0}" "${binfile}0.o" object {debug}] != "" } {
+     untested ptype.exp
+     return -1
+}
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug}] != "" } {
+     untested ptype.exp
+     return -1
+}
+if  { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug}] != "" } {
+     untested ptype.exp
+     return -1
 }
 
 # Create and source the file that provides information about the compiler
@@ -137,7 +148,6 @@ if {!$gcc_compiled && !$hp_aCC_compiler} {
 # For get_debug_format to do its job, we need to have a current source file.
 gdb_test "list main" ""
 get_debug_format
-setup_xfail_format "DWARF 1"
 gdb_test "whatis v_boolean" "type = (enum |)boolean" \
   "whatis unnamed typedef'd enum (compiler bug in IBM's xlc)"
 
@@ -172,7 +182,6 @@ gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumera
 # acts like whatis for basic types.  If it is thought to be necessary to
 # test both whatis and ptype for all the types, the tests should be
 # merged into whatis.exp, or else maintenance will be a royal pain -kingdon
-#setup_xfail "i960-*-*" 1821
 #setup_xfail "mips-idt-*" "mips-sgi-*"
 #send "ptype v_char\n"
 #gdb_expect {
@@ -277,7 +286,6 @@ gdb_test "ptype v_int" "type = int.*" "ptype int"
 #
 # test ptype command with arrays
 #
-#setup_xfail "i960-*-*" 1821
 #setup_xfail "mips-idt-*" "mips-sgi-*"
 #send "ptype v_char_array\n"
 #gdb_expect {
@@ -372,7 +380,6 @@ gdb_test "ptype v_int" "type = int.*" "ptype int"
 #
 
 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" }
-setup_xfail_format "DWARF 1"
 if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"}
 gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
 
@@ -380,7 +387,6 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
 ##
 ## test ptype command with pointers
 ##
-#setup_xfail "i960-*-*" 1821
 #setup_xfail "mips-idt-*" "mips-sgi-*"
 #send "ptype v_char_pointer\n"
 #gdb_expect {
@@ -579,6 +585,18 @@ ptype_maybe_prototyped "ffptr" "int (*(*)(char))(short int)" \
 ptype_maybe_prototyped "fffptr" "int (*(*(*)(char))(short int))(long int)" \
                                 "int (*(*(*)())())()"
 
+# Test printing type of typedefs in different scopes, with same name
+# but different type.
+
+gdb_test "list intfoo" ""
+gdb_test "ptype foo" "type = int" "ptype foo typedef after first list of intfoo"
+gdb_test "list charfoo" ""
+gdb_test "ptype foo" "type = char" "ptype foo typedef after first list of charfoo"
+gdb_test "list intfoo" ""
+gdb_test "ptype foo" "type = int" "ptype foo typedef after second list of intfoo"
+gdb_test "list charfoo" ""
+gdb_test "ptype foo" "type = char" "ptype foo typedef after second list of charfoo"
+
 # Test printing type of string constants and array constants, but
 # requires a running process.  These call malloc, and can take a long
 # time to execute over a slow serial link, so increase the timeout.