+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 1998-2016 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
*/
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
test_struct locst;
int locar[4];
int i;
+ struct localstruct {} locdefst;
locst.memberc = 15;
locst.memberi = 16;
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;
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;
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;
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. */
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;