2013-04-24 Muhammad Bilal <mbilal@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / ptype.c
index 7b8ca24cda8931f435ee48ec7e975af311b00358..4148da771e180bcbb98d917a963dfc1444be5fde 100644 (file)
@@ -59,6 +59,7 @@ double                v_double_array[2];
 
 /* PR 3742 */
 typedef char t_char_array[];
+t_char_array *pv_char_array;
 
 /**** pointers *******/
 
@@ -197,6 +198,16 @@ struct outer_struct {
        long outer_long;
 } nested_su;
 
+struct highest
+{
+  int a;
+  struct
+  {
+    int b;
+    struct { int c; } anonymous_level_2;
+  } anonymous_level_1;
+} the_highest;
+
 /**** Enumerations *******/
 
 enum 
@@ -226,6 +237,48 @@ enum misordered {two = 2, one = 1, zero = 0, three = 3};
    in the executable, at least for AIX xlc.  */
 enum misordered v_misordered = three;
 
+/**** Pointers to functions *******/
+
+typedef int (*func_type) (int (*) (int, float), float);
+double (*old_fptr) ();
+double (*new_fptr) (void);
+int (*fptr) (int, float);
+int *(*fptr2) (int (*) (int, float), float);
+int (*xptr) (int (*) (), int (*) (void), int);
+int (*(*ffptr) (char)) (short);
+int (*(*(*fffptr) (char)) (short)) (long);
+
+func_type v_func_type;
+
+/* Here are the sort of stabs we expect to see for the above:
+
+   .stabs "func_type:t(0,100)=*(0,101)=g(0,1)(0,102)=*(0,103)=g(0,1)(0,1)(0,14)#(0,14)#",128,0,234,0
+   .stabs "old_fptr:G(0,110)=*(0,111)=f(0,15)",32,0,231,0
+   .stabs "new_fptr:G(0,120)=*(0,121)=g(0,15)(0,122)=(0,122)#",32,0,232,0
+   .stabs "fptr:G(0,130)=*(0,103)#",32,0,233,0
+   .stabs "fptr2:G(0,140)=*(0,141)=g(0,142)=*(0,1)(0,102)(0,14)#",32,0,235,0
+   .stabs "xptr:G(0,150)=*(0,151)=g(0,1)(0,152)=*(0,153)=f(0,1)(0,154)=*(0,155)=g(0,1)(0,122)#(0,1)#",32,0,236,0
+   .stabs "ffptr:G(0,160)=*(0,161)=g(0,162)=*(0,163)=g(0,1)(0,8)#(0,2)#",32,0,237,0\
+   .stabs "fffptr:G(0,170)=*(0,171)=g(0,172)=*(0,173)=g(0,174)=*(0,175)=g(0,1)(0,3)#(0,8)#(0,2)#",32,0,237,0
+
+   Most of these use Sun's extension for prototyped function types ---
+   the 'g' type descriptor.  As of around 9 Feb 2002, GCC didn't emit
+   those, but GDB can read them, so the related tests in ptype.exp
+   will all xfail.  */
+
+
+/***********/
+
+extern char charfoo ();
+
+typedef int foo;
+
+foo intfoo (afoo)
+{
+  charfoo (afoo);
+  return (afoo * 2);
+}
+
 /***********/
 
 int main ()
@@ -237,10 +290,6 @@ int main ()
      sure it is linked in to this program.  */
   v_char_pointer = (char *) malloc (1);
 
-#ifdef usestubs
-  set_debug_traps();
-  breakpoint();
-#endif
   /* Some linkers (e.g. on AIX) remove unreferenced variables,
      so make sure to reference them. */
   primary = blue;
@@ -312,6 +361,8 @@ int main ()
   nested_su.outer_int = 0;
   v_t_struct_p = 0;
 
+  the_highest.a = 0;
+
   v_boolean = FALSE;
   v_boolean2 = my_false;
   return 0;
This page took 0.025195 seconds and 4 git commands to generate.