NPL: Clean up handling of inferior exit
authorPavel Labath <labath@google.com>
Mon, 18 Dec 2017 09:44:29 +0000 (09:44 +0000)
committerPavel Labath <labath@google.com>
Mon, 18 Dec 2017 09:44:29 +0000 (09:44 +0000)
commitd8b3c1a1350d1b1b0604bc9bc384da9c7d6ad28a
tree27537c74981f8039d76e3f395ceefca635a3a6b8
parent6f42de3062e797e3a2e71c4c8444f0922b6a09b1
NPL: Clean up handling of inferior exit

Summary:
lldb-server was sending the "exit" packet (W??) twice. This happened
because it was handling both the pre-exit (PTRACE_EVENT_EXIT) and
post-exit (WIFEXITED) as exit events. We had some code which was trying
to detect when we've already sent the exit packet, but this stopped
working quite a while ago.

This never really caused any problems in practice because the client
automatically closes the connection after receiving the first packet, so
the only effect of this was some warning messages about extra packets
from the lldb-server test suite, which were ignored because they didn't
fail the test.

The new test suite will be stricter about this, so I fix this issue
ignoring the first event. I think this is the correct behavior, as the
inferior is not really dead at that point, so it's premature to send the
exit packet.

There isn't an actual test yet which would verify the exit behavior, but
in my next patch I will add a test which will also test this
functionality.

Reviewers: eugene

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D41069

llvm-svn: 320961
lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/unittests/tools/lldb-server/tests/TestClient.cpp