+Thu Aug 28 12:09:15 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-base.h (STATE_ARCHITECTURE, STATE_TARGET): Add to simulator
+ base type.
+
+ * sim-options.c (standard_options): Add --architecture=MACHINE and
+ --target=TARGET options.
+ (OPTION_ARCHITECTURE, OPTION_TARGET): Define.
+ (standard_option_handler): Handle architecture and target options.
+ (bfd.h): Include.
+
+ * sim-utils.c (sim_analyze_program): Pass STATE_TARGET to
+ bfd_openr.
+ (sim_analyze_program): Set prog_bfd architecture from
+ STATE_ARCHITECTURE if known.
+
Wed Aug 27 18:13:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
* configure: Regenerated to track ../common/aclocal.m4 changes.
typedef struct _sim_cpu sim_cpu;
#include "sim-module.h"
+
#include "sim-trace.h"
#include "sim-profile.h"
#include "sim-model.h"
#include "sim-core.h"
#include "sim-events.h"
#include "sim-io.h"
+#include "sim-engine.h"
+#include "sim-watch.h"
/* Global pointer to current state while sim_resume is running.
int verbose_p;
#define STATE_VERBOSE_P(sd) ((sd)->base.verbose_p)
+ /* If non NULL, the BFD architecture specified on the command line */
+ const struct bfd_arch_info *architecture;
+#define STATE_ARCHITECTURE(sd) ((sd)->base.architecture)
+
+ /* If non NULL, the bfd target specified on the command line */
+ const char *target;
+#define STATE_TARGET(sd) ((sd)->base.target)
+
/* In standalone simulator, this is the program's arguments passed
on the command line. */
char **prog_argv;
#ifdef SIM_HAVE_FLATMEM
unsigned int mem_size;
#define STATE_MEM_SIZE(sd) ((sd)->base.mem_size)
+ unsigned int mem_base;
+#define STATE_MEM_BASE(sd) ((sd)->base.mem_base)
unsigned char *memory;
#define STATE_MEMORY(sd) ((sd)->base.memory)
#endif
#define STATE_EVENTS(sd) (&(sd)->base.events)
sim_events events;
+ /* generic halt/resume engine */
+ sim_engine engine;
+#define STATE_ENGINE(sd) (&(sd)->base.engine)
+
+ /* generic watchpoint support */
+ sim_watchpoints watchpoints;
+#define STATE_WATCHPOINTS(sd) (&(sd)->base.watchpoints)
+
/* Marker for those wanting to do sanity checks.
This should remain the last member of this struct to help catch
miscompilation errors. */
#define CPU_STATE(cpu) ((cpu)->base.state)
/* Processor specific core data */
-#define CPU_CORE(cpu) (& (cpu)->base.core)
sim_cpu_core core;
+#define CPU_CORE(cpu) (& (cpu)->base.core)
/* Trace data. See sim-trace.h. */
TRACE_DATA trace_data;
#include "sim-io.h"
#include "sim-assert.h"
+#include "bfd.h"
+
/* Add a set of options to the simulator.
TABLE is an array of OPTIONS terminated by a NULL `opt.name' entry.
This is intended to be called by modules in their `install' handler. */
#define OPTION_DEBUG_INSN (OPTION_START + 0)
#define OPTION_DEBUG_FILE (OPTION_START + 1)
#define OPTION_DO_COMMAND (OPTION_START + 2)
+#define OPTION_ARCHITECTURE (OPTION_START + 3)
+#define OPTION_TARGET (OPTION_START + 4)
static const OPTION standard_options[] =
{
'H', NULL, "Print help information",
standard_option_handler },
+ { {"architecture", required_argument, NULL, OPTION_ARCHITECTURE},
+ '\0', "MACHINE", "Specify the architecture to use",
+ standard_option_handler },
+
+ { {"target", required_argument, NULL, OPTION_TARGET},
+ '\0', "BFDNAME", "Specify the object-code format for the object files",
+ standard_option_handler },
+
{ {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL }
};
sim_do_command (sd, arg);
break;
+ case OPTION_ARCHITECTURE:
+ {
+ const struct bfd_arch_info *ap = bfd_scan_arch (arg);
+ if (ap == NULL)
+ {
+ sim_io_eprintf (sd, "Architecture `%s' unknown\n", arg);
+ return SIM_RC_FAIL;
+ }
+ STATE_ARCHITECTURE (sd) = ap;
+ break;
+ }
+
+ case OPTION_TARGET:
+ {
+ STATE_TARGET (sd) = strdup (arg);
+ break;
+ }
+
case 'H':
sim_print_help (sd, is_command);
if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE)
return SIM_RC_OK;
/* open a new copy of the prog_bfd */
- prog_bfd = bfd_openr (prog_name, 0);
+ prog_bfd = bfd_openr (prog_name, STATE_TARGET (sd));
if (prog_bfd == NULL)
{
sim_io_eprintf (sd, "%s: can't open \"%s\": %s\n",
bfd_close (prog_bfd);
return SIM_RC_FAIL;
}
-
+ if (STATE_ARCHITECTURE (sd) != NULL)
+ bfd_set_arch_info (prog_bfd, STATE_ARCHITECTURE (sd));
/* update the sim structure */
if (STATE_PROG_BFD (sd) != NULL)