diff options
author | Yao Qi <yao@codesourcery.com> | 2014-06-05 15:07:47 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2014-06-06 09:45:22 +0800 |
commit | b8b91e982ec3235a24ce052cbd8bb0e4fe1464e0 (patch) | |
tree | 4a44d39f7b5fd9d2e71a83d88a0ac0f8c186ff1c /gdb/testsuite/gdb.threads/staticthreads.exp | |
parent | 872a9dd8819dc701e19f6e6f3e15a320e5b08b67 (diff) | |
download | gdb-b8b91e982ec3235a24ce052cbd8bb0e4fe1464e0.zip gdb-b8b91e982ec3235a24ce052cbd8bb0e4fe1464e0.tar.gz gdb-b8b91e982ec3235a24ce052cbd8bb0e4fe1464e0.tar.bz2 |
Fix the race in gdb.threads/staticthreads.exp
The code in gdb.threads/staticthreads.exp about checking the value of
tlsvar in main thread is racy, because when child thread hits
breakpoint, the main thread may not go into pthread_join yet, and
may not be unwind to main.
This patch is to move the line setting breakpoint on after sem_wait,
so that the child thread will hit breakpoint after main thread calls
sem_post. IOW, when child thread hits breakpoint, the main thread is
in either sem_post or pthread_join. "up 10" can unwind main thread to
main.
gdb/testsuite:
2014-06-06 Yao Qi <yao@codesourcery.com>
* gdb.threads/staticthreads.c (thread_function): Move the line
setting breakpoint on forward.
* gdb.threads/staticthreads.exp: Update comments.
Diffstat (limited to 'gdb/testsuite/gdb.threads/staticthreads.exp')
-rw-r--r-- | gdb/testsuite/gdb.threads/staticthreads.exp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.threads/staticthreads.exp b/gdb/testsuite/gdb.threads/staticthreads.exp index 9fa625a..bdc03d4 100644 --- a/gdb/testsuite/gdb.threads/staticthreads.exp +++ b/gdb/testsuite/gdb.threads/staticthreads.exp @@ -105,7 +105,7 @@ if { "$have_tls" != "" } { gdb_continue_to_breakpoint "tlsvar-is-set" ".* tlsvar-is-set .*" gdb_test "p tlsvar" " = 2" "tlsvar in thread" gdb_test "thread 1" ".*" - # Unwind from pthread_join. + # Unwind to main. gdb_test "up 10" " in main .*" gdb_test "p tlsvar" " = 1" "tlsvar in main" } |