char **argv, int argc);
static int register_changed_p (int regnum, struct regcache *,
struct regcache *);
-static void get_register (int regnum, int format);
+static void get_register (struct frame_info *, int regnum, int format);
/* Command implementations. FIXME: Is this libgdb? No. This is the MI
layer that calls libgdb. Any operation used in the below should be
void
mi_cmd_data_list_register_names (char *command, char **argv, int argc)
{
+ struct frame_info *frame;
+ struct gdbarch *gdbarch;
int regnum, numregs;
int i;
struct cleanup *cleanup;
In this case, some entries of gdbarch_register_name will change depending
upon the particular processor being debugged. */
- numregs = gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch);
+ frame = get_selected_frame (NULL);
+ gdbarch = get_frame_arch (frame);
+ numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-names");
regnum < numregs;
regnum++)
{
- if (gdbarch_register_name (current_gdbarch, regnum) == NULL
- || *(gdbarch_register_name (current_gdbarch, regnum)) == '\0')
+ if (gdbarch_register_name (gdbarch, regnum) == NULL
+ || *(gdbarch_register_name (gdbarch, regnum)) == '\0')
ui_out_field_string (uiout, NULL, "");
else
ui_out_field_string (uiout, NULL,
- gdbarch_register_name
- (current_gdbarch, regnum));
+ gdbarch_register_name (gdbarch, regnum));
}
}
if (regnum < 0 || regnum >= numregs)
error ("bad register number");
- if (gdbarch_register_name (current_gdbarch, regnum) == NULL
- || *(gdbarch_register_name (current_gdbarch, regnum)) == '\0')
+ if (gdbarch_register_name (gdbarch, regnum) == NULL
+ || *(gdbarch_register_name (gdbarch, regnum)) == '\0')
ui_out_field_string (uiout, NULL, "");
else
ui_out_field_string (uiout, NULL,
- gdbarch_register_name (current_gdbarch, regnum));
+ gdbarch_register_name (gdbarch, regnum));
}
do_cleanups (cleanup);
}
{
static struct regcache *this_regs = NULL;
struct regcache *prev_regs;
+ struct gdbarch *gdbarch;
int regnum, numregs, changed;
int i;
struct cleanup *cleanup;
In this case, some entries of gdbarch_register_name will change depending
upon the particular processor being debugged. */
- numregs = gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch);
+ gdbarch = get_regcache_arch (this_regs);
+ numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
make_cleanup_ui_out_list_begin_end (uiout, "changed-registers");
regnum < numregs;
regnum++)
{
- if (gdbarch_register_name (current_gdbarch, regnum) == NULL
- || *(gdbarch_register_name (current_gdbarch, regnum)) == '\0')
+ if (gdbarch_register_name (gdbarch, regnum) == NULL
+ || *(gdbarch_register_name (gdbarch, regnum)) == '\0')
continue;
changed = register_changed_p (regnum, prev_regs, this_regs);
if (changed < 0)
if (regnum >= 0
&& regnum < numregs
- && gdbarch_register_name (current_gdbarch, regnum) != NULL
- && *gdbarch_register_name (current_gdbarch, regnum) != '\000')
+ && gdbarch_register_name (gdbarch, regnum) != NULL
+ && *gdbarch_register_name (gdbarch, regnum) != '\000')
{
changed = register_changed_p (regnum, prev_regs, this_regs);
if (changed < 0)
void
mi_cmd_data_list_register_values (char *command, char **argv, int argc)
{
+ struct frame_info *frame;
+ struct gdbarch *gdbarch;
int regnum, numregs, format;
int i;
struct cleanup *list_cleanup, *tuple_cleanup;
In this case, some entries of gdbarch_register_name will change depending
upon the particular processor being debugged. */
- numregs = gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch);
-
if (argc == 0)
error ("mi_cmd_data_list_register_values: Usage: -data-list-register-values <format> [<regnum1>...<regnumN>]");
format = (int) argv[0][0];
+ frame = get_selected_frame (NULL);
+ gdbarch = get_frame_arch (frame);
+ numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
+
list_cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-values");
if (argc == 1) /* No args, beside the format: do all the regs. */
regnum < numregs;
regnum++)
{
- if (gdbarch_register_name (current_gdbarch, regnum) == NULL
- || *(gdbarch_register_name (current_gdbarch, regnum)) == '\0')
+ if (gdbarch_register_name (gdbarch, regnum) == NULL
+ || *(gdbarch_register_name (gdbarch, regnum)) == '\0')
continue;
tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_int (uiout, "number", regnum);
- get_register (regnum, format);
+ get_register (frame, regnum, format);
do_cleanups (tuple_cleanup);
}
}
if (regnum >= 0
&& regnum < numregs
- && gdbarch_register_name (current_gdbarch, regnum) != NULL
- && *gdbarch_register_name (current_gdbarch, regnum) != '\000')
+ && gdbarch_register_name (gdbarch, regnum) != NULL
+ && *gdbarch_register_name (gdbarch, regnum) != '\000')
{
tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_int (uiout, "number", regnum);
- get_register (regnum, format);
+ get_register (frame, regnum, format);
do_cleanups (tuple_cleanup);
}
else
/* Output one register's contents in the desired format. */
static void
-get_register (int regnum, int format)
+get_register (struct frame_info *frame, int regnum, int format)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte buffer[MAX_REGISTER_SIZE];
int optim;
int realnum;
if (format == 'N')
format = 0;
- frame_register (get_selected_frame (NULL), regnum, &optim, &lval, &addr,
- &realnum, buffer);
+ frame_register (frame, regnum, &optim, &lval, &addr, &realnum, buffer);
if (optim)
error ("Optimized out");
strcpy (buf, "0x");
ptr = buf + 2;
- for (j = 0; j < register_size (current_gdbarch, regnum); j++)
+ for (j = 0; j < register_size (gdbarch, regnum); j++)
{
- int idx = gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG ? j
- : register_size (current_gdbarch, regnum) - 1 - j;
+ int idx = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ?
+ j : register_size (gdbarch, regnum) - 1 - j;
sprintf (ptr, "%02x", (unsigned char) buffer[idx]);
ptr += 2;
}
struct value_print_options opts;
get_formatted_print_options (&opts, format);
opts.deref_ref = 1;
- val_print (register_type (current_gdbarch, regnum), buffer, 0, 0,
+ val_print (register_type (gdbarch, regnum), buffer, 0, 0,
stb->stream, 0, &opts, current_language);
ui_out_field_stream (uiout, "value", stb);
ui_out_stream_delete (stb);
void
mi_cmd_data_write_register_values (char *command, char **argv, int argc)
{
+ struct regcache *regcache;
+ struct gdbarch *gdbarch;
int numregs, i;
char format;
In this case, some entries of gdbarch_register_name will change depending
upon the particular processor being debugged. */
- numregs = gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch);
+ regcache = get_current_regcache ();
+ gdbarch = get_regcache_arch (regcache);
+ numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
if (argc == 0)
error ("mi_cmd_data_write_register_values: Usage: -data-write-register-values <format> [<regnum1> <value1>...<regnumN> <valueN>]");
int regnum = atoi (argv[i]);
if (regnum >= 0 && regnum < numregs
- && gdbarch_register_name (current_gdbarch, regnum)
- && *gdbarch_register_name (current_gdbarch, regnum))
+ && gdbarch_register_name (gdbarch, regnum)
+ && *gdbarch_register_name (gdbarch, regnum))
{
LONGEST value;
value = parse_and_eval_address (argv[i + 1]);
/* Write it down. */
- regcache_cooked_write_signed (get_current_regcache (), regnum, value);
+ regcache_cooked_write_signed (regcache, regnum, value);
}
else
error ("bad register number");