This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

address-to-pointer gotcha


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]