Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* frame_register_read()
@ 2002-05-14  3:19 Richard Earnshaw
  2002-05-14  7:41 ` frame_register_read() Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Earnshaw @ 2002-05-14  3:19 UTC (permalink / raw)
  To: gdb; +Cc: Richard.Earnshaw, Andrew Cagney


Andrew,

frame_register_read() contains the comment

  /* FIXME: cagney/2002-04-10: This test is just bogus.  It is no
     indication of the validity of the register.  The value could
     easily be found (on the stack) even though the corresponding
     register isn't available.  */
  if (register_cached (regnum) < 0)
    return 0;                   /* register value not available */

But in regcache.c we have

/* REGISTER_VALID is 0 if the register needs to be fetched,
                     1 if it has been fetched, and
                    -1 if the register value was not available.  
   "Not available" means don't try to fetch it again.  */

So why is the code in frame_register_read incorrect?  It's simply testing 
that the register exists for this target.  If it doesn't exist, then how 
can it be recovered from the stack?

I guess it is possible that the check should be moved into 
default_get_saved_register, for the case where we are trying to fetch the 
register directly from the regcache, but either the target has this 
register, or it doesn't.

R.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: frame_register_read()
  2002-05-14  3:19 frame_register_read() Richard Earnshaw
@ 2002-05-14  7:41 ` Andrew Cagney
  2002-05-14  9:00   ` frame_register_read() Richard Earnshaw
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2002-05-14  7:41 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb

> Andrew,
> 
> frame_register_read() contains the comment
> 
>   /* FIXME: cagney/2002-04-10: This test is just bogus.  It is no
>      indication of the validity of the register.  The value could
>      easily be found (on the stack) even though the corresponding
>      register isn't available.  */
>   if (register_cached (regnum) < 0)
>     return 0;                   /* register value not available */
> 
> But in regcache.c we have
> 
> /* REGISTER_VALID is 0 if the register needs to be fetched,
>                      1 if it has been fetched, and
>                     -1 if the register value was not available.  
>    "Not available" means don't try to fetch it again.  */
> 
> So why is the code in frame_register_read incorrect?  It's simply testing 
> that the register exists for this target.  If it doesn't exist, then how 
> can it be recovered from the stack?

Introspect (tracepoints, target snapshots) do this.  If a specific 
snapshot doesn't contain a register then the register is unavailable. 
The corresponding hardware still has the register so its value can be 
found on the stack.

> I guess it is possible that the check should be moved into 
> default_get_saved_register, for the case where we are trying to fetch the 
> register directly from the regcache, but either the target has this 
> register, or it doesn't.

Andrew




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: frame_register_read()
  2002-05-14  7:41 ` frame_register_read() Andrew Cagney
@ 2002-05-14  9:00   ` Richard Earnshaw
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Earnshaw @ 2002-05-14  9:00 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Richard.Earnshaw, gdb

> > Andrew,
> > 
> > frame_register_read() contains the comment
> > 
> >   /* FIXME: cagney/2002-04-10: This test is just bogus.  It is no
> >      indication of the validity of the register.  The value could
> >      easily be found (on the stack) even though the corresponding
> >      register isn't available.  */
> >   if (register_cached (regnum) < 0)
> >     return 0;                   /* register value not available */
> > 
> > But in regcache.c we have
> > 
> > /* REGISTER_VALID is 0 if the register needs to be fetched,
> >                      1 if it has been fetched, and
> >                     -1 if the register value was not available.  
> >    "Not available" means don't try to fetch it again.  */
> > 
> > So why is the code in frame_register_read incorrect?  It's simply testing 
> > that the register exists for this target.  If it doesn't exist, then how 
> > can it be recovered from the stack?
> 
> Introspect (tracepoints, target snapshots) do this.  If a specific 
> snapshot doesn't contain a register then the register is unavailable. 
> The corresponding hardware still has the register so its value can be 
> found on the stack.

So it seems the comment in regcache.c is incomplete/misleading.  Could you 
clarify it?

R.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-05-14 16:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-14  3:19 frame_register_read() Richard Earnshaw
2002-05-14  7:41 ` frame_register_read() Andrew Cagney
2002-05-14  9:00   ` frame_register_read() Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox