Re: [RFC] Implementation of DW_OP_deref and DW_OP_deref_size operators

Jim Blandy
2002-07-05T03:05:15Z

Mark Kettenis <kettenis@chello.nl> writes:
> After staring for a while at some compiler warnings resulting from an
> attempt to make an i386 x x86-64 cross-debugger, and failing to
> understand the code that implements the DW_OP_deref and
> DW_OP_deref_size operators I think I've found out what's wrong.
>
> These expressions are supposed to dereference pointers. In GDB this
> means that they should look at the address indicated by the pointer
> they're dereferencing *in the target*. The current code is trying to
> dereference a pointer in GDB. If we look at the history of this code
> it is perfectly understandable. It is largely copied from the
> unwinder that comes with GCC. This unwinder is supposed to be linked
> into the program that contains the DWARF2 code, so in that context it
> makes sense to lookup pointers in the program this code is running in.
>
> Does this sound reasonable?

Yes! However, pointers are not always unsigned. I think on some
32-bit ABIs for 64-bit MIPS chips they need to be signed. Andrew will
know the facts.