* [RFA] Eliminate hard coded constant num_regs in mips_gdbarch_init
@ 2003-06-27 17:28 Fred Fish
2003-06-27 19:53 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Fred Fish @ 2003-06-27 17:28 UTC (permalink / raw)
To: gdb-patches; +Cc: Fred Fish
It seems wrong to hard code the number of registers in
mips_gdbarch_init. Here is one way to fix it, for the case
"num_regs=90", and possibly for the "num_regs=71" case also.
However using sizeof(mips_generic_reg_names) is somewhat of a
misleading way to find the number of strings in MIPS_REGISTER_NAMES
and I'm not too thrilled about using a hard coded 32 instead of
something like "sizeof(mips_gpr_names)/sizeof(char*)".
-Fred
2003-06-25 Fred Fish <fnf@intrinsity.com>
* mips-tdep.c (mips_gdbarch_init): Set num_regs to be the number
of base registers (32) plus the number of machine dependent
register names, which should equal the number of machine dependent
registers.
Index: mips-tdep.c
===================================================================
RCS file: /mips/newtools/fsf/gdb/gdb/mips-tdep.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -c -p -r1.21 -r1.22
*** mips-tdep.c 2003/06/23 14:31:26 1.21
--- mips-tdep.c 2003/06/26 02:36:53 1.22
*************** mips_gdbarch_init (struct gdbarch_info i
*** 5908,5914 ****
if (info.osabi == GDB_OSABI_IRIX)
num_regs = 71;
else
! num_regs = 90;
set_gdbarch_num_regs (gdbarch, num_regs);
set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
--- 5908,5914 ----
if (info.osabi == GDB_OSABI_IRIX)
num_regs = 71;
else
! num_regs = 32 + sizeof(mips_generic_reg_names)/sizeof(char *);
set_gdbarch_num_regs (gdbarch, num_regs);
set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFA] Eliminate hard coded constant num_regs in mips_gdbarch_init
2003-06-27 17:28 [RFA] Eliminate hard coded constant num_regs in mips_gdbarch_init Fred Fish
@ 2003-06-27 19:53 ` Andrew Cagney
2003-06-27 20:25 ` Fred Fish
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2003-06-27 19:53 UTC (permalink / raw)
To: Fred Fish; +Cc: gdb-patches
> It seems wrong to hard code the number of registers in
> mips_gdbarch_init. Here is one way to fix it, for the case
> "num_regs=90", and possibly for the "num_regs=71" case also.
It's about par for the course :-( The code also assumes that
mips_r3041_reg_names, mips_r3051_reg_names and mips_r3081_reg_names are
the same size (90 - 32). If you're trying to add more than 90
registers, you've a bigger problem.
The various MIPS_REGISTER_NAME definitions should all be part of a table.
> However using sizeof(mips_generic_reg_names) is somewhat of a
> misleading way to find the number of strings in MIPS_REGISTER_NAMES
> and I'm not too thrilled about using a hard coded 32 instead of
> something like "sizeof(mips_gpr_names)/sizeof(char*)".
Try MIPS_NUMREGS.
Andrew
PS: Does Intrinsity have a disclaimer?
> 2003-06-25 Fred Fish <fnf@intrinsity.com>
>
> * mips-tdep.c (mips_gdbarch_init): Set num_regs to be the number
> of base registers (32) plus the number of machine dependent
> register names, which should equal the number of machine dependent
> registers.
>
> Index: mips-tdep.c
> ===================================================================
> RCS file: /mips/newtools/fsf/gdb/gdb/mips-tdep.c,v
> retrieving revision 1.21
> retrieving revision 1.22
> diff -c -p -r1.21 -r1.22
> *** mips-tdep.c 2003/06/23 14:31:26 1.21
> --- mips-tdep.c 2003/06/26 02:36:53 1.22
> *************** mips_gdbarch_init (struct gdbarch_info i
> *** 5908,5914 ****
> if (info.osabi == GDB_OSABI_IRIX)
> num_regs = 71;
> else
> ! num_regs = 90;
> set_gdbarch_num_regs (gdbarch, num_regs);
> set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
>
> --- 5908,5914 ----
> if (info.osabi == GDB_OSABI_IRIX)
> num_regs = 71;
> else
> ! num_regs = 32 + sizeof(mips_generic_reg_names)/sizeof(char *);
> set_gdbarch_num_regs (gdbarch, num_regs);
> set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] Eliminate hard coded constant num_regs in mips_gdbarch_init
2003-06-27 19:53 ` Andrew Cagney
@ 2003-06-27 20:25 ` Fred Fish
2003-07-01 21:50 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Fred Fish @ 2003-06-27 20:25 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Fred Fish, gdb-patches
> It's about par for the course :-( The code also assumes that
> mips_r3041_reg_names, mips_r3051_reg_names and mips_r3081_reg_names are
> the same size (90 - 32). If you're trying to add more than 90
> registers, you've a bigger problem.
Currently we have at total of 416 registers defined, including the
standard mips architecture registers. However that includes an
individual register for every element of each matrix register, each of
which holds 16 32-bit values. I'm working on redefining the register
set more like how the MMX and Altivec registers work, where $m0 is a
single register instead of 16 individual registers ($m0_00,
... $m0_15).
> PS: Does Intrinsity have a disclaimer?
Not yet, though AFAIK that doesn't prevent me from submitting simple
bug fixes of only a few lines (particularly if they are relatively
generic) and having them accepted, unless the policy has changed
recently. I expect no problem with getting a disclaimer at some point
in the near future to include all our changes.
-Fred
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] Eliminate hard coded constant num_regs in mips_gdbarch_init
2003-06-27 20:25 ` Fred Fish
@ 2003-07-01 21:50 ` Andrew Cagney
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2003-07-01 21:50 UTC (permalink / raw)
To: Fred Fish; +Cc: gdb-patches
> It's about par for the course :-( The code also assumes that
>> mips_r3041_reg_names, mips_r3051_reg_names and mips_r3081_reg_names are
>> the same size (90 - 32). If you're trying to add more than 90
>> registers, you've a bigger problem.
>
>
> Currently we have at total of 416 registers defined, including the
you have a bigger problem :-(
> standard mips architecture registers. However that includes an
> individual register for every element of each matrix register, each of
> which holds 16 32-bit values. I'm working on redefining the register
> set more like how the MMX and Altivec registers work, where $m0 is a
> single register instead of 16 individual registers ($m0_00,
> ... $m0_15).
Insight, at least, works much better when you do this. Also note the
``reggroups'', it lets you categorize all the registers - again working
much better with GUIs.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-07-01 21:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-27 17:28 [RFA] Eliminate hard coded constant num_regs in mips_gdbarch_init Fred Fish
2003-06-27 19:53 ` Andrew Cagney
2003-06-27 20:25 ` Fred Fish
2003-07-01 21:50 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox