Fix problem that alias can be defined or not depending on the order.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / collection.c
index 39863325b0a026ef26a24bdc6ac1854598239291..4a70ec16ac3bcecb6d1c2dc1d5810bf095680afe 100644 (file)
@@ -1,3 +1,20 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 1998-2020 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
 /*
  * Test program for trace collection
  */
@@ -26,6 +43,16 @@ double       globald;
 test_struct  globalstruct;
 test_struct *globalp;
 int          globalarr[16];
+int          globalarr2[4];
+int          globalarr3[4];
+
+struct global_pieces {
+  unsigned int a;
+  unsigned int b;
+} global_pieces =
+  {
+    0x12345678, 0x87654321
+  };
 
 /*
  * Additional globals used in arithmetic tests
@@ -93,6 +120,7 @@ int local_test_func ()                       /* test collecting locals */
   test_struct locst;
   int         locar[4];
   int         i;
+  struct localstruct {} locdefst;
 
   locst.memberc  = 15;
   locst.memberi  = 16;
@@ -190,6 +218,21 @@ int globals_test_func ()
   return i;    /* Set_Tracepoint_Here */
 }
 
+int strings_test_func ()
+{
+  int i = 0;
+  char *locstr, *longloc;
+
+  locstr = "abcdef";
+  longloc = malloc(500);
+  strcpy(longloc, "how now brown cow spam spam spam wonderful wonderful spam");
+
+  i += strlen (locstr);
+  i += strlen (longloc);
+
+  return i;    /* Set_Tracepoint_Here */
+}
+
 int
 main (argc, argv, envp)
      int argc;
@@ -199,11 +242,6 @@ main (argc, argv, envp)
   test_struct mystruct;
   int         myarray[4];
 
-#ifdef usestubs
-  set_debug_traps ();
-  breakpoint ();
-#endif
-
   begin ();
   /* Assign collectable values to global variables. */
   l0  = s0  = c0  = 0;     l1  = s1  = c1  = 1;
@@ -228,6 +266,12 @@ main (argc, argv, envp)
   for (i = 0; i < 15; i++)
     globalarr[i] = i;
 
+  for (i = 0; i < 4; i++)
+    globalarr2[i] = i;
+
+  for (i = 0; i < 4; i++)
+    globalarr3[3 - i] = i;
+
   mystruct.memberc = 101;
   mystruct.memberi = 102;
   mystruct.memberf = 103.3;
@@ -246,6 +290,7 @@ main (argc, argv, envp)
   i += reglocal_test_func ();
   i += statlocal_test_func ();
   i += globals_test_func ();
+  i += strings_test_func ();
 
   /* Values of globals at end of test should be different from
      values that they had when trace data was captured.  */
@@ -274,6 +319,10 @@ main (argc, argv, envp)
   globalp = 0;
   for (i = 0; i < 15; i++)
     globalarr[i] = 0;
+  for (i = 0; i < 4; i++)
+    globalarr2[i] = 0;
+  for (i = 0; i < 4; i++)
+    globalarr3[i] = 0;
 
   end ();
   return 0;
This page took 0.026166 seconds and 4 git commands to generate.