OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [nodebug.c] - Blame information for rev 842

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
#include <stdlib.h>
2
/* Test that things still (sort of) work when compiled without -g.  */
3
 
4
int dataglobal = 3;                     /* Should go in global data */
5
static int datalocal = 4;               /* Should go in local data */
6
int bssglobal;                          /* Should go in global bss */
7
static int bsslocal;                    /* Should go in local bss */
8
 
9
#ifdef PROTOTYPES
10
int
11
inner (int x)
12
#else
13
int
14
inner (x)
15
     int x;
16
#endif
17
{
18
  return x + dataglobal + datalocal + bssglobal + bsslocal;
19
}
20
 
21
#ifdef PROTOTYPES
22
static short
23
middle (int x)
24
#else
25
static short
26
middle (x)
27
     int x;
28
#endif
29
{
30
  return 2 * inner (x);
31
}
32
 
33
#ifdef PROTOTYPES
34
short
35
top (int x)
36
#else
37
short
38
top (x)
39
     int x;
40
#endif
41
{
42
  return 2 * middle (x);
43
}
44
 
45
#ifdef PROTOTYPES
46
int
47
main (int argc, char **argv)
48
#else
49
int
50
main (argc, argv)
51
     int argc;
52
     char **argv;
53
#endif
54
{
55
#ifdef usestubs
56
  set_debug_traps();
57
  breakpoint();
58
#endif
59
  return top (argc);
60
}
61
 
62
int *x;
63
 
64
#ifdef PROTOTYPES
65
int array_index (char *arr, int i)
66
#else
67
int
68
array_index (arr, i)
69
     char *arr;
70
     int i;
71
#endif
72
{
73
  /* The basic concept is just "return arr[i];".  But call malloc so that gdb
74
     will be able to call functions.  */
75
  char retval;
76
  x = (int *) malloc (sizeof (int));
77
  *x = i;
78
  retval = arr[*x];
79
  free (x);
80
  return retval;
81
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.