struct tui_data_element *data,
int regnum, int *changedp);
-static void tui_register_format (struct frame_info *,
- struct tui_data_element*, int);
-
static void tui_scroll_regs_forward_command (char *, int);
static void tui_scroll_regs_backward_command (char *, int);
pagination_enabled = 1;
}
-/* Get the register from the frame and make a printable representation
- of it in the data element. */
-static void
-tui_register_format (struct frame_info *frame,
- struct tui_data_element *data_element,
- int regnum)
+/* Get the register from the frame and return a printable
+ representation of it. */
+
+static char *
+tui_register_format (struct frame_info *frame, int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct ui_file *stream;
struct ui_file *old_stdout;
- const char *name;
struct cleanup *cleanups;
char *p, *s;
-
- name = gdbarch_register_name (gdbarch, regnum);
- if (name == 0 || *name == '\0')
- return;
+ char *ret;
pagination_enabled = 0;
old_stdout = gdb_stdout;
if (s && s[1] == 0)
*s = 0;
- xfree (data_element->content);
- data_element->content = xstrdup (p);
+ ret = xstrdup (p);
do_cleanups (cleanups);
+
+ return ret;
}
/* Get the register value from the given frame and format it for the
*changedp = FALSE;
if (target_has_registers)
{
- struct value *old_val = data->value;
+ char *prev_content = data->content;
- data->value = get_frame_register_value (frame, regnum);
- release_value (data->value);
- if (changedp)
- {
- struct gdbarch *gdbarch = get_frame_arch (frame);
- int size = register_size (gdbarch, regnum);
-
- /* We only know whether a value chunk is available if we've
- tried to read it. */
- if (value_lazy (data->value))
- value_fetch_lazy (data->value);
- if (value_lazy (old_val))
- value_fetch_lazy (old_val);
-
- if (value_optimized_out (data->value) != value_optimized_out (old_val)
- || !value_available_contents_eq (data->value, 0,
- old_val, 0, size))
- *changedp = TRUE;
- }
+ data->content = tui_register_format (frame, regnum);
- value_free (old_val);
+ if (changedp != NULL
+ && strcmp (prev_content, data->content) != 0)
+ *changedp = 1;
- /* Reformat the data content if the value changed. */
- if (changedp == 0 || *changedp == TRUE)
- tui_register_format (frame, data, regnum);
+ xfree (prev_content);
ret = TUI_SUCCESS;
}