From eef758e949cca34488d4e8392f97c19aa328cdf7 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 4 Feb 2019 14:28:08 +0000 Subject: [PATCH] Move FileAction, ProcessInfo and ProcessLaunchInfo from Target to Host Summary: These classes describe the details of the process we are about to launch, and so they are naturally used by the launching code in the Host module. Previously they were present in Target because that is the most important (but by far not the only) user of the launching code. Since the launching code has other customers, must of which do not care about Targets, it makes sense to move these classes to the Host layer, next to the launching code. This move reduces the number of times that Target is included from host to 8 (it used to be 14). Reviewers: zturner, clayborg, jingham, davide, teemperor Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D56602 llvm-svn: 353047 --- .../lldb/{Target => Host}/FileAction.h | 4 +-- .../lldb/{Target => Host}/ProcessInfo.h | 0 .../lldb/{Target => Host}/ProcessLaunchInfo.h | 4 +-- lldb/include/lldb/Target/Process.h | 4 +-- lldb/include/lldb/Target/Target.h | 2 +- lldb/include/lldb/module.modulemap | 3 ++ lldb/source/API/SBLaunchInfo.cpp | 2 +- lldb/source/Host/CMakeLists.txt | 3 ++ .../{Target => Host/common}/FileAction.cpp | 2 +- lldb/source/Host/common/Host.cpp | 4 +-- .../Host/common/MonitoringProcessLauncher.cpp | 2 +- .../{Target => Host/common}/ProcessInfo.cpp | 2 +- .../common}/ProcessLaunchInfo.cpp | 4 +-- lldb/source/Host/macosx/objcxx/Host.mm | 2 +- .../Host/posix/ProcessLauncherPosixFork.cpp | 2 +- .../Host/windows/ProcessLauncherWindows.cpp | 2 +- ...latformiOSSimulatorCoreSimulatorSupport.mm | 2 +- .../Plugins/Platform/POSIX/PlatformPOSIX.cpp | 3 +- .../Process/Linux/NativeProcessLinux.cpp | 2 +- .../GDBRemoteCommunicationServerCommon.cpp | 2 +- .../GDBRemoteCommunicationServerLLGS.cpp | 2 +- .../GDBRemoteCommunicationServerPlatform.cpp | 2 +- lldb/source/Target/CMakeLists.txt | 3 -- lldb/unittests/Host/CMakeLists.txt | 3 ++ lldb/unittests/Host/FileActionTest.cpp | 20 +++++++++++++ lldb/unittests/Host/ProcessInfoTest.cpp | 20 +++++++++++++ lldb/unittests/Host/ProcessLaunchInfoTest.cpp | 28 +++++++++++++++++++ .../tools/lldb-server/tests/TestClient.cpp | 1 - .../tools/lldb-server/tests/TestClient.h | 2 +- 29 files changed, 102 insertions(+), 30 deletions(-) rename lldb/include/lldb/{Target => Host}/FileAction.h (94%) rename lldb/include/lldb/{Target => Host}/ProcessInfo.h (100%) rename lldb/include/lldb/{Target => Host}/ProcessLaunchInfo.h (98%) rename lldb/source/{Target => Host/common}/FileAction.cpp (98%) rename lldb/source/{Target => Host/common}/ProcessInfo.cpp (98%) rename lldb/source/{Target => Host/common}/ProcessLaunchInfo.cpp (99%) create mode 100644 lldb/unittests/Host/FileActionTest.cpp create mode 100644 lldb/unittests/Host/ProcessInfoTest.cpp create mode 100644 lldb/unittests/Host/ProcessLaunchInfoTest.cpp diff --git a/lldb/include/lldb/Target/FileAction.h b/lldb/include/lldb/Host/FileAction.h similarity index 94% rename from lldb/include/lldb/Target/FileAction.h rename to lldb/include/lldb/Host/FileAction.h index fc5abb19a4cb..4d333bb327a5 100644 --- a/lldb/include/lldb/Target/FileAction.h +++ b/lldb/include/lldb/Host/FileAction.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_Target_FileAction_h -#define liblldb_Target_FileAction_h +#ifndef LLDB_HOST_FILEACTION_H +#define LLDB_HOST_FILEACTION_H #include "lldb/Utility/FileSpec.h" #include diff --git a/lldb/include/lldb/Target/ProcessInfo.h b/lldb/include/lldb/Host/ProcessInfo.h similarity index 100% rename from lldb/include/lldb/Target/ProcessInfo.h rename to lldb/include/lldb/Host/ProcessInfo.h diff --git a/lldb/include/lldb/Target/ProcessLaunchInfo.h b/lldb/include/lldb/Host/ProcessLaunchInfo.h similarity index 98% rename from lldb/include/lldb/Target/ProcessLaunchInfo.h rename to lldb/include/lldb/Host/ProcessLaunchInfo.h index 87ebe336887c..6c1419a792ca 100644 --- a/lldb/include/lldb/Target/ProcessLaunchInfo.h +++ b/lldb/include/lldb/Host/ProcessLaunchInfo.h @@ -15,10 +15,10 @@ // LLDB Headers #include "lldb/Utility/Flags.h" +#include "lldb/Host/FileAction.h" #include "lldb/Host/Host.h" +#include "lldb/Host/ProcessInfo.h" #include "lldb/Host/PseudoTerminal.h" -#include "lldb/Target/FileAction.h" -#include "lldb/Target/ProcessInfo.h" #include "lldb/Utility/FileSpec.h" namespace lldb_private { diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 0be1548f477f..9d46485220ba 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -28,14 +28,14 @@ #include "lldb/Core/ThreadSafeValue.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Host/HostThread.h" +#include "lldb/Host/ProcessInfo.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Host/ProcessRunLock.h" #include "lldb/Interpreter/Options.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/InstrumentationRuntime.h" #include "lldb/Target/Memory.h" -#include "lldb/Target/ProcessInfo.h" -#include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/QueueList.h" #include "lldb/Target/ThreadList.h" #include "lldb/Utility/ArchSpec.h" diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index f86a2625709a..adc479574d97 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -23,10 +23,10 @@ #include "lldb/Core/ModuleList.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Expression/Expression.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/PathMappingList.h" -#include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/SectionLoadHistory.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/Broadcaster.h" diff --git a/lldb/include/lldb/module.modulemap b/lldb/include/lldb/module.modulemap index 9c7f3e6f58e5..922a4495cdbd 100644 --- a/lldb/include/lldb/module.modulemap +++ b/lldb/include/lldb/module.modulemap @@ -17,6 +17,7 @@ module lldb_Host { module Editline { header "Host/Editline.h" export * } module FileCache { header "Host/FileCache.h" export * } module File { header "Host/File.h" export * } + module FileAction { header "Host/FileAction.h" export * } module FileSystem { header "Host/FileSystem.h" export * } module HostGetOpt { header "Host/HostGetOpt.h" export * } module Host { header "Host/Host.h" export * } @@ -38,7 +39,9 @@ module lldb_Host { module PipeBase { header "Host/PipeBase.h" export * } module Pipe { header "Host/Pipe.h" export * } module PosixApi { header "Host/PosixApi.h" export * } + module ProcessInfo { header "Host/ProcessInfo.h" export * } module ProcessLauncher { header "Host/ProcessLauncher.h" export * } + module ProcessLaunchInfo { header "Host/ProcessLaunchInfo.h" export * } module ProcessRunLock { header "Host/ProcessRunLock.h" export * } module PseudoTerminal { header "Host/PseudoTerminal.h" export * } module SafeMachO { header "Host/SafeMachO.h" export * } diff --git a/lldb/source/API/SBLaunchInfo.cpp b/lldb/source/API/SBLaunchInfo.cpp index 1063f55598c6..3d27887081d4 100644 --- a/lldb/source/API/SBLaunchInfo.cpp +++ b/lldb/source/API/SBLaunchInfo.cpp @@ -10,7 +10,7 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBListener.h" -#include "lldb/Target/ProcessLaunchInfo.h" +#include "lldb/Host/ProcessLaunchInfo.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt index 333f109a9a26..0ae241d4421b 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -19,6 +19,7 @@ endmacro() add_host_subdirectory(common common/File.cpp + common/FileAction.cpp common/FileCache.cpp common/FileSystem.cpp common/GetOptInc.cpp @@ -36,6 +37,8 @@ add_host_subdirectory(common common/NativeThreadProtocol.cpp common/OptionParser.cpp common/PipeBase.cpp + common/ProcessInfo.cpp + common/ProcessLaunchInfo.cpp common/ProcessRunLock.cpp common/PseudoTerminal.cpp common/Socket.cpp diff --git a/lldb/source/Target/FileAction.cpp b/lldb/source/Host/common/FileAction.cpp similarity index 98% rename from lldb/source/Target/FileAction.cpp rename to lldb/source/Host/common/FileAction.cpp index c8c0af0ac382..97367049abbd 100644 --- a/lldb/source/Target/FileAction.cpp +++ b/lldb/source/Host/common/FileAction.cpp @@ -8,8 +8,8 @@ #include +#include "lldb/Host/FileAction.h" #include "lldb/Host/PosixApi.h" -#include "lldb/Target/FileAction.h" #include "lldb/Utility/Stream.h" using namespace lldb_private; diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 4e9b3ac2d403..acdb92d49939 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -46,16 +46,16 @@ #include +#include "lldb/Host/FileAction.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/HostProcess.h" #include "lldb/Host/MonitoringProcessLauncher.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Host/ProcessLauncher.h" #include "lldb/Host/ThreadLauncher.h" #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h" -#include "lldb/Target/FileAction.h" -#include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/FileSpec.h" diff --git a/lldb/source/Host/common/MonitoringProcessLauncher.cpp b/lldb/source/Host/common/MonitoringProcessLauncher.cpp index 285182a82cb2..2ee69353e19a 100644 --- a/lldb/source/Host/common/MonitoringProcessLauncher.cpp +++ b/lldb/source/Host/common/MonitoringProcessLauncher.cpp @@ -9,7 +9,7 @@ #include "lldb/Host/MonitoringProcessLauncher.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostProcess.h" -#include "lldb/Target/ProcessLaunchInfo.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Utility/Log.h" #include "llvm/Support/FileSystem.h" diff --git a/lldb/source/Target/ProcessInfo.cpp b/lldb/source/Host/common/ProcessInfo.cpp similarity index 98% rename from lldb/source/Target/ProcessInfo.cpp rename to lldb/source/Host/common/ProcessInfo.cpp index 65aec34d0b4b..76f521bebb51 100644 --- a/lldb/source/Target/ProcessInfo.cpp +++ b/lldb/source/Host/common/ProcessInfo.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Target/ProcessInfo.h" +#include "lldb/Host/ProcessInfo.h" #include diff --git a/lldb/source/Target/ProcessLaunchInfo.cpp b/lldb/source/Host/common/ProcessLaunchInfo.cpp similarity index 99% rename from lldb/source/Target/ProcessLaunchInfo.cpp rename to lldb/source/Host/common/ProcessLaunchInfo.cpp index f9d0b78caccc..443f00e65af4 100644 --- a/lldb/source/Target/ProcessLaunchInfo.cpp +++ b/lldb/source/Host/common/ProcessLaunchInfo.cpp @@ -9,10 +9,10 @@ #include #include "lldb/Host/Config.h" +#include "lldb/Host/FileAction.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Target/FileAction.h" -#include "lldb/Target/ProcessLaunchInfo.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index 3ebfc0c53c48..94a0a5b25b92 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -56,9 +56,9 @@ #include "lldb/Host/ConnectionFileDescriptor.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Host/ThreadLauncher.h" #include "lldb/Target/Process.h" -#include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/CleanUp.h" #include "lldb/Utility/DataBufferHeap.h" diff --git a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp index bc1ac78f6991..3edb4861a2fa 100644 --- a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp +++ b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp @@ -10,7 +10,7 @@ #include "lldb/Host/Host.h" #include "lldb/Host/HostProcess.h" #include "lldb/Host/Pipe.h" -#include "lldb/Target/ProcessLaunchInfo.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" #include "llvm/Support/Errno.h" diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp index b66dff9d11d6..2f540547c7c3 100644 --- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp +++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp @@ -8,7 +8,7 @@ #include "lldb/Host/windows/ProcessLauncherWindows.h" #include "lldb/Host/HostProcess.h" -#include "lldb/Target/ProcessLaunchInfo.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/ConvertUTF.h" diff --git a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm index a172c9d70674..ed18a1cb7569 100644 --- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm @@ -16,7 +16,7 @@ #include // Project includes #include "lldb/Host/PseudoTerminal.h" -#include "lldb/Target/FileAction.h" +#include "lldb/Host/FileAction.h" #include "llvm/ADT/StringRef.h" diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index a28a73230e2a..27fd07478296 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -8,7 +8,6 @@ #include "PlatformPOSIX.h" - #include "lldb/Core/Debugger.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" @@ -22,11 +21,11 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" -#include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/CleanUp.h" #include "lldb/Utility/DataBufferHeap.h" diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 422fdeb59a11..5f41b43ae374 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -23,6 +23,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostProcess.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Host/PseudoTerminal.h" #include "lldb/Host/ThreadLauncher.h" #include "lldb/Host/common/NativeRegisterContext.h" @@ -31,7 +32,6 @@ #include "lldb/Host/posix/ProcessLauncherPosixFork.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Process.h" -#include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/Target.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/RegisterValue.h" diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index 276ca65e8627..af5e66c22db2 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -21,13 +21,13 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Host/Config.h" #include "lldb/Host/File.h" +#include "lldb/Host/FileAction.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/SafeMachO.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Symbol/ObjectFile.h" -#include "lldb/Target/FileAction.h" #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Utility/Endian.h" diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index 4b618153f981..857f428d7b76 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -20,6 +20,7 @@ #include "lldb/Host/ConnectionFileDescriptor.h" #include "lldb/Host/Debug.h" #include "lldb/Host/File.h" +#include "lldb/Host/FileAction.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" @@ -27,7 +28,6 @@ #include "lldb/Host/common/NativeProcessProtocol.h" #include "lldb/Host/common/NativeRegisterContext.h" #include "lldb/Host/common/NativeThreadProtocol.h" -#include "lldb/Target/FileAction.h" #include "lldb/Target/MemoryRegionInfo.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/DataBuffer.h" diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp index 3c07f509dc88..08aa015e62ce 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -21,9 +21,9 @@ #include "lldb/Host/Config.h" #include "lldb/Host/ConnectionFileDescriptor.h" +#include "lldb/Host/FileAction.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Target/FileAction.h" #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Target/UnixSignals.h" diff --git a/lldb/source/Target/CMakeLists.txt b/lldb/source/Target/CMakeLists.txt index 265b3a80779d..b1bbbc469053 100644 --- a/lldb/source/Target/CMakeLists.txt +++ b/lldb/source/Target/CMakeLists.txt @@ -2,7 +2,6 @@ add_lldb_library(lldbTarget ABI.cpp CPPLanguageRuntime.cpp ExecutionContext.cpp - FileAction.cpp JITLoader.cpp JITLoaderList.cpp InstrumentationRuntime.cpp @@ -17,8 +16,6 @@ add_lldb_library(lldbTarget PathMappingList.cpp Platform.cpp Process.cpp - ProcessInfo.cpp - ProcessLaunchInfo.cpp Queue.cpp QueueItem.cpp QueueList.cpp diff --git a/lldb/unittests/Host/CMakeLists.txt b/lldb/unittests/Host/CMakeLists.txt index 93394661d36d..fe82ac95cf4d 100644 --- a/lldb/unittests/Host/CMakeLists.txt +++ b/lldb/unittests/Host/CMakeLists.txt @@ -1,9 +1,12 @@ set (FILES + FileActionTest.cpp FileSystemTest.cpp HostInfoTest.cpp HostTest.cpp MainLoopTest.cpp NativeProcessProtocolTest.cpp + ProcessInfoTest.cpp + ProcessLaunchInfoTest.cpp SocketAddressTest.cpp SocketTest.cpp SymbolsTest.cpp diff --git a/lldb/unittests/Host/FileActionTest.cpp b/lldb/unittests/Host/FileActionTest.cpp new file mode 100644 index 000000000000..abe4408427c8 --- /dev/null +++ b/lldb/unittests/Host/FileActionTest.cpp @@ -0,0 +1,20 @@ +//===-- FileActionTest.cpp --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/Host/FileAction.h" +#include "gtest/gtest.h" + +using namespace lldb_private; + +TEST(FileActionTest, Open) { + FileAction Action; + Action.Open(47, FileSpec("/tmp"), /*read*/ true, /*write*/ false); + EXPECT_EQ(Action.GetAction(), FileAction::eFileActionOpen); + EXPECT_EQ(Action.GetFileSpec(), FileSpec("/tmp")); +} diff --git a/lldb/unittests/Host/ProcessInfoTest.cpp b/lldb/unittests/Host/ProcessInfoTest.cpp new file mode 100644 index 000000000000..ad6341aebf44 --- /dev/null +++ b/lldb/unittests/Host/ProcessInfoTest.cpp @@ -0,0 +1,20 @@ +//===-- ProcessInfoTest.cpp -------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/Host/ProcessInfo.h" +#include "gtest/gtest.h" + +using namespace lldb_private; + +TEST(ProcessInfoTest, Constructor) { + ProcessInfo Info("foo", ArchSpec("x86_64-pc-linux"), 47); + EXPECT_STREQ("foo", Info.GetName()); + EXPECT_EQ(ArchSpec("x86_64-pc-linux"), Info.GetArchitecture()); + EXPECT_EQ(47, Info.GetProcessID()); +} diff --git a/lldb/unittests/Host/ProcessLaunchInfoTest.cpp b/lldb/unittests/Host/ProcessLaunchInfoTest.cpp new file mode 100644 index 000000000000..8a42265453ba --- /dev/null +++ b/lldb/unittests/Host/ProcessLaunchInfoTest.cpp @@ -0,0 +1,28 @@ +//===-- ProcessLaunchInfoTest.cpp -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/Host/ProcessLaunchInfo.h" +#include "gtest/gtest.h" + +using namespace lldb_private; +using namespace lldb; + +TEST(ProcessLaunchInfoTest, Constructor) { + ProcessLaunchInfo Info(FileSpec("/stdin"), FileSpec("/stdout"), + FileSpec("/stderr"), FileSpec("/wd"), + eLaunchFlagStopAtEntry); + EXPECT_EQ(FileSpec("/stdin"), + Info.GetFileActionForFD(STDIN_FILENO)->GetFileSpec()); + EXPECT_EQ(FileSpec("/stdout"), + Info.GetFileActionForFD(STDOUT_FILENO)->GetFileSpec()); + EXPECT_EQ(FileSpec("/stderr"), + Info.GetFileActionForFD(STDERR_FILENO)->GetFileSpec()); + EXPECT_EQ(FileSpec("/wd"), Info.GetWorkingDirectory()); + EXPECT_EQ(eLaunchFlagStopAtEntry, Info.GetFlags().Get()); +} diff --git a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp index 3fea70b8f5a6..ff75b07759f5 100644 --- a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp +++ b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp @@ -10,7 +10,6 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Host/common/TCPSocket.h" #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h" -#include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Utility/Args.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Path.h" diff --git a/lldb/unittests/tools/lldb-server/tests/TestClient.h b/lldb/unittests/tools/lldb-server/tests/TestClient.h index b3f89887c43d..3016d370307e 100644 --- a/lldb/unittests/tools/lldb-server/tests/TestClient.h +++ b/lldb/unittests/tools/lldb-server/tests/TestClient.h @@ -11,7 +11,7 @@ #include "MessageObjects.h" #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h" -#include "lldb/Target/ProcessLaunchInfo.h" +#include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/Connection.h" #include "llvm/ADT/Optional.h"