Fix SH simulator to handle program exit correctly.
This commit is contained in:
parent
9ef450d85d
commit
3be50301d5
|
@ -1,3 +1,12 @@
|
|||
Sat Oct 21 12:31:01 1995 Jim Wilson <wilson@chestnut.cygnus.com>
|
||||
|
||||
* run.c (main): Always return sigrc at end.
|
||||
|
||||
Tue Oct 10 12:03:13 1995 J.T. Conklin <jtc@rtl.cygnus.com>
|
||||
|
||||
* run.c (main): Print error diagnostic and exit if bfd_openr() or
|
||||
bfd_check_format() fails.
|
||||
|
||||
Thu Sep 28 15:40:36 1995 steve chamberlain <sac@slash.cygnus.com>
|
||||
|
||||
* run.c, run.1: From sh directory.
|
||||
|
|
|
@ -86,15 +86,28 @@ main (ac, av)
|
|||
{
|
||||
printf ("run %s\n", name);
|
||||
}
|
||||
|
||||
abfd = bfd_openr (name, 0);
|
||||
if (!abfd)
|
||||
{
|
||||
fprintf (stderr, "run: can't open %s: %s\n",
|
||||
name, bfd_errmsg(bfd_get_error()));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!bfd_check_format (abfd, bfd_object))
|
||||
{
|
||||
fprintf (stderr, "run: can't load %s: %s\n",
|
||||
name, bfd_errmsg(bfd_get_error()));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
sim_set_callbacks (&default_callback);
|
||||
default_callback.init (&default_callback);
|
||||
if (abfd)
|
||||
{
|
||||
if (bfd_check_format (abfd, bfd_object))
|
||||
{
|
||||
|
||||
for (s = abfd->sections; s; s = s->next)
|
||||
if (abfd)
|
||||
{
|
||||
unsigned char *buffer = (unsigned char *)malloc (bfd_section_size (abfd, s));
|
||||
bfd_get_section_contents (abfd,
|
||||
|
@ -127,17 +140,12 @@ main (ac, av)
|
|||
|
||||
sim_stop_reason (&reason, &sigrc);
|
||||
|
||||
if (sigrc == SIGQUIT)
|
||||
{
|
||||
return sim_get_quit_code();
|
||||
}
|
||||
else
|
||||
/* If reason is sim_exited, then sigrc holds the exit code which we want
|
||||
to return. If reason is sim_stopped or sim_signalled, then sigrc holds
|
||||
the signal that the simulator received; we want to return that to
|
||||
indicate failure. */
|
||||
return sigrc;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
|
|
Loading…
Reference in New Issue