1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* Test program partial trace data visualization. */
26 typedef struct TEST_STRUCT
{
33 typedef int test_array
[4];
35 /* Global variables to be collected. */
41 test_struct globalstruct
;
47 const char g_const_string
[] = "hello world";
48 char g_string_unavail
[sizeof (g_const_string
)];
49 char g_string_partial
[sizeof (g_const_string
)];
50 const char *g_string_p
;
52 /* Used to check that <unavailable> is not the same as 0 in array
53 element repetitions. */
61 struct tuple tarray
[8];
78 static StructA static_struct_a
;
89 StructRef (unsigned int val
) : ref(d
) {}
100 struct StructB struct_b
;
101 struct StructA
StructB::static_struct_a
;
103 StructRef
g_structref(0x12345678);
104 StructRef
*g_structref_p
= &g_structref
;
107 /* Test functions. */
110 begin () /* called before anything else */
115 end () /* called after everything else */
124 i
+= globalc
+ globali
+ globalf
+ globald
;
125 i
+= globalstruct
.memberc
+ globalstruct
.memberi
;
126 i
+= globalstruct
.memberf
+ globalstruct
.memberd
;
129 return i
; /* set globals_test_func tracepoint here */
133 main (int argc
, char **argv
, char **envp
)
136 test_struct mystruct
;
140 /* Assign collectable values to global variables. */
145 globalstruct
.memberc
= 81;
146 globalstruct
.memberi
= 82;
147 globalstruct
.memberf
= 83.3;
148 globalstruct
.memberd
= 84.4;
149 globalp
= &globalstruct
;
151 for (i
= 0; i
< 15; i
++)
154 mystruct
.memberc
= 101;
155 mystruct
.memberi
= 102;
156 mystruct
.memberf
= 103.3;
157 mystruct
.memberd
= 104.4;
164 memset (&struct_b
, 0xaa, sizeof struct_b
);
165 memset (&struct_b
.static_struct_a
, 0xaa, sizeof struct_b
.static_struct_a
);
166 struct_b
.string
= g_const_string
;
167 memcpy (g_string_unavail
, g_const_string
, sizeof (g_const_string
));
168 memcpy (g_string_partial
, g_const_string
, sizeof (g_const_string
));
169 g_string_p
= g_const_string
;
171 /* Call test functions, so they can be traced and data collected. */
173 i
+= globals_test_func ();
175 /* Set 'em back to zero, so that the collected values will be
176 distinctly different from the "realtime" (end of test) values. */
182 globalstruct
.memberc
= 0;
183 globalstruct
.memberi
= 0;
184 globalstruct
.memberf
= 0;
185 globalstruct
.memberd
= 0;
187 for (i
= 0; i
< 15; i
++)
190 memset (&struct_b
, 0, sizeof struct_b
);
191 memset (&struct_b
.static_struct_a
, 0, sizeof struct_b
.static_struct_a
);
192 struct_b
.string
= NULL
;
193 memset (g_string_unavail
, 0, sizeof (g_string_unavail
));
194 memset (g_string_partial
, 0, sizeof (g_string_partial
));
199 g_structref
.clear ();
200 g_structref_p
= NULL
;
This page took 0.034809 seconds and 4 git commands to generate.