From: Yao Qi <qiyaoltc@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: Yao Qi <qiyaoltc@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 4/6] testsuite: Don't use expect_background to reap gdbserver
Date: Mon, 13 Apr 2015 14:20:00 -0000 [thread overview]
Message-ID: <86zj6ct8hz.fsf@gmail.com> (raw)
In-Reply-To: <552BC9FC.2020201@redhat.com> (Pedro Alves's message of "Mon, 13 Apr 2015 14:51:56 +0100")
Pedro Alves <palves@redhat.com> writes:
>> looks we can't prevent DejaGNU invoking send_user.
>
> I think we should just call raw "expect" instead then.
Using "expect" is OK to me, how about the patch below?
--
Yao (齐尧)
From: Yao Qi <yao.qi@linaro.org>
Date: Mon, 13 Apr 2015 12:36:56 +0100
Subject: [PATCH] Catch exception in lib/gdbserver-support.exp:gdb_exit
I see the error when I run gdb-sigterm.exp with native-gdbserver
on x86_64-linux.
infrun: prepare_to_wait^M
Cannot execute this command while the target is running.^M
Use the "interrupt" command to stop the target^M
and then try again.^M
gdb.base/gdb-sigterm.exp: expect eof #0: got eof
gdb.base/gdb-sigterm.exp: expect eof #0: stepped 12 times
ERROR OCCURED: : spawn id exp8 not open
while executing
"expect {
-i exp8 -timeout 10
-re "$gdb_prompt $" {
exp_continue
}
-i "$server_spawn_id" eof {
wait -i $expect_out(spawn_id)
unse..."
("uplevel" body line 1)
invoked from within
In gdb-sigterm.exp, SIGTERM is sent to GDB and it exits. However,
Dejagnu or tcl doesn't know this.
This patch is to catch the exception, but error messages are still
shown in the console and gdb.log. In order to avoid this, we also
replace gdb_expect with expect.
gdb/testsuite:
2015-04-13 Yao Qi <yao.qi@linaro.org>
* lib/gdbserver-support.exp (gdb_exit): Catch exception
and use expect instead of gdb_expect.
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index 53843b8..b3140c2 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -353,15 +353,23 @@ proc gdb_exit {} {
global gdb_prompt
if {[info exists gdb_spawn_id] && [info exists server_spawn_id]} {
- send_gdb "monitor exit\n";
- gdb_expect {
- -re "$gdb_prompt $" {
- exp_continue
- }
- -i "$server_spawn_id" eof {
- wait -i $expect_out(spawn_id)
- unset server_spawn_id
- unset inferior_spawn_id
+ # GDB may be terminated in an expected way or an unexpected way,
+ # but DejaGNU doesn't know that, so gdb_spawn_id isn't unset.
+ # Catch the exceptions.
+ catch {
+ send_gdb "monitor exit\n";
+ # We use expect rather than gdb_expect because
+ # we want to suppress printing exception messages, otherwise,
+ # remote_expect, invoked by gdb_expect, prints the exceptions.
+ expect {
+ -i "$gdb_spawn_id" -re "$gdb_prompt $" {
+ exp_continue
+ }
+ -i "$server_spawn_id" eof {
+ wait -i $expect_out(spawn_id)
+ unset server_spawn_id
+ unset inferior_spawn_id
+ }
}
}
}
next prev parent reply other threads:[~2015-04-13 14:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-23 13:54 [PATCH 0/6] Introduce $inferior_spawn_id, make interrupt.exp work with GDBserver Pedro Alves
2015-02-23 13:54 ` [PATCH 1/6] gdb.base/interrupt.exp: Fix race Pedro Alves
2015-02-23 13:54 ` [PATCH 3/6] gdb_test_multiple: Fix user code argument processing Pedro Alves
2015-02-23 13:54 ` [PATCH 4/6] testsuite: Don't use expect_background to reap gdbserver Pedro Alves
2015-04-13 11:42 ` Yao Qi
2015-04-13 12:09 ` Pedro Alves
2015-04-13 13:25 ` Yao Qi
2015-04-13 13:52 ` Pedro Alves
2015-04-13 14:20 ` Yao Qi [this message]
2015-04-13 14:22 ` Pedro Alves
2015-04-13 14:48 ` Yao Qi
2015-02-23 13:54 ` [PATCH 6/6] gdb.base/interrupt.exp: Use send_inferior/$inferior_spawn_id Pedro Alves
2015-02-23 13:54 ` [PATCH 2/6] gdb.base/interrupt.exp: Use gdb_test_multiple instead of gdb_expect Pedro Alves
2015-02-23 14:28 ` [PATCH 5/6] testsuite: Introduce $inferior_spawn_id Pedro Alves
2015-02-24 16:31 ` Yao Qi
2015-02-27 10:42 ` Pedro Alves
2015-02-27 10:59 ` Pedro Alves
2015-02-27 11:01 ` Pedro Alves
2015-02-27 12:12 ` Yao Qi
2015-02-27 13:59 ` [pushed] Add "../lib/unbuffer_output.c" and use it in gdb.base/interrupt.c (Re: [PATCH 5/6] testsuite: Introduce $inferior_spawn_id) Pedro Alves
2015-02-27 14:13 ` Yao Qi
2015-02-27 14:42 ` Eli Zaretskii
2015-02-27 14:47 ` Pedro Alves
2015-02-27 12:08 ` [PATCH 5/6] testsuite: Introduce $inferior_spawn_id Yao Qi
2015-02-27 12:30 ` Pedro Alves
2015-04-16 16:55 ` Antoine Tremblay
2015-04-16 17:14 ` Pedro Alves
2015-04-21 18:25 ` Pedro Alves
2015-04-21 18:32 ` Antoine Tremblay
2015-04-07 17:31 ` [PATCH 0/6] Introduce $inferior_spawn_id, make interrupt.exp work with GDBserver Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86zj6ct8hz.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox