mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-30 12:44:10 +08:00
2002-11-06 Andrew Cagney <ac131313@redhat.com>
* infcmd.c: Include "reggroups.h" and <ctype.h>. (print_float_info): Print registers in float_reggroup. (print_vector_info): Print registers in vector_reggroup. (default_print_registers_info): When all, print registers in all_reggroup. Otherwize, print registers in general_reggroup. (registers_info): Rewrite. Add support for register groups. Eliminate a goto.
This commit is contained in:
parent
1bd34ded16
commit
f9418c0f19
@ -1,3 +1,13 @@
|
||||
2002-11-06 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
* infcmd.c: Include "reggroups.h" and <ctype.h>.
|
||||
(print_float_info): Print registers in float_reggroup.
|
||||
(print_vector_info): Print registers in vector_reggroup.
|
||||
(default_print_registers_info): When all, print registers in
|
||||
all_reggroup. Otherwize, print registers in general_reggroup.
|
||||
(registers_info): Rewrite. Add support for register groups.
|
||||
Eliminate a goto.
|
||||
|
||||
2002-11-06 Elena Zannoni <ezannoni@redhat.com>
|
||||
|
||||
* symtab.c (methods_info): Delete. It has been ifdeffed out for
|
||||
|
111
gdb/infcmd.c
111
gdb/infcmd.c
@ -41,6 +41,8 @@
|
||||
#include "event-top.h"
|
||||
#include "parser-defs.h"
|
||||
#include "regcache.h"
|
||||
#include "reggroups.h"
|
||||
#include <ctype.h>
|
||||
|
||||
/* Functions exported for general use, in inferior.h: */
|
||||
|
||||
@ -1583,11 +1585,14 @@ default_print_registers_info (struct gdbarch *gdbarch,
|
||||
specific reg. */
|
||||
if (regnum == -1)
|
||||
{
|
||||
if (!print_all)
|
||||
if (print_all)
|
||||
{
|
||||
if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
|
||||
if (!gdbarch_register_reggroup_p (gdbarch, i, all_reggroup))
|
||||
continue;
|
||||
if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)))
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gdbarch_register_reggroup_p (gdbarch, i, general_reggroup))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1685,35 +1690,89 @@ registers_info (char *addr_exp, int fpregs)
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
while (*addr_exp != '\0')
|
||||
{
|
||||
char *start;
|
||||
const char *end;
|
||||
|
||||
/* Keep skipping leading white space. */
|
||||
if (isspace ((*addr_exp)))
|
||||
{
|
||||
addr_exp++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Discard any leading ``$''. Check that there is something
|
||||
resembling a register following it. */
|
||||
if (addr_exp[0] == '$')
|
||||
addr_exp++;
|
||||
if (isspace ((*addr_exp)) || (*addr_exp) == '\0')
|
||||
error ("Missing register name");
|
||||
|
||||
/* Find the start/end of this register name/num/group. */
|
||||
start = addr_exp;
|
||||
while ((*addr_exp) != '\0' && !isspace ((*addr_exp)))
|
||||
addr_exp++;
|
||||
end = addr_exp;
|
||||
while (*end != '\0' && *end != ' ' && *end != '\t')
|
||||
++end;
|
||||
numregs = NUM_REGS + NUM_PSEUDO_REGS;
|
||||
|
||||
/* Figure out what we've found and display it. */
|
||||
|
||||
regnum = frame_map_name_to_regnum (addr_exp, end - addr_exp);
|
||||
if (regnum >= 0)
|
||||
goto found;
|
||||
/* A register name? */
|
||||
{
|
||||
int regnum = frame_map_name_to_regnum (start, end - start);
|
||||
if (regnum >= 0)
|
||||
{
|
||||
gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
|
||||
selected_frame, regnum, fpregs);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* A register number? (how portable is this one?). */
|
||||
{
|
||||
char *endptr;
|
||||
int regnum = strtol (start, &endptr, 0);
|
||||
if (endptr == end
|
||||
&& regnum >= 0
|
||||
&& regnum < NUM_REGS + NUM_PSEUDO_REGS)
|
||||
{
|
||||
gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
|
||||
selected_frame, regnum, fpregs);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
regnum = numregs;
|
||||
/* A register group? */
|
||||
{
|
||||
struct reggroup *const *group;
|
||||
for (group = reggroups (current_gdbarch);
|
||||
(*group) != NULL;
|
||||
group++)
|
||||
{
|
||||
/* Don't bother with a length check. Should the user
|
||||
enter a short register group name, go with the first
|
||||
group that matches. */
|
||||
if (strncmp (start, reggroup_name ((*group)), end - start) == 0)
|
||||
break;
|
||||
}
|
||||
if ((*group) != NULL)
|
||||
{
|
||||
int regnum;
|
||||
for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
|
||||
{
|
||||
if (gdbarch_register_reggroup_p (current_gdbarch, regnum,
|
||||
(*group)))
|
||||
gdbarch_print_registers_info (current_gdbarch,
|
||||
gdb_stdout, selected_frame,
|
||||
regnum, fpregs);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (*addr_exp >= '0' && *addr_exp <= '9')
|
||||
regnum = atoi (addr_exp); /* Take a number */
|
||||
if (regnum >= numregs) /* Bad name, or bad number */
|
||||
error ("%.*s: invalid register", (int) (end - addr_exp), addr_exp);
|
||||
|
||||
found:
|
||||
gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
|
||||
selected_frame, regnum, fpregs);
|
||||
|
||||
addr_exp = end;
|
||||
while (*addr_exp == ' ' || *addr_exp == '\t')
|
||||
++addr_exp;
|
||||
/* Nothing matched. */
|
||||
error ("Invalid register `%.*s'", (int) (end - start), start);
|
||||
}
|
||||
while (*addr_exp != '\0');
|
||||
}
|
||||
|
||||
void
|
||||
@ -1746,7 +1805,7 @@ print_vector_info (struct gdbarch *gdbarch, struct ui_file *file,
|
||||
|
||||
for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
|
||||
{
|
||||
if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (regnum)))
|
||||
if (gdbarch_register_reggroup_p (gdbarch, regnum, vector_reggroup))
|
||||
{
|
||||
printed_something = 1;
|
||||
gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
|
||||
@ -1919,7 +1978,7 @@ print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
|
||||
|
||||
for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
|
||||
{
|
||||
if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
|
||||
if (gdbarch_register_reggroup_p (gdbarch, regnum, float_reggroup))
|
||||
{
|
||||
printed_something = 1;
|
||||
gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user