static void
gdbsim_fetch_register (regno)
-int regno;
+ int regno;
{
+ static int warn_user = 1;
if (regno == -1)
{
for (regno = 0; regno < NUM_REGS; regno++)
gdbsim_fetch_register (regno);
}
- else
+ else if (reg_names[regno] != NULL && *reg_names[regno] != '\0')
{
char buf[MAX_REGISTER_RAW_SIZE];
-
- sim_fetch_register (gdbsim_desc, regno, buf);
+ int nr_bytes = sim_fetch_register (gdbsim_desc, regno, buf, REGISTER_RAW_SIZE (regno));
+ if (nr_bytes == 0)
+ /* register not applicable, supply zero's */
+ memset (buf, 0, MAX_REGISTER_RAW_SIZE);
+ else if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno)
+ && warn_user)
+ {
+ printf_unfiltered ("Size of register %s (%d) incorrect (%d instead of %d))",
+ reg_names [regno], regno,
+ nr_bytes, REGISTER_RAW_SIZE (regno));
+ warn_user = 0;
+ }
supply_register (regno, buf);
if (sr_get_debug ())
{
static void
gdbsim_store_register (regno)
-int regno;
+ int regno;
{
if (regno == -1)
{
for (regno = 0; regno < NUM_REGS; regno++)
gdbsim_store_register (regno);
}
- else
+ else if (reg_names[regno] != NULL && *reg_names[regno] != '\0')
{
- /* FIXME: Until read_register() returns LONGEST, we have this. */
char tmp[MAX_REGISTER_RAW_SIZE];
+ int nr_bytes;
read_register_gen (regno, tmp);
- sim_store_register (gdbsim_desc, regno, tmp);
+ nr_bytes = sim_store_register (gdbsim_desc, regno, tmp, REGISTER_RAW_SIZE (regno));
+ if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno))
+ fatal ("Register size different to expected");
if (sr_get_debug ())
{
printf_filtered ("gdbsim_store_register: %d", regno);
inferior_pid = 42;
insert_breakpoints (); /* Needed to get correct instruction in cache */
+ clear_proceed_status ();
+
/* NB: Entry point already set by sim_create_inferior. */
proceed ((CORE_ADDR)-1, TARGET_SIGNAL_DEFAULT, 0);
}
len = (7 + 1 /* gdbsim */
+ strlen (" -E little")
- + strlen (" --arch=xxxxxxxxxx")
+ + strlen (" --architecture=xxxxxxxxxx")
+ (args ? strlen (args) : 0)
+ 50) /* slack */;
arg_buf = (char *) alloca (len);
explicitly specified */
if (!target_architecture_auto)
{
- strcat (arg_buf, " --arch=");
+ strcat (arg_buf, " --architecture=");
strcat (arg_buf, target_architecture->printable_name);
}
/* finally, any explicit args */
just as `wait' would. */
static void
-gdbsim_cntrl_c (int signo)
+gdbsim_cntrl_c (signo)
+ int signo;
{
gdbsim_stop ();
}
if (sr_get_debug ())
printf_filtered ("gdbsim_wait\n");
+#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
+ {
+ struct sigaction sa, osa;
+ sa.sa_handler = gdbsim_cntrl_c;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction (SIGINT, &sa, &osa);
+ prev_sigint = osa.sa_handler;
+ }
+#else
prev_sigint = signal (SIGINT, gdbsim_cntrl_c);
+#endif
sim_resume (gdbsim_desc, resume_step,
target_signal_to_host (resume_siggnal));
signal (SIGINT, prev_sigint);