Fix for PR gdb/1543.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.threads / thread_check.exp
CommitLineData
9b254dd1 1# Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
ce78e7c3
MI
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
ce78e7c3
MI
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
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
ce78e7c3 15
ce78e7c3
MI
16# This file was written by Manoj Iyer. (manjo@austin.ibm.com)
17# Test break points and single step on thread functions.
18#
19# Test Purpose:
20# - Test that breakpoints, continue in a threaded application works.
21# On powerpc64-unknown-linux-gnu system, running kernel version
22# 2.6.5-7.71-pseries64 this test is known to fail due to kernel bug
23# in ptrace system call.
24#
25# Test Strategy:
8de0841b 26# - thread_check.c creates 2 threads
ce78e7c3
MI
27# - start gdb
28# - create 2 breakpoints #1 main() #2 tf() (the thread function)
29# - run gdb till #1 main() breakpoint is reached
30# - continue to breakpoint #2 tf()
31# - delete all breakpoints
32# - exit gdb.
33
34if $tracelevel then {
35 strace $tracelevel
36}
37
38set prms_id 0
39set bug_id 0
40
41set testfile "thread_check"
42set srcfile ${testfile}.c
43set binfile ${objdir}/${subdir}/${testfile}
44
45if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
46 return -1
47}
48
49
50gdb_start
51gdb_reinitialize_dir $srcdir/$subdir
52gdb_load ${binfile}
53
54if ![runto_main] then {
55 fail "Can't run to main"
56 return 1;
57}
58
59
60#
61# set breakpoint at thread fucntion tf
62#
63gdb_test "break tf" \
64 "Breakpoint.*at.* file .*$srcfile, line.*" \
65 "breakpoint at tf"
66
67
68#
69#
70# continue to tf() breakpoint #2
71#
72gdb_test "continue" \
8de0841b 73 ".*Breakpoint 2,.*tf.*at.*$srcfile:.*" \
ce78e7c3
MI
74 "continue to tf"
75
76#
77# backtrace from thread function.
78#
79gdb_test "backtrace" \
8de0841b 80 "#0 .*tf .*at .*$srcfile:.*" \
ce78e7c3
MI
81 "backtrace from thread function"
82
83
84#
85# delete all breakpoints
86#
87delete_breakpoints
88
89#
90# exit gdb
91#
92gdb_exit
This page took 0.390728 seconds and 4 git commands to generate.