* REGISTER_BYTE() and pseudos
@ 2002-05-15 9:36 Richard Earnshaw
2002-05-15 10:06 ` Andrew Cagney
0 siblings, 1 reply; 8+ messages in thread
From: Richard Earnshaw @ 2002-05-15 9:36 UTC (permalink / raw)
To: gdb; +Cc: Richard.Earnshaw
What should REGISTER_BYTE() return for a pseudo that doesn't have space
allocated in registers[]?
R.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REGISTER_BYTE() and pseudos
2002-05-15 9:36 REGISTER_BYTE() and pseudos Richard Earnshaw
@ 2002-05-15 10:06 ` Andrew Cagney
2002-05-15 10:35 ` Elena Zannoni
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2002-05-15 10:06 UTC (permalink / raw)
To: Richard.Earnshaw, Elena Zannoni; +Cc: gdb
> What should REGISTER_BYTE() return for a pseudo that doesn't have space
> allocated in registers[]?
It shouldn't matter. However, check with Elena for what was done with
the sh5.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REGISTER_BYTE() and pseudos
2002-05-15 10:06 ` Andrew Cagney
@ 2002-05-15 10:35 ` Elena Zannoni
2002-05-15 10:46 ` Richard Earnshaw
2002-05-15 11:08 ` Richard Earnshaw
0 siblings, 2 replies; 8+ messages in thread
From: Elena Zannoni @ 2002-05-15 10:35 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Richard.Earnshaw, Elena Zannoni, gdb
Andrew Cagney writes:
> > What should REGISTER_BYTE() return for a pseudo that doesn't have space
> > allocated in registers[]?
>
> It shouldn't matter. However, check with Elena for what was done with
> the sh5.
>
> Andrew
>
>
Yeah, I was going to chime in, but I am behind on this thread.
Richard, look at the sh-tdep.c file. I checked in the sh5 work. It
still needs another round of cleaning but ti should pretty much all be
there.
Elena
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REGISTER_BYTE() and pseudos
2002-05-15 10:35 ` Elena Zannoni
@ 2002-05-15 10:46 ` Richard Earnshaw
2002-05-15 11:46 ` Elena Zannoni
2002-05-15 11:08 ` Richard Earnshaw
1 sibling, 1 reply; 8+ messages in thread
From: Richard Earnshaw @ 2002-05-15 10:46 UTC (permalink / raw)
To: Elena Zannoni; +Cc: Andrew Cagney, Richard.Earnshaw, gdb
> Yeah, I was going to chime in, but I am behind on this thread.
> Richard, look at the sh-tdep.c file. I checked in the sh5 work. It
> still needs another round of cleaning but ti should pretty much all be
> there.
OK, I'll have another look.
The bit I'm worried about though is if we call something like
generic_get_saved_register for a pseudo and we hit a call_dummy frame.
The code in there goes:
if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
{
if (lval) /* found it in a CALL_DUMMY frame */
*lval = not_lval;
if (raw_buffer)
memcpy (raw_buffer,
generic_find_dummy_frame (frame->pc, frame->frame) +
REGISTER_BYTE (regnum),
REGISTER_RAW_SIZE (regnum));
return;
Which will try to look up the pseudo in the buffer even if it isn't there.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REGISTER_BYTE() and pseudos
2002-05-15 10:35 ` Elena Zannoni
2002-05-15 10:46 ` Richard Earnshaw
@ 2002-05-15 11:08 ` Richard Earnshaw
2002-05-15 11:45 ` Elena Zannoni
2002-05-15 13:01 ` Andrew Cagney
1 sibling, 2 replies; 8+ messages in thread
From: Richard Earnshaw @ 2002-05-15 11:08 UTC (permalink / raw)
To: Elena Zannoni; +Cc: Andrew Cagney, Richard.Earnshaw, gdb
OK, I see what you are doing. Basically, if a pseudo maps onto a real
register somewhere in the regcache, you return the address of that.
However, what should be done if the pseudo doesn't exist as a single
entry, or if it is a manipulation of a real register? For example, on the
ARM, the CPSR may be just a few bits retrieved from the PC.
Also, what would you do if you needed to address two non-adjacent
registers?
R.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REGISTER_BYTE() and pseudos
2002-05-15 11:08 ` Richard Earnshaw
@ 2002-05-15 11:45 ` Elena Zannoni
2002-05-15 13:01 ` Andrew Cagney
1 sibling, 0 replies; 8+ messages in thread
From: Elena Zannoni @ 2002-05-15 11:45 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: Elena Zannoni, Andrew Cagney, gdb
Richard Earnshaw writes:
> OK, I see what you are doing. Basically, if a pseudo maps onto a real
> register somewhere in the regcache, you return the address of that.
>
> However, what should be done if the pseudo doesn't exist as a single
> entry, or if it is a manipulation of a real register? For example, on the
> ARM, the CPSR may be just a few bits retrieved from the PC.
>
> Also, what would you do if you needed to address two non-adjacent
> registers?
>
> R.
Look at sh64_pseudo_register_read() and how FPSCR is treated. FPSCR
is built as a collection of non-adjacent bits in various architectural
registers.
In theory sh64_pseudo_register_read shouldn't even be there. All that
code should just be part of sh64_register_read. Basically
sh64_register_read just does what it wants with the registers, almost
like if there was no difference between pseudos and real registers.
Same with sh64_register_write and sh64_pseudo_register_write.
Elena
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REGISTER_BYTE() and pseudos
2002-05-15 10:46 ` Richard Earnshaw
@ 2002-05-15 11:46 ` Elena Zannoni
0 siblings, 0 replies; 8+ messages in thread
From: Elena Zannoni @ 2002-05-15 11:46 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: Elena Zannoni, Andrew Cagney, gdb
Richard Earnshaw writes:
>
> > Yeah, I was going to chime in, but I am behind on this thread.
> > Richard, look at the sh-tdep.c file. I checked in the sh5 work. It
> > still needs another round of cleaning but ti should pretty much all be
> > there.
>
> OK, I'll have another look.
>
> The bit I'm worried about though is if we call something like
> generic_get_saved_register for a pseudo and we hit a call_dummy frame.
> The code in there goes:
>
> if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
> {
> if (lval) /* found it in a CALL_DUMMY frame */
> *lval = not_lval;
> if (raw_buffer)
> memcpy (raw_buffer,
> generic_find_dummy_frame (frame->pc, frame->frame) +
> REGISTER_BYTE (regnum),
> REGISTER_RAW_SIZE (regnum));
> return;
>
> Which will try to look up the pseudo in the buffer even if it isn't there.
Hmmm, yes you are probably right. That case is likely broken then.
Elena
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REGISTER_BYTE() and pseudos
2002-05-15 11:08 ` Richard Earnshaw
2002-05-15 11:45 ` Elena Zannoni
@ 2002-05-15 13:01 ` Andrew Cagney
1 sibling, 0 replies; 8+ messages in thread
From: Andrew Cagney @ 2002-05-15 13:01 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: Elena Zannoni, gdb
> OK, I see what you are doing. Basically, if a pseudo maps onto a real
> register somewhere in the regcache, you return the address of that.
>
> However, what should be done if the pseudo doesn't exist as a single
> entry, or if it is a manipulation of a real register? For example, on the
> ARM, the CPSR may be just a few bits retrieved from the PC.
>
> Also, what would you do if you needed to address two non-adjacent
> registers?
Return ``not_lval''. I think that case can go in the too hard basket.
First, I don't know if GDB's ``struct value'' system is rich enough to
describe a value split across [disjoint] registers and memory. Second,
even if it was, the current get_saved_register() doesn't make that
knowledge available. An interface more like value_of_register() would
be better.
BTW, this code:
> OK, I'll have another look.
>
> The bit I'm worried about though is if we call something like
> generic_get_saved_register for a pseudo and we hit a call_dummy frame.
> The code in there goes:
>
> if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
> {
> if (lval) /* found it in a CALL_DUMMY frame */
> *lval = not_lval;
> if (raw_buffer)
> memcpy (raw_buffer,
> generic_find_dummy_frame (frame->pc, frame->frame) +
> REGISTER_BYTE (regnum),
> REGISTER_RAW_SIZE (regnum));
> return;
>
> Which will try to look up the pseudo in the buffer even if it isn't
there.
Reveals a problem with the patch:
http://sources.redhat.com/ml/gdb-patches/2002-05/msg00416.html
For the moment a custom get_saved_register will get around this.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-05-15 20:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-15 9:36 REGISTER_BYTE() and pseudos Richard Earnshaw
2002-05-15 10:06 ` Andrew Cagney
2002-05-15 10:35 ` Elena Zannoni
2002-05-15 10:46 ` Richard Earnshaw
2002-05-15 11:46 ` Elena Zannoni
2002-05-15 11:08 ` Richard Earnshaw
2002-05-15 11:45 ` Elena Zannoni
2002-05-15 13:01 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox