From: Andrew STUBBS <andrew.stubbs@st.com>
To: Andrew STUBBS <andrew.stubbs@st.com>,
GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] long long for printf on MinGW
Date: Wed, 23 Apr 2008 16:12:00 -0000 [thread overview]
Message-ID: <480F3816.8060209@st.com> (raw)
In-Reply-To: <20080423115213.GA16165@caradoc.them.org>
[-- Attachment #1: Type: text/plain, Size: 243 bytes --]
Daniel Jacobowitz wrote:
> Go ahead with the patch. We can rip it out if we switch to gnulib's
> printf.
Committed.
I've attached the final verion. It's only the patch offsets that have
changed since the last patch posted.
Thanks
Andrew
[-- Attachment #2: updated-printf.patch --]
[-- Type: text/plain, Size: 1727 bytes --]
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.
Index: gdb/printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.117
diff -u -p -r1.117 printcmd.c
--- gdb/printcmd.c 30 Jan 2008 19:19:51 -0000 1.117
+++ gdb/printcmd.c 23 Apr 2008 12:05:33 -0000
@@ -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;
next prev parent reply other threads:[~2008-04-23 13:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-11 11:21 Andrew STUBBS
2006-10-11 13:03 ` Daniel Jacobowitz
2006-10-11 15:12 ` Andrew STUBBS
2008-04-22 19:41 ` Daniel Jacobowitz
2008-04-23 10:26 ` Andrew STUBBS
2008-04-23 12:18 ` Daniel Jacobowitz
2008-04-23 16:12 ` Andrew STUBBS [this message]
2006-10-11 20:28 ` Mark Kettenis
2006-10-11 20:44 ` Daniel Jacobowitz
2006-10-12 10:09 ` Andrew STUBBS
[not found] ` <200610151745.k9FHjvPa017960@elgar.sibelius.xs4all.nl>
2006-10-16 9:45 ` Andrew STUBBS
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=480F3816.8060209@st.com \
--to=andrew.stubbs@st.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox