Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Fix sol-thread.c compilation on Solaris
@ 2017-11-28 13:23 Rainer Orth
  2017-11-28 14:01 ` Pedro Alves
  2017-11-29 15:41 ` Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: Rainer Orth @ 2017-11-28 13:23 UTC (permalink / raw)
  To: gdb-patches

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

Building current gdb mainline with gcc 7.1 on Solaris 11.4 fails:

/vol/src/gnu/gdb/gdb/dist/gdb/sol-thread.c: In function ‘void _initialize_sol_thread()’:
/vol/src/gnu/gdb/gdb/dist/gdb/sol-thread.c:1229:66: error: invalid conversion from ‘void (*)(char*, int)’ to ‘void (*)(const char*, int)’ [-fpermissive]
     _("Show info on Solaris user threads."), &maintenanceinfolist);
                                                                  ^
In file included from /vol/src/gnu/gdb/gdb/dist/gdb/completer.h:21:0,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/symtab.h:31,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/language.h:26,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/frame.h:72,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/gdbarch.h:39,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/defs.h:557,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/sol-thread.c:51:
/vol/src/gnu/gdb/gdb/dist/gdb/command.h:140:33: note:   initializing argument 3 of ‘cmd_list_element* add_cmd(const char*, command_class, void (*)(const char*, int), const char*, cmd_list_element**)’
 extern struct cmd_list_element *add_cmd (const char *, enum command_class,
                                 ^~~~~~~

The following patch allows compilation to succeed on i386-pc-solaris2.11
and sparc-sun-solaris2.11.

Ok for mainline?

	Rainer

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


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

	* sol-thread.c (td_ta_thr_iter_ftype): Constify cbdata_p.
	(info_solthreads): Constify args.


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

# 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,
 					td_thr_state_e state, int ti_pri,
 					sigset_t *ti_sigmask_p,
 					unsigned ti_user_flags);
@@ -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,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix sol-thread.c compilation on Solaris
  2017-11-28 13:23 Fix sol-thread.c compilation on Solaris Rainer Orth
@ 2017-11-28 14:01 ` Pedro Alves
  2017-11-29 13:26   ` Rainer Orth
  2017-11-29 15:41 ` Tom Tromey
  1 sibling, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2017-11-28 14:01 UTC (permalink / raw)
  To: Rainer Orth, gdb-patches

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 (...)

>  					td_thr_state_e state, int ti_pri,
>  					sigset_t *ti_sigmask_p,
>  					unsigned ti_user_flags);
> @@ -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?

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix sol-thread.c compilation on Solaris
  2017-11-28 14:01 ` Pedro Alves
@ 2017-11-29 13:26   ` Rainer Orth
  2017-11-29 14:07     ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Rainer Orth @ 2017-11-29 13:26 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

[-- 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);
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix sol-thread.c compilation on Solaris
  2017-11-29 13:26   ` Rainer Orth
@ 2017-11-29 14:07     ` Pedro Alves
  2017-11-29 14:09       ` Rainer Orth
  0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2017-11-29 14:07 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gdb-patches

On 11/29/2017 01:26 PM, Rainer Orth wrote:
> 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.

OK.

BTW, while you're here, I believe there's nothing blocking
the "Remove ioctl-based procfs support on Solaris" patch
at this point, right?

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix sol-thread.c compilation on Solaris
  2017-11-29 14:07     ` Pedro Alves
@ 2017-11-29 14:09       ` Rainer Orth
  0 siblings, 0 replies; 6+ messages in thread
From: Rainer Orth @ 2017-11-29 14:09 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Hi Pedro,

> BTW, while you're here, I believe there's nothing blocking
> the "Remove ioctl-based procfs support on Solaris" patch
> at this point, right?

nothing except for completing the testing, which is what I'm doing as we
speak ;-)

	Rainer

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix sol-thread.c compilation on Solaris
  2017-11-28 13:23 Fix sol-thread.c compilation on Solaris Rainer Orth
  2017-11-28 14:01 ` Pedro Alves
@ 2017-11-29 15:41 ` Tom Tromey
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2017-11-29 15:41 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gdb-patches

>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

Rainer> /vol/src/gnu/gdb/gdb/dist/gdb/command.h:140:33: note:   initializing argument 3 of ‘cmd_list_element* add_cmd(const char*, command_class, void (*)(const char*, int), const char*, cmd_list_element**)’
Rainer>  extern struct cmd_list_element *add_cmd (const char *, enum command_class,
Rainer>                                  ^~~~~~~

Rainer> The following patch allows compilation to succeed on i386-pc-solaris2.11
Rainer> and sparc-sun-solaris2.11.

Thanks for fixing this.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-29 15:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 13:23 Fix sol-thread.c compilation on Solaris Rainer Orth
2017-11-28 14:01 ` Pedro Alves
2017-11-29 13:26   ` Rainer Orth
2017-11-29 14:07     ` Pedro Alves
2017-11-29 14:09       ` Rainer Orth
2017-11-29 15:41 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox