For Sega/Hitachi, when simulator exits, check to see if it was because
of a signal.
This commit is contained in:
parent
3d0f44462f
commit
f2d1b56f40
1 changed files with 20 additions and 7 deletions
27
sim/sh/run.c
27
sim/sh/run.c
|
@ -21,12 +21,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
/* Steve Chamberlain
|
/* Steve Chamberlain
|
||||||
sac@cygnus.com */
|
sac@cygnus.com */
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <varargs.h>
|
#include <varargs.h>
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
#include "remote-sim.h"
|
#include "remote-sim.h"
|
||||||
|
|
||||||
|
#ifndef SIGQUIT
|
||||||
|
#define SIGQUIT SIGTERM
|
||||||
|
#endif
|
||||||
|
|
||||||
void usage();
|
void usage();
|
||||||
extern int optind;
|
extern int optind;
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
|
@ -45,6 +50,8 @@ main (ac, av)
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int trace = 0;
|
int trace = 0;
|
||||||
char *name = "";
|
char *name = "";
|
||||||
|
enum sim_stop reason;
|
||||||
|
int sigrc;
|
||||||
|
|
||||||
while ((i = getopt (ac, av, "m:p:s:tv")) != EOF)
|
while ((i = getopt (ac, av, "m:p:s:tv")) != EOF)
|
||||||
switch (i)
|
switch (i)
|
||||||
|
@ -116,14 +123,20 @@ main (ac, av)
|
||||||
if (verbose)
|
if (verbose)
|
||||||
sim_info (0);
|
sim_info (0);
|
||||||
|
|
||||||
/* Assume we left through the exit system call,
|
sim_stop_reason (&reason, &sigrc);
|
||||||
in which case r5 has the exit code */
|
|
||||||
{
|
|
||||||
unsigned char b[4];
|
|
||||||
sim_fetch_register (5, b);
|
|
||||||
return b[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Check to see if we left through the exit system call.
|
||||||
|
If we did, then we will have gotten a SIGQUIT and the exit
|
||||||
|
code is in r5. Otherwise, report the error number as the
|
||||||
|
exit code. */
|
||||||
|
if (sigrc == SIGQUIT)
|
||||||
|
{
|
||||||
|
unsigned char b[4];
|
||||||
|
sim_fetch_register (5, b);
|
||||||
|
return b[3];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return sigrc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue