From patchwork Fri Nov 18 12:45:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 60831 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38743384F4B5 for ; Fri, 18 Nov 2022 12:45:35 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.CeBiTec.Uni-Bielefeld.DE (smtp.CeBiTec.Uni-Bielefeld.DE [129.70.160.84]) by sourceware.org (Postfix) with ESMTPS id 58383384F49C for ; Fri, 18 Nov 2022 12:45:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 58383384F49C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=CeBiTec.Uni-Bielefeld.DE Authentication-Results: sourceware.org; spf=none smtp.mailfrom=cebitec.uni-bielefeld.de Received: from localhost (localhost [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 6C75FAF6F4 for ; Fri, 18 Nov 2022 13:45:18 +0100 (CET) X-Virus-Scanned: amavisd-new at CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (smtp.cebitec.uni-bielefeld.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zg8joA0KuO3v for ; Fri, 18 Nov 2022 13:45:17 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (p50855a16.dip0.t-ipconnect.de [80.133.90.22]) (Authenticated sender: ro) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id D5E58AFA0C for ; Fri, 18 Nov 2022 13:45:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=CeBiTec.Uni-Bielefeld.DE; s=20200306; t=1668775517; bh=syBG3uneea3XiGVad+ITIZ49KmUMZvvbzdWzhTZMHRU=; h=From:To:Subject:Date:From; b=OVxPMZa2oLERSdpDt8dTqLFU+fRvaWCOydFWZChf9qT5Lxb7Rxyn9AuMDBsauUDhU 8LCk/2vWHxMZzmuCdhpBhvLq7sDGb78cIt2c+zhR8ViOIW3sqskrvN4BqkpmuR/Enz v3vJbX2DNVsypgZQURXJkIJLNu+d362NXnltb9BNS8pByqOZfnMeZRB/Sg0COusjNK owQ/UTHHlNZ7IWQnlgZk00dLLqaGsbr3D4Op5452ZHw4CDnkxMArtWzRvqpa8FbAg7 8sp1UMkcmxtJhHyd6mmklTa9C7gVL8AZi7TJ3d2saAHT1OLa0GxtnNVD/vXX9tN0Df sFto1ADiQQrlA== From: Rainer Orth To: gdb-patches@sourceware.org Subject: [PATCH] Fix sol-thread.c compilation on 32-bit Solaris Date: Fri, 18 Nov 2022 13:45:17 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.90 (usg-unix-v) MIME-Version: 1.0 X-Spam-Status: No, score=-3794.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, KAM_ASCII_DIVIDERS, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" sol-thread.c fails to compile on 32-bit Solaris: there are several instances of In file included from /vol/src/gnu/gdb/hg/master/local/gdb/../gdbsupport/common-defs.h:203, from /vol/src/gnu/gdb/hg/master/local/gdb/defs.h:28, from /vol/src/gnu/gdb/hg/master/local/gdb/sol-thread.c:51: /vol/src/gnu/gdb/hg/master/local/gdb/sol-thread.c: In member function ‘virtual void sol_thread_target::resume(ptid_t, int, gdb_signal)’: /vol/src/gnu/gdb/hg/master/local/gdb/sol-thread.c:416:20: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘ULONGEST’ {aka ‘long long unsigned int’} [-Werror=format=] 416 | warning (_("Specified thread %ld seems to have terminated"), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /vol/src/gnu/gdb/hg/master/local/gdb/../gdbsupport/gdb_locale.h:28:29: note: in definition of macro ‘_’ 28 | # define _(String) gettext (String) | ^~~~~~ /vol/src/gnu/gdb/hg/master/local/gdb/sol-thread.c:416:40: note: format string is defined here 416 | warning (_("Specified thread %ld seems to have terminated"), | ~~^ | | | long int | %lld Fixed by using pulongest () instead. Tested on i386-pc-solaris2.11, amd64-pc-solaris2.11, sparc-sun-solaris2.11, and sparcv9-sun-solaris2.11 (together with Simon's patch for PR build/29798). Will commit shortly unless someone has a better suggestion how to handle this. Rainer # HG changeset patch # Parent c0bb6fc7e6c240e96987dc8adefb3ec8bb343690 Fix sol-thread.c compilation on 32-bit Solaris diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -413,8 +413,8 @@ sol_thread_target::resume (ptid_t ptid, if (ptid.pid () == -2) /* Inactive thread. */ error (_("This version of Solaris can't start inactive threads.")); if (info_verbose && ptid.pid () == -1) - warning (_("Specified thread %ld seems to have terminated"), - save_ptid.tid ()); + warning (_("Specified thread %s seems to have terminated"), + pulongest (save_ptid.tid ())); } beneath ()->resume (ptid, step, signo); @@ -435,8 +435,8 @@ sol_thread_target::wait (ptid_t ptid, st if (ptid.pid () == -2) /* Inactive thread. */ error (_("This version of Solaris can't start inactive threads.")); if (info_verbose && ptid.pid () == -1) - warning (_("Specified thread %ld seems to have terminated"), - ptid_for_warning.tid ()); + warning (_("Specified thread %s seems to have terminated"), + pulongest (ptid_for_warning.tid ())); } ptid_t rtnval = beneath ()->wait (ptid, ourstatus, options); @@ -973,14 +973,14 @@ sol_thread_target::pid_to_str (ptid_t pt lwp = thread_to_lwp (ptid, -2); if (lwp.pid () == -1) - return string_printf ("Thread %ld (defunct)", - ptid.tid ()); + return string_printf ("Thread %s (defunct)", + pulongest (ptid.tid ())); else if (lwp.pid () != -2) - return string_printf ("Thread %ld (LWP %ld)", - ptid.tid (), lwp.lwp ()); + return string_printf ("Thread %s (LWP %ld)", + pulongest (ptid.tid ()), lwp.lwp ()); else - return string_printf ("Thread %ld ", - ptid.tid ()); + return string_printf ("Thread %s ", + pulongest (ptid.tid ())); } else if (ptid.lwp () != 0) return string_printf ("LWP %ld ", ptid.lwp ());