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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [coremaker2.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* Simple little program that just generates a core dump from inside some
2
   nested function calls.  Keep this as self contained as possible, I.E.
3
   use no environment resources other than possibly abort(). */
4
 
5
#ifndef __STDC__
6
#define const   /**/
7
#endif
8
 
9
#ifndef HAVE_ABORT
10
#define HAVE_ABORT 1
11
#endif
12
 
13
#if HAVE_ABORT
14
#define ABORT abort()
15
#else
16
#define ABORT {char *invalid = 0; *invalid = 0xFF;}
17
#endif
18
 
19
/* Don't make these automatic vars or we will have to walk back up the
20
   stack to access them. */
21
 
22
char *buf1;
23
char *buf2;
24
 
25
int coremaker_data = 1; /* In Data section */
26
int coremaker_bss;      /* In BSS section */
27
 
28
const int coremaker_ro = 201;   /* In Read-Only Data section */
29
 
30
void
31
func2 (int x)
32
{
33
  int coremaker_local[5];
34
  int i;
35
  static int y;
36
 
37
  /* Make sure that coremaker_local doesn't get optimized away. */
38
  for (i = 0; i < 5; i++)
39
    coremaker_local[i] = i;
40
  coremaker_bss = 0;
41
  for (i = 0; i < 5; i++)
42
    coremaker_bss += coremaker_local[i];
43
  coremaker_data = coremaker_ro + 1;
44
  y = 10 * x;
45
  ABORT;
46
}
47
 
48
void
49
func1 (int x)
50
{
51
  func2 (x * 2);
52
}
53
 
54
int main ()
55
{
56
  func1 (10);
57
  return 0;
58
}

powered by: WebSVN 2.1.0

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