* [PATCH] Fix sol-thread.c compilation on 32-bit Solaris
@ 2022-11-18 12:45 Rainer Orth
2022-11-18 15:34 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Rainer Orth @ 2022-11-18 12:45 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1860 bytes --]
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
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-sol-thread-32bit.patch --]
[-- Type: text/x-patch, Size: 1950 bytes --]
# 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 ());
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix sol-thread.c compilation on 32-bit Solaris
2022-11-18 12:45 [PATCH] Fix sol-thread.c compilation on 32-bit Solaris Rainer Orth
@ 2022-11-18 15:34 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2022-11-18 15:34 UTC (permalink / raw)
To: Rainer Orth; +Cc: gdb-patches
>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
[...]
Rainer> Fixed by using pulongest () instead.
Rainer> Will commit shortly unless someone has a better suggestion how to handle
Rainer> this.
This is the way to do it, looks good to me.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-18 15:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 12:45 [PATCH] Fix sol-thread.c compilation on 32-bit Solaris Rainer Orth
2022-11-18 15:34 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).