1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2008-2024 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 * Test restoration of machine state
22 extern void hide (int);
24 /* Test register variable
25 Requires -- compiler honors 'register'. */
32 hide (a
); /* External function to defeat optimization. */
33 a
++; /* register_state: set breakpoint here */
34 hide (a
); /* register post-change */
37 /* Test auto variable (whatever that means). */
44 hide (a
); /* External function to defeat optimization. */
45 a
++; /* auto_state: set breakpoint here */
46 hide (a
); /* auto post-change */
49 /* Test function-static variable. */
52 function_static_state (void)
56 hide (a
); /* External function to defeat optimization. */
57 a
++; /* function_static_state: set breakpoint here */
58 hide (a
); /* function static post-change */
61 /* Test module-static variable. */
66 module_static_state (void)
70 hide (astatic
); /* External function to defeat optimization. */
71 astatic
++; /* module_static_state: set breakpoint here */
72 hide (astatic
); /* module static post-change */
75 /* Test module-global variable. */
80 module_global_state (void)
84 hide (aglobal
); /* External function to defeat optimization. */
85 aglobal
++; /* module_global_state: set breakpoint here */
86 hide (aglobal
); /* module global post-change */
89 /* main test driver */
92 main (int argc
, char **argv
)
94 register_state (); /* begin main */
96 function_static_state ();
97 module_static_state ();
98 module_global_state ();
100 return 0; /* end main */