From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1484 invoked by alias); 11 Oct 2006 11:21:47 -0000 Received: (qmail 1474 invoked by uid 22791); 11 Oct 2006 11:21:45 -0000 X-Spam-Check-By: sourceware.org Received: from lon-del-03.spheriq.net (HELO lon-del-03.spheriq.net) (195.46.50.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 11 Oct 2006 11:21:40 +0000 Received: from lon-out-02.spheriq.net ([195.46.50.130]) by lon-del-03.spheriq.net with ESMTP id k9BBLbgb009923 for ; Wed, 11 Oct 2006 11:21:37 GMT Received: from lon-cus-01.spheriq.net (lon-cus-01.spheriq.net [195.46.50.37]) by lon-out-02.spheriq.net with ESMTP id k9BBLbDk024784 for ; Wed, 11 Oct 2006 11:21:37 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-01.spheriq.net with ESMTP id k9BBLXJk030660 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Wed, 11 Oct 2006 11:21:36 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A3FBDDE95 for ; Wed, 11 Oct 2006 10:57:52 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id F40DD47313 for ; Wed, 11 Oct 2006 10:57:51 +0000 (GMT) Received: from [164.129.15.13] (bri1043.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CIC22338 (AUTH stubbsa); Wed, 11 Oct 2006 11:57:48 +0100 (BST) Message-ID: <452CCE2D.8070806@st.com> Date: Wed, 11 Oct 2006 11:21:00 -0000 From: Andrew STUBBS User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: GDB Patches Subject: [PATCH] long long for printf on MinGW Content-Type: multipart/mixed; boundary="------------030207070200070102010609" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00104.txt.bz2 This is a multi-part message in MIME format. --------------030207070200070102010609 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 332 Hi, Windows/MinGW printf does support printing of long long types, but it does not do using %lld etc. This patch converts %ll (or %...ll) to %I64 as required by Windows. GDB printf still won't accept I64 as input, but then this is not standard compliant so I don't think it really should. :ADDPATCH printcmd.c: Andrew Stubbs --------------030207070200070102010609 Content-Type: text/plain; name="printf.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="printf.patch" Content-length: 1673 2006-10-11 Andrew Stubbs * printcmd.c (printf_command): Convert %lld to %I64d on MinGW. Index: src/gdb/printcmd.c =================================================================== --- src.orig/gdb/printcmd.c 2006-07-17 23:15:55.000000000 +0100 +++ src/gdb/printcmd.c 2006-10-11 11:28:29.000000000 +0100 @@ -1967,8 +1967,24 @@ printf_command (char *arg, int from_tty) *f); f++; - strncpy (current_substring, last_arg, f - last_arg); - current_substring += f - last_arg; +#if defined (__MINGW32__) + /* Windows' printf does support long long, but not the usual way. + Convert %lld to %I64d. */ + if (lcount > 1) + { + 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 +#endif + { + strncpy (current_substring, last_arg, f - last_arg); + current_substring += f - last_arg; + } *current_substring++ = '\0'; last_arg = f; argclass[nargs_wanted++] = this_argclass; @@ -2056,7 +2072,8 @@ printf_command (char *arg, int from_tty) error (_("long double not supported in printf")); #endif case long_long_arg: -#if defined (CC_HAS_LONG_LONG) && defined (PRINTF_HAS_LONG_LONG) +#if defined (CC_HAS_LONG_LONG) && (defined (PRINTF_HAS_LONG_LONG) \ + || defined (__MINGW32__)) { long long val = value_as_long (val_args[i]); printf_filtered (current_substring, val); --------------030207070200070102010609--