diff options
author | Pedro Alves <palves@redhat.com> | 2016-01-12 01:12:38 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-01-12 01:12:38 +0000 |
commit | b05b120205e697db6291abb95a8cd2be054f99e9 (patch) | |
tree | 18f01a0a849488e1402c73caaaeedc189dcaf8a3 /gdb/testsuite/gdb.threads | |
parent | fd18a3722ce73d6c031dc1b968d1e1d508df17b5 (diff) | |
download | gdb-b05b120205e697db6291abb95a8cd2be054f99e9.zip gdb-b05b120205e697db6291abb95a8cd2be054f99e9.tar.gz gdb-b05b120205e697db6291abb95a8cd2be054f99e9.tar.bz2 |
Reapply: List inferiors/threads/pspaces in ascending order
[This reapplies a change that was accidentally reverted with c0ecb95f3d.]
Before:
(gdb) info threads
Id Target Id Frame
3 Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30
2 Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60
* 1 Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92
After:
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92
2 Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60
3 Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30
gdb/doc/ChangeLog:
2015-11-24 Pedro Alves <palves@redhat.com>
PR 17539
* gdb.texinfo (Inferiors and Programs): Adjust "maint info
program-spaces" example to ascending order listing.
(Threads): Adjust "info threads" example to ascending order
listing.
(Forks): Adjust "info inferiors" example to ascending order
listing.
gdb/ChangeLog:
2015-11-24 Pedro Alves <palves@redhat.com>
PR 17539
* inferior.c (add_inferior_silent): Append the new inferior to the
end of the list.
* progspace.c (add_program_space): Append the new pspace to the
end of the list.
* thread.c (new_thread): Append the new thread to the end of the
list.
gdb/testsuite/ChangeLog:
2015-11-24 Pedro Alves <palves@redhat.com>
PR 17539
* gdb.base/foll-exec-mode.exp: Adjust to GDB listing inferiors and
threads in ascending order.
* gdb.base/foll-fork.exp: Likewise.
* gdb.base/foll-vfork.exp: Likewise.
* gdb.base/multi-forks.exp: Likewise.
* gdb.mi/mi-nonstop.exp: Likewise.
* gdb.mi/mi-nsintrall.exp: Likewise.
* gdb.multi/base.exp: Likewise.
* gdb.multi/multi-arch.exp: Likewise.
* gdb.python/py-inferior.exp: Likewise.
* gdb.threads/break-while-running.exp: Likewise.
* gdb.threads/execl.exp: Likewise.
* gdb.threads/gcore-thread.exp: Likewise.
* gdb.threads/info-threads-cur-sal.exp: Likewise.
* gdb.threads/kill.exp: Likewise.
* gdb.threads/linux-dp.exp: Likewise.
* gdb.threads/multiple-step-overs.exp: Likewise.
* gdb.threads/next-bp-other-thread.exp: Likewise.
* gdb.threads/step-bg-decr-pc-switch-thread.exp: Likewise.
* gdb.threads/step-over-lands-on-breakpoint.exp: Likewise.
* gdb.threads/step-over-trips-on-watchpoint.exp: Likewise.
* gdb.threads/thread-find.exp: Likewise.
* gdb.threads/tls.exp: Likewise.
* lib/mi-support.exp (mi_reverse_list): Delete.
(mi_check_thread_states): No longer reverse list.
Diffstat (limited to 'gdb/testsuite/gdb.threads')
-rw-r--r-- | gdb/testsuite/gdb.threads/break-while-running.exp | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/execl.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/gcore-thread.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/info-threads-cur-sal.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/kill.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/linux-dp.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/multiple-step-overs.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/next-bp-other-thread.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/thread-find.exp | 218 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/tls.exp | 2 |
13 files changed, 59 insertions, 199 deletions
diff --git a/gdb/testsuite/gdb.threads/break-while-running.exp b/gdb/testsuite/gdb.threads/break-while-running.exp index 05860bc..8a197e4 100644 --- a/gdb/testsuite/gdb.threads/break-while-running.exp +++ b/gdb/testsuite/gdb.threads/break-while-running.exp @@ -78,7 +78,7 @@ proc test { update_thread_list always_inserted non_stop } { # without the user explicitly fetching the thread list. if {$update_thread_list} { gdb_test "info threads" \ - "\\\(running\\\).*\\\(running\\\).* main .*" \ + "main .*\\\(running\\\).*\\\(running\\\).*" \ "only main stopped" } @@ -107,7 +107,7 @@ proc test { update_thread_list always_inserted non_stop } { if {$non_stop == "on"} { gdb_test "info threads" \ - "\\\(running\\\).* breakpoint_function .* main .*" \ + "main .* breakpoint_function .*\\\(running\\\)" \ "one thread running" # Unblock the other thread, which should then trip on the same @@ -131,7 +131,7 @@ proc test { update_thread_list always_inserted non_stop } { } gdb_test "info threads" \ - " breakpoint_function .* breakpoint_function .* main .*" \ + " main .* breakpoint_function .* breakpoint_function .*" \ "all threads stopped" } else { # This test is not merged with the non-stop one because in @@ -142,7 +142,7 @@ proc test { update_thread_list always_inserted non_stop } { -re "\\\(running\\\).*$gdb_prompt $" { fail $test } - -re "breakpoint_function .* main .*$gdb_prompt $" { + -re "main .* breakpoint_function .*$gdb_prompt $" { pass $test } } diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp index 14e3e68..8538fd7 100644 --- a/gdb/testsuite/gdb.threads/execl.exp +++ b/gdb/testsuite/gdb.threads/execl.exp @@ -40,7 +40,7 @@ gdb_test "b [gdb_get_line_number "breakpoint here"]" \ gdb_test "continue" ".*breakpoint here.*" "continue to exec" -gdb_test "info threads" ".*3 *Thread.*2 *Thread.*1 *Thread.*" "info threads before exec" +gdb_test "info threads" "1 *Thread.*2 *Thread.*3 *Thread.*" "info threads before exec" # When continuing from this point we'll hit the breakpoint in main() # again, this time in the exec'd process. diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp index 44fb347..f74f147 100644 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp @@ -127,7 +127,7 @@ foreach name { corefile core0file } { with_test_prefix $name { # mapping various OS's may do? Let's assume that there must # be at least two threads: - gdb_test "info threads" ".*${nl} 2 ${horiz}${nl}\\* 1 .*" \ + gdb_test "info threads" "\\* 1 ${horiz}${nl} 2 ${horiz}.*" \ "corefile contains at least two threads" # One thread in the corefile should be in the "thread2" function. @@ -137,6 +137,6 @@ foreach name { corefile core0file } { with_test_prefix $name { # The thread2 thread should be marked as the current thread. - gdb_test "info threads" ".*${nl}\\* ${horiz} thread2 .*" \ + gdb_test "info threads" "\\* ${horiz} thread2 .*${nl}" \ "thread2 is current thread in corefile" }} diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp index 603d944..23a3c36 100644 --- a/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp +++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp @@ -41,14 +41,20 @@ gdb_test "list $line" \ # There used to be a bug where "info threads" would set the current # SAL to the location of the last thread displayed. gdb_test "info threads" \ - "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*\r\n 1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \ + [multi_line \ + "\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*" \ + " 1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \ + "\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*"] \ "info threads before break" # Check that "break" is still operating on the same file by default. gdb_test "break $line" ".*${srcfile2}.*" "break on line" gdb_test "info threads" \ - "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*\r\n 1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \ + [multi_line \ + "\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*" \ + " 1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \ + "\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*"] \ "info threads before list" # And that so is "list". diff --git a/gdb/testsuite/gdb.threads/kill.exp b/gdb/testsuite/gdb.threads/kill.exp index 741ebd5..a6d8382 100644 --- a/gdb/testsuite/gdb.threads/kill.exp +++ b/gdb/testsuite/gdb.threads/kill.exp @@ -48,7 +48,7 @@ proc test {threaded} { gdb_continue_to_breakpoint "break here" ".*break here.*" if {$threaded} { - gdb_test "info threads" "6.*5.*4.*3.*2.*1.*" "all threads started" + gdb_test "info threads" "1.*2.*3.*4.*5.*6.*" "all threads started" } # This kills and ensures no output other than the prompt comes out, diff --git a/gdb/testsuite/gdb.threads/linux-dp.exp b/gdb/testsuite/gdb.threads/linux-dp.exp index 7b5c706..6365f7d 100644 --- a/gdb/testsuite/gdb.threads/linux-dp.exp +++ b/gdb/testsuite/gdb.threads/linux-dp.exp @@ -168,7 +168,7 @@ set nthreads 6 gdb_breakpoint [gdb_get_line_number "linuxthreads.exp: info threads 2"] gdb_continue_to_breakpoint "main thread's sleep" set info_threads_ptn ".*" -for {set i $nthreads} {$i > 0} {incr i -1} { +for {set i 1} {$i < $nthreads} {incr i} { append info_threads_ptn "$i *Thread .*" } append info_threads_ptn "\[\r\n\]+$gdb_prompt $" diff --git a/gdb/testsuite/gdb.threads/multiple-step-overs.exp b/gdb/testsuite/gdb.threads/multiple-step-overs.exp index 6a38192..cf7728b 100644 --- a/gdb/testsuite/gdb.threads/multiple-step-overs.exp +++ b/gdb/testsuite/gdb.threads/multiple-step-overs.exp @@ -46,7 +46,7 @@ proc setup {} { gdb_breakpoint [gdb_get_line_number "set wait-threads breakpoint here"] gdb_continue_to_breakpoint "run to breakpoint" - gdb_test "info threads" "3 .* 2 .*\\\* 1.*" "info threads shows all threads" + gdb_test "info threads" "\\\* 1 .* 2 .* 3 .*" "info threads shows all threads" gdb_test_no_output "set scheduler-locking on" diff --git a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp index 25791be..4de3bf9 100644 --- a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp +++ b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp @@ -35,7 +35,7 @@ foreach schedlock {"off" "step" "on" } { gdb_breakpoint [gdb_get_line_number "set wait-thread breakpoint here"] gdb_continue_to_breakpoint "run to wait-thread breakpoint" - gdb_test "info threads" "2 .*\\\* 1.*" "info threads shows all threads" + gdb_test "info threads" "\\\* 1 .* 2 .*" "info threads shows all threads" delete_breakpoints diff --git a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp index 1354d03..4f5c05c 100644 --- a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp +++ b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp @@ -48,7 +48,7 @@ delete_breakpoints gdb_breakpoint [gdb_get_line_number "set breakpoint here"] gdb_continue_to_breakpoint "run to nop breakpoint" -gdb_test "info threads" "\\\* 2 .* 1.*" "info threads shows all threads" +gdb_test "info threads" " 1 .*\\\* 2 .*" "info threads shows all threads" gdb_test "next" "while.*" "next over nop" diff --git a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp index aa91e29..a7273d4 100644 --- a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp +++ b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp @@ -40,7 +40,7 @@ proc do_test {displaced command} { gdb_breakpoint [gdb_get_line_number "set wait-thread breakpoint here"] gdb_continue_to_breakpoint "run to wait-thread breakpoint" - gdb_test "info threads" "2 .*\\\* 1.*" "info threads shows all threads" + gdb_test "info threads" "\\\* 1 .* 2 .*" "info threads shows all threads" gdb_test_no_output "set scheduler-locking on" diff --git a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp index b0a7e4a..2f0be50 100644 --- a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp +++ b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp @@ -59,7 +59,7 @@ proc do_test { displaced with_bp } { gdb_breakpoint [gdb_get_line_number "set wait-thread breakpoint here"] gdb_continue_to_breakpoint "run to wait-thread breakpoint" - gdb_test "info threads" "2 .*\\\* 1.*" "info threads shows all threads" + gdb_test "info threads" "\\\* 1 .* 2 .*" "info threads shows all threads" gdb_test_no_output "set scheduler-locking on" diff --git a/gdb/testsuite/gdb.threads/thread-find.exp b/gdb/testsuite/gdb.threads/thread-find.exp index 57d58a2..bd90c57 100644 --- a/gdb/testsuite/gdb.threads/thread-find.exp +++ b/gdb/testsuite/gdb.threads/thread-find.exp @@ -55,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 $" { @@ -90,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 $" { @@ -125,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 $" { @@ -241,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 $" { @@ -286,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 $" { @@ -331,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 $" { @@ -378,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 $" { diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp index cd7fc0a..4d0a235 100644 --- a/gdb/testsuite/gdb.threads/tls.exp +++ b/gdb/testsuite/gdb.threads/tls.exp @@ -205,7 +205,7 @@ gdb_test "continue" ".*Breakpoint 3.*still alive.*" "continue to synch point" set no_of_threads 0 send_gdb "info thread\n" gdb_expect { - -re "^info thread\[ \t\r\n\]+ *Id .*Frame\[ \t\r\n\]+(\[0-9\]+) *Thread.*$gdb_prompt $" { + -re "^info thread\[ \t\r\n\]+ *Id .*Frame\[ \t\r\n\]+.*(\[0-9\]+) *Thread\[^\r\n\]+\r\n$gdb_prompt $" { set no_of_threads $expect_out(1,string) pass "get number of threads" } |