Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Fix sol-thread.c compilation on Solaris
Date: Wed, 29 Nov 2017 13:26:00 -0000	[thread overview]
Message-ID: <yddtvxdcj22.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)
In-Reply-To: <18ebfbc6-c73a-6aea-7fb8-ad30eef06d1e@redhat.com> (Pedro Alves's	message of "Tue, 28 Nov 2017 14:01:15 +0000")

[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]

Hi Pedro,

> On 11/28/2017 01:23 PM, Rainer Orth wrote:
>> 
>> # HG changeset patch
>> # Parent  d3867b61620919242bbc9d875d355487a4e71e96
>> Fix sol-thread.c compilation on Solaris
>> 
>> diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
>> --- a/gdb/sol-thread.c
>> +++ b/gdb/sol-thread.c
>> @@ -112,7 +112,7 @@ typedef td_err_e (td_ta_get_nthreads_fty
>>  typedef td_err_e (td_ta_tsd_iter_ftype)(const td_thragent_t *ta_p,
>>  					td_key_iter_f *cb, void *cbdata_p);
>>  typedef td_err_e (td_ta_thr_iter_ftype)(const td_thragent_t *ta_p,
>> -					td_thr_iter_f *cb, void *cbdata_p,
>> +					td_thr_iter_f *cb, const void *cbdata_p,
>
> Pedantically, I'd think it better that this prototype
> continues to match the prototype declared in Solaris's
> proc_service.h (...)

indeed: <thread_db.h> has

td_err_e
td_ta_thr_iter(const td_thragent_t *, td_thr_iter_f *, void *,
	td_thr_state_e, int, sigset_t *, unsigned);

i.e. without the const.

>> @@ -1122,7 +1122,7 @@ info_cb (const td_thrhandle_t *th, void 
>>     inferior.  */
>>  
>>  static void
>> -info_solthreads (char *args, int from_tty)
>> +info_solthreads (const char *args, int from_tty)
>>  {
>>    p_td_ta_thr_iter (main_ta, info_cb, args,
>>  		    TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
>
> (...) which I guess means using '(void *) args' here.  WDYT?

Makes sense.  The resulting patch works just as well.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2017-11-27  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* sol-thread.c (info_solthreads): Constify args.
	Cast args to void *.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-sol-thread.patch --]
[-- Type: text/x-patch, Size: 598 bytes --]

# HG changeset patch
# Parent  b50d57495ca9e18f5c34b0bf201f7e7fc7509094
Fix sol-thread.c compilation on Solaris

diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -1122,9 +1122,9 @@ info_cb (const td_thrhandle_t *th, void 
    inferior.  */
 
 static void
-info_solthreads (char *args, int from_tty)
+info_solthreads (const char *args, int from_tty)
 {
-  p_td_ta_thr_iter (main_ta, info_cb, args,
+  p_td_ta_thr_iter (main_ta, info_cb, (void *) args,
 		    TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
 		    TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
 }

  reply	other threads:[~2017-11-29 13:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 13:23 Rainer Orth
2017-11-28 14:01 ` Pedro Alves
2017-11-29 13:26   ` Rainer Orth [this message]
2017-11-29 14:07     ` Pedro Alves
2017-11-29 14:09       ` Rainer Orth
2017-11-29 15:41 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yddtvxdcj22.fsf@CeBiTec.Uni-Bielefeld.DE \
    --to=ro@cebitec.uni-bielefeld.de \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox