diff options
author | Pedro Alves <palves@redhat.com> | 2016-01-13 10:56:10 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-01-13 11:03:19 +0000 |
commit | 663f6d42f47265d2deaa86c8a976e658fb13f820 (patch) | |
tree | bd245ce035bd243e40c05056a39ee0d28e8bc3c5 /gdb/testsuite | |
parent | c84f6bbfe50ff13928360d3cc349d7c553867ce6 (diff) | |
download | gdb-663f6d42f47265d2deaa86c8a976e658fb13f820.zip gdb-663f6d42f47265d2deaa86c8a976e658fb13f820.tar.gz gdb-663f6d42f47265d2deaa86c8a976e658fb13f820.tar.bz2 |
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 <palves@redhat.com>
* NEWS: Mention $_gthread.
* gdbthread.h (struct thread_info) <global_num>: 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 <palves@redhat.com>
* 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 <palves@redhat.com>
* gdb.texinfo (Threads): Document the $_gthread convenience
variable.
(Convenience Vars): Likewise.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/default.exp | 1 | ||||
-rw-r--r-- | gdb/testsuite/gdb.multi/tids.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/thread-specific.exp | 5 |
4 files changed, 14 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c863518..dcdc09c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2016-01-13 Pedro Alves <palves@redhat.com> + * gdb.base/default.exp: Expect $_gthread as well. + * gdb.multi/tids.exp: Test $_gthread. + * gdb.threads/thread-specific.exp: Test $_gthread. + +2016-01-13 Pedro Alves <palves@redhat.com> + * gdb.multi/tids.exp: Test "info threads -gid". 2016-01-13 Pedro Alves <palves@redhat.com> diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index fec2cde..10739ca 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -587,6 +587,7 @@ set show_conv_list \ {$_sdata = void} \ {$_siginfo = void} \ {$_thread = 0} \ + {$_gthread = 0} \ {$_inferior = 1} \ {$_exception = <error: No frame selected>} \ {$_probe_argc = <error: No frame selected>} \ 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 diff --git a/gdb/testsuite/gdb.threads/thread-specific.exp b/gdb/testsuite/gdb.threads/thread-specific.exp index 2b75b60..8f61f88 100644 --- a/gdb/testsuite/gdb.threads/thread-specific.exp +++ b/gdb/testsuite/gdb.threads/thread-specific.exp @@ -66,7 +66,10 @@ clean_restart ${binfile} gdb_test_no_output "set print sevenbit-strings" gdb_test_no_output "set width 0" +# As this test only runs a single inferior, $_thread and $_gthread +# should match throughout. gdb_test {print $_thread} ".* = 0" "thread var when not running" +gdb_test {print $_gthread} ".* = 0" "gthread var when not running" runto_main @@ -82,6 +85,7 @@ if {[llength $threads] == 0} { } gdb_test {print $_thread} ".* = [lindex $threads 0]" "thread var in main" +gdb_test {print $_gthread} ".* = [lindex $threads 0]" "gthread var in main" gdb_test_multiple "break $line thread [lindex $threads 0]" \ "breakpoint $line main thread" { @@ -120,6 +124,7 @@ if { $this_breakpoint != -1 } { if { $this_thread != -1 } { gdb_test {print $_thread} ".* = $this_thread" "thread var at break" + gdb_test {print $_gthread} ".* = $this_thread" "gthread var at break" } else { untested "thread var at break" } |