This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] convert a host address to a string
- From: Kai Tietz <Kai dot Tietz at onevision dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org, Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Date: Thu, 8 Jan 2009 12:30:44 +0100
- Subject: Re: [RFC] convert a host address to a string
Hi Joel,
gdb-patches-owner@sourceware.org wrote on 08.01.2009 12:24:48:
> > By it you can use standard ISO type intptr_t. And I missed to add
> > inttypes.h.
> > By this you could simply use PRIXPTR for printing hex pointer failues.
> >
> > E.g.
> > fprint (fp, "0x%" PRIXPTR, (intptr_t) address);
>
> That's pretty clever. Bad luck for us, however. The MinGW inttypes.h
> defines PRIxPTR as "I64x". When I tried with an example, I got a warning
> because intptr_t is "long long int" whereas "%I64x" requires an unsigned
> int. Changing the cast to uintptr_t helps a little, but it's not enough
> since "unsigned int" is definitely not large enough to hold a pointer!
>
> I really should report that to the MinGW guys!
Ok, I got it. But there is not much to do here. I am a bit curious about
that x wants an unsigned scalar. I have to verify this.
The alternative for this, would be to cast to size_t in general.
Cheers,
Kai
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.