diff options
author | Andrew Stubbs <andrew.stubbs@st.com> | 2008-04-23 13:21:54 +0000 |
---|---|---|
committer | Andrew Stubbs <andrew.stubbs@st.com> | 2008-04-23 13:21:54 +0000 |
commit | 09d71d234aed77ea5c32dbdaf9409f35e3ba0e22 (patch) | |
tree | ecd952cea79bc9a9ad5ae792a7332317cf40a05e /gdb | |
parent | fdc5970995855bc716612543e07e4eadd167e4c1 (diff) | |
download | gdb-09d71d234aed77ea5c32dbdaf9409f35e3ba0e22.zip gdb-09d71d234aed77ea5c32dbdaf9409f35e3ba0e22.tar.gz gdb-09d71d234aed77ea5c32dbdaf9409f35e3ba0e22.tar.bz2 |
2008-04-23 Andrew Stubbs <andrew.stubbs@st.com>
* printcmd.c: Define USE_PRINTF_I64 and PRINTF_HAS_LONG_LONG on MinGW.
(printf_command): Convert %lld to %I64d when USE_PRINTF_I64 set.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/printcmd.c | 26 |
2 files changed, 29 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6f426e0..ed16e47 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-04-23 Andrew Stubbs <andrew.stubbs@st.com> + + * printcmd.c: Define USE_PRINTF_I64 and PRINTF_HAS_LONG_LONG on MinGW. + (printf_command): Convert %lld to %I64d when USE_PRINTF_I64 set. + 2008-04-23 Paolo Bonzini <bonzini@gnu.org> * acinclude.m4: Add override.m4. diff --git a/gdb/printcmd.c b/gdb/printcmd.c index e73c511..26a54cb 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -47,6 +47,13 @@ #include "tui/tui.h" /* For tui_active et.al. */ #endif +#if defined(__MINGW32__) +# define USE_PRINTF_I64 1 +# define PRINTF_HAS_LONG_LONG +#else +# define USE_PRINTF_I64 0 +#endif + extern int asm_demangle; /* Whether to demangle syms in asm printouts */ extern int addressprint; /* Whether to print hex addresses in HLL " */ @@ -2009,8 +2016,23 @@ printf_command (char *arg, int from_tty) *f); f++; - strncpy (current_substring, last_arg, f - last_arg); - current_substring += f - last_arg; + + if (lcount > 1 && USE_PRINTF_I64) + { + /* Windows' printf does support long long, but not the usual way. + Convert %lld to %I64d. */ + int length_before_ll = f - last_arg - 1 - lcount; + strncpy (current_substring, last_arg, length_before_ll); + strcpy (current_substring + length_before_ll, "I64"); + current_substring[length_before_ll + 3] = + last_arg[length_before_ll + lcount]; + current_substring += length_before_ll + 4; + } + else + { + strncpy (current_substring, last_arg, f - last_arg); + current_substring += f - last_arg; + } *current_substring++ = '\0'; last_arg = f; argclass[nargs_wanted++] = this_argclass; |