gdb: remove uses of iterate_over_inferiors in mi/mi-main.c
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / collection.c
index 422b737cc8a7dab3b2ee17cc304a4e10aaca7336..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
  */
@@ -27,6 +44,7 @@ test_struct  globalstruct;
 test_struct *globalp;
 int          globalarr[16];
 int          globalarr2[4];
+int          globalarr3[4];
 
 struct global_pieces {
   unsigned int a;
@@ -200,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;
@@ -209,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;
@@ -241,6 +269,9 @@ main (argc, argv, envp)
   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;
@@ -259,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.  */
@@ -289,6 +321,8 @@ main (argc, argv, envp)
     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.025165 seconds and 4 git commands to generate.