* [RFA] better alpha_register_virtual_type
@ 2003-06-02 5:04 Richard Henderson
2003-06-02 16:30 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2003-06-02 5:04 UTC (permalink / raw)
To: gdb-patches
Ok?
r~
* alpha-tdep.c (alpha_register_virtual_type): Use void_data_ptr
for SP, GP; void_func_ptr for PC; non-language-specific types
for all others.
* alpha-tdep.h (ALPHA_GP_REGNUM): New.
Index: alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.95
diff -c -p -d -u -p -r1.95 alpha-tdep.c
--- alpha-tdep.c 2 Jun 2003 04:32:19 -0000 1.95
+++ alpha-tdep.c 2 Jun 2003 04:46:18 -0000
@@ -89,8 +89,17 @@ alpha_register_convertible (int regno)
static struct type *
alpha_register_virtual_type (int regno)
{
- return ((regno >= FP0_REGNUM && regno < (FP0_REGNUM+31))
- ? builtin_type_double : builtin_type_long);
+ if (regno == ALPHA_SP_REGNUM || regno == ALPHA_GP_REGNUM)
+ return builtin_type_void_data_ptr;
+ if (regno == ALPHA_PC_REGNUM)
+ return builtin_type_void_func_ptr;
+
+ /* Don't need to worry about little vs big endian until
+ some jerk tries to port to alpha-unicosmk. */
+ if (regno >= FP0_REGNUM && regno < FP0_REGNUM + 31)
+ return builtin_type_ieee_double_little;
+
+ return builtin_type_int64;
}
/* Is REGNUM a member of REGGROUP? */
Index: alpha-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.h,v
retrieving revision 1.15
diff -c -p -d -u -p -r1.15 alpha-tdep.h
--- alpha-tdep.h 1 Jun 2003 21:46:37 -0000 1.15
+++ alpha-tdep.h 2 Jun 2003 04:46:19 -0000
@@ -43,9 +43,10 @@
#define ALPHA_GCC_FP_REGNUM 15 /* Used by gcc as frame register */
#define ALPHA_A0_REGNUM 16 /* Loc of first arg during a subr call */
#define ALPHA_T9_REGNUM 23 /* Return address register for OSF/1 __div* */
+#define ALPHA_RA_REGNUM 26 /* Contains return address value */
#define ALPHA_T12_REGNUM 27 /* Contains start addr of current proc */
+#define ALPHA_GP_REGNUM 29 /* Contains the global pointer */
#define ALPHA_SP_REGNUM 30 /* Contains address of top of stack */
-#define ALPHA_RA_REGNUM 26 /* Contains return address value */
#define ALPHA_ZERO_REGNUM 31 /* Read-only register, always 0 */
#define ALPHA_FP0_REGNUM 32 /* Floating point register 0 */
#define ALPHA_FPA0_REGNUM 48 /* First float arg during a subr call */
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] better alpha_register_virtual_type
2003-06-02 5:04 [RFA] better alpha_register_virtual_type Richard Henderson
@ 2003-06-02 16:30 ` Daniel Jacobowitz
2003-06-02 16:43 ` Richard Henderson
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2003-06-02 16:30 UTC (permalink / raw)
To: Richard Henderson; +Cc: gdb-patches
On Sun, Jun 01, 2003 at 10:03:58PM -0700, Richard Henderson wrote:
> Ok?
Yes. I was a little surprised by the void_data_ptr/void_func_ptr bit,
but I see that d10v does the same thing, so it must be right :)
Hmm, I'm not sure. Any particular reason for this patch? The
ieee_double_little and int64 parts are definitely correct, but
>
>
> r~
>
>
> * alpha-tdep.c (alpha_register_virtual_type): Use void_data_ptr
> for SP, GP; void_func_ptr for PC; non-language-specific types
> for all others.
> * alpha-tdep.h (ALPHA_GP_REGNUM): New.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] better alpha_register_virtual_type
2003-06-02 16:30 ` Daniel Jacobowitz
@ 2003-06-02 16:43 ` Richard Henderson
2003-06-02 17:09 ` Daniel Jacobowitz
2003-06-02 19:06 ` Andrew Cagney
0 siblings, 2 replies; 6+ messages in thread
From: Richard Henderson @ 2003-06-02 16:43 UTC (permalink / raw)
To: gdb-patches
On Mon, Jun 02, 2003 at 12:30:36PM -0400, Daniel Jacobowitz wrote:
> Yes. I was a little surprised by the void_data_ptr/void_func_ptr bit,
> but I see that d10v does the same thing, so it must be right :)
>
> Hmm, I'm not sure. Any particular reason for this patch?
Well, the void_func_ptr bit is nice because "info r" yields
pc 0x12000053c 0x12000053c <main+16>
The void_data_ptr bits I think just document which registers
are ABI mandated to contain pointer values all of the time.
Actually, I have a related question here. Something that I
didn't notice earlier is that d10v is using register_type,
not register_virtual_type. Looking at the guts of regcache.c,
it would appear that the later is deprecated, since not
having a register_type hook (among other things) results in
legacy_p being set.
I thought it obvious to rename my existing hook, but that changes
the behaviour of "info r" -- I no longer get the pc decoded, and
indeed "ptype $pc" once again yields int64_t.
Is this a bug elsewhere in gdb, or what?
Oh, and wrt regcache's legacy_p, it seems to want you to implement
the pseudo_register_{read,write} hooks, even if the target doesn't
have any. But nevertheless d10v doesn't implement the hooks.
Perhaps the predicates should be modified to notice that there are
no pseudos defined?
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] better alpha_register_virtual_type
2003-06-02 16:43 ` Richard Henderson
@ 2003-06-02 17:09 ` Daniel Jacobowitz
2003-06-02 19:06 ` Andrew Cagney
1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2003-06-02 17:09 UTC (permalink / raw)
To: Richard Henderson; +Cc: gdb-patches
On Mon, Jun 02, 2003 at 09:43:05AM -0700, Richard Henderson wrote:
> On Mon, Jun 02, 2003 at 12:30:36PM -0400, Daniel Jacobowitz wrote:
> > Yes. I was a little surprised by the void_data_ptr/void_func_ptr bit,
> > but I see that d10v does the same thing, so it must be right :)
> >
> > Hmm, I'm not sure. Any particular reason for this patch?
>
> Well, the void_func_ptr bit is nice because "info r" yields
>
> pc 0x12000053c 0x12000053c <main+16>
>
> The void_data_ptr bits I think just document which registers
> are ABI mandated to contain pointer values all of the time.
Hmm, that's pretty nice. Sure.
> Actually, I have a related question here. Something that I
> didn't notice earlier is that d10v is using register_type,
> not register_virtual_type. Looking at the guts of regcache.c,
> it would appear that the later is deprecated, since not
> having a register_type hook (among other things) results in
> legacy_p being set.
>
> I thought it obvious to rename my existing hook, but that changes
> the behaviour of "info r" -- I no longer get the pc decoded, and
> indeed "ptype $pc" once again yields int64_t.
>
> Is this a bug elsewhere in gdb, or what?
Hum. That seems strange if you look at init_regcache_descr, since
gdbarch_register_type and REGISTER_VIRTUAL_TYPE are used similarly. I
can't see how legacy_p would affect this.
What does ptype $pc say - does it show up as an int64_t or a code
pointer?
> Oh, and wrt regcache's legacy_p, it seems to want you to implement
> the pseudo_register_{read,write} hooks, even if the target doesn't
> have any. But nevertheless d10v doesn't implement the hooks.
> Perhaps the predicates should be modified to notice that there are
> no pseudos defined?
I don't see what you mean; it's:
if (!gdbarch_pseudo_register_read_p (gdbarch)
&& !gdbarch_pseudo_register_write_p (gdbarch)
&& !gdbarch_register_type_p (gdbarch))
but gdbarch_register_type_p should be true.
"maint print registers" might be handy here.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] better alpha_register_virtual_type
2003-06-02 16:43 ` Richard Henderson
2003-06-02 17:09 ` Daniel Jacobowitz
@ 2003-06-02 19:06 ` Andrew Cagney
2003-06-02 22:39 ` Richard Henderson
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2003-06-02 19:06 UTC (permalink / raw)
To: Richard Henderson; +Cc: gdb-patches
> On Mon, Jun 02, 2003 at 12:30:36PM -0400, Daniel Jacobowitz wrote:
>
>> Yes. I was a little surprised by the void_data_ptr/void_func_ptr bit,
>> but I see that d10v does the same thing, so it must be right :)
For the d10v it is 100% right. The d10v's PC needs to be a code pointer
so that it it is automatically converted into a CORE_ADDR when used in
equations vis:
(gdb) ptype $pc
type = void (*)()
(gdb) x/i $pc
0x10140b8 <main+20>: ld r0, @r11 || nop
(gdb) print/x $pc
$1 = 0x10140b8
(gdb) print/x (int)$pc
$2 = 0x502e
>> Hmm, I'm not sure. Any particular reason for this patch?
>
>
> Well, the void_func_ptr bit is nice because "info r" yields
>
> pc 0x12000053c 0x12000053c <main+16>
>
> The void_data_ptr bits I think just document which registers
> are ABI mandated to contain pointer values all of the time.
>
> Actually, I have a related question here. Something that I
> didn't notice earlier is that d10v is using register_type,
> not register_virtual_type. Looking at the guts of regcache.c,
> it would appear that the later is deprecated, since not
> having a register_type hook (among other things) results in
> legacy_p being set.
>
> I thought it obvious to rename my existing hook, but that changes
> the behaviour of "info r" -- I no longer get the pc decoded, and
> indeed "ptype $pc" once again yields int64_t.
Something weird is happening. The only thing notable about the d10v is
that it doesn't set PC_REGNUM (per above, the d10v works). Perhaphs the
alpha definition is confusing std-regs.c / builtin-regs.c (but that
doesn't make much sense).
> Is this a bug elsewhere in gdb, or what?
Perhaps.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] better alpha_register_virtual_type
2003-06-02 19:06 ` Andrew Cagney
@ 2003-06-02 22:39 ` Richard Henderson
0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2003-06-02 22:39 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Mon, Jun 02, 2003 at 03:06:19PM -0400, Andrew Cagney wrote:
> >I thought it obvious to rename my existing hook, but that changes
> >the behaviour of "info r" -- I no longer get the pc decoded, and
> >indeed "ptype $pc" once again yields int64_t.
>
> Something weird is happening. The only thing notable about the d10v is
> that it doesn't set PC_REGNUM (per above, the d10v works). Perhaphs the
> alpha definition is confusing std-regs.c / builtin-regs.c (but that
> doesn't make much sense).
I have no idea. I can't replicate this now. I've made the
change to _register_type again and things seem to work as
expected. Perhaps I did something stupid before. *shrug*
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-06-02 22:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-02 5:04 [RFA] better alpha_register_virtual_type Richard Henderson
2003-06-02 16:30 ` Daniel Jacobowitz
2003-06-02 16:43 ` Richard Henderson
2003-06-02 17:09 ` Daniel Jacobowitz
2003-06-02 19:06 ` Andrew Cagney
2003-06-02 22:39 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox