This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Fix sparc-*-linux register fetching/storing
> Well, remember that we can't cast things to (CORE_ADDR *) reliably.
> With --enable-64-bit-bfd, that has a tendency to turn into a 'long long *'.
> What was happening was reading $sp out of the regcache, and then
> passing it to target_read_memory. If this were MIPS, I think we'd have
> to sign extend there, for "correctness". We'd eventually truncate it
> back down with a cast in infptrace.c, though.
>
> I just don't like duplicating that above code sequence everywhere we
> get a pointer out of a register into a CORE_ADDR. It seems like a very
> frequent operation, in nat or in tdep.
[Carefully read code ... Hmm, why is it reading registers from memory
(stack) ..... Hmm, why were all the registers written direct to the
stack ...? Hmm, nothing does something that stupid except something
with register windows .... Er, Oh dear....]
Sorry, yes that code, as it stands, looks like it does need to do an
extract_XXXX_address() call on the register.
As it stands? gdbarch_register_read/write and the fetch registers for
frame function should be mapping those registers onto memory addresses
instead of passing the problem down to the target fetch register code.
That way, those stored-in-memory registers are fetched via the memory
and not the data cache. That, however, is currently just theory :-)
Andrew