[PATCH] Fix sol-thread.c compilation on 32-bit Solaris

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Fri Nov 18 12:45:17 GMT 2022


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol2-sol-thread-32bit.patch
Type: text/x-patch
Size: 1950 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/gdb-patches/attachments/20221118/e89a2da4/attachment-0001.bin>


More information about the Gdb-patches mailing list