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/testsuite/gdb.multi/tids.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gdb/testsuite/gdb.multi') diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp index b0c768f..b72695d 100644 --- a/gdb/testsuite/gdb.multi/tids.exp +++ b/gdb/testsuite/gdb.multi/tids.exp @@ -158,8 +158,9 @@ with_test_prefix "two inferiors" { " 2\.1 +2 +.*" \ " 2\.2 +3 +.* thread_function1 .* at .*$srcfile:.*"] - # Confirm the convenience variable show the expected number. + # Confirm the convenience variables show the expected numbers. gdb_test "p \$_thread == 2" " = 1" + gdb_test "p \$_gthread == 4" " = 1" # Without an explicit inferior component, GDB defaults to the # current inferior. Make sure we don't refer to a thread by -- cgit v1.1