diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2008-11-17 16:43:34 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2008-11-17 16:43:34 +0000 |
commit | 66bb093b5faddd76e3e307ce59024ac703e8b892 (patch) | |
tree | 4bcb5c077f25e10f7998756e24d2c2ff74891dd8 /gdb/testsuite | |
parent | 8dd4f202ecf146ae7746e10277ddebedc43f42d4 (diff) | |
download | gdb-66bb093b5faddd76e3e307ce59024ac703e8b892.zip gdb-66bb093b5faddd76e3e307ce59024ac703e8b892.tar.gz gdb-66bb093b5faddd76e3e307ce59024ac703e8b892.tar.bz2 |
Implement =thread-selected notification.
* mi/mi-common.h (struct mi_interp): New, moved from ...
* mi/mi-interp.c: ...here.
* mi/mi-main.c (mi_execute_command): If the thread changed
as result of command, report that.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-pthreads.exp | 6 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 13 |
3 files changed, 23 insertions, 4 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1c66e08..58b2a2a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,13 @@ 2008-11-17 Vladimir Prus <vladimir@codesourcery.com> + * gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Make sure + "thread N" results in =thread-selected. + * lib/mi-support (mi_run_cmd, mi_expect_stop) + (mi_send_resuming_command_raw): Be prepared for + =thread-selected. + +2008-11-17 Vladimir Prus <vladimir@codesourcery.com> + * gdb.mi/mi-nonstop.exp: Expect 'group-id' field. * lib/mi-support.exp: Likewise. diff --git a/gdb/testsuite/gdb.mi/mi-pthreads.exp b/gdb/testsuite/gdb.mi/mi-pthreads.exp index dbb3ece..0ab5715 100644 --- a/gdb/testsuite/gdb.mi/mi-pthreads.exp +++ b/gdb/testsuite/gdb.mi/mi-pthreads.exp @@ -55,6 +55,12 @@ proc check_mi_thread_command_set {} { "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \ "check_mi_thread_command_set: -thread-select $thread" } + + foreach thread $thread_list { + mi_gdb_test "-interpreter-exec console \"thread $thread\"" \ + ".*\\^done\r\n=thread-selected,id=\"$thread\"" \ + "check =thread-selected: thread $thread" + } } # diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 39db896..56c1b9f 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -30,6 +30,8 @@ global mi_inferior_tty_name set MIFLAGS "-i=mi" +set thread_selected_re "=thread-selected,id=\"\[0-9+\]\"\r\n" + # # mi_gdb_exit -- exit the GDB, killing the target program if necessary # @@ -775,6 +777,7 @@ proc mi_run_cmd {args} { return -1 } global mi_gdb_prompt + global thread_selected_re if [target_info exists gdb_init_command] { send_gdb "[target_info gdb_init_command]\n"; @@ -816,7 +819,7 @@ proc mi_run_cmd {args} { send_gdb "220-exec-run $args\n" gdb_expect { - -re "220\\^running\r\n(\\*running,thread-id=\"\[^\"\]+\"\r\n|=thread-created,id=\"1\",group-id=\"\[0-9\]+\"\r\n)*${mi_gdb_prompt}" { + -re "220\\^running\r\n(\\*running,thread-id=\"\[^\"\]+\"\r\n|=thread-created,id=\"1\",group-id=\"\[0-9\]+\"\r\n)*(${thread_selected_re})?${mi_gdb_prompt}" { } timeout { perror "Unable to start target" @@ -954,6 +957,7 @@ proc mi_expect_stop { reason func args file line extra test } { global decimal global fullname_syntax global async + global thread_selected_re set after_stopped "" set after_reason "" @@ -1014,9 +1018,9 @@ proc mi_expect_stop { reason func args file line extra test } { set any "\[^\n\]*" - verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}thread-id=\"$decimal\",stopped-threads=$any,frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}\r\n$after_stopped$prompt_re" + verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}thread-id=\"$decimal\",stopped-threads=$any,frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped\r\n($thread_selected_re)?$prompt_re" gdb_expect { - -re "\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",stopped-threads=$any,frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped\r\n$prompt_re" { + -re "\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",stopped-threads=$any,frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped\r\n($thread_selected_re)?$prompt_re" { pass "$test" return $expect_out(2,string) } @@ -1430,10 +1434,11 @@ proc mi_tbreak {location} { proc mi_send_resuming_command_raw {command test} { global mi_gdb_prompt + global thread_selected_re send_gdb "$command\n" gdb_expect { - -re "\\^running\r\n\\*running,thread-id=\"\[^\"\]+\"\r\n${mi_gdb_prompt}" { + -re "\\^running\r\n\\*running,thread-id=\"\[^\"\]+\"\r\n($thread_selected_re)?${mi_gdb_prompt}" { # Note that lack of 'pass' call here -- this works around limitation # in DejaGNU xfail mechanism. mi-until.exp has this: # |