This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
address-to-pointer gotcha
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: address-to-pointer gotcha
- From: David Taylor <taylor at cygnus dot com>
- Date: Tue, 17 Oct 2000 12:18:59 -0400
Just an FYI --
If you have a port where addresses and pointers are not identical and
the mapping is dependent upon the type of object being referred to
(e.g., a pointer to data vs a pointer to a function), then you should
be aware that there are places where ADDRESS_TO_POINTER is called with
the wrong type (in particular, it is sometimes called with a text
address and a type of pointer to void...
If your address_to_pointer routine does:
enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
addr >>= 1;
you *ARE* going to lose.