Re: [commit+7.6] [patch+7.6] Fix 7.5 regression crashing GDB if gdbserver dies

Yao Qi
2013-04-02T03:58:15Z

On 03/23/2013 04:42 AM, Jan Kratochvil wrote:
> +set server_pid [exp_pid -i [board_info target fileid]]
> +remote_exec target "kill -9 $server_pid"
> +
> +gdb_test "step" "Remote connection closed"

Jan,
I got a fail in this test (on Lucid x86_64),

Executing on native-gdbserver: kill -9 31336 {} {} {} (timeout = 300)
spawn -ignore SIGHUP kill -9 31336 ^M
kill: : invalid process id^M
kill: : invalid process id^M
kill: : invalid process id^M
step^M
Cannot find bounds of current function
(gdb) FAIL: gdb.server/server-kill.exp: step

The GDB's output of command 'step' is unexpected but looks reasonable
to me. What we want to check here is GDB gets "connection closed" when
GDBserver died, so any commands which talk with GDBserver should be
qualified. I choose 'tstaus' here, because it simply talks with
GDBserver to get trace status, and don't involve other factors into
it. Note that we can use 'stepi' here, but I think 'tstatus' is simpler
than it, so I choose 'tstatus' in the test finally.

This patch fixes the fail I saw. Is it OK for mainline and 7.6?

--
Yao (é½å°§)

gdb/testsuite:

2013-04-02 Yao Qi <yao@codesourcery.com>

* gdb.server/server-kill.exp: Use command 'tstatus' instead of
'step'.
---
gdb/testsuite/gdb.server/server-kill.exp | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp
index 45a2a89..1b48152 100644
--- a/gdb/testsuite/gdb.server/server-kill.exp
+++ b/gdb/testsuite/gdb.server/server-kill.exp
@@ -40,4 +40,6 @@ delete_breakpoints
set server_pid [exp_pid -i [board_info target fileid]]
remote_exec target "kill -9 $server_pid"

-gdb_test "step" "Remote connection closed"
+# Force GDB to talk with GDBserver, so that we can get the
+# "connection closed" error.
+gdb_test "tstatus" "Remote connection closed"
--
1.7.7.6