aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-11-02 13:48:42 +0000
committerAndrew Burgess <aburgess@redhat.com>2022-11-17 14:49:41 +0000
commitcbda14deaf49b48450207cfb0990c71c11d07a64 (patch)
treed087c5cc98cc361a0a95ee9984e6e9b1d05aecb7 /gdb/doc
parent91f63aa2e2002a1533991b0e52579b2e026f50da (diff)
downloadgdb-cbda14deaf49b48450207cfb0990c71c11d07a64.zip
gdb-cbda14deaf49b48450207cfb0990c71c11d07a64.tar.gz
gdb-cbda14deaf49b48450207cfb0990c71c11d07a64.tar.bz2
gdb: new $_inferior_thread_count convenience variable
Add a new convenience variable $_inferior_thread_count that contains the number of live (non-exited) threads in the current inferior. This can be used in command scripts, or breakpoint conditions, etc to adjust the behaviour for multi-threaded inferiors. This value is only stable in all-stop mode. In non-stop mode, where new threads can be started, and existing threads exit, at any time, this convenience variable can give a different value each time it is evaluated.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/gdb.texinfo14
1 files changed, 12 insertions, 2 deletions
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index a41f0f7..bb7b276 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -3642,8 +3642,15 @@ The debugger convenience variables @samp{$_thread} and
@samp{$_gthread} contain, respectively, the per-inferior thread number
and the global thread number of the current thread. You may find this
useful in writing breakpoint conditional expressions, command scripts,
-and so forth. @xref{Convenience Vars,, Convenience Variables}, for
-general information on convenience variables.
+and so forth. The convenience variable @samp{$_inferior_thread_count}
+contains the number of live threads in the current inferior.
+@xref{Convenience Vars,, Convenience Variables}, for general
+information on convenience variables.
+
+When running in non-stop mode (@pxref{Non-Stop Mode}), where new
+threads can be created, and existing threads exit, at any time,
+@samp{$_inferior_thread_count} could return a different value each
+time it is evaluated.
If @value{GDBN} detects the program is multi-threaded, it augments the
usual message about stopping at a breakpoint with the ID and name of
@@ -12655,6 +12662,9 @@ The thread number of the current thread. @xref{thread numbers}.
@item $_gthread
The global number of the current thread. @xref{global thread numbers}.
+@item $_inferior_thread_count
+The number of live threads in the current inferior. @xref{Threads}.
+
@item $_gdb_major
@itemx $_gdb_minor
@vindex $_gdb_major@r{, convenience variable}