[patch] * server.c (start_inferior): Set last_ptid in --wrapper case.
Doug Evans
dje@google.com
Fri Dec 16 07:49:00 GMT 2011
Hi.
I was testing stdio gdbserver and was getting a failure in ext-run.exp.
gdbserver is started like this:
[without the --debug, that's just for illustration]
target extended-remote | /g3/gnu/sourceware/stdio-gdbserver/build/obj64/gdb/testsuite/../gdbserver/gdbserver --debug --once --multi --wrapper /bin/sh -c 'exec "$@" >/dev/null </dev/null' exec -- stdio
And I was seeing in this in the output:
[...]
linux_wait ret = LWP 30805.30805, 1, 5
Writing resume reply for <all threads>:1
Remote connection closed
[...]
gdbserver was crashing on a segv because last_ptid wasn't being set.
handle_v_run:
start_inferior (program_argv); <-- doesn't set last_ptid if --wrapper
if (last_status.kind == TARGET_WAITKIND_STOPPED)
{
prepare_resume_reply (own_buf, last_ptid, &last_status);
-->
prepare_resume_reply:
switch (status->kind)
{
case TARGET_WAITKIND_STOPPED:
...
current_inferior = find_thread_ptid (ptid);
and current_inferior is NULL at this point.
I will check this in in a few days if there are no objections.
2011-12-15 Doug Evans <dje@google.com>
* server.c (start_inferior): Set last_ptid in --wrapper case.
Index: gdbserver/server.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
retrieving revision 1.152
diff -u -p -r1.152 server.c
--- gdbserver/server.c 2 Dec 2011 22:26:53 -0000 1.152
+++ gdbserver/server.c 16 Dec 2011 00:38:11 -0000
@@ -285,7 +285,7 @@ start_inferior (char **argv)
resume_info.kind = resume_continue;
resume_info.sig = 0;
- mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
+ last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
if (last_status.kind != TARGET_WAITKIND_STOPPED)
return signal_pid;
@@ -294,7 +294,7 @@ start_inferior (char **argv)
{
(*the_target->resume) (&resume_info, 1);
- mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
+ last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
if (last_status.kind != TARGET_WAITKIND_STOPPED)
return signal_pid;
More information about the Gdb-patches
mailing list