llgs: Propagate the environment when launching the inferior from command line
authorPavel Labath <labath@google.com>
Mon, 18 Dec 2017 14:31:39 +0000 (14:31 +0000)
committerPavel Labath <labath@google.com>
Mon, 18 Dec 2017 14:31:39 +0000 (14:31 +0000)
commit11e5917d2aecff32546644e91132f8efb565b4c9
tree307da454cc4de73ee6af09e2b6a10badf4067e81
parent1acab00229576cdb8ba5972d3794dfcc76282c08
llgs: Propagate the environment when launching the inferior from command line

Summary:
We were failing to propagate the environment when lldb-server was
started with a pre-loaded process
(e.g.: lldb-server gdbserver -- inferior --inferior_args)

This patch makes sure the environment is propagated. Instead of adding a
new GDBRemoteCommunicationServerLLGS::SetLaunchEnvironment function to
complement SetLaunchArgs and SetLaunchFlags, I replace these with a
more generic SetLaunchInfo, which can be used to set any launch-related
property.

The accompanying test also verifies that the server correctly terminates
the connection after sending the exit packet (specifically, that it does
not send the exit packet twice).

Reviewers: clayborg, eugene

Subscribers: lldb-commits, mgorny

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

llvm-svn: 320984
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
lldb/tools/lldb-server/lldb-gdbserver.cpp
lldb/unittests/tools/lldb-server/CMakeLists.txt
lldb/unittests/tools/lldb-server/inferior/environment_check.cpp [new file with mode: 0644]
lldb/unittests/tools/lldb-server/tests/CMakeLists.txt
lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp [new file with mode: 0644]
lldb/unittests/tools/lldb-server/tests/TestClient.cpp