From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37769 invoked by alias); 16 Feb 2018 21:58:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 37755 invoked by uid 89); 16 Feb 2018 21:58:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:372 X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Feb 2018 21:58:22 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 2768D16145 for ; Fri, 16 Feb 2018 15:58:21 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id mo1NeM4DNuMnymo1Ne12ER; Fri, 16 Feb 2018 15:58:21 -0600 Received: from 174-29-60-18.hlrn.qwest.net ([174.29.60.18]:51210 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1emo1M-0009us-RM; Fri, 16 Feb 2018 15:58:20 -0600 From: Tom Tromey To: Pedro Alves Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFA 3/3] Special case NULL when using printf's %s format References: <20180215205001.337-1-tom@tromey.com> <20180215205001.337-4-tom@tromey.com> <6abda67a-ad87-ebc7-e0d4-ab60e7e4cbc6@redhat.com> <5843def6-8004-4103-188c-50125c7b3d9f@redhat.com> Date: Fri, 16 Feb 2018 21:58:00 -0000 In-Reply-To: <5843def6-8004-4103-188c-50125c7b3d9f@redhat.com> (Pedro Alves's message of "Fri, 16 Feb 2018 12:25:32 +0000") Message-ID: <87zi484mx0.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Source-L: No X-Exim-ID: 1emo1M-0009us-RM X-Source-Sender: 174-29-60-18.hlrn.qwest.net (bapiya) [174.29.60.18]:51210 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-02/txt/msg00220.txt.bz2 Pedro> Then again, I don't think it's likely that programs map Pedro> strings at 0 (I think it's more like interrupt vectors), so for %s, Pedro> it's likely that nobody would miss printing 0 as a string. Another option would be to do a try-catch and only print "(null)" on failure, if the pointer is 0. Tom