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
Kai,
> > > Please be aware that %llx isn't valid for x86_64 windows (as it isn't
> for
> > > 32-bit standard). The options 'I' or 'I64' have to be used for
> > > those targets (at least for _WIN64).
> >
> > Are you serious? Wow, that's unbelievable. %llx is defined by ISO
> > C99, and you're saying that even the 64-bit editions of Windows that
> > were introduced several years after the standard was ratified (and
> > almost a decade after the first drafts were circulated) don't
> > implement that bit of the standard?
> >
>
> Sadly, yes. IIRC they implemented it in their newer runtimes, but it
> didn't made it into msvcrt.dll even on 64-bit systems.
I don't doubt that you are right, but I was wondering whether configure
was (apparently incorrectly) defining PRINTF_HAS_LONG_LONG.
| #include <stdio.h>
|
| int
| main (void)
| {
| long long addr = 0xdeadbeeffeedfaceLL;
|
| printf ("addr = 0x%llx.\n", addr);
| return 0;
| }
I compiled the program above on our x86_64 Vista, and it compiled and
worked like a charm. The check in configure is actually of the same
nature.
On 32bit systems:
- XP: PRINTF_HAS_LONG_LONG is not defined.
- Vista: All works fine.
I don't have access to an x86_64 XP install, but I'm going to make
a guess that PRINTF_HAS_LONG_LONG is not defined there.
What I will do is send a patch that implements what Mark suggested.
This should work on all our supported platforms, with the addition
of x86_64 Vista, but to the exclusion of x86_64 XP. I am OK with
the idea of adding a extra #if WIN64_ branch that allows us to build
on x86_64 XP, but you'll have to convince others as well.
--
Joel