This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] findvar.c: support LOC_BASEREG[_ARG] on Harvard archs
- To: Nick Duffek <nsd at redhat dot com>
- Subject: Re: [RFA] findvar.c: support LOC_BASEREG[_ARG] on Harvard archs
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- Date: 16 Jul 2001 17:18:39 -0500
- Cc: ezannoni at cygnus dot com, gdb-patches at sources dot redhat dot com,taylor at candd dot org
- References: <np7kx8zpy0.fsf@zwingli.cygnus.com><200107161954.f6GJskB20239@rtl.cygnus.com>
Nick Duffek <nsd@redhat.com> writes:
> >You should do similar things for LOC_INDIRECT,
>
> Aren't LOC_INDIRECT addresses from the symbol table and therefore already
> Harvard-adjusted?
SYMBOL_VALUE_ADDRESS (var) is already an address, but the value
returned by read_memory_unsigned_integer will not be.
> >LOC_REF_ARG,
>
> I think that architectures already handle this in their own
> FRAME_ARGS_ADDRESS implementations, so this would do double pointer
> translation.
Similar --- read_memory_unsigned_integer will return a value which
needs to be tweaked.
Your revisions below look okay to me.
> Index: gdb/findvar.c
> ===================================================================
> diff -up gdb/findvar.c gdb/findvar.c
> --- gdb/findvar.c Mon Jul 16 15:52:10 2001
> +++ gdb/findvar.c Mon Jul 16 15:51:58 2001
> @@ -610,22 +610,15 @@ addresses have not been bound by the dyn
>
> case LOC_BASEREG:
> case LOC_BASEREG_ARG:
> - {
> - char *buf = (char*) alloca (MAX_REGISTER_RAW_SIZE);
> - get_saved_register (buf, NULL, NULL, frame, SYMBOL_BASEREG (var),
> - NULL);
> - addr = extract_address (buf, REGISTER_RAW_SIZE (SYMBOL_BASEREG (var)));
> - addr += SYMBOL_VALUE (var);
> - break;
> - }
> -
> case LOC_THREAD_LOCAL_STATIC:
> {
> - char *buf = (char*) alloca (MAX_REGISTER_RAW_SIZE);
> + value_ptr regval;
>
> - get_saved_register (buf, NULL, NULL, frame, SYMBOL_BASEREG (var),
> - NULL);
> - addr = extract_address (buf, REGISTER_RAW_SIZE (SYMBOL_BASEREG (var)));
> + regval = value_from_register (lookup_pointer_type (type),
> + SYMBOL_BASEREG (var), frame);
> + if (regval == NULL)
> + error ("Value of base register not available.");
> + addr = value_as_pointer (regval);
> addr += SYMBOL_VALUE (var);
> break;
> }
>