Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] dwarf2loc.c: Add missing DWARF2_REG_TO_REGNUM call
@ 2003-04-21 21:47 Kevin Buettner
  2003-04-21 22:02 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Buettner @ 2003-04-21 21:47 UTC (permalink / raw)
  To: gdb-patches

I'm testing on a target for which DWARF2_REG_TO_REGNUM is not the
identity function.  I found that gdb was fetching the wrong register
in dwarf2loc.c.  The patch below fixes this problem.

Okay?

(This is almost obvious, but there are several choices for where this
call might be placed...)

	* dwarf2loc.c (dwarf2_evaluate_loc_desc): Invoke DWARF2_REG_TO_REGNUM
	on the DWARF2 register number prior to fetching a register.

Index: dwarf2loc.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/dwarf2loc.c,v
retrieving revision 2.2
diff -u -p -r2.2 dwarf2loc.c
--- dwarf2loc.c	2003/04/16 21:18:45	2.2
+++ dwarf2loc.c	2003/04/21 21:32:40
@@ -223,7 +223,8 @@ dwarf2_evaluate_loc_desc (struct symbol 
   result = dwarf_expr_fetch (ctx, 0);
 
   if (ctx->in_reg)
-    retval = value_from_register (SYMBOL_TYPE (var), result, frame);
+    retval = value_from_register (SYMBOL_TYPE (var),
+                                  DWARF2_REG_TO_REGNUM (result), frame);
   else
     {
       retval = allocate_value (SYMBOL_TYPE (var));


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

* Re: [RFA] dwarf2loc.c: Add missing DWARF2_REG_TO_REGNUM call
  2003-04-21 21:47 [RFA] dwarf2loc.c: Add missing DWARF2_REG_TO_REGNUM call Kevin Buettner
@ 2003-04-21 22:02 ` Daniel Jacobowitz
  2003-04-22 14:15   ` Elena Zannoni
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2003-04-21 22:02 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

On Mon, Apr 21, 2003 at 02:46:53PM -0700, Kevin Buettner wrote:
> I'm testing on a target for which DWARF2_REG_TO_REGNUM is not the
> identity function.  I found that gdb was fetching the wrong register
> in dwarf2loc.c.  The patch below fixes this problem.
> 
> Okay?
> 
> (This is almost obvious, but there are several choices for where this
> call might be placed...)

Hmm... this isn't my area to approve, but I believe this the right
place for the call.  dwarf_expr_read_reg already assumes that the regno
on the stack is a DWARF-2 register number.

> 
> 	* dwarf2loc.c (dwarf2_evaluate_loc_desc): Invoke DWARF2_REG_TO_REGNUM
> 	on the DWARF2 register number prior to fetching a register.
> 
> Index: dwarf2loc.c
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/dwarf2loc.c,v
> retrieving revision 2.2
> diff -u -p -r2.2 dwarf2loc.c
> --- dwarf2loc.c	2003/04/16 21:18:45	2.2
> +++ dwarf2loc.c	2003/04/21 21:32:40
> @@ -223,7 +223,8 @@ dwarf2_evaluate_loc_desc (struct symbol 
>    result = dwarf_expr_fetch (ctx, 0);
>  
>    if (ctx->in_reg)
> -    retval = value_from_register (SYMBOL_TYPE (var), result, frame);
> +    retval = value_from_register (SYMBOL_TYPE (var),
> +                                  DWARF2_REG_TO_REGNUM (result), frame);
>    else
>      {
>        retval = allocate_value (SYMBOL_TYPE (var));
> 

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: [RFA] dwarf2loc.c: Add missing DWARF2_REG_TO_REGNUM call
  2003-04-21 22:02 ` Daniel Jacobowitz
@ 2003-04-22 14:15   ` Elena Zannoni
  2003-04-22 23:48     ` Kevin Buettner
  0 siblings, 1 reply; 4+ messages in thread
From: Elena Zannoni @ 2003-04-22 14:15 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Kevin Buettner, gdb-patches

Daniel Jacobowitz writes:
 > On Mon, Apr 21, 2003 at 02:46:53PM -0700, Kevin Buettner wrote:
 > > I'm testing on a target for which DWARF2_REG_TO_REGNUM is not the
 > > identity function.  I found that gdb was fetching the wrong register
 > > in dwarf2loc.c.  The patch below fixes this problem.
 > > 
 > > Okay?
 > > 
 > > (This is almost obvious, but there are several choices for where this
 > > call might be placed...)
 > 
 > Hmm... this isn't my area to approve, but I believe this the right
 > place for the call.  dwarf_expr_read_reg already assumes that the regno
 > on the stack is a DWARF-2 register number.
 > 

OK from my side, except, could you introduce a new variable 'regnum'?

elena


 > > 
 > > 	* dwarf2loc.c (dwarf2_evaluate_loc_desc): Invoke DWARF2_REG_TO_REGNUM
 > > 	on the DWARF2 register number prior to fetching a register.
 > > 
 > > Index: dwarf2loc.c
 > > ===================================================================
 > > RCS file: /cvs/cvsfiles/devo/gdb/dwarf2loc.c,v
 > > retrieving revision 2.2
 > > diff -u -p -r2.2 dwarf2loc.c
 > > --- dwarf2loc.c	2003/04/16 21:18:45	2.2
 > > +++ dwarf2loc.c	2003/04/21 21:32:40
 > > @@ -223,7 +223,8 @@ dwarf2_evaluate_loc_desc (struct symbol 
 > >    result = dwarf_expr_fetch (ctx, 0);
 > >  
 > >    if (ctx->in_reg)
 > > -    retval = value_from_register (SYMBOL_TYPE (var), result, frame);
 > > +    retval = value_from_register (SYMBOL_TYPE (var),
 > > +                                  DWARF2_REG_TO_REGNUM (result), frame);
 > >    else
 > >      {
 > >        retval = allocate_value (SYMBOL_TYPE (var));
 > > 
 > 
 > -- 
 > Daniel Jacobowitz
 > MontaVista Software                         Debian GNU/Linux Developer


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

* Re: [RFA] dwarf2loc.c: Add missing DWARF2_REG_TO_REGNUM call
  2003-04-22 14:15   ` Elena Zannoni
@ 2003-04-22 23:48     ` Kevin Buettner
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Buettner @ 2003-04-22 23:48 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb-patches

On Apr 22, 10:20am, Elena Zannoni wrote:

> OK from my side, except, could you introduce a new variable 'regnum'?

Here's what I committed:

	* dwarf2loc.c (dwarf2_evaluate_loc_desc): Invoke DWARF2_REG_TO_REGNUM
	on the DWARF2 register number prior to fetching a register.

Index: dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- dwarf2loc.c	13 Apr 2003 15:53:44 -0000	1.6
+++ dwarf2loc.c	22 Apr 2003 23:18:26 -0000	1.7
@@ -223,7 +223,10 @@ dwarf2_evaluate_loc_desc (struct symbol 
   result = dwarf_expr_fetch (ctx, 0);
 
   if (ctx->in_reg)
-    retval = value_from_register (SYMBOL_TYPE (var), result, frame);
+    {
+      int regnum = DWARF2_REG_TO_REGNUM (result);
+      retval = value_from_register (SYMBOL_TYPE (var), regnum, frame);
+    }
   else
     {
       retval = allocate_value (SYMBOL_TYPE (var));


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

end of thread, other threads:[~2003-04-22 23:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-21 21:47 [RFA] dwarf2loc.c: Add missing DWARF2_REG_TO_REGNUM call Kevin Buettner
2003-04-21 22:02 ` Daniel Jacobowitz
2003-04-22 14:15   ` Elena Zannoni
2003-04-22 23:48     ` Kevin Buettner

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