X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.threads%2Fthread-find.exp;h=bd90c57f479b7feb4acefc28459ab4baf33dd928;hb=b05b120205e697db6291abb95a8cd2be054f99e9;hp=f39886c0018dbf5ae74a94144d8efc991d4eadd1;hpb=97ccebe869a69550b5a89a59b99955fb783f2b81;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/testsuite/gdb.threads/thread-find.exp b/gdb/testsuite/gdb.threads/thread-find.exp index f39886c001..bd90c57f47 100644 --- a/gdb/testsuite/gdb.threads/thread-find.exp +++ b/gdb/testsuite/gdb.threads/thread-find.exp @@ -1,4 +1,4 @@ -# Copyright 2011-2012 Free Software Foundation, Inc. +# Copyright 2011-2016 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 @@ -16,16 +16,12 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@gnu.org -set testfile "linux-dp" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile linux-dp.c if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != ""} { return -1 } -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +clean_restart ${binfile} gdb_test_no_output "set print sevenbit-strings" runto_main @@ -33,10 +29,6 @@ runto_main gdb_breakpoint [gdb_get_line_number "linuxthreads.exp: info threads 2"] gdb_continue_to_breakpoint "main thread's sleep" -# Make sure thread list is up-to-date (in case remote targets have not yet -# reported thread creation events) -gdb_test "info threads" - # Create thread names. gdb_test "thread apply 1 thread name threadname_1" \ "Thread 1 .*" \ @@ -63,29 +55,11 @@ gdb_test "thread apply 6 thread name threadname_6" \ "name thread 6" # Collect thread ids, if any. + gdb_test_multiple "info threads" "collect thread id" { - -re ". 6 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_6\" \[^\r\n\]*" { - set thread6 $expect_out(1,string) - exp_continue - } - -re ". 5 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_5\" \[^\r\n\]*" { - set thread5 $expect_out(1,string) - exp_continue - } - -re ". 4 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_4\" \[^\r\n\]*" { - set thread4 $expect_out(1,string) - exp_continue - } - -re ". 3 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_3\" \[^\r\n\]*" { - set thread3 $expect_out(1,string) - exp_continue - } - -re ". 2 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_2\" \[^\r\n\]*" { - set thread2 $expect_out(1,string) - exp_continue - } - -re ". 1 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_1\" \[^\r\n\]*" { - set thread1 $expect_out(1,string) + -re ". (\[0-9\]+) \[^\r\n\]*\[Tt\]hread (\[0-9a-fA-Fx\]+)\[^\r\n\]* \"threadname_\[0-9\]+\" \[^\r\n\]*" { + set thr_num $expect_out(1,string) + set thread$thr_num $expect_out(2,string) exp_continue } -re ".*$gdb_prompt $" { @@ -98,29 +72,11 @@ if { [info exists thread6] } then { } # Collect process ids, if any. + gdb_test_multiple "info threads" "collect thread id" { - -re ". 6 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_6\" \[^\r\n\]*" { - set process6 $expect_out(1,string) - exp_continue - } - -re ". 5 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_5\" \[^\r\n\]*" { - set process5 $expect_out(1,string) - exp_continue - } - -re ". 4 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_4\" \[^\r\n\]*" { - set process4 $expect_out(1,string) - exp_continue - } - -re ". 3 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_3\" \[^\r\n\]*" { - set process3 $expect_out(1,string) - exp_continue - } - -re ". 2 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_2\" \[^\r\n\]*" { - set process2 $expect_out(1,string) - exp_continue - } - -re ". 1 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_1\" \[^\r\n\]*" { - set process1 $expect_out(1,string) + -re ". (\[0-9\]+) \[^\r\n\]*\[Pp\]rocess (\[0-9a-fA-Fx\]+)\[^\r\n\]* \"threadname_\[0-9\]+\" \[^\r\n\]*" { + set thr_num $expect_out(1,string) + set process$thr_num $expect_out(2,string) exp_continue } -re ".*$gdb_prompt $" { @@ -133,29 +89,11 @@ if { [info exists process6] } then { } # Collect lwp ids, if any. + gdb_test_multiple "info threads" "collect thread id" { - -re ". 6 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_6\" \[^\r\n\]*" { - set lwp6 $expect_out(1,string) - exp_continue - } - -re ". 5 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_5\" \[^\r\n\]*" { - set lwp5 $expect_out(1,string) - exp_continue - } - -re ". 4 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_4\" \[^\r\n\]*" { - set lwp4 $expect_out(1,string) - exp_continue - } - -re ". 3 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_3\" \[^\r\n\]*" { - set lwp3 $expect_out(1,string) - exp_continue - } - -re ". 2 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_2\" \[^\r\n\]*" { - set lwp2 $expect_out(1,string) - exp_continue - } - -re ". 1 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_1\" \[^\r\n\]*" { - set lwp1 $expect_out(1,string) + -re ". (\[0-9\]+) \[^\r\n\]*LWP (\[0-9a-fA-Fx\]+)\[^\r\n\]* \"threadname_\[0-9\]+\" \[^\r\n\]*" { + set thr_num $expect_out(1,string) + set lwp$thr_num $expect_out(2,string) exp_continue } -re ".*$gdb_prompt $" { @@ -249,36 +187,13 @@ gdb_test "thread find foobarbaz" "No threads match .*" "no thread" # Test regular expression # -set see1 0 -set see2 0 -set see3 0 -set see4 0 -set see5 0 -set see6 0 - +for {set i 1} {$i <= 6} {incr i} { + set see$i 0 +} gdb_test_multiple "thread find threadname_\[345\]" "test regular exp" { - -re "Thread 6 has name \[^\r\n\]*" { - set see6 1 - exp_continue - } - -re "Thread 5 has name \[^\r\n\]*" { - set see5 1 - exp_continue - } - -re "Thread 4 has name \[^\r\n\]*" { - set see4 1 - exp_continue - } - -re "Thread 3 has name \[^\r\n\]*" { - set see3 1 - exp_continue - } - -re "Thread 2 has name \[^\r\n\]*" { - set see2 1 - exp_continue - } - -re "Thread 1 has name \[^\r\n\]*" { - set see1 1 + -re "Thread (\[0-9\]+) has name \[^\r\n\]*" { + set thr_num $expect_out(1,string) + set see$thr_num 1 exp_continue } -re ".*$gdb_prompt $" { @@ -294,36 +209,13 @@ gdb_test_multiple "thread find threadname_\[345\]" "test regular exp" { # Test info threads on a subset of threads # -set see1 0 -set see2 0 -set see3 0 -set see4 0 -set see5 0 -set see6 0 - +for {set i 1} {$i <= 6} {incr i} { + set see$i 0 +} gdb_test_multiple "info threads 2 4 6" "info threads 2 4 6" { - -re ". 6 \[^\r\n\]*\"threadname_6\" \[^\r\n\]*" { - set see6 1 - exp_continue - } - -re ". 5 \[^\r\n\]*\"threadname_5\" \[^\r\n\]*" { - set see5 1 - exp_continue - } - -re ". 4 \[^\r\n\]*\"threadname_4\" \[^\r\n\]*" { - set see4 1 - exp_continue - } - -re ". 3 \[^\r\n\]*\"threadname_3\" \[^\r\n\]*" { - set see3 1 - exp_continue - } - -re ". 2 \[^\r\n\]*\"threadname_2\" \[^\r\n\]*" { - set see2 1 - exp_continue - } - -re ". 1 \[^\r\n\]*\"threadname_1\" \[^\r\n\]*" { - set see1 1 + -re ". (\[0-9\]+) \[^\r\n\]*\"threadname_\[0-9\]+\" \[^\r\n\]*" { + set thr_num $expect_out(1,string) + set see$thr_num 1 exp_continue } -re "$gdb_prompt $" { @@ -339,36 +231,13 @@ gdb_test_multiple "info threads 2 4 6" "info threads 2 4 6" { # Test info threads on a range # -set see1 0 -set see2 0 -set see3 0 -set see4 0 -set see5 0 -set see6 0 - +for {set i 1} {$i <= 6} {incr i} { + set see$i 0 +} gdb_test_multiple "info threads 3-5" "info threads 3-5" { - -re ". 6 .*\"threadname_6\" \[^\r\n\]*" { - set see6 1 - exp_continue - } - -re ". 5 .*\"threadname_5\" \[^\r\n\]*" { - set see5 1 - exp_continue - } - -re ". 4 .*\"threadname_4\" \[^\r\n\]*" { - set see4 1 - exp_continue - } - -re ". 3 .*\"threadname_3\" \[^\r\n\]*" { - set see3 1 - exp_continue - } - -re ". 2 .*\"threadname_2\" \[^\r\n\]*" { - set see2 1 - exp_continue - } - -re ". 1 .*\"threadname_1\" \[^\r\n\]*" { - set see1 1 + -re ". (\[0-9\]+) \[^\r\n\]*\"threadname_\[0-9\]+\" \[^\r\n\]*" { + set thr_num $expect_out(1,string) + set see$thr_num 1 exp_continue } -re "$gdb_prompt $" { @@ -386,36 +255,13 @@ gdb_test "info threads 5-3" "inverted range" "test inverted range" # Test degenerate range -set see1 0 -set see2 0 -set see3 0 -set see4 0 -set see5 0 -set see6 0 - +for {set i 1} {$i <= 6} {incr i} { + set see$i 0 +} gdb_test_multiple "info threads 3-3" "info threads 3-3" { - -re ". 6 .*\"threadname_6\" \[^\r\n\]*" { - set see6 1 - exp_continue - } - -re ". 5 .*\"threadname_5\" \[^\r\n\]*" { - set see5 1 - exp_continue - } - -re ". 4 .*\"threadname_4\" \[^\r\n\]*" { - set see4 1 - exp_continue - } - -re ". 3 .*\"threadname_3\" \[^\r\n\]*" { - set see3 1 - exp_continue - } - -re ". 2 .*\"threadname_2\" \[^\r\n\]*" { - set see2 1 - exp_continue - } - -re ". 1 .*\"threadname_1\" \[^\r\n\]*" { - set see1 1 + -re ". (\[0-9\]+) .*\"threadname_\[0-9\]+\" \[^\r\n\]*" { + set thr_num $expect_out(1,string) + set see$thr_num 1 exp_continue } -re ".*$gdb_prompt $" {