aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-07-12 11:15:22 +0000
committerJason Molenda <jmolenda@apple.com>1999-07-12 11:15:22 +0000
commit43e526b9b4c9868d3cd90772a54f767f8d45cadd (patch)
tree4d68a4a2d3a6c7e4f6237bc04015fc182a8ced0c /sim/common
parentedac9bffc154855d959fcbc32e2fe0b073a9ec71 (diff)
downloadgdb-43e526b9b4c9868d3cd90772a54f767f8d45cadd.zip
gdb-43e526b9b4c9868d3cd90772a54f767f8d45cadd.tar.gz
gdb-43e526b9b4c9868d3cd90772a54f767f8d45cadd.tar.bz2
import gdb-1999-07-12 snapshot
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog23
-rw-r--r--sim/common/nltvals.def24
-rw-r--r--sim/common/nrun.c49
-rw-r--r--sim/common/sim-base.h5
-rw-r--r--sim/common/sim-hload.c10
-rw-r--r--sim/common/sim-options.c30
-rw-r--r--sim/common/sim-resume.c5
7 files changed, 91 insertions, 55 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 5f702b0..3c6a9f0 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,26 @@
+Sun Jul 11 23:47:20 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-resume.c (sim_resume): Ensure that the siggnal [sic] is only
+ passed in when sim_resume is first entered - don't re-pass it
+ after a restart.
+
+Sun Jul 11 23:34:44 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-options.c (standard_option_handler): Add OPTION_LOAD_VMA and
+ OPTION_LOAD_LMA but only when is defined.
+ (standard_options): When SIM_HANDLES_LMA is defined include
+ options --load-lma and --load-vma.
+ (standard_install): Initialize STATE_LOAD_AT_LMA_P.
+
+ * sim-base.h (STATE_LOAD_AT_LMA_P): Define.
+ (struct sim_state_base): Add load_at_lma_p.
+ * sim-hload.c (sim_load): Replace SIM_HANDLES_LMA with
+ STATE_LOAD_AT_LMA_P.
+
+Sun Jul 11 12:03:36 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * nrun.c (main): Re-format loop gnu style.
+
Wed Jul 7 19:56:03 1999 Andrew Cagney <cagney@b1.cygnus.com>
* dv-sockser.c (connected_p): Initialize addrlen.
diff --git a/sim/common/nltvals.def b/sim/common/nltvals.def
index bed711c..b5e82fc 100644
--- a/sim/common/nltvals.def
+++ b/sim/common/nltvals.def
@@ -416,27 +416,3 @@
/* end v850 sys target macros */
#endif
#endif
-#ifdef NL_TARGET_venus
-#ifdef sys_defs
-/* from syscall.h */
-/* begin venus sys target macros */
- { "SYS_argv", 13 },
- { "SYS_argvlen", 12 },
- { "SYS_chdir", 14 },
- { "SYS_chmod", 16 },
- { "SYS_close", 3 },
- { "SYS_exit", 1 },
- { "SYS_fstat", 10 },
- { "SYS_getpid", 8 },
- { "SYS_kill", 9 },
- { "SYS_lseek", 6 },
- { "SYS_open", 2 },
- { "SYS_read", 4 },
- { "SYS_stat", 15 },
- { "SYS_time", 18 },
- { "SYS_unlink", 7 },
- { "SYS_utime", 17 },
- { "SYS_write", 5 },
-/* end venus sys target macros */
-#endif
-#endif
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 2f13b1f..c5b43a2 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -137,41 +137,44 @@ main (int argc, char **argv)
((reason == sim_stopped) &&
(STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT)));
}
- else do
+ else
{
+ do
+ {
#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
- struct sigaction sa, osa;
- sa.sa_handler = cntrl_c;
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = 0;
- sigaction (SIGINT, &sa, &osa);
- prev_sigint = osa.sa_handler;
+ struct sigaction sa, osa;
+ sa.sa_handler = cntrl_c;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction (SIGINT, &sa, &osa);
+ prev_sigint = osa.sa_handler;
#else
- prev_sigint = signal (SIGINT, cntrl_c);
+ prev_sigint = signal (SIGINT, cntrl_c);
#endif
- sim_resume (sd, 0, sigrc);
- signal (SIGINT, prev_sigint);
- sim_stop_reason (sd, &reason, &sigrc);
-
- if ((reason == sim_stopped) &&
- (sigrc == sim_signal_to_host (sd, SIM_SIGINT)))
- break; /* exit on control-C */
-
- /* remain on signals in oe mode */
- } while ((reason == sim_stopped) &&
- (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT));
-
+ sim_resume (sd, 0, sigrc);
+ signal (SIGINT, prev_sigint);
+ sim_stop_reason (sd, &reason, &sigrc);
+
+ if ((reason == sim_stopped) &&
+ (sigrc == sim_signal_to_host (sd, SIM_SIGINT)))
+ break; /* exit on control-C */
+
+ /* remain on signals in oe mode */
+ } while ((reason == sim_stopped) &&
+ (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT));
+
+ }
/* Print any stats the simulator collected. */
sim_info (sd, 0);
-
+
/* Shutdown the simulator. */
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. */
-
+
#ifdef SIM_H8300 /* FIXME: Ugh. grep for SLEEP in compile.c */
if (sigrc == SIGILL)
abort ();
diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
index 3fe01b4..f3af305 100644
--- a/sim/common/sim-base.h
+++ b/sim/common/sim-base.h
@@ -237,6 +237,11 @@ typedef struct {
#endif
+ /* Should image loads be performed using the LMA or VMA? Older
+ simulators use the VMA while newer simulators prefer the LMA. */
+ int load_at_lma_p;
+#define STATE_LOAD_AT_LMA_P(SD) ((SD)->base.load_at_lma_p)
+
/* Marker for those wanting to do sanity checks.
This should remain the last member of this struct to help catch
miscompilation errors. */
diff --git a/sim/common/sim-hload.c b/sim/common/sim-hload.c
index e4016f4..b8726ba 100644
--- a/sim/common/sim-hload.c
+++ b/sim/common/sim-hload.c
@@ -45,20 +45,14 @@ sim_load (sd, prog_name, prog_bfd, from_tty)
incorrectly write the program sections at LMA interpreted as a
virtual address. This is still accommodated for backward
compatibility reasons. */
- /* FIXME: The following simulators use this file as of 980313:
- m32r, mips, v850 [grep for sim-hload in all Makefile.in's].
- Each of these should be properly using lma. When this is confirmed,
- SIM_HANDLES_LMA can go away. */
-#ifndef SIM_HANDLES_LMA
-#define SIM_HANDLES_LMA 0
-#endif
result_bfd = sim_load_file (sd, STATE_MY_NAME (sd),
STATE_CALLBACK (sd),
prog_name,
STATE_PROG_BFD (sd),
STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG,
- SIM_HANDLES_LMA, sim_write);
+ STATE_LOAD_AT_LMA_P (sd),
+ sim_write);
if (result_bfd == NULL)
{
bfd_close (STATE_PROG_BFD (sd));
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index b49256b..8d0f923 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -111,6 +111,8 @@ typedef enum {
#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */
OPTION_H8300,
#endif
+ OPTION_LOAD_LMA,
+ OPTION_LOAD_VMA,
} STANDARD_OPTIONS;
static const OPTION standard_options[] =
@@ -182,6 +184,19 @@ static const OPTION standard_options[] =
'\0', "BFDNAME", "Specify the object-code format for the object files",
standard_option_handler },
+#ifdef SIM_HANDLES_LMA
+ { {"load-lma", no_argument, NULL, OPTION_LOAD_LMA},
+ '\0', NULL,
+#if SIM_HANDLES_LMA
+ "Use VMA or LMA addresses when loading image (default LMA)",
+#else
+ "Use VMA or LMA addresses when loading image (default VMA)",
+#endif
+ standard_option_handler, "load-{lma,vma}" },
+ { {"load-vma", no_argument, NULL, OPTION_LOAD_VMA},
+ '\0', NULL, "", standard_option_handler, "" },
+#endif
+
{ {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL }
};
@@ -394,6 +409,18 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
break;
}
+ case OPTION_LOAD_LMA:
+ {
+ STATE_LOAD_AT_LMA_P (sd) = 1;
+ break;
+ }
+
+ case OPTION_LOAD_VMA:
+ {
+ STATE_LOAD_AT_LMA_P (sd) = 0;
+ break;
+ }
+
case OPTION_HELP:
sim_print_help (sd, is_command);
if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE)
@@ -413,6 +440,9 @@ standard_install (SIM_DESC sd)
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
if (sim_add_option_table (sd, NULL, standard_options) != SIM_RC_OK)
return SIM_RC_FAIL;
+#ifdef SIM_HANDLES_LMA
+ STATE_LOAD_AT_LMA_P (sd) = SIM_HANDLES_LMA;
+#endif
return SIM_RC_OK;
}
diff --git a/sim/common/sim-resume.c b/sim/common/sim-resume.c
index 09b475e..8cf75d5 100644
--- a/sim/common/sim-resume.c
+++ b/sim/common/sim-resume.c
@@ -70,6 +70,11 @@ sim_resume (SIM_DESC sd,
if (next_cpu_nr >= nr_cpus)
next_cpu_nr = 0;
+ /* Only deliver the siggnal ]sic] the first time through - don't
+ re-deliver any siggnal during a restart. */
+ if (jmpval == sim_engine_restart_jmpval)
+ siggnal = 0;
+
#ifdef SIM_CPU_EXCEPTION_RESUME
{
sim_cpu* cpu = STATE_CPU (sd, next_cpu_nr);