2010-07-13 Emmanuel Thomé <Emmanuel.Thome@gmail.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-prettyprint.c
index 7f16400a883bdccc0a91c47e365b3bc9489f91d0..66a90141f121a7780fb7368f6fa58818b5430798 100644 (file)
@@ -1,6 +1,6 @@
 /* This testcase is part of GDB, the GNU debugger.
 
-   Copyright 2008, 2009 Free Software Foundation, Inc.
+   Copyright 2008, 2009, 2010 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
@@ -29,11 +29,21 @@ struct ss
   struct s b;
 };
 
+struct arraystruct
+{
+  int y;
+  struct s x[2];
+};
+
 struct ns {
   const char *null_str;
   int length;
 };
 
+struct lazystring {
+  const char *lazy_str;
+};
+
 #ifdef __cplusplus
 struct S : public s {
   int zs;
@@ -115,6 +125,15 @@ typedef struct string_repr
 
 /* This lets us avoid malloc.  */
 int array[100];
+int narray[10];
+
+struct justchildren
+{
+  int len;
+  int *elements;
+};
+
+typedef struct justchildren nostring_type;
 
 struct container
 {
@@ -186,22 +205,33 @@ main ()
 {
   struct ss  ss;
   struct ss  ssa[2];
+  struct arraystruct arraystruct;
   string x = make_string ("this is x");
   zzz_type c = make_container ("container");
   zzz_type c2 = make_container ("container2");
   const struct string_repr cstring = { { "const string" } };
   /* Clearing by being `static' could invoke an other GDB C++ bug.  */
   struct nullstr nullstr;
+  nostring_type nstype;
+  nstype.elements = narray;
+  nstype.len = 0;
 
   init_ss(&ss, 1, 2);
   init_ss(ssa+0, 3, 4);
   init_ss(ssa+1, 5, 6);
   memset (&nullstr, 0, sizeof nullstr);
 
+  arraystruct.y = 7;
+  init_s (&arraystruct.x[0], 23);
+  init_s (&arraystruct.x[1], 24);
+
   struct ns  ns;
   ns.null_str = "embedded\0null\0string";
   ns.length = 20;
 
+  struct lazystring estring;
+  estring.lazy_str = "embedded x\201\202\203\204" ;
+
 #ifdef __cplusplus
   S cps;
 
@@ -241,5 +271,9 @@ main ()
   do_nothing ();
 #endif
 
+  nstype.elements[0] = 7;
+  nstype.elements[1] = 42;
+  nstype.len = 2;
+  
   return 0;      /* break to inspect struct and union */
 }
This page took 0.029015 seconds and 4 git commands to generate.