gdb: Add 'tui reg prev' command.
There is already a 'tui reg next' command, this adds a symmetric 'tui reg prev' command. gdb/ChangeLog: * tui/tui-regs.c (tui_reg_prev_command): New function. (_initialize_tui_regs): Add 'prev' command for 'tui reg'. * reggroups.c (reggroup_prev): New function. * reggroups.h (reggroup_prev): Add declaration. Update comment. gdb/doc/ChangeLog: * gdb.texinfo (TUI Commands): Add 'tui reg prev' details.
This commit is contained in:
parent
7e16ef3474
commit
55b4002792
6 changed files with 78 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2015-05-26 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
|
* tui/tui-regs.c (tui_reg_prev_command): New function.
|
||||||
|
(_initialize_tui_regs): Add 'prev' command for 'tui reg'.
|
||||||
|
* reggroups.c (reggroup_prev): New function.
|
||||||
|
* reggroups.h (reggroup_prev): Add declaration. Update comment.
|
||||||
|
|
||||||
2015-05-26 Omair Javaid <omair.javaid@linaro.org>
|
2015-05-26 Omair Javaid <omair.javaid@linaro.org>
|
||||||
Yao Qi <yao.qi@linaro.org>
|
Yao Qi <yao.qi@linaro.org>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2015-05-26 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
|
* gdb.texinfo (TUI Commands): Add 'tui reg prev' details.
|
||||||
|
|
||||||
2015-05-22 Andrew Burgess <andrew.burgess@embecosm.com>
|
2015-05-22 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
* gdb.texinfo (TUI): Include 'tui enable' in the introduction.
|
* gdb.texinfo (TUI): Include 'tui enable' in the introduction.
|
||||||
|
|
|
@ -25014,6 +25014,12 @@ their order is target specific. The predefined register groups are the
|
||||||
following: @code{general}, @code{float}, @code{system}, @code{vector},
|
following: @code{general}, @code{float}, @code{system}, @code{vector},
|
||||||
@code{all}, @code{save}, @code{restore}.
|
@code{all}, @code{save}, @code{restore}.
|
||||||
|
|
||||||
|
@item tui reg prev
|
||||||
|
Show the previous register group. The list of register groups as well
|
||||||
|
as their order is target specific. The predefined register groups are
|
||||||
|
the following: @code{general}, @code{float}, @code{system},
|
||||||
|
@code{vector}, @code{all}, @code{save}, @code{restore}.
|
||||||
|
|
||||||
@item tui reg system
|
@item tui reg system
|
||||||
Show the system registers in the register window.
|
Show the system registers in the register window.
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,35 @@ reggroup_next (struct gdbarch *gdbarch, struct reggroup *last)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See reggroups.h. */
|
||||||
|
|
||||||
|
struct reggroup *
|
||||||
|
reggroup_prev (struct gdbarch *gdbarch, struct reggroup *curr)
|
||||||
|
{
|
||||||
|
struct reggroups *groups;
|
||||||
|
struct reggroup_el *el;
|
||||||
|
struct reggroup *prev;
|
||||||
|
|
||||||
|
/* Don't allow this function to be called during architecture
|
||||||
|
creation. If there are no groups, use the default groups list. */
|
||||||
|
groups = gdbarch_data (gdbarch, reggroups_data);
|
||||||
|
gdb_assert (groups != NULL);
|
||||||
|
if (groups->first == NULL)
|
||||||
|
groups = &default_groups;
|
||||||
|
|
||||||
|
prev = NULL;
|
||||||
|
for (el = groups->first; el != NULL; el = el->next)
|
||||||
|
{
|
||||||
|
gdb_assert (el->group != NULL);
|
||||||
|
if (el->group == curr)
|
||||||
|
return prev;
|
||||||
|
prev = el->group;
|
||||||
|
}
|
||||||
|
if (curr == NULL)
|
||||||
|
return prev;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Is REGNUM a member of REGGROUP? */
|
/* Is REGNUM a member of REGGROUP? */
|
||||||
int
|
int
|
||||||
default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
||||||
|
|
|
@ -49,11 +49,14 @@ extern void reggroup_add (struct gdbarch *gdbarch, struct reggroup *group);
|
||||||
extern const char *reggroup_name (struct reggroup *reggroup);
|
extern const char *reggroup_name (struct reggroup *reggroup);
|
||||||
extern enum reggroup_type reggroup_type (struct reggroup *reggroup);
|
extern enum reggroup_type reggroup_type (struct reggroup *reggroup);
|
||||||
|
|
||||||
/* Interator for the architecture's register groups. Pass in NULL,
|
/* Iterators for the architecture's register groups. Pass in NULL, returns
|
||||||
returns the first group. Pass in a group, returns the next group,
|
the first (for next), or last (for prev) group. Pass in a group,
|
||||||
or NULL when the last group is reached. */
|
returns the next or previous group, or NULL when either the end or the
|
||||||
|
beginning of the group list is reached. */
|
||||||
extern struct reggroup *reggroup_next (struct gdbarch *gdbarch,
|
extern struct reggroup *reggroup_next (struct gdbarch *gdbarch,
|
||||||
struct reggroup *last);
|
struct reggroup *last);
|
||||||
|
extern struct reggroup *reggroup_prev (struct gdbarch *gdbarch,
|
||||||
|
struct reggroup *curr);
|
||||||
|
|
||||||
/* Is REGNUM a member of REGGROUP? */
|
/* Is REGNUM a member of REGGROUP? */
|
||||||
extern int default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
extern int default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
||||||
|
|
|
@ -575,6 +575,29 @@ tui_reg_next_command (char *arg, int from_tty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Implementation of the "tui reg prev" command. Cycle the register group
|
||||||
|
displayed in the tui REG window, moving backwards through the list of
|
||||||
|
available register groups. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
tui_reg_prev_command (char *arg, int from_tty)
|
||||||
|
{
|
||||||
|
struct gdbarch *gdbarch = get_current_arch ();
|
||||||
|
|
||||||
|
if (TUI_DATA_WIN != NULL)
|
||||||
|
{
|
||||||
|
struct reggroup *group
|
||||||
|
= TUI_DATA_WIN->detail.data_display_info.current_group;
|
||||||
|
|
||||||
|
group = reggroup_prev (gdbarch, group);
|
||||||
|
if (group == NULL)
|
||||||
|
group = reggroup_prev (gdbarch, NULL);
|
||||||
|
|
||||||
|
if (group != NULL)
|
||||||
|
tui_show_registers (group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tui_reg_float_command (char *arg, int from_tty)
|
tui_reg_float_command (char *arg, int from_tty)
|
||||||
{
|
{
|
||||||
|
@ -630,6 +653,9 @@ _initialize_tui_regs (void)
|
||||||
add_cmd ("next", class_tui, tui_reg_next_command,
|
add_cmd ("next", class_tui, tui_reg_next_command,
|
||||||
_("Display next register group."),
|
_("Display next register group."),
|
||||||
&tuireglist);
|
&tuireglist);
|
||||||
|
add_cmd ("prev", class_tui, tui_reg_prev_command,
|
||||||
|
_("Display previous register group."),
|
||||||
|
&tuireglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue