Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: make "stop-on-solib-events" a boolean setting
@ 2026-09-28 19:54 Simon Marchi
  2026-09-29 11:21 ` Andrew Burgess
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2026-09-28 19:54 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

While reviewing a patch, I noticed that the "stop-on-solib-events"
setting was an integer, even though it is spiritually a boolean.  It has
been an integer since it was introduced in commit 87273c713f0e
(1996-01-23).  Make it a boolean setting.

User-visible improvements:

 - The setting accepts the usual boolean values: on/off, yes/no,
   enable/disable, as well as 1/0.

 - "set stop-on-solib-events" with no argument now turns the setting
   on, like other boolean settings, instead of erroring out with
   "Argument required (integer to set it to)".

 - Tab completion offers "on" and "off".

 - "show stop-on-solib-events" prints "on" or "off" instead of a
   number.

Possible breaking changes:

 - Integer values other than 0 and 1, as well as expressions (for
   instance "set stop-on-solib-events $var"), are now rejected with an
   error.

 - The CLI and MI output changes from:

     (gdb) show stop-on-solib-events
     Stopping for shared library events is 0.
     (gdb) interpreter-exec mi "-gdb-show stop-on-solib-events"
     ^done,value="0"
     (gdb) print $_gdb_setting_str("stop-on-solib-events")
     $1 = "0"

   to:

     (gdb) show stop-on-solib-events
     Stopping for shared library events is off.
     (gdb) interpreter-exec mi "-gdb-show stop-on-solib-events"
     ^done,value="off"
     (gdb) print $_gdb_setting_str("stop-on-solib-events")
     $1 = "off"

 - The Python gdb.parameter("stop-on-solib-events") function now returns
   True or False instead of an integer.  The Guile equivalent now
   returns #t or #f.

I think that all these observable changes are relatively easy to work
around.

Add a NEWS entry for the change and update the documentation.

Change-Id: Ia792b172cd6da810de208446447dc78a2e47b09d
---
 gdb/NEWS            |  6 ++++++
 gdb/breakpoint.c    |  4 ++--
 gdb/doc/gdb.texinfo |  2 +-
 gdb/infrun.c        | 16 ++++++++--------
 gdb/infrun.h        |  4 ++--
 5 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index 77ad2d3fc22c..af85dac6665d 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -51,6 +51,12 @@ show print shadowed
 
 * Changed commands
 
+set stop-on-solib-events on|off
+show stop-on-solib-events
+  This setting is now a boolean.  Previously, it was an integer, where
+  any non-zero value meant "on".  The values 0 and 1 are still
+  accepted.
+
 info locals
   The new "-shadowed on|off" option overrides the "set print shadowed"
   setting for a single invocation of the command.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 988737b6f96f..69b9b47276b0 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -12236,8 +12236,8 @@ internal_breakpoint::check_status (bpstat *bs)
 	 events.  This allows the user to get control and place
 	 breakpoints in initializer routines for dynamically loaded
 	 objects (among other things).  */
-      bs->stop = stop_on_solib_events != 0;
-      bs->print = stop_on_solib_events != 0;
+      bs->stop = stop_on_solib_events;
+      bs->print = stop_on_solib_events;
     }
   else
     bs->stop = false;
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index a24f67cb8de1..5cfbad231402 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22510,7 +22510,7 @@ The surrounding square brackets are optional.
 @end table
 
 @table @code
-@item set stop-on-solib-events
+@item set stop-on-solib-events [on|off]
 @kindex set stop-on-solib-events
 This command controls whether @value{GDBN} should give you control
 when the dynamic linker notifies it about some shared library event.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 3fbfeff9269d..59c25259fd52 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -413,9 +413,9 @@ get_detach_signal (process_stratum_target *proc_target, ptid_t ptid)
 
 static struct cmd_list_element *stop_command;
 
-/* Nonzero if we want to give control to the user when we're notified
+/* True if we want to give control to the user when we're notified
    of shared library events by the dynamic linker.  */
-int stop_on_solib_events;
+bool stop_on_solib_events;
 
 /* Enable or disable optional shared library event breakpoints
    as appropriate when the above flag is changed.  */
@@ -10846,16 +10846,16 @@ leave it stopped or free to run as needed."),
   /* Update cached state.  */
   signal_cache_update (-1);
 
-  add_setshow_zinteger_cmd ("stop-on-solib-events", class_support,
-			    &stop_on_solib_events, _("\
+  add_setshow_boolean_cmd ("stop-on-solib-events", class_support,
+			   &stop_on_solib_events, _("\
 Set stopping for shared library events."), _("\
 Show stopping for shared library events."), _("\
-If nonzero, gdb will give control to the user when the dynamic linker\n\
+If on, gdb will give control to the user when the dynamic linker\n\
 notifies gdb of shared library events.  The most common event of interest\n\
 to the user would be loading/unloading of a new library."),
-			    set_stop_on_solib_events,
-			    show_stop_on_solib_events,
-			    &setlist, &showlist);
+			   set_stop_on_solib_events,
+			   show_stop_on_solib_events,
+			   &setlist, &showlist);
 
   add_setshow_enum_cmd ("follow-fork-mode", class_run,
 			follow_fork_mode_kind_names,
diff --git a/gdb/infrun.h b/gdb/infrun.h
index cbc603b74edd..7b2b882dc9ad 100644
--- a/gdb/infrun.h
+++ b/gdb/infrun.h
@@ -75,9 +75,9 @@ infrun_debug_show_threads (const char *title, ThreadRange threads)
 }
 
 
-/* Nonzero if we want to give control to the user when we're notified
+/* True if we want to give control to the user when we're notified
    of shared library events by the dynamic linker.  */
-extern int stop_on_solib_events;
+extern bool stop_on_solib_events;
 
 /* True if execution commands resume all threads of all processes by
    default; otherwise, resume only threads of the current inferior

base-commit: 421bec796fa3a06179856da870a13cf71ddf5df2
-- 
2.55.0


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

* Re: [PATCH] gdb: make "stop-on-solib-events" a boolean setting
  2026-09-28 19:54 [PATCH] gdb: make "stop-on-solib-events" a boolean setting Simon Marchi
@ 2026-09-29 11:21 ` Andrew Burgess
  2026-09-29 19:22   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2026-09-29 11:21 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches; +Cc: Simon Marchi

Simon Marchi <simon.marchi@efficios.com> writes:

> While reviewing a patch, I noticed that the "stop-on-solib-events"
> setting was an integer, even though it is spiritually a boolean.  It has
> been an integer since it was introduced in commit 87273c713f0e
> (1996-01-23).  Make it a boolean setting.
>
> User-visible improvements:
>
>  - The setting accepts the usual boolean values: on/off, yes/no,
>    enable/disable, as well as 1/0.
>
>  - "set stop-on-solib-events" with no argument now turns the setting
>    on, like other boolean settings, instead of erroring out with
>    "Argument required (integer to set it to)".
>
>  - Tab completion offers "on" and "off".
>
>  - "show stop-on-solib-events" prints "on" or "off" instead of a
>    number.
>
> Possible breaking changes:
>
>  - Integer values other than 0 and 1, as well as expressions (for
>    instance "set stop-on-solib-events $var"), are now rejected with an
>    error.
>
>  - The CLI and MI output changes from:
>
>      (gdb) show stop-on-solib-events
>      Stopping for shared library events is 0.
>      (gdb) interpreter-exec mi "-gdb-show stop-on-solib-events"
>      ^done,value="0"
>      (gdb) print $_gdb_setting_str("stop-on-solib-events")
>      $1 = "0"
>
>    to:
>
>      (gdb) show stop-on-solib-events
>      Stopping for shared library events is off.
>      (gdb) interpreter-exec mi "-gdb-show stop-on-solib-events"
>      ^done,value="off"
>      (gdb) print $_gdb_setting_str("stop-on-solib-events")
>      $1 = "off"
>
>  - The Python gdb.parameter("stop-on-solib-events") function now returns
>    True or False instead of an integer.  The Guile equivalent now
>    returns #t or #f.
>
> I think that all these observable changes are relatively easy to work
> around.
>
> Add a NEWS entry for the change and update the documentation.

I agree that this is a good improvement to make.  I have two minor
nits, see below, but otherwise:

Approved-By: Andrew Burgess <aburgess@redhat.com>

> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index a24f67cb8de1..5cfbad231402 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -22510,7 +22510,7 @@ The surrounding square brackets are optional.
>  @end table
>  
>  @table @code
> -@item set stop-on-solib-events
> +@item set stop-on-solib-events [on|off]

This should use "@r{[}on@r{|}off@r{]}" which formats the [|] in normal
non-code style text to make it distinct from the on and off, which will
use @code style.

Our docs are super inconsistent and I have a patch to try and clean this
up but I was waiting for the release to be out of the way before posting
it.

>  @kindex set stop-on-solib-events
>  This command controls whether @value{GDBN} should give you control
>  when the dynamic linker notifies it about some shared library event.
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index 3fbfeff9269d..59c25259fd52 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -413,9 +413,9 @@ get_detach_signal (process_stratum_target *proc_target, ptid_t ptid)
>  
>  static struct cmd_list_element *stop_command;
>  
> -/* Nonzero if we want to give control to the user when we're notified
> +/* True if we want to give control to the user when we're notified
>     of shared library events by the dynamic linker.  */
> -int stop_on_solib_events;
> +bool stop_on_solib_events;

The comment on this should really be: /* See infrun.h.  */

Thanks,
Andrew


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

* Re: [PATCH] gdb: make "stop-on-solib-events" a boolean setting
  2026-09-29 11:21 ` Andrew Burgess
@ 2026-09-29 19:22   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2026-09-29 19:22 UTC (permalink / raw)
  To: Andrew Burgess, Simon Marchi, gdb-patches

On 9/29/26 7:21 AM, Andrew Burgess wrote:
> Simon Marchi <simon.marchi@efficios.com> writes:
> 
>> While reviewing a patch, I noticed that the "stop-on-solib-events"
>> setting was an integer, even though it is spiritually a boolean.  It has
>> been an integer since it was introduced in commit 87273c713f0e
>> (1996-01-23).  Make it a boolean setting.
>>
>> User-visible improvements:
>>
>>  - The setting accepts the usual boolean values: on/off, yes/no,
>>    enable/disable, as well as 1/0.
>>
>>  - "set stop-on-solib-events" with no argument now turns the setting
>>    on, like other boolean settings, instead of erroring out with
>>    "Argument required (integer to set it to)".
>>
>>  - Tab completion offers "on" and "off".
>>
>>  - "show stop-on-solib-events" prints "on" or "off" instead of a
>>    number.
>>
>> Possible breaking changes:
>>
>>  - Integer values other than 0 and 1, as well as expressions (for
>>    instance "set stop-on-solib-events $var"), are now rejected with an
>>    error.
>>
>>  - The CLI and MI output changes from:
>>
>>      (gdb) show stop-on-solib-events
>>      Stopping for shared library events is 0.
>>      (gdb) interpreter-exec mi "-gdb-show stop-on-solib-events"
>>      ^done,value="0"
>>      (gdb) print $_gdb_setting_str("stop-on-solib-events")
>>      $1 = "0"
>>
>>    to:
>>
>>      (gdb) show stop-on-solib-events
>>      Stopping for shared library events is off.
>>      (gdb) interpreter-exec mi "-gdb-show stop-on-solib-events"
>>      ^done,value="off"
>>      (gdb) print $_gdb_setting_str("stop-on-solib-events")
>>      $1 = "off"
>>
>>  - The Python gdb.parameter("stop-on-solib-events") function now returns
>>    True or False instead of an integer.  The Guile equivalent now
>>    returns #t or #f.
>>
>> I think that all these observable changes are relatively easy to work
>> around.
>>
>> Add a NEWS entry for the change and update the documentation.
> 
> I agree that this is a good improvement to make.  I have two minor
> nits, see below, but otherwise:
> 
> Approved-By: Andrew Burgess <aburgess@redhat.com>
> 
>> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
>> index a24f67cb8de1..5cfbad231402 100644
>> --- a/gdb/doc/gdb.texinfo
>> +++ b/gdb/doc/gdb.texinfo
>> @@ -22510,7 +22510,7 @@ The surrounding square brackets are optional.
>>  @end table
>>  
>>  @table @code
>> -@item set stop-on-solib-events
>> +@item set stop-on-solib-events [on|off]
> 
> This should use "@r{[}on@r{|}off@r{]}" which formats the [|] in normal
> non-code style text to make it distinct from the on and off, which will
> use @code style.
> 
> Our docs are super inconsistent and I have a patch to try and clean this
> up but I was waiting for the release to be out of the way before posting
> it.

Ack, fixed.

>>  @kindex set stop-on-solib-events
>>  This command controls whether @value{GDBN} should give you control
>>  when the dynamic linker notifies it about some shared library event.
>> diff --git a/gdb/infrun.c b/gdb/infrun.c
>> index 3fbfeff9269d..59c25259fd52 100644
>> --- a/gdb/infrun.c
>> +++ b/gdb/infrun.c
>> @@ -413,9 +413,9 @@ get_detach_signal (process_stratum_target *proc_target, ptid_t ptid)
>>  
>>  static struct cmd_list_element *stop_command;
>>  
>> -/* Nonzero if we want to give control to the user when we're notified
>> +/* True if we want to give control to the user when we're notified
>>     of shared library events by the dynamic linker.  */
>> -int stop_on_solib_events;
>> +bool stop_on_solib_events;
> 
> The comment on this should really be: /* See infrun.h.  */

Agreed, it's a good excuse to clean this up.

Pushed with those fixed, thanks.

Simon

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

end of thread, other threads:[~2026-09-29 19:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 19:54 [PATCH] gdb: make "stop-on-solib-events" a boolean setting Simon Marchi
2026-09-29 11:21 ` Andrew Burgess
2026-09-29 19:22   ` Simon Marchi

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