[Lldb-commits] Format strings and different operating systems

Dimitry Andric dimitry at andric.com
Tue Jun 19 14:32:46 PDT 2012

On 2012-06-19 16:39, Filipe Cabecinhas wrote:
> We (will) have an issue with format strings (or types) and support for multiple operating systems.
> Right now, we're printing the addr_t type with %llx. This makes sense in Mac OS X (Lion), which uses unsigned long long for uint64_t (addr_t is typedeffed to uint64_t).
> But FreeBSD (9) uses an unsigned long.

And Windows even uses the totally non-standard __int64, with format string "%I64"...

> I see three options:
> Changing the format strings and interpolate PRIx64 and similar constants;
> Converting the debug printfs to a more C++-like mechanism, like llvm has;
> Creating an lldb format string and an interpreter for it.

Please use the PRIx64 constants, although they are exceptionally ugly,
not to mention awkward to use, but they are the only really portable
ones, at least for printfs. :)

More information about the lldb-commits mailing list