This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 13/17] btrace: non-stop
- From: Pedro Alves <palves at redhat dot com>
- To: Markus Metzger <markus dot t dot metzger at intel dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 09 Sep 2015 12:54:20 +0100
- Subject: Re: [PATCH 13/17] btrace: non-stop
- Authentication-results: sourceware.org; auth=none
- References: <1441794909-32718-1-git-send-email-markus dot t dot metzger at intel dot com> <1441794909-32718-14-git-send-email-markus dot t dot metzger at intel dot com>
On 09/09/2015 11:35 AM, Markus Metzger wrote:
> +# make sure $line matches the full expected output per thread.
> +# and let's hope that GDB never mixes the output from different threads.
> +#
> +# this is quite fragile, mostly because the prompt appears somewhere in
> +# the middle of the output.
> +proc gdb_cont_to { threads cmd line nthreads } {
> + global gdb_prompt
> + set full_cmd "thread apply $threads $cmd"
> + set prompt_seen 0
> +
> + send_gdb "$full_cmd\n"
> +
> + for {set i 0} {$i < $nthreads} {incr i} {
> + set test "$full_cmd: thread $i"
> +
> + # check for the prompt. it may be in front of one of the lines we
> + # try to match.
> + gdb_test_multiple "" "$test: check prompt" {
> + -notransfer -re "$gdb_prompt " {
> + set prompt_seen 1
> + }
> + }
> +
Hmmm. I'm not sure I'm missing some subtlety, but it seems to me
that if you used -notransfer, then the prompt will still be in the buffer,
and ...
> + # check for the line. and for a typical error.
> + gdb_test_multiple "" $test {
> + -re "Cannot execute this command \[^\\\r\\\n\]* is running\." {
> + fail $test
> + }
> + -re "$line\[^\\\r\\\n\]*\r\n" {
> + pass $test
> + }
> + }
... thus this gdb_test_multiple can trip on it and issue a fail.
Wouldn't this instead work?
gdb_test_multiple "" $test {
-re "Cannot execute this command \[^\\\r\\\n\]* is running\." {
fail $test
}
-re "$line\[^\\\r\\\n\]*\r\n" {
pass $test
}
-re "$gdb_prompt " {
set prompt_seen 1
exp_continue
}
}
Thanks,
Pedro Alves