From 663f6d42f47265d2deaa86c8a976e658fb13f820 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 13 Jan 2016 10:56:10 +0000 Subject: Add $_gthread convenience variable This commit adds a new $_gthread convenience variable, that is like $_thread, but holds the current thread's global thread id. gdb/ChangeLog: 2016-01-13 Pedro Alves * NEWS: Mention $_gthread. * gdbthread.h (struct thread_info) : Mention $_gthread. * thread.c (thread_num_make_value_helper): New function. (thread_id_make_value): Delete. (thread_id_per_inf_num_make_value, global_thread_id_make_value): New. (thread_funcs): Adjust. (gthread_funcs): New. (_initialize_thread): Register $_gthread variable. gdb/testsuite/ChangeLog: 2016-01-13 Pedro Alves * gdb.base/default.exp: Expect $_gthread as well. * gdb.multi/tids.exp: Test $_gthread. * gdb.threads/thread-specific.exp: Test $_gthread. gdb/doc/ChangeLog: 2016-01-13 Pedro Alves * gdb.texinfo (Threads): Document the $_gthread convenience variable. (Convenience Vars): Likewise. --- gdb/doc/ChangeLog | 6 ++++++ gdb/doc/gdb.texinfo | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'gdb/doc') diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index d723276..4b59057 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,5 +1,11 @@ 2016-01-13 Pedro Alves + * gdb.texinfo (Threads): Document the $_gthread convenience + variable. + (Convenience Vars): Likewise. + +2016-01-13 Pedro Alves + * gdb.texinfo (Threads): Document "info threads -gid". 2016-01-13 Pedro Alves diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 654efa4..7da31c8 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -2937,8 +2937,10 @@ thread. In other words, @value{GDBN} assigns a thread number to the program's ``main thread'' even if the program is not multi-threaded. @vindex $_thread@r{, convenience variable} -The debugger convenience variable @samp{$_thread} contains the -per-inferior thread number of the current thread. You may find this +@vindex $_gthread@r{, convenience variable} +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. @@ -10459,6 +10461,9 @@ Programs, ,Debugging Multiple Inferiors and Programs}. @item $_thread The thread number of the current thread. @xref{thread numbers}. +@item $_gthread +The global number of the current thread. @xref{global thread numbers}. + @end table @node Convenience Funs -- cgit v1.1