This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] dwarf2loc.c: Add missing DWARF2_REG_TO_REGNUM call
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Kevin Buettner <kevinb at redhat dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Mon, 21 Apr 2003 18:02:54 -0400
- Subject: Re: [RFA] dwarf2loc.c: Add missing DWARF2_REG_TO_REGNUM call
- References: <1030421214653.ZM18664@localhost.localdomain>
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