* [patch/rfc] Add get_*() to rs6000-tdep.c
@ 2002-12-17 10:35 Andrew Cagney
[not found] ` <ac131313@redhat.com>
0 siblings, 1 reply; 17+ messages in thread
From: Andrew Cagney @ 2002-12-17 10:35 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 182 bytes --]
The attatched modifies rs6000-tdep.c so that it uses
get_frame_extra_info(), get_frame_saved_regs() and
frame_extra_info_zalloc().
I'll look to commit this in a few days.
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 5920 bytes --]
2002-12-17 Andrew Cagney <ac131313@redhat.com>
* rs6000-tdep.c (rs6000_init_extra_frame_info): Use
frame_extra_info_zalloc.
(rs6000_frame_args_address): Use get_frame_extra_info.
(frame_get_saved_regs): Use get_frame_saved_regs.
(frame_initial_stack_address): Use get_frame_saved_regs and
get_frame_extra_info.
(frame_initial_stack_address): Use get_frame_extra_info.
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.99
diff -u -r1.99 rs6000-tdep.c
--- rs6000-tdep.c 9 Dec 2002 03:30:44 -0000 1.99
+++ rs6000-tdep.c 17 Dec 2002 18:03:08 -0000
@@ -166,9 +166,9 @@
void
rs6000_init_extra_frame_info (int fromleaf, struct frame_info *fi)
{
- fi->extra_info = (struct frame_extra_info *)
- frame_obstack_alloc (sizeof (struct frame_extra_info));
- fi->extra_info->initial_sp = 0;
+ struct frame_extra_info *extra_info =
+ frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
+ extra_info->initial_sp = 0;
if (get_next_frame (fi) != NULL
&& get_frame_pc (fi) < TEXT_SEGMENT_BASE)
/* We're in get_prev_frame */
@@ -197,8 +197,9 @@
static CORE_ADDR
rs6000_frame_args_address (struct frame_info *fi)
{
- if (fi->extra_info->initial_sp != 0)
- return fi->extra_info->initial_sp;
+ struct frame_extra_info *extra_info = get_frame_extra_info (fi);
+ if (extra_info->initial_sp != 0)
+ return extra_info->initial_sp;
else
return frame_initial_stack_address (fi);
}
@@ -1572,7 +1573,7 @@
struct gdbarch_tdep * tdep = gdbarch_tdep (current_gdbarch);
int wordsize = tdep->wordsize;
- if (fi->saved_regs)
+ if (get_frame_saved_regs (fi))
return;
if (fdatap == NULL)
@@ -1615,7 +1616,7 @@
CORE_ADDR fpr_addr = frame_addr + fdatap->fpr_offset;
for (i = fdatap->saved_fpr; i < 32; i++)
{
- fi->saved_regs[FP0_REGNUM + i] = fpr_addr;
+ get_frame_saved_regs (fi)[FP0_REGNUM + i] = fpr_addr;
fpr_addr += 8;
}
}
@@ -1629,7 +1630,7 @@
CORE_ADDR gpr_addr = frame_addr + fdatap->gpr_offset;
for (i = fdatap->saved_gpr; i < 32; i++)
{
- fi->saved_regs[i] = gpr_addr;
+ get_frame_saved_regs (fi)[i] = gpr_addr;
gpr_addr += wordsize;
}
}
@@ -1644,7 +1645,7 @@
CORE_ADDR vr_addr = frame_addr + fdatap->vr_offset;
for (i = fdatap->saved_vr; i < 32; i++)
{
- fi->saved_regs[tdep->ppc_vr0_regnum + i] = vr_addr;
+ get_frame_saved_regs (fi)[tdep->ppc_vr0_regnum + i] = vr_addr;
vr_addr += REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum);
}
}
@@ -1660,8 +1661,8 @@
CORE_ADDR ev_addr = frame_addr + fdatap->ev_offset;
for (i = fdatap->saved_ev; i < 32; i++)
{
- fi->saved_regs[tdep->ppc_ev0_regnum + i] = ev_addr;
- fi->saved_regs[tdep->ppc_gp0_regnum + i] = ev_addr + 4;
+ get_frame_saved_regs (fi)[tdep->ppc_ev0_regnum + i] = ev_addr;
+ get_frame_saved_regs (fi)[tdep->ppc_gp0_regnum + i] = ev_addr + 4;
ev_addr += REGISTER_RAW_SIZE (tdep->ppc_ev0_regnum);
}
}
@@ -1670,17 +1671,17 @@
/* If != 0, fdatap->cr_offset is the offset from the frame that holds
the CR. */
if (fdatap->cr_offset != 0)
- fi->saved_regs[tdep->ppc_cr_regnum] = frame_addr + fdatap->cr_offset;
+ get_frame_saved_regs (fi)[tdep->ppc_cr_regnum] = frame_addr + fdatap->cr_offset;
/* If != 0, fdatap->lr_offset is the offset from the frame that holds
the LR. */
if (fdatap->lr_offset != 0)
- fi->saved_regs[tdep->ppc_lr_regnum] = frame_addr + fdatap->lr_offset;
+ get_frame_saved_regs (fi)[tdep->ppc_lr_regnum] = frame_addr + fdatap->lr_offset;
/* If != 0, fdatap->vrsave_offset is the offset from the frame that holds
the VRSAVE. */
if (fdatap->vrsave_offset != 0)
- fi->saved_regs[tdep->ppc_vrsave_regnum] = frame_addr + fdatap->vrsave_offset;
+ get_frame_saved_regs (fi)[tdep->ppc_vrsave_regnum] = frame_addr + fdatap->vrsave_offset;
}
/* Return the address of a frame. This is the inital %sp value when the frame
@@ -1697,8 +1698,8 @@
/* If the initial stack pointer (frame address) of this frame is known,
just return it. */
- if (fi->extra_info->initial_sp)
- return fi->extra_info->initial_sp;
+ if (get_frame_extra_info (fi)->initial_sp)
+ return get_frame_extra_info (fi)->initial_sp;
/* Find out if this function is using an alloca register. */
@@ -1708,7 +1709,7 @@
/* If saved registers of this frame are not known yet, read and
cache them. */
- if (!fi->saved_regs)
+ if (!get_frame_saved_regs (fi))
frame_get_saved_regs (fi, &fdata);
/* If no alloca register used, then fi->frame is the value of the %sp for
@@ -1716,8 +1717,8 @@
if (fdata.alloca_reg < 0)
{
- fi->extra_info->initial_sp = get_frame_base (fi);
- return fi->extra_info->initial_sp;
+ get_frame_extra_info (fi)->initial_sp = get_frame_base (fi);
+ return get_frame_extra_info (fi)->initial_sp;
}
/* There is an alloca register, use its value, in the current frame,
@@ -1726,7 +1727,7 @@
char *tmpbuf = alloca (MAX_REGISTER_RAW_SIZE);
if (frame_register_read (fi, fdata.alloca_reg, tmpbuf))
{
- fi->extra_info->initial_sp
+ get_frame_extra_info (fi)->initial_sp
= extract_unsigned_integer (tmpbuf,
REGISTER_RAW_SIZE (fdata.alloca_reg));
}
@@ -1734,9 +1735,9 @@
/* NOTE: cagney/2002-04-17: At present the only time
frame_register_read will fail is when the register isn't
available. If that does happen, use the frame. */
- fi->extra_info->initial_sp = get_frame_base (fi);
+ get_frame_extra_info (fi)->initial_sp = get_frame_base (fi);
}
- return fi->extra_info->initial_sp;
+ return get_frame_extra_info (fi)->initial_sp;
}
/* Describe the pointer in each stack frame to the previous stack frame
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch/rfc] Add get_*() to rs6000-tdep.c
[not found] ` <ac131313@redhat.com>
@ 2002-12-17 14:13 ` Kevin Buettner
2002-12-18 7:37 ` Andrew Cagney
2003-03-11 23:16 ` [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions Kevin Buettner
` (2 subsequent siblings)
3 siblings, 1 reply; 17+ messages in thread
From: Kevin Buettner @ 2002-12-17 14:13 UTC (permalink / raw)
To: gdb-patches
On Dec 17, 1:12pm, Andrew Cagney wrote:
> The attatched modifies rs6000-tdep.c so that it uses
> get_frame_extra_info(), get_frame_saved_regs() and
> frame_extra_info_zalloc().
>
> I'll look to commit this in a few days.
It looks okay to me. Commit it now if you like.
Kevin
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch/rfc] Add get_*() to rs6000-tdep.c
2002-12-17 14:13 ` Kevin Buettner
@ 2002-12-18 7:37 ` Andrew Cagney
0 siblings, 0 replies; 17+ messages in thread
From: Andrew Cagney @ 2002-12-18 7:37 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> On Dec 17, 1:12pm, Andrew Cagney wrote:
>
>
>> The attatched modifies rs6000-tdep.c so that it uses
>> get_frame_extra_info(), get_frame_saved_regs() and
>> frame_extra_info_zalloc().
>>
>> I'll look to commit this in a few days.
>
>
> It looks okay to me. Commit it now if you like.
Wicked. In.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* [RFA] mips-tdep.c: Fix printing of floats in "info all-registers"
@ 2003-03-04 17:24 Kevin Buettner
2003-03-04 18:01 ` Andrew Cagney
0 siblings, 1 reply; 17+ messages in thread
From: Kevin Buettner @ 2003-03-04 17:24 UTC (permalink / raw)
To: gdb-patches
When doing "info all-registers" on 64-bit mips, floating point values are
not being displayed correctly. OTOH, the output of "info float" is correct.
Thanks to Chris Demetriou for bringing this problem to my attention.
Okay?
* mips-tdep.c (do_fp_register_row): Fix typo which caused a double
type to be used when attempting to unpack a float.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.168
diff -u -p -r1.168 mips-tdep.c
--- mips-tdep.c 3 Mar 2003 20:50:19 -0000 1.168
+++ mips-tdep.c 4 Mar 2003 17:16:24 -0000
@@ -4150,7 +4150,7 @@ do_fp_register_row (int regnum)
{
/* Eight byte registers: print each one as float AND as double. */
mips_read_fp_register_single (regnum, raw_buffer);
- flt1 = unpack_double (mips_double_register_type (), raw_buffer, &inv1);
+ flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
mips_read_fp_register_double (regnum, raw_buffer);
doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3);
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] mips-tdep.c: Fix printing of floats in "info all-registers"
2003-03-04 17:24 [RFA] mips-tdep.c: Fix printing of floats in "info all-registers" Kevin Buettner
@ 2003-03-04 18:01 ` Andrew Cagney
0 siblings, 0 replies; 17+ messages in thread
From: Andrew Cagney @ 2003-03-04 18:01 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> When doing "info all-registers" on 64-bit mips, floating point values are
> not being displayed correctly. OTOH, the output of "info float" is correct.
>
> Thanks to Chris Demetriou for bringing this problem to my attention.
>
> Okay?
Yes.
> * mips-tdep.c (do_fp_register_row): Fix typo which caused a double
> type to be used when attempting to unpack a float.
>
> Index: mips-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> retrieving revision 1.168
> diff -u -p -r1.168 mips-tdep.c
> --- mips-tdep.c 3 Mar 2003 20:50:19 -0000 1.168
> +++ mips-tdep.c 4 Mar 2003 17:16:24 -0000
> @@ -4150,7 +4150,7 @@ do_fp_register_row (int regnum)
> {
> /* Eight byte registers: print each one as float AND as double. */
> mips_read_fp_register_single (regnum, raw_buffer);
> - flt1 = unpack_double (mips_double_register_type (), raw_buffer, &inv1);
> + flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
>
> mips_read_fp_register_double (regnum, raw_buffer);
> doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3);
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions
@ 2003-03-04 21:17 Kevin Buettner
2003-03-07 17:04 ` Andrew Cagney
0 siblings, 1 reply; 17+ messages in thread
From: Kevin Buettner @ 2003-03-04 21:17 UTC (permalink / raw)
To: gdb-patches
When using dwarf2 debug info, floating point registers are mapped
incorrectly for certain mips targets. It turns out that Irix is the
only one that's getting it right due to the fact that FP0_REGNUM is
defined to be 32.
Thanks to Chris Demetriou for diagnosing this problem and suggesting
the solution.
[Note: Irix cross some other mips target is currently broken due to
the fact that FP0_REGNUM is not multiarched yet.]
Okay?
* mips-tdep.c (mips_dwarf_reg_to_regnum, mips_dwarf2_reg_to_regnum):
New functions.
(mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum()
and set_gdbarch_dwarf2_reg_to_regnum().
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.168
diff -u -p -r1.168 mips-tdep.c
--- mips-tdep.c 3 Mar 2003 20:50:19 -0000 1.168
+++ mips-tdep.c 4 Mar 2003 17:25:21 -0000
@@ -5563,6 +5563,29 @@ mips_ecoff_reg_to_regnum (int num)
return num + FP0_REGNUM - 32;
}
+/* Convert a dwarf register number to a gdb REGNUM */
+
+static int
+mips_dwarf_reg_to_regnum (int num)
+{
+ if (num < 32)
+ return num;
+ else
+ return num + FP0_REGNUM - 32;
+}
+
+/* Convert a dwarf2 register number to a gdb REGNUM */
+
+static int
+mips_dwarf2_reg_to_regnum (int num)
+{
+ if (num < 32)
+ return num;
+ else
+ return num + FP0_REGNUM - 32;
+}
+
+
/* Convert an integer into an address. By first converting the value
into a pointer and then extracting it signed, the address is
guarenteed to be correctly sign extended. */
@@ -5980,6 +6003,8 @@ mips_gdbarch_init (struct gdbarch_info i
/* Map debug register numbers onto internal register numbers. */
set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum);
+ set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_reg_to_regnum);
+ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf2_reg_to_regnum);
/* Initialize a frame */
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs);
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions
2003-03-04 21:17 [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions Kevin Buettner
@ 2003-03-07 17:04 ` Andrew Cagney
2003-03-07 17:52 ` Kevin Buettner
0 siblings, 1 reply; 17+ messages in thread
From: Andrew Cagney @ 2003-03-07 17:04 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> When using dwarf2 debug info, floating point registers are mapped
> incorrectly for certain mips targets. It turns out that Irix is the
> only one that's getting it right due to the fact that FP0_REGNUM is
> defined to be 32.
>
> Thanks to Chris Demetriou for diagnosing this problem and suggesting
> the solution.
>
> [Note: Irix cross some other mips target is currently broken due to
> the fact that FP0_REGNUM is not multiarched yet.]
I don't think FP0_REGNUM should be multi-arched. The only reference to
FP0_REGNUM in generic code that I could find was this gem:
if (FP0_REGNUM >= 0) /* need floating point? */
{
if ((regno >= 0 && regno < FP0_REGNUM) ||
regno == PC_REGNUM ||
(NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
regno == FP_REGNUM ||
regno == SP_REGNUM)
return; /* not a floating point register */
if ((fpregs = proc_get_fpregs (pi)) == NULL)
proc_error (pi, "fetch_registers, get_fpregs", __LINE__);
supply_fpregset (fpregs);
}
mips_tdep could certainly gain a local tdep->fp0_regnum though.
> Okay?
Yes, just make it a little bit more robust. The i386 does this:
/* This will hopefully provoke a warning. */
return NUM_REGS + NUM_PSEUDO_REGS;
when it doesn't know what to do with a register.
Andrew
> +static int
> +mips_dwarf_reg_to_regnum (int num)
> +{
> + if (num < 32)
> + return num;
> + else
> + return num + FP0_REGNUM - 32;
> +}
> +
> +/* Convert a dwarf2 register number to a gdb REGNUM */
> +
> +static int
> +mips_dwarf2_reg_to_regnum (int num)
> +{
> + if (num < 32)
> + return num;
> + else
> + return num + FP0_REGNUM - 32;
> +}
> +
> +
> /* Convert an integer into an address. By first converting the value
> into a pointer and then extracting it signed, the address is
> guarenteed to be correctly sign extended. */
> @@ -5980,6 +6003,8 @@ mips_gdbarch_init (struct gdbarch_info i
> /* Map debug register numbers onto internal register numbers. */
> set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
> set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum);
> + set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_reg_to_regnum);
> + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf2_reg_to_regnum);
>
> /* Initialize a frame */
> set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs);
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions
2003-03-07 17:04 ` Andrew Cagney
@ 2003-03-07 17:52 ` Kevin Buettner
2003-03-07 18:52 ` Andrew Cagney
2003-03-07 19:13 ` Andrew Cagney
0 siblings, 2 replies; 17+ messages in thread
From: Kevin Buettner @ 2003-03-07 17:52 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Mar 7, 12:03pm, Andrew Cagney wrote:
> > [Note: Irix cross some other mips target is currently broken due to
> > the fact that FP0_REGNUM is not multiarched yet.]
>
> I don't think FP0_REGNUM should be multi-arched. The only reference to
I should point out that FP0_REGNUM is already in gdbarch.h. What I meant
was that mips should be calling set_gdbarch_fp0_regnum() instead of
defining it via a macro in the tm-*.h files.
[...FP0_REGNUM reference in generic code elided]
> mips_tdep could certainly gain a local tdep->fp0_regnum though.
Did you notice the references to FP0_REGNUM in mips-linux-tdep.c and
mips-nat.c?. If we do as you suggest, an access method will need to
be added to mips-tdep.h for getting at tdep->fp0_regnum (since you
refuse to export the mips tdep struct). Also, all occurrences of
FP0_REGNUM in mips-linux-tdep.c and mips-nat.c will need to be
rewritten to use this access method.
Certainly all of this could be done, but the need to know the first
floating point register number is something that's shared among a
number of ports. Doesn't it makes sense to define (as has already
been done) a common mechanism for determining this register number
rather than letting each port develop ad hoc methods?
> > Okay?
>
> Yes, just make it a little bit more robust. The i386 does this:
>
> /* This will hopefully provoke a warning. */
> return NUM_REGS + NUM_PSEUDO_REGS;
>
> when it doesn't know what to do with a register.
Rather than hoping that returning an out of range register number will
provoke a warning (at some indeterminate point in the future),
wouldn't it be better to call complaint() directly? Or, alternatively,
define a return value (e.g. -1) which callers of *_REG_TO_REGNUM would
then check so that an appropriate complaint could be registered?
Kevin
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions
2003-03-07 17:52 ` Kevin Buettner
@ 2003-03-07 18:52 ` Andrew Cagney
2003-03-11 21:22 ` Kevin Buettner
2003-03-07 19:13 ` Andrew Cagney
1 sibling, 1 reply; 17+ messages in thread
From: Andrew Cagney @ 2003-03-07 18:52 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> Okay?
>
>>
>> Yes, just make it a little bit more robust. The i386 does this:
>>
>> /* This will hopefully provoke a warning. */
>> return NUM_REGS + NUM_PSEUDO_REGS;
>>
>> when it doesn't know what to do with a register.
>
>
> Rather than hoping that returning an out of range register number will
> provoke a warning (at some indeterminate point in the future),
> wouldn't it be better to call complaint() directly? Or, alternatively,
> define a return value (e.g. -1) which callers of *_REG_TO_REGNUM would
> then check so that an appropriate complaint could be registered?
True. In the mean time, these new methods might as well be consistent
with the other existing reg_to_regnum methods (from memory, it does
eventually provoke a warning).
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions
2003-03-07 17:52 ` Kevin Buettner
2003-03-07 18:52 ` Andrew Cagney
@ 2003-03-07 19:13 ` Andrew Cagney
1 sibling, 0 replies; 17+ messages in thread
From: Andrew Cagney @ 2003-03-07 19:13 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
>> mips_tdep could certainly gain a local tdep->fp0_regnum though.
>
>
> Did you notice the references to FP0_REGNUM in mips-linux-tdep.c and
> mips-nat.c?. If we do as you suggest, an access method will need to
> be added to mips-tdep.h for getting at tdep->fp0_regnum (since you
> refuse to export the mips tdep struct). Also, all occurrences of
> FP0_REGNUM in mips-linux-tdep.c and mips-nat.c will need to be
> rewritten to use this access method.
I ignored everything that wasn't core.
Such a rewrite goes on my to-do list.
> Certainly all of this could be done, but the need to know the first
> floating point register number is something that's shared among a
> number of ports. Doesn't it makes sense to define (as has already
> been done) a common mechanism for determining this register number
> rather than letting each port develop ad hoc methods?
The problem is that FP0_REGNUM has no narrow and well defined meaning.
Same problem as with SP_REGNUM, PC_REGNUM, FP_REGNUM.
As a specific example. Given an ISA with 64 bit FP registers that is
running a 32 bit FP ABI (debug info refers to 32 bit FP registers).
/proc assumes FP0_REGNUM designates the first 64 bit [raw] FP register,
yet dwarf2 assumes that FP0_REGNUM designates the first 32 bit [cooked]
FP register.
It doesn't work (well, ok the current mess involving register
convertible kind of half sort of makes it appear to work). Per previous
patches, that code needs an overhaul.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions
2003-03-07 18:52 ` Andrew Cagney
@ 2003-03-11 21:22 ` Kevin Buettner
2003-03-11 22:06 ` Andrew Cagney
0 siblings, 1 reply; 17+ messages in thread
From: Kevin Buettner @ 2003-03-11 21:22 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Mar 7, 1:52pm, Andrew Cagney wrote:
> True. In the mean time, these new methods might as well be consistent
> with the other existing reg_to_regnum methods (from memory, it does
> eventually provoke a warning).
Okay.
I've studied the code some more on the gcc side of things. gcc
differentiates between ``dbx'' (which we call ``aout'' in gdb) and
everything else. As such, I decided that it didn't make much sense to
have three identical functions to maintain (i.e. the ecoff, dwarf,
and dwarf2 cases). It's quite possible that the non-dbx case(s) will
need to be modified in the near future since I'm considering adding
some mappings for the hi and lo registers. If we ever do discover a
reason for making the dwarf, dwarf2, and ecoff mappings diverge, it
will be easy enough to replicate the function at that time.
Below is a revised patch which takes into account your earlier
comments as well as the observation that I just made above.
Okay?
* mips-tdep.c (mips_ecoff_reg_to_regnum): Rename to
mips_dwarf_dwarf2_ecoff_reg_to_regnum().
(mips_dwarf_dwarf2_ecoff_reg_to_regnum, mips_stab_reg_to_regnum):
Do range checks on register number obtained from debugging info.
(mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum() and
set_gdbarch_dwarf2_reg_to_regnum(). Adjust call of
set_gdbarch_ecoff_reg_to_regnum() to account for new name of
mapping function.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.168
diff -u -p -r1.168 mips-tdep.c
--- mips-tdep.c 3 Mar 2003 20:50:19 -0000 1.168
+++ mips-tdep.c 11 Mar 2003 21:03:42 -0000
@@ -5546,23 +5546,37 @@ mips_saved_pc_after_call (struct frame_i
static int
mips_stab_reg_to_regnum (int num)
{
- if (num < 32)
+ if (num >= 0 && num < 32)
return num;
- else
+ else if (num >= 38 && num < 70)
return num + FP0_REGNUM - 38;
+ else
+ {
+ /* This will hopefully (eventually) provoke a warning. Should
+ we be calling complaint() here? */
+ return NUM_REGS + NUM_PSEUDO_REGS;
+ }
}
-/* Convert a ecoff register number to a gdb REGNUM */
+
+/* Convert a dwarf, dwarf2, or ecoff register number to a gdb REGNUM */
static int
-mips_ecoff_reg_to_regnum (int num)
+mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num)
{
- if (num < 32)
+ if (num >= 0 && num < 32)
return num;
- else
+ else if (num >= 32 && num < 64)
return num + FP0_REGNUM - 32;
+ else
+ {
+ /* This will hopefully (eventually) provoke a warning. Should
+ we be calling complaint() here? */
+ return NUM_REGS + NUM_PSEUDO_REGS;
+ }
}
+
/* Convert an integer into an address. By first converting the value
into a pointer and then extracting it signed, the address is
guarenteed to be correctly sign extended. */
@@ -5979,7 +5993,9 @@ mips_gdbarch_init (struct gdbarch_info i
/* Map debug register numbers onto internal register numbers. */
set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
- set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum);
+ set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
+ set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
+ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
/* Initialize a frame */
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs);
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions
2003-03-11 21:22 ` Kevin Buettner
@ 2003-03-11 22:06 ` Andrew Cagney
0 siblings, 0 replies; 17+ messages in thread
From: Andrew Cagney @ 2003-03-11 22:06 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> * mips-tdep.c (mips_ecoff_reg_to_regnum): Rename to
> mips_dwarf_dwarf2_ecoff_reg_to_regnum().
> (mips_dwarf_dwarf2_ecoff_reg_to_regnum, mips_stab_reg_to_regnum):
> Do range checks on register number obtained from debugging info.
> (mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum() and
> set_gdbarch_dwarf2_reg_to_regnum(). Adjust call of
> set_gdbarch_ecoff_reg_to_regnum() to account for new name of
> mapping function.
>
Yes, thanks.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions
[not found] ` <ac131313@redhat.com>
2002-12-17 14:13 ` Kevin Buettner
@ 2003-03-11 23:16 ` Kevin Buettner
2003-03-11 23:18 ` [RFA] mips-tdep.c: Fix printing of floats in "info all-registers" Kevin Buettner
2003-04-02 5:13 ` [RFA] MIPS: Add mappings for HI and LO registers Kevin Buettner
3 siblings, 0 replies; 17+ messages in thread
From: Kevin Buettner @ 2003-03-11 23:16 UTC (permalink / raw)
To: gdb-patches
On Mar 11, 5:06pm, Andrew Cagney wrote:
> > * mips-tdep.c (mips_ecoff_reg_to_regnum): Rename to
> > mips_dwarf_dwarf2_ecoff_reg_to_regnum().
> > (mips_dwarf_dwarf2_ecoff_reg_to_regnum, mips_stab_reg_to_regnum):
> > Do range checks on register number obtained from debugging info.
> > (mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum() and
> > set_gdbarch_dwarf2_reg_to_regnum(). Adjust call of
> > set_gdbarch_ecoff_reg_to_regnum() to account for new name of
> > mapping function.
> >
> Yes, thanks.
Committed.
Kevin
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] mips-tdep.c: Fix printing of floats in "info all-registers"
[not found] ` <ac131313@redhat.com>
2002-12-17 14:13 ` Kevin Buettner
2003-03-11 23:16 ` [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions Kevin Buettner
@ 2003-03-11 23:18 ` Kevin Buettner
2003-04-02 5:13 ` [RFA] MIPS: Add mappings for HI and LO registers Kevin Buettner
3 siblings, 0 replies; 17+ messages in thread
From: Kevin Buettner @ 2003-03-11 23:18 UTC (permalink / raw)
To: gdb-patches
On Mar 4, 1:01pm, Andrew Cagney wrote:
> > Okay?
>
> Yes.
>
> > * mips-tdep.c (do_fp_register_row): Fix typo which caused a double
> > type to be used when attempting to unpack a float.
Committed.
Kevin
^ permalink raw reply [flat|nested] 17+ messages in thread
* [RFA] MIPS: Add mappings for HI and LO registers
@ 2003-03-31 23:11 Kevin Buettner
2003-04-02 3:36 ` Andrew Cagney
0 siblings, 1 reply; 17+ messages in thread
From: Kevin Buettner @ 2003-03-31 23:11 UTC (permalink / raw)
To: gdb-patches
I've recently submitted some gcc patches which add debug info related
mappings for the MIPS "hi" and "lo" registers. (Previously, if either of
these appeared in DWARF 2 debug output, they'd show up as -1.)
The patch below adds the corresponding code for mapping these
registers from values that'll (hopefully soon) appear in debug info to
gdb's internal register numbers.
The most recent patch on the gcc side is:
http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02596.html
Okay? (If so, I'll wait for approval on the gcc side before committing
this patch.)
* mips-tdep.c (mips_dwarf_dwarf2_ecoff_reg_to_regnum)
(mips_stab_reg_to_regnum): Add mappings for HI_REGNUM and LO_REGNUM.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.178
diff -u -p -r1.178 mips-tdep.c
--- mips-tdep.c 26 Mar 2003 22:39:52 -0000 1.178
+++ mips-tdep.c 31 Mar 2003 22:49:23 -0000
@@ -5573,6 +5573,10 @@ mips_stab_reg_to_regnum (int num)
return num;
else if (num >= 38 && num < 70)
return num + FP0_REGNUM - 38;
+ else if (num == 70)
+ return HI_REGNUM;
+ else if (num == 71)
+ return LO_REGNUM;
else
{
/* This will hopefully (eventually) provoke a warning. Should
@@ -5591,6 +5595,10 @@ mips_dwarf_dwarf2_ecoff_reg_to_regnum (i
return num;
else if (num >= 32 && num < 64)
return num + FP0_REGNUM - 32;
+ else if (num == 64)
+ return HI_REGNUM;
+ else if (num == 65)
+ return LO_REGNUM;
else
{
/* This will hopefully (eventually) provoke a warning. Should
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] MIPS: Add mappings for HI and LO registers
2003-03-31 23:11 [RFA] MIPS: Add mappings for HI and LO registers Kevin Buettner
@ 2003-04-02 3:36 ` Andrew Cagney
0 siblings, 0 replies; 17+ messages in thread
From: Andrew Cagney @ 2003-04-02 3:36 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> I've recently submitted some gcc patches which add debug info related
> mappings for the MIPS "hi" and "lo" registers. (Previously, if either of
> these appeared in DWARF 2 debug output, they'd show up as -1.)
>
> The patch below adds the corresponding code for mapping these
> registers from values that'll (hopefully soon) appear in debug info to
> gdb's internal register numbers.
>
> The most recent patch on the gcc side is:
>
> http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02596.html
>
> Okay? (If so, I'll wait for approval on the gcc side before committing
> this patch.)
>
> * mips-tdep.c (mips_dwarf_dwarf2_ecoff_reg_to_regnum)
> (mips_stab_reg_to_regnum): Add mappings for HI_REGNUM and LO_REGNUM.
>
Yep.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] MIPS: Add mappings for HI and LO registers
[not found] ` <ac131313@redhat.com>
` (2 preceding siblings ...)
2003-03-11 23:18 ` [RFA] mips-tdep.c: Fix printing of floats in "info all-registers" Kevin Buettner
@ 2003-04-02 5:13 ` Kevin Buettner
3 siblings, 0 replies; 17+ messages in thread
From: Kevin Buettner @ 2003-04-02 5:13 UTC (permalink / raw)
To: gdb-patches
On Apr 1, 10:35pm, Andrew Cagney wrote:
> > * mips-tdep.c (mips_dwarf_dwarf2_ecoff_reg_to_regnum)
> > (mips_stab_reg_to_regnum): Add mappings for HI_REGNUM and LO_REGNUM.
>
> Yep.
Committed.
Kevin
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2003-04-02 5:13 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-04 17:24 [RFA] mips-tdep.c: Fix printing of floats in "info all-registers" Kevin Buettner
2003-03-04 18:01 ` Andrew Cagney
-- strict thread matches above, loose matches on Subject: below --
2003-03-31 23:11 [RFA] MIPS: Add mappings for HI and LO registers Kevin Buettner
2003-04-02 3:36 ` Andrew Cagney
2003-03-04 21:17 [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions Kevin Buettner
2003-03-07 17:04 ` Andrew Cagney
2003-03-07 17:52 ` Kevin Buettner
2003-03-07 18:52 ` Andrew Cagney
2003-03-11 21:22 ` Kevin Buettner
2003-03-11 22:06 ` Andrew Cagney
2003-03-07 19:13 ` Andrew Cagney
2002-12-17 10:35 [patch/rfc] Add get_*() to rs6000-tdep.c Andrew Cagney
[not found] ` <ac131313@redhat.com>
2002-12-17 14:13 ` Kevin Buettner
2002-12-18 7:37 ` Andrew Cagney
2003-03-11 23:16 ` [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions Kevin Buettner
2003-03-11 23:18 ` [RFA] mips-tdep.c: Fix printing of floats in "info all-registers" Kevin Buettner
2003-04-02 5:13 ` [RFA] MIPS: Add mappings for HI and LO registers Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox