| OLD | NEW |
| 1 /* New version of run front end support for simulators. | 1 /* New version of run front end support for simulators. |
| 2 Copyright (C) 1997, 2004, 2007-2012 Free Software Foundation, Inc. | 2 Copyright (C) 1997, 2004, 2007-2012 Free Software Foundation, Inc. |
| 3 | 3 |
| 4 This program is free software; you can redistribute it and/or modify | 4 This program is free software; you can redistribute it and/or modify |
| 5 it under the terms of the GNU General Public License as published by | 5 it under the terms of the GNU General Public License as published by |
| 6 the Free Software Foundation; either version 3 of the License, or | 6 the Free Software Foundation; either version 3 of the License, or |
| 7 (at your option) any later version. | 7 (at your option) any later version. |
| 8 | 8 |
| 9 This program is distributed in the hope that it will be useful, | 9 This program is distributed in the hope that it will be useful, |
| 10 but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 GNU General Public License for more details. | 12 GNU General Public License for more details. |
| 13 | 13 |
| 14 You should have received a copy of the GNU General Public License | 14 You should have received a copy of the GNU General Public License |
| 15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 16 | 16 |
| 17 /* Need to be before general includes, to pick up e.g. _GNU_SOURCE. */ |
| 18 #ifdef HAVE_CONFIG_H |
| 19 #include "cconfig.h" |
| 20 #include "tconfig.h" |
| 21 #endif |
| 22 |
| 17 #include <signal.h> | 23 #include <signal.h> |
| 24 |
| 25 /* For strsignal. */ |
| 26 #ifdef HAVE_STRING_H |
| 27 #include <string.h> |
| 28 #else |
| 29 #ifdef HAVE_STRINGS_H |
| 30 #include <strings.h> |
| 31 #endif |
| 32 #endif |
| 33 |
| 18 #include "sim-main.h" | 34 #include "sim-main.h" |
| 19 | 35 |
| 20 #include "bfd.h" | 36 #include "bfd.h" |
| 21 | 37 |
| 22 #ifdef HAVE_ENVIRON | 38 #ifdef HAVE_ENVIRON |
| 23 extern char **environ; | 39 extern char **environ; |
| 24 #endif | 40 #endif |
| 25 | 41 |
| 26 #ifdef HAVE_UNISTD_H | 42 #ifdef HAVE_UNISTD_H |
| 27 /* For chdir. */ | 43 /* For chdir. */ |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 to return. If reason is sim_stopped or sim_signalled, then sigrc holds | 211 to return. If reason is sim_stopped or sim_signalled, then sigrc holds |
| 196 the signal that the simulator received; we want to return that to | 212 the signal that the simulator received; we want to return that to |
| 197 indicate failure. */ | 213 indicate failure. */ |
| 198 | 214 |
| 199 /* Why did we stop? */ | 215 /* Why did we stop? */ |
| 200 switch (reason) | 216 switch (reason) |
| 201 { | 217 { |
| 202 case sim_signalled: | 218 case sim_signalled: |
| 203 case sim_stopped: | 219 case sim_stopped: |
| 204 if (sigrc != 0) | 220 if (sigrc != 0) |
| 205 fprintf (stderr, "program stopped with signal %d.\n", sigrc); | 221 » fprintf (stderr, "program stopped with signal %d (%s).\n", sigrc, |
| 222 » » strsignal (sigrc)); |
| 206 break; | 223 break; |
| 207 | 224 |
| 208 case sim_exited: | 225 case sim_exited: |
| 209 break; | 226 break; |
| 210 | 227 |
| 211 default: | 228 default: |
| 212 fprintf (stderr, "program in undefined state (%d:%d)\n", reason, sigrc); | 229 fprintf (stderr, "program in undefined state (%d:%d)\n", reason, sigrc); |
| 213 break; | 230 break; |
| 214 | 231 |
| 215 } | 232 } |
| 216 | 233 |
| 217 return sigrc; | 234 return sigrc; |
| 218 } | 235 } |
| 219 | 236 |
| 220 static void | 237 static void |
| 221 usage (void) | 238 usage (void) |
| 222 { | 239 { |
| 223 fprintf (stderr, "Usage: %s [options] program [program args]\n", myname); | 240 fprintf (stderr, "Usage: %s [options] program [program args]\n", myname); |
| 224 fprintf (stderr, "Run `%s --help' for full list of options.\n", myname); | 241 fprintf (stderr, "Run `%s --help' for full list of options.\n", myname); |
| 225 exit (1); | 242 exit (1); |
| 226 } | 243 } |
| OLD | NEW |