From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1147) id CD96A395B472; Sun, 20 Nov 2022 13:53:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD96A395B472 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668952401; bh=miptOPGkFAxRsHmumIwLCevLRr7qvdowBQIXeqeT1kk=; h=From:To:Subject:Date:From; b=okaeFBmtn5bTCH2YZ81MVt+uvo+Ku2WEetjMQOlGz08MBhd3F3/7oaS1ZtcWmjjUR aSG6A7D3Q9Q+Ui1nXHotSasC4Fjnkuu+EUPYypSFq7q3XJ8IvPk9QDXXTlQ/tWTXSj 0SpF0yLjZya4RBrjWuyjZBVvnF5lR8F2J5kCuo+Y= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Rainer Orth To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix sol-thread.c compilation on 32-bit Solaris X-Act-Checkin: binutils-gdb X-Git-Author: Rainer Orth X-Git-Refname: refs/heads/master X-Git-Oldrev: abad6c11d03e17a5fef9d6fff5e58f8a288620f0 X-Git-Newrev: f1a8d786c37bbe40d0bc2fec618d0e875d043811 Message-Id: <20221120135321.CD96A395B472@sourceware.org> Date: Sun, 20 Nov 2022 13:53:21 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df1a8d786c37b= be40d0bc2fec618d0e875d043811 commit f1a8d786c37bbe40d0bc2fec618d0e875d043811 Author: Rainer Orth Date: Sun Nov 20 14:52:09 2022 +0100 Fix sol-thread.c compilation on 32-bit Solaris =20 sol-thread.c fails to compile on 32-bit Solaris: there are several instances of =20 In file included from /vol/src/gnu/gdb/hg/master/local/gdb/../gdbsuppor= t/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 = =E2=80=98virtual void sol_thread_target::resume(ptid_t, int, gdb_signal)=E2= =80=99: /vol/src/gnu/gdb/hg/master/local/gdb/sol-thread.c:416:20: error: format= =E2=80=98%ld=E2=80=99 expects argument of type =E2=80=98long int=E2=80=99,= but argument 2 has type =E2=80=98ULONGEST=E2=80=99 {aka =E2=80=98long long= unsigned int=E2=80=99} [-Werror=3Dformat=3D] 416 | warning (_("Specified thread %ld seems to have terminat= ed"), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~ /vol/src/gnu/gdb/hg/master/local/gdb/../gdbsupport/gdb_locale.h:28:29: note: in definition of macro =E2=80=98_=E2=80=99 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 terminat= ed"), | ~~^ | | | long int | %lld =20 Fixed by using pulongest () instead. =20 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). Diff: --- gdb/sol-thread.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 18754f4f93b..c9abb4547ca 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -413,8 +413,8 @@ sol_thread_target::resume (ptid_t ptid, int step, enum = gdb_signal signo) if (ptid.pid () =3D=3D -2) /* Inactive thread. */ error (_("This version of Solaris can't start inactive threads.")); if (info_verbose && ptid.pid () =3D=3D -1) - warning (_("Specified thread %ld seems to have terminated"), - save_ptid.tid ()); + warning (_("Specified thread %s seems to have terminated"), + pulongest (save_ptid.tid ())); } =20 beneath ()->resume (ptid, step, signo); @@ -435,8 +435,8 @@ sol_thread_target::wait (ptid_t ptid, struct target_wai= tstatus *ourstatus, if (ptid.pid () =3D=3D -2) /* Inactive thread. */ error (_("This version of Solaris can't start inactive threads.")); if (info_verbose && ptid.pid () =3D=3D -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 ())); } =20 ptid_t rtnval =3D beneath ()->wait (ptid, ourstatus, options); @@ -973,14 +973,14 @@ sol_thread_target::pid_to_str (ptid_t ptid) lwp =3D thread_to_lwp (ptid, -2); =20 if (lwp.pid () =3D=3D -1) - return string_printf ("Thread %ld (defunct)", - ptid.tid ()); + return string_printf ("Thread %s (defunct)", + pulongest (ptid.tid ())); else if (lwp.pid () !=3D -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 () !=3D 0) return string_printf ("LWP %ld ", ptid.lwp ());