* [PR tui/13073] unnamed or unavailable registers
@ 2011-08-12 17:17 Pedro Alves
2011-08-12 17:28 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Pedro Alves @ 2011-08-12 17:17 UTC (permalink / raw)
To: gdb-patches
The TUI wasn't handling unnamed registers as the rest of
gdb does, causing PR13073.
(gdb) layout regs
...
(gdb) run
Starting program: /home/wmealing/Documents/workspace/asm/binsearch
Register 57 is not available
Register 57 is not available
<the register window doesn't appear>
This was a latent bug, but now get_frame_register started
throwing an unavailable error if you try to unwind such non
existing register, exposing the bug. While at it, I made tui's
register layout consider unavailable and optimized out registers
when computing if the register changed.
Applied to mainline and to the 7.3 branch (it was a regression
compared to 7.2).
BTW, can we add a "7.3" Version to bugzilla please? Tom?
--
Pedro Alves
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.
---
gdb/tui/tui-regs.c | 56 +++++++++++++++++++++++++++++------------------------
1 file changed, 31 insertions(+), 25 deletions(-)
Index: src/gdb/tui/tui-regs.c
===================================================================
--- src.orig/gdb/tui/tui-regs.c 2011-08-10 18:55:02.042098985 +0100
+++ src/gdb/tui/tui-regs.c 2011-08-10 19:26:36.032098331 +0100
@@ -230,10 +230,19 @@ tui_show_register_group (struct reggroup
+ 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
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
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 *
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 *fra
*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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-12 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-12 17:17 [PR tui/13073] unnamed or unavailable registers Pedro Alves
2011-08-12 17:28 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox