This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: How to add core addresses (or LM_ADDR problems revisited)
> Second, regarding the types, I (initially) also thought that an offset
> should be represented as some other type (than a CORE_ADDR), but in
> the process of converting existing GDB code to use core_addr_add() and
> core_addr_sub(), I've found that the type of the offset is almost
> always a CORE_ADDR. (Maybe even always.) I suppose it's possible that
> we simply have this detail wrong, but I'm reluctant to change it at
> the moment. (It's rather pervasive...)
Yes, I've noticed this. I still think the difference between two
addresses is an offset, the addition of two addresses being pretty
meaningless, and an address plus offset returns an address.
If I were you, I wouldn't try to fix the actual code - it hasn't
affected things so far so I don't see this change breaking anything.
Instead, I'd just get the functions right and and add a note explaining
the problem of incorrect use. Later, when someone tries to make a
CORE_ADDR into a struct, this second problem can be fixed.
enjoy,
Andrew
PS: DOUBLEST is in a similar situtation.