aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-08-12 17:04:32 +0000
committerPedro Alves <palves@redhat.com>2011-08-12 17:04:32 +0000
commitd20c1c3feaf11ec83a0cc70226444a0be9533ff9 (patch)
tree653adcfc114ed829432171be460843ecc3da0559 /gdb/tui
parent5d0bb2fbbca461e1b3041111378c962949c05050 (diff)
downloadgdb-d20c1c3feaf11ec83a0cc70226444a0be9533ff9.zip
gdb-d20c1c3feaf11ec83a0cc70226444a0be9533ff9.tar.gz
gdb-d20c1c3feaf11ec83a0cc70226444a0be9533ff9.tar.bz2
2011-08-12 Pedro Alves <pedro@codesourcery.com>
PR tui/13073 gdb/ * tui/tui-regs.c (tui_show_register_group): Skip registers with an empty name. (tui_show_register_group): Don't store a byte buffer in the data element's value. (tui_register_format): Skip registers with an empty name. (tui_get_register): Store a struct value in the data element's value field instead of a byte buffer holding the raw register contents. Account for optimized-out and unavailable registers when comparing register contents.
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-regs.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index b0d8622..2b09358 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -230,10 +230,19 @@ tui_show_register_group (struct reggroup *group,
+ gdbarch_num_pseudo_regs (gdbarch);
regnum++)
{
- /* Must be in the group and have a name. */
- if (gdbarch_register_reggroup_p (gdbarch, regnum, group)
- && gdbarch_register_name (gdbarch, regnum) != 0)
- nr_regs++;
+ const char *name;
+
+ /* Must be in the group. */
+ if (!gdbarch_register_reggroup_p (gdbarch, regnum, group))
+ continue;
+
+ /* If the register name is empty, it is undefined for this
+ processor, so don't display anything. */
+ name = gdbarch_register_name (gdbarch, regnum);
+ if (name == 0 || *name == '\0')
+ continue;
+
+ nr_regs++;
}
if (display_info->regs_content_count > 0 && !refresh_values_only)
@@ -273,12 +282,15 @@ tui_show_register_group (struct reggroup *group,
struct tui_data_element *data;
const char *name;
+ /* Must be in the group. */
if (!gdbarch_register_reggroup_p (gdbarch, regnum, group))
continue;
- name = gdbarch_register_name (gdbarch, regnum);
- if (name == 0)
- continue;
+ /* If the register name is empty, it is undefined for this
+ processor, so don't display anything. */
+ name = gdbarch_register_name (gdbarch, regnum);
+ if (name == 0 || *name == '\0')
+ continue;
data_item_win =
&display_info->regs_content[pos]->which_element.data_window;
@@ -292,9 +304,6 @@ tui_show_register_group (struct reggroup *group,
data->name = name;
data->highlight = FALSE;
}
- if (data->value == (void*) NULL)
- data->value = (void*) xmalloc (MAX_REGISTER_SIZE);
-
tui_get_register (frame, data, regnum, 0);
}
pos++;
@@ -691,11 +700,9 @@ tui_register_format (struct frame_info *frame,
char *p, *s;
name = gdbarch_register_name (gdbarch, regnum);
- if (name == 0)
- {
- return;
- }
-
+ if (name == 0 || *name == '\0')
+ return;
+
pagination_enabled = 0;
old_stdout = gdb_stdout;
stream = tui_sfileopen (256);
@@ -730,24 +737,23 @@ tui_get_register (struct frame_info *frame,
*changedp = FALSE;
if (target_has_registers)
{
- gdb_byte buf[MAX_REGISTER_SIZE];
+ struct value *old_val = data->value;
- get_frame_register (frame, regnum, buf);
+ 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);
- char *old = (char*) data->value;
- int i;
- for (i = 0; i < size; i++)
- if (buf[i] != old[i])
- {
- *changedp = TRUE;
- old[i] = buf[i];
- }
+ if (value_optimized_out (data->value) != value_optimized_out (old_val)
+ || !value_available_contents_eq (data->value, 0,
+ old_val, 0, size))
+ *changedp = TRUE;
}
+ value_free (old_val);
+
/* Reformat the data content if the value changed. */
if (changedp == 0 || *changedp == TRUE)
tui_register_format (frame, data, regnum);