static void gdbsim_store_register (int regno) { if (regno == -1) { for (regno = 0; regno < NUM_REGS; regno++) gdbsim_store_register (regno); return; } else if (REGISTER_SIM_REGNO (regno) >= 0) { char tmp[MAX_REGISTER_SIZE]; int nr_bytes; deprecated_read_register_gen (regno, tmp); nr_bytes = sim_store_register (gdbsim_desc, REGISTER_SIM_REGNO (regno), tmp, register_size (current_gdbarch, regno)); if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno)) internal_error (__FILE__, __LINE__, "Register size different to expected"); /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0' indicating that GDB and the SIM have different ideas about which registers are fetchable. */ if (sr_get_debug ()) { printf_filtered ("gdbsim_store_register: %d", regno); /* FIXME: We could print something more intelligible. */ dump_mem (tmp, register_size (current_gdbarch, regno)); } } }
static void gdbsim_store_register (struct target_ops *ops, struct regcache *regcache, int regno) { struct gdbarch *gdbarch = get_regcache_arch (regcache); if (regno == -1) { for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++) gdbsim_store_register (ops, regcache, regno); return; } else if (gdbarch_register_sim_regno (gdbarch, regno) >= 0) { char tmp[MAX_REGISTER_SIZE]; int nr_bytes; regcache_cooked_read (regcache, regno, tmp); nr_bytes = sim_store_register (gdbsim_desc, gdbarch_register_sim_regno (gdbarch, regno), tmp, register_size (gdbarch, regno)); if (nr_bytes > 0 && nr_bytes != register_size (gdbarch, regno)) internal_error (__FILE__, __LINE__, _("Register size different to expected")); /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0' indicating that GDB and the SIM have different ideas about which registers are fetchable. */ if (remote_debug) { printf_filtered ("gdbsim_store_register: %d", regno); /* FIXME: We could print something more intelligible. */ dump_mem (tmp, register_size (gdbarch, regno)); } } }
void store_inferior_registers (int regno) { if (regno == -1) { for (regno = 0; regno < NUM_REGS; regno++) store_inferior_registers (regno); } else sim_store_register (gdbsim_desc, regno, ®isters[REGISTER_BYTE (regno)], REGISTER_RAW_SIZE (regno)); }