-# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008,
-# 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# This file was written by Fred Fish. (fnf@cygnus.com)
-if $tracelevel then {
- strace $tracelevel
-}
-
-
-# This only works with native configurations
-if ![isnative] then {
- return
-}
-set testfile "pthreads"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
# regexp for "horizontal" text (i.e. doesn't include newline or
# carriage return)
set target_cflags ""
}
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
return -1
}
+clean_restart ${binfile}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
-gdb_test "set print sevenbit-strings" ""
-#gdb_test "set print address off" ""
-gdb_test "set width 0" ""
+gdb_test_no_output "set print sevenbit-strings"
+#gdb_test_no_output "set print address off"
+gdb_test_no_output "set width 0"
# We'll need this when we send_gdb a ^C to GDB. Need to do it before we
# run the program and gdb starts saving and restoring tty states.
# On Ultrix, we don't need it and it is really slow (because shell_escape
# doesn't use vfork).
if ![istarget "*-*-ultrix*"] then {
- gdb_test "shell stty intr '^C'" ""
+ gdb_test "shell stty intr '^C'" ".*"
}
proc all_threads_running {} {
global srcfile
# Reset all the counters to zero.
- gdb_test "set var common_routine::hits=0" ""
- gdb_test "set var common_routine::from_thread1=0" ""
- gdb_test "set var common_routine::from_thread2=0" ""
- gdb_test "set var common_routine::from_main=0" ""
- gdb_test "set var common_routine::full_coverage=0" ""
+ gdb_test_no_output "set var common_routine::hits=0"
+ gdb_test_no_output "set var common_routine::from_thread1=0"
+ gdb_test_no_output "set var common_routine::from_thread2=0"
+ gdb_test_no_output "set var common_routine::from_main=0"
+ gdb_test_no_output "set var common_routine::full_coverage=0"
# Disable all breakpoints.
- gdb_test "disable" ""
+ gdb_test_no_output "disable"
# Set up a breakpoint that will cause us to stop when we have
# been called 15 times. This should be plenty of time to allow
# every thread to run at least once, since each thread sleeps for
# one second between calls to common_routine.
- gdb_test "tbreak common_routine if hits >= 15" ""
+ gdb_test "tbreak common_routine if hits >= 15" ".*"
# Start all the threads running again and wait for the inferior
# to stop. Since no other breakpoints are set at this time
gdb_test "continue" \
"Continuing.*Breakpoint .*, thread1 \\(arg=0xfeedface\\).*at.*$srcfile.*" \
"Continue to creation of first thread"
- gdb_test "disable" ""
+ gdb_test_no_output "disable"
# Extract the thread id number of thread 1 from "info threads" output.
gdb_test_multiple "info threads" "get thread 1 id" {
return 1;
}
}
- gdb_test "bt" ""
+ gdb_test "bt" ".*"
# Verify that all threads can be run again after a ^C stop.
if [all_threads_running] then {
"set break at common_routine in thread 2"
gdb_test_multiple "continue" "continue to bkpt at common_routine in thread 2" {
- -re "Breakpoint .* common_routine \\(arg=2\\).*" {
+ -re "Breakpoint .* common_routine \\(arg=2\\).*$gdb_prompt $" {
pass "continue to bkpt at common_routine in thread 2"
gdb_test "backtrace" \
"#0.*common_routine \\(arg=2\\).*#1.*thread2.*" \
"backtrace from thread 2 bkpt in common_routine"
}
- -re "Breakpoint .* common_routine \\(arg=0\\).*" {
+ -re "Breakpoint .* common_routine \\(arg=0\\).*$gdb_prompt $" {
fail "continue to bkpt at common_routine in thread 2 (arg=0)"
}
- -re "Breakpoint .* common_routine \\(arg=1\\).*" {
+ -re "Breakpoint .* common_routine \\(arg=1\\).*$gdb_prompt $" {
fail "continue to bkpt at common_routine in thread 2 (arg=1)"
}
}