| OLD | NEW |
| 1 /* Copyright 1992-1996, 1999, 2004, 2007-2012 Free Software Foundation, | 1 /* Copyright 1992-1996, 1999, 2004, 2007-2012 Free Software Foundation, |
| 2 Inc. | 2 Inc. |
| 3 | 3 |
| 4 This file is part of GDB. | 4 This file is part of GDB. |
| 5 | 5 |
| 6 This program is free software; you can redistribute it and/or modify | 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 | 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 | 8 the Free Software Foundation; either version 3 of the License, or |
| 9 (at your option) any later version. | 9 (at your option) any later version. |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #define HAVE_ABORT 1 | 28 #define HAVE_ABORT 1 |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 #if HAVE_ABORT | 31 #if HAVE_ABORT |
| 32 #include <stdlib.h> | 32 #include <stdlib.h> |
| 33 #define ABORT abort() | 33 #define ABORT abort() |
| 34 #else | 34 #else |
| 35 #define ABORT {char *invalid = 0; *invalid = 0xFF;} | 35 #define ABORT {char *invalid = 0; *invalid = 0xFF;} |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 #ifdef USE_RLIMIT |
| 39 # include <sys/resource.h> |
| 40 # ifndef RLIM_INFINITY |
| 41 # define RLIM_INFINITY -1 |
| 42 # endif |
| 43 #endif /* USE_RLIMIT */ |
| 44 |
| 38 /* Don't make these automatic vars or we will have to walk back up the | 45 /* Don't make these automatic vars or we will have to walk back up the |
| 39 stack to access them. */ | 46 stack to access them. */ |
| 40 | 47 |
| 41 char *buf1; | 48 char *buf1; |
| 42 char *buf2; | 49 char *buf2; |
| 43 | 50 |
| 44 int coremaker_data = 1; /* In Data section */ | 51 int coremaker_data = 1; /* In Data section */ |
| 45 int coremaker_bss; /* In BSS section */ | 52 int coremaker_bss; /* In BSS section */ |
| 46 | 53 |
| 47 const int coremaker_ro = 201; /* In Read-Only Data section */ | 54 const int coremaker_ro = 201; /* In Read-Only Data section */ |
| 48 | 55 |
| 49 void | 56 void |
| 50 func2 (int x) | 57 func2 (int x) |
| 51 { | 58 { |
| 52 int coremaker_local[5]; | 59 int coremaker_local[5]; |
| 53 int i; | 60 int i; |
| 54 static int y; | 61 static int y; |
| 55 | 62 |
| 63 #ifdef USE_RLIMIT |
| 64 { |
| 65 struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY }; |
| 66 |
| 67 setrlimit (RLIMIT_CORE, &rlim); |
| 68 } |
| 69 #endif |
| 70 |
| 56 /* Make sure that coremaker_local doesn't get optimized away. */ | 71 /* Make sure that coremaker_local doesn't get optimized away. */ |
| 57 for (i = 0; i < 5; i++) | 72 for (i = 0; i < 5; i++) |
| 58 coremaker_local[i] = i; | 73 coremaker_local[i] = i; |
| 59 coremaker_bss = 0; | 74 coremaker_bss = 0; |
| 60 for (i = 0; i < 5; i++) | 75 for (i = 0; i < 5; i++) |
| 61 coremaker_bss += coremaker_local[i]; | 76 coremaker_bss += coremaker_local[i]; |
| 62 coremaker_data = coremaker_ro + 1; | 77 coremaker_data = coremaker_ro + 1; |
| 63 y = 10 * x; | 78 y = 10 * x; |
| 64 ABORT; | 79 ABORT; |
| 65 } | 80 } |
| 66 | 81 |
| 67 void | 82 void |
| 68 func1 (int x) | 83 func1 (int x) |
| 69 { | 84 { |
| 70 func2 (x * 2); | 85 func2 (x * 2); |
| 71 } | 86 } |
| 72 | 87 |
| 73 int main () | 88 int main () |
| 74 { | 89 { |
| 75 func1 (10); | 90 func1 (10); |
| 76 return 0; | 91 return 0; |
| 77 } | 92 } |
| OLD | NEW |