This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] Use trad_frame_alloc_saved_regs everywhere
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: deuling at de dot ibm dot com (Markus Deuling)
- Cc: gdb-patches at sourceware dot org (GDB Patches), qinwei at sunnorth dot com dot cn
- Date: Mon, 26 Nov 2007 16:49:31 +0100 (CET)
- Subject: Re: [rfc] Use trad_frame_alloc_saved_regs everywhere
Markus Deuling wrote:
Sorry for the late review, this patch somehow slipped through ...
> I tried to port alpha target to use trad_frame_alloc_saved_regs correctly but
> I'm not sure I covered everything. I'd appreciate it very much if someone with
> access to an alpha machine could run the testsuite.
I agree that this is the right direction to go in principle, but it'll be
hard to verify correctness of a change like that without actually testing
on an alpha machine.
> What about that unused source part in score-tdep.c? Is it ok to delete it?
I see no reason why we need to delete this code right now -- we're not
actually removing the frame_obstack_zalloc routine, and the score-tdep.c
does not use SIZEOF_FRAME_SAVED_REGS.
A couple of remarks:
> diff -urpN src/gdb/alpha-mdebug-tdep.c dev/gdb/alpha-mdebug-tdep.c
> --- src/gdb/alpha-mdebug-tdep.c 2007-10-17 15:36:43.000000000 +0200
> +++ dev/gdb/alpha-mdebug-tdep.c 2007-11-15 08:54:54.000000000 +0100
> @@ -201,7 +201,7 @@ alpha_mdebug_frame_unwind_cache (struct
> info->proc_desc = proc_desc;
> gdb_assert (proc_desc != NULL);
>
> - info->saved_regs = frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS);
> + info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
>
> /* The VFP of the frame is at FRAME_REG+FRAME_OFFSET. */
> vfp = frame_unwind_register_unsigned (next_frame, PROC_FRAME_REG (proc_desc));
Well, you'll have to adapt all uses of saved_regs thoughout alpha-mdebug-tdep.c,
similar to what you did in alpha-tdep.c.
> diff -urpN src/gdb/alpha-tdep.c dev/gdb/alpha-tdep.c
> --- src/gdb/alpha-tdep.c 2007-11-09 06:32:19.000000000 +0100
> +++ dev/gdb/alpha-tdep.c 2007-11-15 09:44:20.000000000 +0100
> struct alpha_heuristic_unwind_cache
> {
> - CORE_ADDR *saved_regs;
> CORE_ADDR vfp;
> CORE_ADDR start_pc;
> int return_reg;
> + struct trad_frame_saved_reg *saved_regs;
> };
"return_reg" is now obsolete as well, right?
> @@ -1188,15 +1189,15 @@ alpha_heuristic_frame_prev_register (str
> the current frame. Frob regnum so that we pull the value from
> the correct place. */
> if (regnum == ALPHA_PC_REGNUM)
> - regnum = info->return_reg;
> + regnum = info->saved_regs[ALPHA_PC_REGNUM].realreg;
>
> - /* For all registers known to be saved in the current frame,
> + /* For all registers known to be saved in the current frame,
> do the obvious and pull the value out. */
> - if (info->saved_regs[regnum])
> + if (info->saved_regs[regnum].addr)
> {
> *optimizedp = 0;
> *lvalp = lval_memory;
> - *addrp = info->saved_regs[regnum];
> + *addrp = info->saved_regs[regnum].addr;
> *realnump = -1;
> if (bufferp != NULL)
> get_frame_memory (next_frame, *addrp, bufferp, ALPHA_REGISTER_SIZE);
Hmm, the idea of using trad-frame is that instead of coding all that
by hand, you should be able to just call trad_frame_get_prev_register ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com