Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/rfc] blockframe.c: dummy frames unwind and pseudoregs
@ 2002-08-22  8:48 Elena Zannoni
  2002-08-22 11:35 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Elena Zannoni @ 2002-08-22  8:48 UTC (permalink / raw)
  To: gdb-patches


On the e500, the general registers are pseudo registers.
Such registers are used in the debug info to find the address of 
paramters and variables.

In the event that you do the following, you get an internal error:

(gdb) b main
Breakpoint 1 at 0x100002a4: file /es/scratch/ezannoni/uberbaum/src/gdb/testsuite/gdb.base/break.c, line 75.
(gdb) tar sim
Connected to the simulator.
(gdb) lo
(gdb) r
Starting program: /es/scratch/ezannoni/uberbaum/H-sparc-sun-solaris2.5-x-powerpc-eabispe-2/gdb/testsuite/gdb.base/break 

Breakpoint 1, main (argc=1, argv=0xdffffb38, envp=0xdffffb40)
    at /es/scratch/ezannoni/uberbaum/src/gdb/testsuite/gdb.base/break.c:75
75          if (argc == 12345) {  /* an unlikely value < 2^16, in case uninited */
(gdb) info addr argc
Symbol "argc" is an argument at offset 8 from register r31.
(gdb) b marker2
Breakpoint 2 at 0x1000021c: file /es/scratch/ezannoni/uberbaum/src/gdb/testsuite/gdb.base/break.c, line 49.
(gdb) p marker2(44)

Breakpoint 2, 0x1000021c in marker2 (a=268560764)
    at /es/scratch/ezannoni/uberbaum/src/gdb/testsuite/gdb.base/break.c:49
49      int marker2 (a) int a; { return (1); }
The program being debugged stopped while in a function called from GDB.
When the function (marker2) is done executing, GDB will silently
stop (instead of continuing to evaluate the expression containing
the function call).
(gdb) bt
#0  0x1000021c in marker2 (a=268560764)
    at /es/scratch/ezannoni/uberbaum/src/gdb/testsuite/gdb.base/break.c:49
#1  <function called from gdb>
#2  main (/es/scratch/ezannoni/uberbaum/src/gdb/regcache.c:638: gdb-internal-error: regcache_raw_read: Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed.
argc=An internal GDB error was detected.  This may make further
debugging unreliable.  Quit this debugging session? (y or n) 


argc is computerd using r31 which is a pseudo register on this target.

This is because the generic_call_dummy_register_unwind() doesn't deal with
pseudo registers. It has this comment:

      /* Return the actual value.  */
      /* FIXME: cagney/2002-06-26: This should be via the
         gdbarch_register_read() method so that it, on the fly,
         constructs either a raw or pseudo register from the raw
         register cache.  */
      regcache_raw_read (registers, regnum, bufferp);


If instead of raw reads I do cooked reads, I don't get the error.  I
wonder though if, based of the comment, this could be a problem for
other targets.
Thoughts?

Elena

2002-08-22  Elena Zannoni  <ezannoni@redhat.com>

	* blockframe.c (generic_call_dummy_register_unwind): Use
	regcache_cooked_read to catch cases in which the variable is
	stored in a pseudo register.

Index: blockframe.c
===================================================================
RCS file: /cvs/uberbaum/gdb/blockframe.c,v
retrieving revision 1.37
diff -u -p -r1.37 blockframe.c
--- blockframe.c	18 Aug 2002 22:40:15 -0000	1.37
+++ blockframe.c	22 Aug 2002 15:35:27 -0000
@@ -1406,7 +1406,7 @@ generic_call_dummy_register_unwind (stru
          gdbarch_register_read() method so that it, on the fly,
          constructs either a raw or pseudo register from the raw
          register cache.  */
-      regcache_raw_read (registers, regnum, bufferp);
+      regcache_cooked_read (registers, regnum, bufferp);
     }
 }


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

* Re: [RFA/rfc] blockframe.c: dummy frames unwind and pseudoregs
  2002-08-22  8:48 [RFA/rfc] blockframe.c: dummy frames unwind and pseudoregs Elena Zannoni
@ 2002-08-22 11:35 ` Andrew Cagney
  2002-08-22 15:28   ` Elena Zannoni
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2002-08-22 11:35 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb-patches


> This is because the generic_call_dummy_register_unwind() doesn't deal with
> pseudo registers. It has this comment:
> 
>       /* Return the actual value.  */
>       /* FIXME: cagney/2002-06-26: This should be via the
>          gdbarch_register_read() method so that it, on the fly,
>          constructs either a raw or pseudo register from the raw
>          register cache.  */
>       regcache_raw_read (registers, regnum, bufferp);
> 
> 
> If instead of raw reads I do cooked reads, I don't get the error.  I
> wonder though if, based of the comment, this could be a problem for
> other targets.
> Thoughts?

Two architecture features could cause problems:
- where an architecture has different sized raw and virtual (pre-cursor 
to cooked) registers
- where there are pseudo registers

MIPS has has different sized raw and virtual registers and, suprise!, 
doesn't use the code in question.

That code block definitly needs to read the cooked value.  The only 
potential problem is with:
http://sources.redhat.com/ml/gdb/2002-08/msg00196.html
and there, I think your case adds support to the argument that the dummy 
frame code should save (readonly) cooked values.

Given this, yes, ok.

BTW, don't forget to update the comment :-)

Andrew



> 2002-08-22  Elena Zannoni  <ezannoni@redhat.com>
> 
> 	* blockframe.c (generic_call_dummy_register_unwind): Use
> 	regcache_cooked_read to catch cases in which the variable is
> 	stored in a pseudo register.
> 
> Index: blockframe.c
> ===================================================================
> RCS file: /cvs/uberbaum/gdb/blockframe.c,v
> retrieving revision 1.37
> diff -u -p -r1.37 blockframe.c
> --- blockframe.c	18 Aug 2002 22:40:15 -0000	1.37
> +++ blockframe.c	22 Aug 2002 15:35:27 -0000
> @@ -1406,7 +1406,7 @@ generic_call_dummy_register_unwind (stru
>           gdbarch_register_read() method so that it, on the fly,
>           constructs either a raw or pseudo register from the raw
>           register cache.  */
> -      regcache_raw_read (registers, regnum, bufferp);
> +      regcache_cooked_read (registers, regnum, bufferp);
>      }
>  }
> 



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

* Re: [RFA/rfc] blockframe.c: dummy frames unwind and pseudoregs
  2002-08-22 11:35 ` Andrew Cagney
@ 2002-08-22 15:28   ` Elena Zannoni
  0 siblings, 0 replies; 3+ messages in thread
From: Elena Zannoni @ 2002-08-22 15:28 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Elena Zannoni, gdb-patches


Ok, I committed this:
Index: blockframe.c
===================================================================
RCS file: /cvs/uberbaum/gdb/blockframe.c,v
retrieving revision 1.37
diff -u -p -r1.37 blockframe.c
--- blockframe.c	18 Aug 2002 22:40:15 -0000	1.37
+++ blockframe.c	22 Aug 2002 22:23:15 -0000
@@ -1402,11 +1402,10 @@ generic_call_dummy_register_unwind (stru
 #endif
       gdb_assert (registers != NULL);
       /* Return the actual value.  */
-      /* FIXME: cagney/2002-06-26: This should be via the
-         gdbarch_register_read() method so that it, on the fly,
+      /* Use the regcache_cooked_read() method so that it, on the fly,
          constructs either a raw or pseudo register from the raw
          register cache.  */
-      regcache_raw_read (registers, regnum, bufferp);
+      regcache_cooked_read (registers, regnum, bufferp);
     }
 }
 



Andrew Cagney writes:
 > 
 > > This is because the generic_call_dummy_register_unwind() doesn't deal with
 > > pseudo registers. It has this comment:
 > > 
 > >       /* Return the actual value.  */
 > >       /* FIXME: cagney/2002-06-26: This should be via the
 > >          gdbarch_register_read() method so that it, on the fly,
 > >          constructs either a raw or pseudo register from the raw
 > >          register cache.  */
 > >       regcache_raw_read (registers, regnum, bufferp);
 > > 
 > > 
 > > If instead of raw reads I do cooked reads, I don't get the error.  I
 > > wonder though if, based of the comment, this could be a problem for
 > > other targets.
 > > Thoughts?
 > 
 > Two architecture features could cause problems:
 > - where an architecture has different sized raw and virtual (pre-cursor 
 > to cooked) registers
 > - where there are pseudo registers
 > 
 > MIPS has has different sized raw and virtual registers and, suprise!, 
 > doesn't use the code in question.
 > 
 > That code block definitly needs to read the cooked value.  The only 
 > potential problem is with:
 > http://sources.redhat.com/ml/gdb/2002-08/msg00196.html
 > and there, I think your case adds support to the argument that the dummy 
 > frame code should save (readonly) cooked values.
 > 
 > Given this, yes, ok.
 > 
 > BTW, don't forget to update the comment :-)
 > 
 > Andrew
 > 
 > 
 > 
 > > 2002-08-22  Elena Zannoni  <ezannoni@redhat.com>
 > > 
 > > 	* blockframe.c (generic_call_dummy_register_unwind): Use
 > > 	regcache_cooked_read to catch cases in which the variable is
 > > 	stored in a pseudo register.
 > > 
 > > Index: blockframe.c
 > > ===================================================================
 > > RCS file: /cvs/uberbaum/gdb/blockframe.c,v
 > > retrieving revision 1.37
 > > diff -u -p -r1.37 blockframe.c
 > > --- blockframe.c	18 Aug 2002 22:40:15 -0000	1.37
 > > +++ blockframe.c	22 Aug 2002 15:35:27 -0000
 > > @@ -1406,7 +1406,7 @@ generic_call_dummy_register_unwind (stru
 > >           gdbarch_register_read() method so that it, on the fly,
 > >           constructs either a raw or pseudo register from the raw
 > >           register cache.  */
 > > -      regcache_raw_read (registers, regnum, bufferp);
 > > +      regcache_cooked_read (registers, regnum, bufferp);
 > >      }
 > >  }
 > > 
 > 


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

end of thread, other threads:[~2002-08-22 22:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-22  8:48 [RFA/rfc] blockframe.c: dummy frames unwind and pseudoregs Elena Zannoni
2002-08-22 11:35 ` Andrew Cagney
2002-08-22 15:28   ` Elena Zannoni

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