Commit | Line | Data |
---|---|---|
32d0add0 | 1 | # Copyright (C) 2004-2015 Free Software Foundation, Inc. |
8b923272 JB |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
8b923272 | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
8b923272 JB |
8 | # This program is distributed in the hope that it will be useful, |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
e22f8b7c | 12 | # |
8b923272 | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
8b923272 JB |
15 | |
16 | # Please email any bugs, comments, and/or additions to this file to: | |
17 | # bug-gdb@gnu.org | |
18 | ||
19 | # This file verifies that GDB is able to compute a backtrace for a thread | |
20 | # being blocked on a call to pthread_cond_wait(). | |
21 | ||
0efbbabc | 22 | standard_testfile |
8b923272 | 23 | |
0efbbabc | 24 | if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } { |
8b923272 JB |
25 | return -1 |
26 | } | |
27 | ||
0efbbabc | 28 | clean_restart ${binfile} |
a271cc33 | 29 | runto_main |
8b923272 JB |
30 | |
31 | gdb_test "break break_me" \ | |
a271cc33 | 32 | "Breakpoint 2 at .*: file .*${srcfile}, line .*" \ |
8b923272 JB |
33 | "breakpoint on break_me" |
34 | ||
a271cc33 OF |
35 | gdb_test "continue" \ |
36 | ".*Breakpoint 2, break_me ().*" \ | |
8b923272 JB |
37 | "run to break_me" |
38 | ||
39 | # | |
40 | # Backtrace all threads, find the one running noreturn, and | |
41 | # verify that we are able to get a sensible backtrace, including | |
42 | # the frame for the pthread_cond_wait() call. | |
43 | # | |
44 | # The string below will only match if the functions named | |
45 | # occur in a single thread's backtrace, in the given order. | |
46 | # | |
47 | ||
48 | global hex | |
49 | global decimal | |
50 | ||
51 | # | |
52 | # This is a "backtrace break" ("btb"): | |
53 | # | |
54 | set btb "\[^\r\n\]+\[\r\n\]+\#${decimal}\[ \t\]+${hex} in " | |
55 | ||
56 | # One of the threads is blocked on a call to pthread_cond_wait, and | |
57 | # we want to verify that we are able to get a sensible backtrace for | |
58 | # that thread. Because we don't know its thread ID, we can't switch | |
59 | # to it before doing the backtrace. So we get a backtrace for all | |
60 | # threads, and verify that one them returns the expected backtrace. | |
61 | gdb_test "thread apply all backtrace" \ | |
62 | "pthread_cond_wait${btb}cond_wait${btb}noreturn${btb}forever_pthread.*" \ | |
63 | "backtrace in blocked thread" | |
64 |