This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/22821] New: gdbserver resets connection on a failed vRun and causes gdb to crash


https://sourceware.org/bugzilla/show_bug.cgi?id=22821

            Bug ID: 22821
           Summary: gdbserver resets connection on a failed vRun and
                    causes gdb to crash
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: ramiro@hex-rays.com
  Target Milestone: ---

If gdbserver fails to run a file, it will reset the remote connection. gdb will
be unaware of this reset and will likely crash on the next command.


For example:
$ gdb
(gdb) target extended-remote <target>:23946
Remote debugging using <target>:23946
(gdb) set remote exec-file foo
(gdb) r
Starting program:  
Running "foo" on the remote target failed
(gdb) r
Starting program:  
Unknown remote qXfer reply: OK
/build/gdb-A87voC/gdb-7.12/gdb/thread.c:982: internal-error: int
is_thread_state(ptid_t, thread_state): Assertion `tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.


And on the remote:
$ ./gdb/gdbserver/gdbserver --multi 0.0.0.0:23946
Listening on port 23946
Remote debugging from host <host>
/bin/bash: line 0: exec: foo: not found
gdbserver: During startup program exited with code 127.
Listening on port 23946
readchar: Connection reset by peer


Apparently gdbserver will now call error() on a failed run [in
gdb/nat/fork-inferior.c, startup_inferior(), case TARGET_WAITKIND_EXITED],
which will cause the reset, going back to "Listening on port ...". Even
noack_mode is reset, which messes up gdb communication (which is no longer
expecting acks).


I'll attach some logs to this bug report.


I have traced the bug back to the following commit:

commit 2090129c36c7e582943b7d300968d19b46160d84
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Thu Dec 22 21:11:11 2016 -0500

    Share fork_inferior et al with gdbserver

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]