mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 11:39:26 +08:00
* mi/mi-main.c (get_register): Use get_frame_register_value rather
than frame_register, and always pass a valid value to val_print.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2011-01-25 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* mi/mi-main.c (get_register): Use get_frame_register_value rather
|
||||||
|
than frame_register, and always pass a valid value to val_print.
|
||||||
|
|
||||||
2011-01-25 Pedro Alves <pedro@codesourcery.com>
|
2011-01-25 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
Centralize printing "<optimized out>".
|
Centralize printing "<optimized out>".
|
||||||
|
@ -1116,27 +1116,26 @@ static void
|
|||||||
get_register (struct frame_info *frame, int regnum, int format)
|
get_register (struct frame_info *frame, int regnum, int format)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||||
gdb_byte buffer[MAX_REGISTER_SIZE];
|
|
||||||
int optim;
|
|
||||||
int realnum;
|
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
enum lval_type lval;
|
enum lval_type lval;
|
||||||
static struct ui_stream *stb = NULL;
|
static struct ui_stream *stb = NULL;
|
||||||
|
struct value *val;
|
||||||
|
|
||||||
stb = ui_out_stream_new (uiout);
|
stb = ui_out_stream_new (uiout);
|
||||||
|
|
||||||
if (format == 'N')
|
if (format == 'N')
|
||||||
format = 0;
|
format = 0;
|
||||||
|
|
||||||
frame_register (frame, regnum, &optim, &lval, &addr, &realnum, buffer);
|
val = get_frame_register_value (frame, regnum);
|
||||||
|
|
||||||
if (optim)
|
if (value_optimized_out (val))
|
||||||
error ("Optimized out");
|
error ("Optimized out");
|
||||||
|
|
||||||
if (format == 'r')
|
if (format == 'r')
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
char *ptr, buf[1024];
|
char *ptr, buf[1024];
|
||||||
|
const gdb_byte *valaddr = value_contents_for_printing (val);
|
||||||
|
|
||||||
strcpy (buf, "0x");
|
strcpy (buf, "0x");
|
||||||
ptr = buf + 2;
|
ptr = buf + 2;
|
||||||
@ -1145,7 +1144,7 @@ get_register (struct frame_info *frame, int regnum, int format)
|
|||||||
int idx = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ?
|
int idx = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ?
|
||||||
j : register_size (gdbarch, regnum) - 1 - j;
|
j : register_size (gdbarch, regnum) - 1 - j;
|
||||||
|
|
||||||
sprintf (ptr, "%02x", (unsigned char) buffer[idx]);
|
sprintf (ptr, "%02x", (unsigned char) valaddr[idx]);
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
}
|
}
|
||||||
ui_out_field_string (uiout, "value", buf);
|
ui_out_field_string (uiout, "value", buf);
|
||||||
@ -1157,8 +1156,10 @@ get_register (struct frame_info *frame, int regnum, int format)
|
|||||||
|
|
||||||
get_formatted_print_options (&opts, format);
|
get_formatted_print_options (&opts, format);
|
||||||
opts.deref_ref = 1;
|
opts.deref_ref = 1;
|
||||||
val_print (register_type (gdbarch, regnum), buffer, 0, 0,
|
val_print (value_type (val),
|
||||||
stb->stream, 0, NULL, &opts, current_language);
|
value_contents_for_printing (val),
|
||||||
|
value_embedded_offset (val), 0,
|
||||||
|
stb->stream, 0, val, &opts, current_language);
|
||||||
ui_out_field_stream (uiout, "value", stb);
|
ui_out_field_stream (uiout, "value", stb);
|
||||||
ui_out_stream_delete (stb);
|
ui_out_stream_delete (stb);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user