This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Can't build ppc32 GDB
> Date: Fri, 5 May 2006 12:29:55 -0400
> From: Daniel Jacobowitz <drow@false.org>
>
> On Thu, May 04, 2006 at 09:12:14AM +0200, Mark Kettenis wrote:
> > This is where the new ISO C99 <stdint.h> types come in handy. Instead of
> > casting to CORE_ADDR, try casting to uintptr_t.
>
> Can we rely on <stdint.h> on GNU/Linux? I know we can't in general.
> Conveniently, I have a patch on one of my pending branches that
> provides a gdb_stdint.h.
Having a gdb_stdint.h would be cool ;-).
> But for this case there's an easier solution, which IIRC is roughly
> what Paul did: I can pretty much promise you that sizeof (long) ==
> sizeof (void *) on any GNU/Linux system. So either I can merge
> gdb_stdint.h and we can start using that, which might be a nice idea in
> general, or for now I think "long" is fine.
Well, we already use uintptr_t in linux-thread-db.c, and
gdb_thread_db.h errors out if it isn't available (and has been doing
so for ages). So we can be pretty sure that nobody is trying to
compile on systems with libc5 or really old glibc versions.
That said, it is probably safe to assume that all (powerpc) Linux
ports are either ILP32 or LP64, so casting to (unsigned long) should
be perfectly safe. It's just that I think that a uintptr_t cast
better expresses what's happening here. But either way is fine with
me.
Mark