sim: run: punt!

Now that all targets have been converted to nrun, we can finally punt
this old inconsistent interface.

A few stray references to the old run were sprinkled about; clean them
up in the process.

We leave behind the run(1) man page mostly so that we get it updated for
the new nrun interface.
This commit is contained in:
Mike Frysinger 2015-03-31 01:13:12 -04:00
parent aadc9410ba
commit 0fe84f3fbe
17 changed files with 32 additions and 513 deletions

View File

@ -1,3 +1,9 @@
2015-04-01 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (armos.o, armcopro.o, maverick.o, iwmmxt.o, arminit.o,
armrdi.o, armsupp.o, thumbemu.o, bag.o, wrapper.o): Delete rules.
* tconfig.h: Delete file.
2015-03-31 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.

View File

@ -30,32 +30,8 @@ SIM_OBJS = \
## COMMON_POST_CONFIG_FRAG
armos.o: armos.c armdefs.h armos.h armfpe.h targ-vals.h
armcopro.o: armcopro.c armdefs.h
maverick.o: maverick.c armdefs.h
iwmmxt.o: iwmmxt.c iwmmxt.h armdefs.h
armemu26.o: armemu.c armdefs.h armemu.h
armemu26.o: armemu.c armdefs.h armemu.h
$(CC) -c $(srcdir)/armemu.c -o armemu26.o $(ALL_CFLAGS)
armemu32.o: armemu.c armdefs.h armemu.h
$(CC) -c $(srcdir)/armemu.c -o armemu32.o -DMODE32 $(ALL_CFLAGS)
arminit.o: arminit.c armdefs.h armemu.h
armrdi.o: armrdi.c armdefs.h armemu.h armos.h dbg_cp.h dbg_conf.h dbg_rdi.h \
dbg_hif.h communicate.h
armsupp.o: armsupp.c armdefs.h armemu.h
thumbemu.o: thumbemu.c armdefs.h armemu.h
bag.o: bag.c bag.h
wrapper.o: armdefs.h armemu.h dbg_rdi.h \
$(srcdir)/../common/run-sim.h \
$(srcdir)/../common/sim-utils.h \
$(srcdir)/../../include/gdb/sim-arm.h \
$(srcdir)/../../include/gdb/remote-sim.h

View File

@ -1,17 +0,0 @@
/* ARM target configuration file. */
/* Define this if the simulator supports profiling.
See the mips simulator for an example.
This enables the `-p foo' and `-s bar' options.
The target is required to provide sim_set_profile{,_size}. */
/* #define SIM_HAVE_PROFILE */
/* Define this if the simulator uses an instruction cache.
See the h8/300 simulator for an example.
This enables the `-c size' option to set the size of the cache.
The target is required to provide sim_set_simcache_size. */
/* #define SIM_HAVE_SIMCACHE */
/* Define this if the target cpu is bi-endian
and the simulator supports it. */
#define SIM_HAVE_BIENDIAN

View File

@ -1,3 +1,7 @@
2015-04-01 Mike Frysinger <vapier@gentoo.org>
* tconfig.h: Delete.
2015-03-31 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.

View File

@ -19,8 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
#define SIM_HAVE_BIENDIAN
#include "sim-basics.h"
typedef address_word sim_cia;

View File

@ -1,3 +1,8 @@
2015-04-01 Mike Frysinger <vapier@gentoo.org>
* run-sim.h, run.c: Delete.
* tconfig.h (SIM_HAVE_PROFILE, SIM_HAVE_BIENDIAN): Delete.
2015-03-31 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.

View File

@ -1,84 +0,0 @@
/* This file defines the part of the interface between the standalone
simaulator program - run - and simulator library - libsim.a - that
is not used by GDB. The GDB part is described in include/remote-sim.h.
Copyright 2002-2015 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef RUN_SIM_H
#define RUN_SIM_H
#ifdef SIM_TARGET_SWITCHES
/* Parse the command line, extracting any target specific switches
before the generic simulator code gets a chance to complain
about them. Returns the adjusted value of argc. */
int sim_target_parse_command_line (int, char **);
/* Display a list of target specific switches supported by this
target. */
void sim_target_display_usage (int help);
#endif
/* Provide simulator with a default (global) host_callback_struct.
THIS PROCEDURE IS DEPRECATED.
GDB and NRUN do not use this interface.
This procedure does not take a SIM_DESC argument as it is
used before sim_open. */
void sim_set_callbacks (struct host_callback_struct *);
/* Set the size of the simulator memory array.
THIS PROCEDURE IS DEPRECATED.
GDB and NRUN do not use this interface.
This procedure does not take a SIM_DESC argument as it is
used before sim_open. */
void sim_size (int i);
/* Single-step simulator with tracing enabled.
THIS PROCEDURE IS DEPRECATED.
THIS PROCEDURE IS EVEN MORE DEPRECATED THAN SIM_SET_TRACE
GDB and NRUN do not use this interface.
This procedure returns: ``0'' indicating that the simulator should
be continued using sim_trace() calls; ``1'' indicating that the
simulation has finished. */
int sim_trace (SIM_DESC sd);
/* Enable tracing.
THIS PROCEDURE IS DEPRECATED.
GDB and NRUN do not use this interface.
This procedure returns: ``0'' indicating that the simulator should
be continued using sim_trace() calls; ``1'' indicating that the
simulation has finished. */
void sim_set_trace (void);
/* Configure the size of the profile buffer.
THIS PROCEDURE IS DEPRECATED.
GDB and NRUN do not use this interface.
This procedure does not take a SIM_DESC argument as it is
used before sim_open. */
void sim_set_profile_size (int n);
#endif

View File

@ -1,361 +0,0 @@
/* run front end support for all the simulators.
Copyright (C) 1992-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Steve Chamberlain sac@cygnus.com,
and others at Cygnus. */
#ifdef HAVE_CONFIG_H
#include "cconfig.h"
#endif
#include <signal.h>
#include <stdio.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#endif
#include "libiberty.h"
#include "bfd.h"
#include "gdb/callback.h"
#include "gdb/remote-sim.h"
#include "ansidecl.h"
#include "run-sim.h"
#include "version.h"
#ifdef SIM_USE_DEPRECATED_RUN_FRONTEND
# warning "This sim is using the deprecated run.c; please migrate to nrun.c."
#else
# error "Please do not create new sim ports using run.c; use nrun.c instead." \
"New submissions using run.c will not be accepted."
#endif
static void usage (int help);
static void print_version (void);
extern int optind;
extern char *optarg;
extern host_callback default_callback;
static char *myname;
extern int getopt ();
#ifdef NEED_UI_LOOP_HOOK
/* Gdb foolery. This is only needed for gdb using a gui. */
int (*deprecated_ui_loop_hook) (int signo);
#endif
static SIM_DESC sd;
static RETSIGTYPE
cntrl_c (int sig ATTRIBUTE_UNUSED)
{
if (! sim_stop (sd))
{
fprintf (stderr, "Quit!\n");
exit (1);
}
}
int
main (int ac, char **av)
{
RETSIGTYPE (*prev_sigint) ();
bfd *abfd;
int i;
int verbose = 0;
int trace = 0;
#ifdef SIM_HAVE_ENVIRONMENT
int operating_p = 0;
#endif
char *name;
static char *no_args[4];
char **sim_argv = &no_args[0];
char **prog_args;
enum sim_stop reason;
int sigrc;
myname = av[0] + strlen (av[0]);
while (myname > av[0] && myname[-1] != '/')
--myname;
/* The first element of sim_open's argv is the program name. */
no_args[0] = av[0];
#ifdef SIM_HAVE_BIENDIAN
no_args[1] = "-E";
no_args[2] = "set-later";
#endif
/* FIXME: This is currently being migrated into sim_open.
Simulators that use functions such as sim_size() still require
this. */
default_callback.init (&default_callback);
sim_set_callbacks (&default_callback);
#ifdef SIM_TARGET_SWITCHES
ac = sim_target_parse_command_line (ac, av);
#endif
for (i = 1; av[i]; ++i)
{
if (strcmp (av[i], "--help") == 0)
{
usage (1);
}
else if (strcmp (av[i], "--version") == 0)
{
print_version ();
return 0;
}
}
/* FIXME: This is currently being rewritten to have each simulator
do all argv processing. */
while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF)
switch (i)
{
case 'a':
/* FIXME: Temporary hack. */
{
int len = strlen (av[0]) + strlen (optarg);
char *argbuf = (char *) alloca (len + 2 + 50);
sprintf (argbuf, "%s %s", av[0], optarg);
#ifdef SIM_HAVE_BIENDIAN
/* The desired endianness must be passed to sim_open.
The value for "set-later" is set when we know what it is.
-E support isn't yet part of the published interface. */
strcat (argbuf, " -E set-later");
#endif
sim_argv = buildargv (argbuf);
}
break;
#ifdef SIM_HAVE_SIMCACHE
case 'c':
sim_set_simcache_size (atoi (optarg));
break;
#endif
case 'm':
/* FIXME: Rename to sim_set_mem_size. */
sim_size (atoi (optarg));
break;
#ifdef SIM_HAVE_ENVIRONMENT
case 'o':
/* Operating enironment where any signals are delivered to the
target. */
operating_p = 1;
break;
#endif
#ifdef SIM_HAVE_PROFILE
case 'p':
sim_set_profile (atoi (optarg));
break;
case 's':
sim_set_profile_size (atoi (optarg));
break;
#endif
case 't':
trace = 1;
break;
case 'v':
/* Things that are printed with -v are the kinds of things that
gcc -v prints. This is not meant to include detailed tracing
or debugging information, just summaries. */
verbose = 1;
/* sim_set_verbose (1); */
break;
/* FIXME: Quick hack, to be replaced by more general facility. */
default:
usage (0);
}
ac -= optind;
av += optind;
if (ac <= 0)
usage (0);
name = *av;
prog_args = av;
if (verbose)
{
printf ("%s %s\n", myname, name);
}
abfd = bfd_openr (name, 0);
if (!abfd)
{
fprintf (stderr, "%s: can't open %s: %s\n",
myname, name, bfd_errmsg (bfd_get_error ()));
exit (1);
}
if (!bfd_check_format (abfd, bfd_object))
{
fprintf (stderr, "%s: can't load %s: %s\n",
myname, name, bfd_errmsg (bfd_get_error ()));
exit (1);
}
#ifdef SIM_HAVE_BIENDIAN
/* The endianness must be passed to sim_open because one may wish to
examine/set registers before calling sim_load [which is the other
place where one can determine endianness]. We previously passed the
endianness via global `target_byte_order' but that's not a clean
interface. */
for (i = 1; sim_argv[i + 1] != NULL; ++i)
continue;
if (bfd_big_endian (abfd))
sim_argv[i] = "big";
else
sim_argv[i] = "little";
#endif
/* Ensure that any run-time initialisation that needs to be
performed by the simulator can occur. */
sd = sim_open (SIM_OPEN_STANDALONE, &default_callback, abfd, sim_argv);
if (sd == 0)
exit (1);
if (sim_load (sd, name, abfd, 0) == SIM_RC_FAIL)
exit (1);
if (sim_create_inferior (sd, abfd, prog_args, NULL) == SIM_RC_FAIL)
exit (1);
#ifdef SIM_HAVE_ENVIRONMENT
/* NOTE: An old simulator supporting the operating environment MUST
provide sim_set_trace() and not sim_trace(). That way
sim_stop_reason() can be used to determine any stop reason. */
if (trace)
sim_set_trace ();
sigrc = 0;
do
{
prev_sigint = signal (SIGINT, cntrl_c);
sim_resume (sd, 0, sigrc);
signal (SIGINT, prev_sigint);
sim_stop_reason (sd, &reason, &sigrc);
}
while (operating_p && reason == sim_stopped && sigrc != SIGINT);
#else
if (trace)
{
int done = 0;
prev_sigint = signal (SIGINT, cntrl_c);
while (!done)
{
done = sim_trace (sd);
}
signal (SIGINT, prev_sigint);
sim_stop_reason (sd, &reason, &sigrc);
}
else
{
prev_sigint = signal (SIGINT, cntrl_c);
sigrc = 0;
sim_resume (sd, 0, sigrc);
signal (SIGINT, prev_sigint);
sim_stop_reason (sd, &reason, &sigrc);
}
#endif
if (verbose)
sim_info (sd, 0);
sim_close (sd, 0);
/* 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. */
/* Why did we stop? */
switch (reason)
{
case sim_signalled:
case sim_stopped:
if (sigrc != 0)
fprintf (stderr, "program stopped with signal %d.\n", sigrc);
break;
case sim_exited:
break;
case sim_running:
case sim_polling: /* These indicate a serious problem. */
abort ();
break;
}
return sigrc;
}
static void
usage (int help)
{
FILE *stream = help ? stdout : stderr;
fprintf (stream, "Usage: %s [options] program [program args]\n", myname);
fprintf (stream, "Options:\n");
fprintf (stream, "-a args Pass `args' to simulator.\n");
#ifdef SIM_HAVE_SIMCACHE
fprintf (stream, "-c size Set simulator cache size to `size'.\n");
#endif
fprintf (stream, "-m size Set memory size of simulator, in bytes.\n");
#ifdef SIM_HAVE_ENVIRONMENT
fprintf (stream, "-o Select operating (kernel) environment.\n");
#endif
#ifdef SIM_HAVE_PROFILE
fprintf (stream, "-p freq Set profiling frequency.\n");
fprintf (stream, "-s size Set profiling size.\n");
#endif
fprintf (stream, "-t Perform instruction tracing.\n");
fprintf (stream, " Note: Very few simulators support tracing.\n");
fprintf (stream, "-v Verbose output.\n");
fprintf (stream, "\n");
fprintf (stream, "program args Arguments to pass to simulated program.\n");
fprintf (stream, " Note: Very few simulators support this.\n");
#ifdef SIM_TARGET_SWITCHES
fprintf (stream, "\nTarget specific options:\n");
sim_target_display_usage (help);
#endif
if (help && REPORT_BUGS_TO[0])
printf ("Report bugs to %s\n", REPORT_BUGS_TO);
exit (help ? 0 : 1);
}
static void
print_version (void)
{
printf ("GNU simulator %s%s\n", PKGVERSION, version);
}

View File

@ -2,20 +2,8 @@
To override this, create file `tconfig.in' in the simulator's
source directory. */
/* Define this if the simulator supports profiling.
See the mips simulator for an example.
This enables the `-p foo' and `-s bar' options.
The target is required to provide sim_set_profile{,_size}.
TODO: This is specific to the old run.o main. */
/* #define SIM_HAVE_PROFILE */
/* Define this if the simulator uses an instruction cache.
See the h8/300 simulator for an example.
This enables the `-c size' option to set the size of the cache.
The target is required to provide sim_set_simcache_size. */
/* #define SIM_HAVE_SIMCACHE */
/* Define this if the target cpu is bi-endian
and the simulator supports it.
TODO: This is specific to the old run.o main. */
/* #define SIM_HAVE_BIENDIAN */

View File

@ -1,3 +1,7 @@
2015-04-01 Mike Frysinger <vapier@gentoo.org>
* interp.c (sim_set_profile, sim_set_profile_size): Delete.
2015-03-31 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (simops.o): New rule.

View File

@ -42,8 +42,6 @@ uint32 sign_flag;
static struct hash_entry *lookup_hash (uint64 ins, int size);
static void get_operands (operand_desc *s, uint64 mcode, int isize, int nops);
extern void sim_set_profile (int n);
extern void sim_set_profile_size (int n);
static INLINE uint8 *map_memory (unsigned phys_addr);
#define MAX_HASH 16

View File

@ -1,3 +1,7 @@
2015-04-01 Mike Frysinger <vapier@gentoo.org>
* interp.c (sim_set_profile, sim_set_profile_size): Delete.
2015-03-31 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (simops.o): New rule.

View File

@ -43,8 +43,6 @@ static void do_long (uint32 ins);
static void do_2_short (uint16 ins1, uint16 ins2, enum _leftright leftright);
static void do_parallel (uint16 ins1, uint16 ins2);
static char *add_commas (char *buf, int sizeof_buf, unsigned long value);
extern void sim_set_profile (int n);
extern void sim_set_profile_size (int n);
static INLINE uint8 *map_memory (unsigned phys_addr);
#define MAX_HASH 63

View File

@ -1,3 +1,7 @@
2015-04-01 Mike Frysinger <vapier@gentoo.org>
* tconfig.h (SIM_HAVE_PROFILE): Delete.
2015-03-31 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.

View File

@ -7,12 +7,6 @@
#define SIM_HANDLES_LMA 0
#endif
/* Define this if the simulator supports profiling.
See the mips simulator for an example.
This enables the `-p foo' and `-s bar' options.
The target is required to provide sim_set_profile{,_size}. */
#define SIM_HAVE_PROFILE
/* Define this if the simulator uses an instruction cache.
See the h8/300 simulator for an example.
This enables the `-c size' option to set the size of the cache.

View File

@ -1,3 +1,7 @@
2015-04-01 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (SIM_HAVE_BIENDIAN): Delete.
2015-03-31 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.

View File

@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
#define SIM_HAVE_BIENDIAN
#include "sim-basics.h"
typedef address_word sim_cia;