xref: /openbsd-src/gnu/usr.bin/binutils/gdb/testsuite/gdb.threads/switch-threads.exp (revision b725ae7711052a2233e31a66fefb8a752c388d7a)
1*b725ae77Skettenis# Copyright (C) 2003 Free Software Foundation, Inc.
2*b725ae77Skettenis
3*b725ae77Skettenis# This program is free software; you can redistribute it and/or modify
4*b725ae77Skettenis# it under the terms of the GNU General Public License as published by
5*b725ae77Skettenis# the Free Software Foundation; either version 2 of the License, or
6*b725ae77Skettenis# (at your option) any later version.
7*b725ae77Skettenis#
8*b725ae77Skettenis# This program is distributed in the hope that it will be useful,
9*b725ae77Skettenis# but WITHOUT ANY WARRANTY; without even the implied warranty of
10*b725ae77Skettenis# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11*b725ae77Skettenis# GNU General Public License for more details.
12*b725ae77Skettenis#
13*b725ae77Skettenis# You should have received a copy of the GNU General Public License
14*b725ae77Skettenis# along with this program; if not, write to the Free Software
15*b725ae77Skettenis# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16*b725ae77Skettenis
17*b725ae77Skettenis# Please email any bugs, comments, and/or additions to this file to:
18*b725ae77Skettenis# bug-gdb@prep.ai.mit.edu
19*b725ae77Skettenis
20*b725ae77Skettenis# This file was written by Daniel Jacobowitz <drow@mvista.com>.
21*b725ae77Skettenis#
22*b725ae77Skettenis# It tests that the correct thread is single-stepped.  Prior to the
23*b725ae77Skettenis# introduction of vCont, we didn't pass enough information to remote
24*b725ae77Skettenis# multi-threaded stubs to reliably get this correct; gdbserver defaulted
25*b725ae77Skettenis# to the first thread.
26*b725ae77Skettenis
27*b725ae77Skettenis# TODO: we should also test explicitly changing threads with the "thread"
28*b725ae77Skettenis# command.
29*b725ae77Skettenis
30*b725ae77Skettenisif $tracelevel then {
31*b725ae77Skettenis	strace $tracelevel
32*b725ae77Skettenis}
33*b725ae77Skettenis
34*b725ae77Skettenisset testfile "switch-threads"
35*b725ae77Skettenisset srcfile ${testfile}.c
36*b725ae77Skettenisset binfile ${objdir}/${subdir}/${testfile}
37*b725ae77Skettenis
38*b725ae77Skettenisif {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
39*b725ae77Skettenis    return -1
40*b725ae77Skettenis}
41*b725ae77Skettenis
42*b725ae77Skettenisgdb_exit
43*b725ae77Skettenisgdb_start
44*b725ae77Skettenisgdb_reinitialize_dir $srcdir/$subdir
45*b725ae77Skettenisgdb_load ${binfile}
46*b725ae77Skettenis
47*b725ae77Skettenisrunto_main
48*b725ae77Skettenis
49*b725ae77Skettenisgdb_breakpoint thread_func
50*b725ae77Skettenisgdb_continue_to_breakpoint "continue to thread_func"
51*b725ae77Skettenisgdb_test "next" ".*foo \\(\\);"
52*b725ae77Skettenis
53