2011-01-24 Pedro Alves <pedro@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / printcmds.c
index 27080741a3b8fc40234b8fb41be3ccd9ccc8b798..b3841ae17378196f0dc9bb8bdbd665ceee8231bd 100644 (file)
@@ -53,12 +53,18 @@ unsigned char ctable2[] = {
   'a','a','a','a','a','a','a','a','a','a','a','a','a','X','X','X',
   'a','a','a','a','a','a','a','a','a','a','a','a','a','a','X','X',
   'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','X',
-  'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a'
+  'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 0
 };
 
 /* Single and multidimensional arrays to test access and printing of array
    members. */
 
+typedef int ArrayInt [10];
+ArrayInt a1 = {2,4,6,8,10,12,14,16,18,20};
+
+typedef char ArrayChar [5];
+ArrayChar a2 = {'a','b','c','d','\0'};
+
 int int1dim[12] = {0,1,2,3,4,5,6,7,8,9,10,11};
 int int2dim[3][4] = {{0,1,2,3},{4,5,6,7},{8,9,10,11}};
 int int3dim[2][3][2] = {{{0,1},{2,3},{4,5}},{{6,7},{8,9},{10,11}}};
@@ -84,6 +90,34 @@ struct some_arrays {
 
 struct some_arrays *parrays = &arrays;
 
+enum some_volatile_enum { enumvolval1, enumvolval2 };
+
+/* A volatile enum variable whose name is the same as the enumeration
+   name.  See PR11827.  */
+volatile enum some_volatile_enum some_volatile_enum = enumvolval1;
+
+/* A structure with an embedded array at an offset > 0.  The array has
+   all elements with the same repeating value, which must not be the
+   same as the value of the preceding fields in the structure for the
+   test to be effective.  This tests whether GDB uses the correct
+   element content offsets (relative to the complete `some_struct'
+   value) when counting value repetitions.  */
+struct some_struct
+{
+  int a;
+  int b;
+  unsigned char array[20];
+} some_struct = {
+  0x12345678,
+  0x87654321,
+  {
+    0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+    0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+    0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+    0xaa, 0xaa, 0xaa, 0xaa, 0xaa
+  }
+};
+
 /* -- */
 
 int main ()
@@ -97,5 +131,5 @@ int main ()
   /* Prevent AIX linker from removing variables.  */
   return ctable1[0] + ctable2[0] + int1dim[0] + int2dim[0][0]
     + int3dim[0][0][0] + int4dim[0][0][0][0] + teststring[0] +
-      *parrays -> array1;
+      *parrays -> array1 + a1[0] + a2[0];
 }
This page took 0.027501 seconds and 4 git commands to generate.