Commit | Line | Data |
---|---|---|
ce78e7c3 MI |
1 | # Copyright (C) 2004 Free Software Foundation, Inc. |
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 | |
5 | # the Free Software Foundation; either version 2 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
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. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program; if not, write to the Free Software | |
15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
16 | ||
17 | # Please email any bugs, comments, and/or additions to this file to: | |
18 | # bug-gdb@prep.ai.mit.edu | |
19 | ||
20 | # This file was written by Manoj Iyer. (manjo@austin.ibm.com) | |
21 | # Test break points and single step on thread functions. | |
22 | # | |
23 | # Test Purpose: | |
24 | # - Test that breakpoints, continue in a threaded application works. | |
25 | # On powerpc64-unknown-linux-gnu system, running kernel version | |
26 | # 2.6.5-7.71-pseries64 this test is known to fail due to kernel bug | |
27 | # in ptrace system call. | |
28 | # | |
29 | # Test Strategy: | |
30 | # - tbug.c creates 2 threads | |
31 | # - start gdb | |
32 | # - create 2 breakpoints #1 main() #2 tf() (the thread function) | |
33 | # - run gdb till #1 main() breakpoint is reached | |
34 | # - continue to breakpoint #2 tf() | |
35 | # - delete all breakpoints | |
36 | # - exit gdb. | |
37 | ||
38 | if $tracelevel then { | |
39 | strace $tracelevel | |
40 | } | |
41 | ||
42 | set prms_id 0 | |
43 | set bug_id 0 | |
44 | ||
45 | set testfile "thread_check" | |
46 | set srcfile ${testfile}.c | |
47 | set binfile ${objdir}/${subdir}/${testfile} | |
48 | ||
49 | if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } { | |
50 | return -1 | |
51 | } | |
52 | ||
53 | ||
54 | gdb_start | |
55 | gdb_reinitialize_dir $srcdir/$subdir | |
56 | gdb_load ${binfile} | |
57 | ||
58 | if ![runto_main] then { | |
59 | fail "Can't run to main" | |
60 | return 1; | |
61 | } | |
62 | ||
63 | ||
64 | # | |
65 | # set breakpoint at thread fucntion tf | |
66 | # | |
67 | gdb_test "break tf" \ | |
68 | "Breakpoint.*at.* file .*$srcfile, line.*" \ | |
69 | "breakpoint at tf" | |
70 | ||
71 | ||
72 | # | |
73 | # | |
74 | # continue to tf() breakpoint #2 | |
75 | # | |
76 | gdb_test "continue" \ | |
77 | ".*Breakpoint 2.*tf.* at .*tbug.* .*\r\n.*$gdb_prompt $" \ | |
78 | "continue to tf" | |
79 | ||
80 | # | |
81 | # backtrace from thread function. | |
82 | # | |
83 | gdb_test "backtrace" \ | |
84 | "#0 .*tf .*at .*tbug.*" \ | |
85 | "backtrace from thread function" | |
86 | ||
87 | ||
88 | # | |
89 | # delete all breakpoints | |
90 | # | |
91 | delete_breakpoints | |
92 | ||
93 | # | |
94 | # exit gdb | |
95 | # | |
96 | gdb_exit |