summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.mi/mi-pthreads.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.mi/mi-pthreads.exp')
-rw-r--r--gdb/testsuite/gdb.mi/mi-pthreads.exp68
1 files changed, 28 insertions, 40 deletions
diff --git a/gdb/testsuite/gdb.mi/mi-pthreads.exp b/gdb/testsuite/gdb.mi/mi-pthreads.exp
index 8fc5061c803..532134acc04 100644
--- a/gdb/testsuite/gdb.mi/mi-pthreads.exp
+++ b/gdb/testsuite/gdb.mi/mi-pthreads.exp
@@ -17,11 +17,11 @@
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
-# This file tests that GDB's console can be accessed via the MI.
-# Specifically, we are testing the "interpreter-exec" command and that
-# the commands that are executed via this command are properly executed.
-# Console commands executed via MI should use MI output wrappers, MI event
-# handlers, etc.
+# This file tests MI thread commands.
+# Specifically, we are testing the MI command set and the console (in MI)
+# command set ("interpreter-exec") and that the commands that are executed
+# via these command pathways are properly executed. Console commands
+# executed via MI should use MI output wrappers, MI event handlers, etc.
# This only works with native configurations
if {![isnative]} {
@@ -36,6 +36,10 @@ if {[mi_gdb_start]} {
continue
}
+# The procs below dealing with parsing cli/mi output for the threadlist
+# is duplicated in gdb669.exp. Any changes here will probably need to
+# be made there as well.
+
proc get_mi_thread_list {name} {
global expect_out
@@ -45,11 +49,16 @@ proc get_mi_thread_list {name} {
# ^done,thread-ids=[thread-id="1",thread-id="2",...],number-of-threads="N"
# (gdb)
mi_gdb_test "-thread-list-ids" \
- {\^done,thread-ids=\{(thread-id="[0-9]+"(,)*)+\},number-of-threads="[0-9]+"} \
+ {\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \
"-thread_list_ids ($name)"
+ set output {}
+ if {[info exists expect_out(buffer)]} {
+ set output $expect_out(buffer)
+ }
+
set thread_list {}
- if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $expect_out(buffer) threads]} {
+ if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $output threads]} {
fail "finding threads in MI output ($name)"
} else {
pass "finding threads in MI output ($name)"
@@ -74,9 +83,12 @@ proc check_mi_and_console_threads {name} {
global expect_out
mi_gdb_test "-thread-list-ids" \
- {\^done,thread-ids=\{(thread-id="[0-9]+"(,)*)+\},number-of-threads="[0-9]+"} \
+ {\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \
"-thread-list-ids ($name)"
- set mi_output $expect_out(buffer)
+ set mi_output {}
+ if {[info exists expect_out(buffer)]} {
+ set mi_output $expect_out(buffer)
+ }
# GDB will return a list of thread ids and some more info:
#
@@ -86,10 +98,14 @@ proc check_mi_and_console_threads {name} {
# ~" 3 Thread 1026 (LWP 7733) () at __libc_nanosleep:-1"
# ~" 2 Thread 2049 (LWP 7732) 0x401411f8 in __poll (fds=0x804bb24, nfds=1, timeout=2000) at ../sysdeps/unix/sysv/linux/poll.c:63"
# ~"* 1 Thread 1024 (LWP 7731) main (argc=1, argv=0xbfffdd94) at ../../../src/gdb/testsuite/gdb.mi/pthreads.c:160"
- mi_gdb_test {-interpreter-exec console "info threads"} \
+ # FIXME: kseitz/2002-09-05: Don't use the hack-cli method.
+ mi_gdb_test "info threads" \
{.*(~".*"[\r\n]*)+.*} \
"info threads ($name)"
- set console_output $expect_out(buffer)
+ set console_output {}
+ if {[info exists $expect_out(buffer)]} {
+ set console_output $expect_out(buffer)
+ }
# Make a list of all known threads to console (gdb's thread IDs)
set console_thread_list {}
@@ -159,19 +175,6 @@ proc check_mi_and_console_threads {name} {
}
}
-# This procedure checks for the bug gdb/669, where the console
-# command "info threads" and the MI command "-thread-list-ids"
-# return different threads in the system.
-proc check_for_gdb669_bug {} {
- mi_run_to_main
- check_mi_and_console_threads "at main"
-
- for {set i 0} {$i < 4} {incr i} {
- mi_next "next, try $i"
- check_mi_and_console_threads "try $i"
- }
-}
-
# This procedure tests the various thread commands in MI.
proc check_mi_thread_command_set {} {
@@ -192,24 +195,11 @@ proc check_mi_thread_command_set {} {
# many of the threads are blocked in libc calls,
# and many people have libc's with no symbols.
mi_gdb_test "-thread-select $thread" \
- "=context-changed,thread=\"$thread\"\r\n\\^done,new-thread-id=\"$thread\",frame={.*},line=\"(-)?\[0-9\]+\",file=\".*\"" \
+ "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \
"check_mi_thread_command_set: -thread-select $thread"
}
}
-# This procedure checks that the console and MI don't get out
-# of sync with each other.
-proc check_console_thread_commands {} {
-
- # Assumed that we're at done_making_threads
- set thread_list [get_mi_thread_list "in check_console_thread_commands"]
- foreach thread $thread_list {
- mi_gdb_test "-interpreter-exec console \"thread $thread\"" \
- "(\\~\".*\"\r\n)*=context-changed,thread=\"$thread\"\r\n\\^done" \
- "-interpreter-exec console \"thread $thread\""
- }
-}
-
#
# Start here
#
@@ -226,8 +216,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load $binfile
check_mi_thread_command_set
-check_console_thread_commands
-check_for_gdb669_bug
mi_gdb_exit