Initial creation of sourceware repository
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / nodebug.c
CommitLineData
c906108c
SS
1/* Test that things still (sort of) work when compiled without -g. */
2
3int dataglobal = 3; /* Should go in global data */
4static int datalocal = 4; /* Should go in local data */
5int bssglobal; /* Should go in global bss */
6static int bsslocal; /* Should go in local bss */
7
8int
9inner (x)
10 int x;
11{
12 return x + dataglobal + datalocal + bssglobal + bsslocal;
13}
14
15static short
16middle (x)
17 int x;
18{
19 return 2 * inner (x);
20}
21
22short
23top (x)
24 int x;
25{
26 return 2 * middle (x);
27}
28
29int
30main (argc, argv)
31 int argc;
32 char **argv;
33{
34#ifdef usestubs
35 set_debug_traps();
36 breakpoint();
37#endif
38 return top (argc);
39}
40
41char *malloc ();
42
43int *x;
44
45int
46array_index (arr, i)
47 char *arr;
48 int i;
49{
50 /* The basic concept is just "return arr[i];". But call malloc so that gdb
51 will be able to call functions. */
52 char retval;
53 x = (int *) malloc (sizeof (int));
54 *x = i;
55 retval = arr[*x];
56 free (x);
57 return retval;
58}
This page took 0.025437 seconds and 4 git commands to generate.