aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-08-28 09:44:42 +0000
committerAndrew Cagney <cagney@redhat.com>1997-08-28 09:44:42 +0000
commit18c319ae59d5d09bbb31a90b97b8dc03c1761014 (patch)
treed29718d6a31bb9ea8d7dc60b3ae94f3c255e815b /sim
parent88117054103306a68d7879d6f5534bb49a0cffa8 (diff)
downloadgdb-18c319ae59d5d09bbb31a90b97b8dc03c1761014.zip
gdb-18c319ae59d5d09bbb31a90b97b8dc03c1761014.tar.gz
gdb-18c319ae59d5d09bbb31a90b97b8dc03c1761014.tar.bz2
Add --target=BFDTARGET and --architecture=MACHINE options.
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog16
-rw-r--r--sim/common/sim-base.h23
-rw-r--r--sim/common/sim-options.c30
-rw-r--r--sim/common/sim-utils.c5
4 files changed, 71 insertions, 3 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 2c0b780..03efafe 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,19 @@
+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.
diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
index ffbdc16..b21c397 100644
--- a/sim/common/sim-base.h
+++ b/sim/common/sim-base.h
@@ -67,12 +67,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
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.
@@ -138,6 +141,14 @@ typedef struct {
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;
@@ -171,6 +182,8 @@ typedef struct {
#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
@@ -183,6 +196,14 @@ typedef struct {
#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. */
@@ -202,8 +223,8 @@ typedef struct {
#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;
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 8ed5f63..8ace37a 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -36,6 +36,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#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. */
@@ -84,6 +86,8 @@ static DECLARE_OPTION_HANDLER (standard_option_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[] =
{
@@ -127,6 +131,14 @@ 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 }
};
@@ -238,6 +250,24 @@ standard_option_handler (sd, opt, arg, is_command)
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)
diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index a0b582d..b62317ce 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -174,7 +174,7 @@ sim_analyze_program (sd, prog_name, prog_bfd)
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",
@@ -192,7 +192,8 @@ sim_analyze_program (sd, prog_name, prog_bfd)
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)