pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lldb-netbsd: Update to svn r. 293770 and reduce local patches



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Wed Feb 1 15:47:48 2017 +0100
Changeset:	52f4b281c17072e3753213f12cb2ec06ce8706cd

Modified Files:
	lldb-netbsd/Makefile
	lldb-netbsd/distinfo
	lldb-netbsd/patches/patch-source_Host_common_Host.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
Removed Files:
	lldb-netbsd/patches/patch-include_lldb_Host_linux_ProcessLauncherLinux.h
	lldb-netbsd/patches/patch-include_lldb_Host_netbsd_ProcessLauncherNetBSD.h
	lldb-netbsd/patches/patch-include_lldb_Host_posix_ProcessLauncherPosixFork.h
	lldb-netbsd/patches/patch-source_Host_CMakeLists.txt
	lldb-netbsd/patches/patch-source_Host_linux_ProcessLauncherLinux.cpp
	lldb-netbsd/patches/patch-source_Host_netbsd_ProcessLauncherNetBSD.cpp
	lldb-netbsd/patches/patch-source_Host_posix_ProcessLauncherPosixFork.cpp

Log Message:
lldb-netbsd: Update to svn r. 293770 and reduce local patches

ProcessLauncherPosixFork has been committed upstream
https://reviews.llvm.org/D29347

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=52f4b281c17072e3753213f12cb2ec06ce8706cd

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 lldb-netbsd/Makefile                               |   2 +-
 lldb-netbsd/distinfo                               |  11 +-
 ...-include_lldb_Host_linux_ProcessLauncherLinux.h |  30 ---
 ...nclude_lldb_Host_netbsd_ProcessLauncherNetBSD.h |   0
 ...lude_lldb_Host_posix_ProcessLauncherPosixFork.h |  30 ---
 .../patches/patch-source_Host_CMakeLists.txt       |  20 --
 .../patches/patch-source_Host_common_Host.cpp      |  33 +--
 ...atch-source_Host_linux_ProcessLauncherLinux.cpp | 231 --------------------
 ...ch-source_Host_netbsd_ProcessLauncherNetBSD.cpp |   0
 ...-source_Host_posix_ProcessLauncherPosixFork.cpp | 236 ---------------------
 ..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp |   2 +-
 11 files changed, 5 insertions(+), 590 deletions(-)

diffs:
diff --git a/lldb-netbsd/Makefile b/lldb-netbsd/Makefile
index ee470ab..3c22622 100644
--- a/lldb-netbsd/Makefile
+++ b/lldb-netbsd/Makefile
@@ -5,7 +5,7 @@ CATEGORIES=	lang devel
 
 SVN_REPOSITORIES=	lldb
 SVN_REPO.lldb=		http://llvm.org/svn/llvm-project/lldb/trunk
-SVN_REVISION.lldb=	293625
+SVN_REVISION.lldb=	293770
 
 MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	http://lldb.org/
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 39cad21..460e76d 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -14,26 +14,19 @@ RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
 SHA1 (patch-cmake_LLDBDependencies.cmake) = 2577a759167675d3a89915bebad05c8159798e8a
 SHA1 (patch-include_lldb_Core_Debugger.h) = 20d7995866bfe129ab532e470509d8ff9f4ebdea
-SHA1 (patch-include_lldb_Host_linux_ProcessLauncherLinux.h) = 235ac7771eaff7e7d2aa2cd4957083a99aa7b2ea
 SHA1 (patch-include_lldb_Host_netbsd_HostThreadNetBSD.h) = 79f207cdb9da2ef57d39eeb307ec6d10cf828925
-SHA1 (patch-include_lldb_Host_netbsd_ProcessLauncherNetBSD.h) = da39a3ee5e6b4b0d3255bfef95601890afd80709
-SHA1 (patch-include_lldb_Host_posix_ProcessLauncherPosixFork.h) = c2d5a5285874477b35fdc7b048a05c4d92746e06
 SHA1 (patch-source_CMakeLists.txt) = 5dacabc3f39c23bdfd432b5a4895866157b97aa0
 SHA1 (patch-source_Commands_CommandObjectPlatform.cpp) = c578e1b7e787a92b453b343ac8b63583f47585f7
 SHA1 (patch-source_Core_ConstString.cpp) = e79f25d82a90afa3d8a75098d66cab15c13d799f
 SHA1 (patch-source_Core_Debugger.cpp) = 6b284cafa93a30d3ea5d4f88478efb0ada659249
 SHA1 (patch-source_Core_ModuleList.cpp) = ff470cfe29d4702d5be6c5a096d5a8db700547e7
-SHA1 (patch-source_Host_CMakeLists.txt) = b8f27fd100e3488302a276143e423a7fc58683cb
 SHA1 (patch-source_Host_common_Editline.cpp) = 6bc60cc72e5a6148add175cb276bb445bb3ee0f5
-SHA1 (patch-source_Host_common_Host.cpp) = df295302f8e36649adec8203b781ccc9ff014d9a
+SHA1 (patch-source_Host_common_Host.cpp) = 7d48b8bb1e4350ba6d3ddc6357b9b8dc82d6b32d
 SHA1 (patch-source_Host_common_HostInfoBase.cpp) = 402e11c3c8775ba993159cb27c30b2ed9fa82076
 SHA1 (patch-source_Host_common_NativeProcessProtocol.cpp) = 23cc7da280b2123cf0206f3d5660d2647935edbc
 SHA1 (patch-source_Host_linux_HostInfoLinux.cpp) = fb375b959fe0f08c9e888194c58af356edeee441
-SHA1 (patch-source_Host_linux_ProcessLauncherLinux.cpp) = 2f5bf0787feadb5bab39f42a4fbe8a424a2fec88
 SHA1 (patch-source_Host_netbsd_HostThreadNetBSD.cpp) = a1b0fbdad062309a845cfefe4469614fbbe9d20e
-SHA1 (patch-source_Host_netbsd_ProcessLauncherNetBSD.cpp) = da39a3ee5e6b4b0d3255bfef95601890afd80709
 SHA1 (patch-source_Host_netbsd_ThisThread.cpp) = f0d32c81bc1b8fe9aeb86519ea46ba2cb16571c2
-SHA1 (patch-source_Host_posix_ProcessLauncherPosixFork.cpp) = dbcff0f3784a7574e6e7c9047ca0ee31440580f0
 SHA1 (patch-source_Host_windows_HostInfoWindows.cpp) = 73be6130bfc54bde057c23eee23aecd09c200b8d
 SHA1 (patch-source_Initialization_SystemInitializerCommon.cpp) = 80c850b980fe2902f10e441df7a18f428dd1154a
 SHA1 (patch-source_Plugins_ExpressionParser_Clang_ClangModulesDeclVendor.cpp) = a7f61c10f28fdc3280fdd81b2719f014e854c4fa
@@ -50,7 +43,7 @@ SHA1 (patch-source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp) = 125cf947d59593d
 SHA1 (patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp) = d260fdfdc464b1bfb1822e9be17c04480b0d2af4
 SHA1 (patch-source_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp) = 2f4e5859d80f8b0e55554eeb8955bf482cb04b57
 SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = 483584dad2dba01dccd065435a5d75eedf11b3c6
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 9c4c93e27b35cc70870545d3ec952188fcb904be
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 1553f31a05d79c6df6212836d5e83c6bd7003b3e
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = c48bb2dd45682164ab904b8b3f7664b91ac35d5b
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 4369b37e51c367787a12c7f935a8f5daf274841e
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = 22e5c436baea68b38058c8387318d08c7a43c149
diff --git a/lldb-netbsd/patches/patch-include_lldb_Host_linux_ProcessLauncherLinux.h b/lldb-netbsd/patches/patch-include_lldb_Host_linux_ProcessLauncherLinux.h
deleted file mode 100644
index 879a708..0000000
--- a/lldb-netbsd/patches/patch-include_lldb_Host_linux_ProcessLauncherLinux.h
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD$
-
---- include/lldb/Host/linux/ProcessLauncherLinux.h.orig	2016-12-17 10:34:14.000000000 +0000
-+++ include/lldb/Host/linux/ProcessLauncherLinux.h
-@@ -1,25 +0,0 @@
--//===-- ProcessLauncherAndroid.h --------------------------------*- C++ -*-===//
--//
--//                     The LLVM Compiler Infrastructure
--//
--// This file is distributed under the University of Illinois Open Source
--// License. See LICENSE.TXT for details.
--//
--//===----------------------------------------------------------------------===//
--
--#ifndef lldb_Host_android_ProcessLauncherAndroid_h_
--#define lldb_Host_android_ProcessLauncherAndroid_h_
--
--#include "lldb/Host/ProcessLauncher.h"
--
--namespace lldb_private {
--
--class ProcessLauncherLinux : public ProcessLauncher {
--public:
--  virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
--                                    Error &error);
--};
--
--} // end of namespace lldb_private
--
--#endif
diff --git a/lldb-netbsd/patches/patch-include_lldb_Host_netbsd_ProcessLauncherNetBSD.h b/lldb-netbsd/patches/patch-include_lldb_Host_netbsd_ProcessLauncherNetBSD.h
deleted file mode 100644
index e69de29..0000000
diff --git a/lldb-netbsd/patches/patch-include_lldb_Host_posix_ProcessLauncherPosixFork.h b/lldb-netbsd/patches/patch-include_lldb_Host_posix_ProcessLauncherPosixFork.h
deleted file mode 100644
index 8dd5c6b..0000000
--- a/lldb-netbsd/patches/patch-include_lldb_Host_posix_ProcessLauncherPosixFork.h
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD$
-
---- include/lldb/Host/posix/ProcessLauncherPosixFork.h.orig	2017-01-31 22:15:25.384142043 +0000
-+++ include/lldb/Host/posix/ProcessLauncherPosixFork.h
-@@ -0,0 +1,25 @@
-+//===-- ProcessLauncherPosixFork.h ------------------------------*- C++ -*-===//
-+//
-+//                     The LLVM Compiler Infrastructure
-+//
-+// This file is distributed under the University of Illinois Open Source
-+// License. See LICENSE.TXT for details.
-+//
-+//===----------------------------------------------------------------------===//
-+
-+#ifndef lldb_Host_posix_ProcessLauncherPosixFork_h_
-+#define lldb_Host_posix_ProcessLauncherPosixFork_h_
-+
-+#include "lldb/Host/ProcessLauncher.h"
-+
-+namespace lldb_private {
-+
-+class ProcessLauncherPosixFork : public ProcessLauncher {
-+public:
-+  virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
-+                                    Error &error);
-+};
-+
-+} // end of namespace lldb_private
-+
-+#endif
diff --git a/lldb-netbsd/patches/patch-source_Host_CMakeLists.txt b/lldb-netbsd/patches/patch-source_Host_CMakeLists.txt
deleted file mode 100644
index 2612f83..0000000
--- a/lldb-netbsd/patches/patch-source_Host_CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD$
-
---- source/Host/CMakeLists.txt.orig	2017-01-31 17:20:57.000000000 +0000
-+++ source/Host/CMakeLists.txt
-@@ -86,6 +86,7 @@ else()
-     posix/LockFilePosix.cpp
-     posix/MainLoopPosix.cpp
-     posix/PipePosix.cpp
-+    posix/ProcessLauncherPosixFork.cpp
-     )
- 
-   if (NOT (CMAKE_SYSTEM_NAME MATCHES "Android"))
-@@ -117,7 +118,6 @@ else()
-       linux/HostInfoLinux.cpp
-       linux/HostThreadLinux.cpp
-       linux/LibcGlue.cpp
--      linux/ProcessLauncherLinux.cpp
-       linux/ThisThread.cpp
-       )
-     if (CMAKE_SYSTEM_NAME MATCHES "Android")
diff --git a/lldb-netbsd/patches/patch-source_Host_common_Host.cpp b/lldb-netbsd/patches/patch-source_Host_common_Host.cpp
index 8f5ddf5..8fb23c3 100644
--- a/lldb-netbsd/patches/patch-source_Host_common_Host.cpp
+++ b/lldb-netbsd/patches/patch-source_Host_common_Host.cpp
@@ -1,27 +1,7 @@
 $NetBSD$
 
---- source/Host/common/Host.cpp.orig	2017-01-31 17:20:57.000000000 +0000
+--- source/Host/common/Host.cpp.orig	2017-02-01 14:45:44.000000000 +0000
 +++ source/Host/common/Host.cpp
-@@ -71,8 +71,8 @@
- 
- #if defined(_WIN32)
- #include "lldb/Host/windows/ProcessLauncherWindows.h"
--#elif defined(__linux__)
--#include "lldb/Host/linux/ProcessLauncherLinux.h"
-+#elif defined(__linux__) || defined(__NetBSD__)
-+#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
- #else
- #include "lldb/Host/posix/ProcessLauncherPosix.h"
- #endif
-@@ -623,7 +623,7 @@ Error Host::RunShellCommand(const Args &
-   return error;
- }
- 
--// LaunchProcessPosixSpawn for Apple, Linux, FreeBSD and other GLIBC
-+// LaunchProcessPosixSpawn for Apple, Linux, FreeBSD, NetBSD and other GLIBC
- // systems
- 
- #if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) ||        \
 @@ -700,7 +700,7 @@ Error Host::LaunchProcessPosixSpawn(cons
    sigemptyset(&no_signals);
    sigfillset(&all_signals);
@@ -31,14 +11,3 @@ $NetBSD$
    ::posix_spawnattr_setsigdefault(&attr, &no_signals);
  #else
    ::posix_spawnattr_setsigdefault(&attr, &all_signals);
-@@ -975,8 +975,8 @@ Error Host::LaunchProcess(ProcessLaunchI
-   std::unique_ptr<ProcessLauncher> delegate_launcher;
- #if defined(_WIN32)
-   delegate_launcher.reset(new ProcessLauncherWindows());
--#elif defined(__linux__)
--  delegate_launcher.reset(new ProcessLauncherLinux());
-+#elif defined(__linux__) || defined(__NetBSD__)
-+  delegate_launcher.reset(new ProcessLauncherPosixFork());
- #else
-   delegate_launcher.reset(new ProcessLauncherPosix());
- #endif
diff --git a/lldb-netbsd/patches/patch-source_Host_linux_ProcessLauncherLinux.cpp b/lldb-netbsd/patches/patch-source_Host_linux_ProcessLauncherLinux.cpp
deleted file mode 100644
index f16d5c1..0000000
--- a/lldb-netbsd/patches/patch-source_Host_linux_ProcessLauncherLinux.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-$NetBSD$
-
---- source/Host/linux/ProcessLauncherLinux.cpp.orig	2017-01-31 17:20:57.000000000 +0000
-+++ source/Host/linux/ProcessLauncherLinux.cpp
-@@ -1,225 +1 @@
--//===-- ProcessLauncherLinux.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/linux/ProcessLauncherLinux.h"
--#include "lldb/Core/Log.h"
--#include "lldb/Host/FileSpec.h"
--#include "lldb/Host/Host.h"
--#include "lldb/Host/HostProcess.h"
--#include "lldb/Host/Pipe.h"
--#include "lldb/Target/ProcessLaunchInfo.h"
--
--#include <limits.h>
--#include <sys/ptrace.h>
--#include <sys/wait.h>
--
--#include <sstream>
--
--#ifdef __ANDROID__
--#include <android/api-level.h>
--#endif
--
--#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
--#include <linux/personality.h>
--#else
--#include <sys/personality.h>
--#endif
--
--using namespace lldb;
--using namespace lldb_private;
--
--static void FixupEnvironment(Args &env) {
--#ifdef __ANDROID__
--  // If there is no PATH variable specified inside the environment then set the
--  // path to /system/bin. It is required because the default path used by
--  // execve() is wrong on android.
--  static const char *path = "PATH=";
--  for (auto &entry : env.entries()) {
--    if (entry.ref.startswith(path))
--      return;
--  }
--  env.AppendArgument(llvm::StringRef("PATH=/system/bin"));
--#endif
--}
--
--static void LLVM_ATTRIBUTE_NORETURN ExitWithError(int error_fd,
--                                                  const char *operation) {
--  std::ostringstream os;
--  os << operation << " failed: " << strerror(errno);
--  write(error_fd, os.str().data(), os.str().size());
--  close(error_fd);
--  _exit(1);
--}
--
--static void DupDescriptor(int error_fd, const FileSpec &file_spec, int fd,
--                          int flags) {
--  int target_fd = ::open(file_spec.GetCString(), flags, 0666);
--
--  if (target_fd == -1)
--    ExitWithError(error_fd, "DupDescriptor-open");
--
--  if (target_fd == fd)
--    return;
--
--  if (::dup2(target_fd, fd) == -1)
--    ExitWithError(error_fd, "DupDescriptor-dup2");
--
--  ::close(target_fd);
--  return;
--}
--
--static void LLVM_ATTRIBUTE_NORETURN ChildFunc(int error_fd,
--                                              const ProcessLaunchInfo &info) {
--  // First, make sure we disable all logging. If we are logging to stdout, our
--  // logs can be
--  // mistaken for inferior output.
--  Log::DisableAllLogChannels(nullptr);
--
--  // Do not inherit setgid powers.
--  if (setgid(getgid()) != 0)
--    ExitWithError(error_fd, "setgid");
--
--  if (info.GetFlags().Test(eLaunchFlagLaunchInSeparateProcessGroup)) {
--    if (setpgid(0, 0) != 0)
--      ExitWithError(error_fd, "setpgid");
--  }
--
--  for (size_t i = 0; i < info.GetNumFileActions(); ++i) {
--    const FileAction &action = *info.GetFileActionAtIndex(i);
--    switch (action.GetAction()) {
--    case FileAction::eFileActionClose:
--      if (close(action.GetFD()) != 0)
--        ExitWithError(error_fd, "close");
--      break;
--    case FileAction::eFileActionDuplicate:
--      if (dup2(action.GetFD(), action.GetActionArgument()) == -1)
--        ExitWithError(error_fd, "dup2");
--      break;
--    case FileAction::eFileActionOpen:
--      DupDescriptor(error_fd, action.GetFileSpec(), action.GetFD(),
--                    action.GetActionArgument());
--      break;
--    case FileAction::eFileActionNone:
--      break;
--    }
--  }
--
--  const char **argv = info.GetArguments().GetConstArgumentVector();
--
--  // Change working directory
--  if (info.GetWorkingDirectory() &&
--      0 != ::chdir(info.GetWorkingDirectory().GetCString()))
--    ExitWithError(error_fd, "chdir");
--
--  // Disable ASLR if requested.
--  if (info.GetFlags().Test(lldb::eLaunchFlagDisableASLR)) {
--    const unsigned long personality_get_current = 0xffffffff;
--    int value = personality(personality_get_current);
--    if (value == -1)
--      ExitWithError(error_fd, "personality get");
--
--    value = personality(ADDR_NO_RANDOMIZE | value);
--    if (value == -1)
--      ExitWithError(error_fd, "personality set");
--  }
--
--  Args env = info.GetEnvironmentEntries();
--  FixupEnvironment(env);
--  const char **envp = env.GetConstArgumentVector();
--
--  // Clear the signal mask to prevent the child from being affected by
--  // any masking done by the parent.
--  sigset_t set;
--  if (sigemptyset(&set) != 0 ||
--      pthread_sigmask(SIG_SETMASK, &set, nullptr) != 0)
--    ExitWithError(error_fd, "pthread_sigmask");
--
--  if (info.GetFlags().Test(eLaunchFlagDebug)) {
--    // HACK:
--    // Close everything besides stdin, stdout, and stderr that has no file
--    // action to avoid leaking. Only do this when debugging, as elsewhere we
--    // actually rely on
--    // passing open descriptors to child processes.
--    for (int fd = 3; fd < sysconf(_SC_OPEN_MAX); ++fd)
--      if (!info.GetFileActionForFD(fd) && fd != error_fd)
--        close(fd);
--
--    // Start tracing this child that is about to exec.
--    if (ptrace(PTRACE_TRACEME, 0, nullptr, nullptr) == -1)
--      ExitWithError(error_fd, "ptrace");
--  }
--
--  // Execute.  We should never return...
--  execve(argv[0], const_cast<char *const *>(argv),
--         const_cast<char *const *>(envp));
--
--  if (errno == ETXTBSY) {
--    // On android M and earlier we can get this error because the adb deamon can
--    // hold a write
--    // handle on the executable even after it has finished uploading it. This
--    // state lasts
--    // only a short time and happens only when there are many concurrent adb
--    // commands being
--    // issued, such as when running the test suite. (The file remains open when
--    // someone does
--    // an "adb shell" command in the fork() child before it has had a chance to
--    // exec.) Since
--    // this state should clear up quickly, wait a while and then give it one
--    // more go.
--    usleep(50000);
--    execve(argv[0], const_cast<char *const *>(argv),
--           const_cast<char *const *>(envp));
--  }
--
--  // ...unless exec fails.  In which case we definitely need to end the child
--  // here.
--  ExitWithError(error_fd, "execve");
--}
--
--HostProcess
--ProcessLauncherLinux::LaunchProcess(const ProcessLaunchInfo &launch_info,
--                                    Error &error) {
--  char exe_path[PATH_MAX];
--  launch_info.GetExecutableFile().GetPath(exe_path, sizeof(exe_path));
--
--  // A pipe used by the child process to report errors.
--  PipePosix pipe;
--  const bool child_processes_inherit = false;
--  error = pipe.CreateNew(child_processes_inherit);
--  if (error.Fail())
--    return HostProcess();
--
--  ::pid_t pid = ::fork();
--  if (pid == -1) {
--    // Fork failed
--    error.SetErrorStringWithFormat("Fork failed with error message: %s",
--                                   strerror(errno));
--    return HostProcess(LLDB_INVALID_PROCESS_ID);
--  }
--  if (pid == 0) {
--    // child process
--    pipe.CloseReadFileDescriptor();
--    ChildFunc(pipe.ReleaseWriteFileDescriptor(), launch_info);
--  }
--
--  // parent process
--
--  pipe.CloseWriteFileDescriptor();
--  char buf[1000];
--  int r = read(pipe.GetReadFileDescriptor(), buf, sizeof buf);
--
--  if (r == 0)
--    return HostProcess(pid); // No error. We're done.
--
--  error.SetErrorString(buf);
--
--  waitpid(pid, nullptr, 0);
--
--  return HostProcess();
--}
-+k
diff --git a/lldb-netbsd/patches/patch-source_Host_netbsd_ProcessLauncherNetBSD.cpp b/lldb-netbsd/patches/patch-source_Host_netbsd_ProcessLauncherNetBSD.cpp
deleted file mode 100644
index e69de29..0000000
diff --git a/lldb-netbsd/patches/patch-source_Host_posix_ProcessLauncherPosixFork.cpp b/lldb-netbsd/patches/patch-source_Host_posix_ProcessLauncherPosixFork.cpp
deleted file mode 100644
index 99c198e..0000000
--- a/lldb-netbsd/patches/patch-source_Host_posix_ProcessLauncherPosixFork.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-$NetBSD$
-
---- source/Host/posix/ProcessLauncherPosixFork.cpp.orig	2017-01-31 22:19:11.628280905 +0000
-+++ source/Host/posix/ProcessLauncherPosixFork.cpp
-@@ -0,0 +1,231 @@
-+//===-- ProcessLauncherLinux.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/posix/ProcessLauncherPosixFork.h"
-+#include "lldb/Core/Log.h"
-+#include "lldb/Host/FileSpec.h"
-+#include "lldb/Host/Host.h"
-+#include "lldb/Host/HostProcess.h"
-+#include "lldb/Host/Pipe.h"
-+#include "lldb/Target/ProcessLaunchInfo.h"
-+
-+#include <limits.h>
-+#include <sys/ptrace.h>
-+#include <sys/wait.h>
-+
-+#include <sstream>
-+
-+#ifdef __ANDROID__
-+#include <android/api-level.h>
-+#endif
-+
-+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
-+#include <linux/personality.h>
-+#elif defined(__linux__)
-+#include <sys/personality.h>
-+#endif
-+
-+using namespace lldb;
-+using namespace lldb_private;
-+
-+static void FixupEnvironment(Args &env) {
-+#ifdef __ANDROID__
-+  // If there is no PATH variable specified inside the environment then set the
-+  // path to /system/bin. It is required because the default path used by
-+  // execve() is wrong on android.
-+  static const char *path = "PATH=";
-+  for (auto &entry : env.entries()) {
-+    if (entry.ref.startswith(path))
-+      return;
-+  }
-+  env.AppendArgument(llvm::StringRef("PATH=/system/bin"));
-+#endif
-+}
-+
-+static void LLVM_ATTRIBUTE_NORETURN ExitWithError(int error_fd,
-+                                                  const char *operation) {
-+  std::ostringstream os;
-+  os << operation << " failed: " << strerror(errno);
-+  write(error_fd, os.str().data(), os.str().size());
-+  close(error_fd);
-+  _exit(1);
-+}
-+
-+static void DisableASLRIfRequested(int error_fd, const ProcessLaunchInfo &info) {
-+#if defined(__linux__)
-+  if (info.GetFlags().Test(lldb::eLaunchFlagDisableASLR)) {
-+    const unsigned long personality_get_current = 0xffffffff;
-+    int value = personality(personality_get_current);
-+    if (value == -1)
-+      ExitWithError(error_fd, "personality get");
-+
-+    value = personality(ADDR_NO_RANDOMIZE | value);
-+    if (value == -1)
-+      ExitWithError(error_fd, "personality set");
-+  }
-+#endif
-+}
-+
-+static void DupDescriptor(int error_fd, const FileSpec &file_spec, int fd,
-+                          int flags) {
-+  int target_fd = ::open(file_spec.GetCString(), flags, 0666);
-+
-+  if (target_fd == -1)
-+    ExitWithError(error_fd, "DupDescriptor-open");
-+
-+  if (target_fd == fd)
-+    return;
-+
-+  if (::dup2(target_fd, fd) == -1)
-+    ExitWithError(error_fd, "DupDescriptor-dup2");
-+
-+  ::close(target_fd);
-+  return;
-+}
-+
-+static void LLVM_ATTRIBUTE_NORETURN ChildFunc(int error_fd,
-+                                              const ProcessLaunchInfo &info) {
-+  // First, make sure we disable all logging. If we are logging to stdout, our
-+  // logs can be
-+  // mistaken for inferior output.
-+  Log::DisableAllLogChannels(nullptr);
-+
-+  // Do not inherit setgid powers.
-+  if (setgid(getgid()) != 0)
-+    ExitWithError(error_fd, "setgid");
-+
-+  if (info.GetFlags().Test(eLaunchFlagLaunchInSeparateProcessGroup)) {
-+    if (setpgid(0, 0) != 0)
-+      ExitWithError(error_fd, "setpgid");
-+  }
-+
-+  for (size_t i = 0; i < info.GetNumFileActions(); ++i) {
-+    const FileAction &action = *info.GetFileActionAtIndex(i);
-+    switch (action.GetAction()) {
-+    case FileAction::eFileActionClose:
-+      if (close(action.GetFD()) != 0)
-+        ExitWithError(error_fd, "close");
-+      break;
-+    case FileAction::eFileActionDuplicate:
-+      if (dup2(action.GetFD(), action.GetActionArgument()) == -1)
-+        ExitWithError(error_fd, "dup2");
-+      break;
-+    case FileAction::eFileActionOpen:
-+      DupDescriptor(error_fd, action.GetFileSpec(), action.GetFD(),
-+                    action.GetActionArgument());
-+      break;
-+    case FileAction::eFileActionNone:
-+      break;
-+    }
-+  }
-+
-+  const char **argv = info.GetArguments().GetConstArgumentVector();
-+
-+  // Change working directory
-+  if (info.GetWorkingDirectory() &&
-+      0 != ::chdir(info.GetWorkingDirectory().GetCString()))
-+    ExitWithError(error_fd, "chdir");
-+
-+  DisableASLRIfRequested(error_fd, info);
-+  Args env = info.GetEnvironmentEntries();
-+  FixupEnvironment(env);
-+  const char **envp = env.GetConstArgumentVector();
-+
-+  // Clear the signal mask to prevent the child from being affected by
-+  // any masking done by the parent.
-+  sigset_t set;
-+  if (sigemptyset(&set) != 0 ||
-+      pthread_sigmask(SIG_SETMASK, &set, nullptr) != 0)
-+    ExitWithError(error_fd, "pthread_sigmask");
-+
-+  if (info.GetFlags().Test(eLaunchFlagDebug)) {
-+    // HACK:
-+    // Close everything besides stdin, stdout, and stderr that has no file
-+    // action to avoid leaking. Only do this when debugging, as elsewhere we
-+    // actually rely on
-+    // passing open descriptors to child processes.
-+    for (int fd = 3; fd < sysconf(_SC_OPEN_MAX); ++fd)
-+      if (!info.GetFileActionForFD(fd) && fd != error_fd)
-+        close(fd);
-+
-+    // Start tracing this child that is about to exec.
-+    if (ptrace(PT_TRACE_ME, 0, nullptr, 0) == -1)
-+      ExitWithError(error_fd, "ptrace");
-+  }
-+
-+  // Execute.  We should never return...
-+  execve(argv[0], const_cast<char *const *>(argv),
-+         const_cast<char *const *>(envp));
-+
-+#if defined(__linux__)
-+  if (errno == ETXTBSY) {
-+    // On android M and earlier we can get this error because the adb deamon can
-+    // hold a write
-+    // handle on the executable even after it has finished uploading it. This
-+    // state lasts
-+    // only a short time and happens only when there are many concurrent adb
-+    // commands being
-+    // issued, such as when running the test suite. (The file remains open when
-+    // someone does
-+    // an "adb shell" command in the fork() child before it has had a chance to
-+    // exec.) Since
-+    // this state should clear up quickly, wait a while and then give it one
-+    // more go.
-+    usleep(50000);
-+    execve(argv[0], const_cast<char *const *>(argv),
-+           const_cast<char *const *>(envp));
-+  }
-+#endif
-+
-+  // ...unless exec fails.  In which case we definitely need to end the child
-+  // here.
-+  ExitWithError(error_fd, "execve");
-+}
-+
-+HostProcess
-+ProcessLauncherPosixFork::LaunchProcess(const ProcessLaunchInfo &launch_info,
-+                                        Error &error) {
-+  char exe_path[PATH_MAX];
-+  launch_info.GetExecutableFile().GetPath(exe_path, sizeof(exe_path));
-+
-+  // A pipe used by the child process to report errors.
-+  PipePosix pipe;
-+  const bool child_processes_inherit = false;
-+  error = pipe.CreateNew(child_processes_inherit);
-+  if (error.Fail())
-+    return HostProcess();
-+
-+  ::pid_t pid = ::fork();
-+  if (pid == -1) {
-+    // Fork failed
-+    error.SetErrorStringWithFormat("Fork failed with error message: %s",
-+                                   strerror(errno));
-+    return HostProcess(LLDB_INVALID_PROCESS_ID);
-+  }
-+  if (pid == 0) {
-+    // child process
-+    pipe.CloseReadFileDescriptor();
-+    ChildFunc(pipe.ReleaseWriteFileDescriptor(), launch_info);
-+  }
-+
-+  // parent process
-+
-+  pipe.CloseWriteFileDescriptor();
-+  char buf[1000];
-+  int r = read(pipe.GetReadFileDescriptor(), buf, sizeof buf);
-+
-+  if (r == 0)
-+    return HostProcess(pid); // No error. We're done.
-+
-+  error.SetErrorString(buf);
-+
-+  waitpid(pid, nullptr, 0);
-+
-+  return HostProcess();
-+}
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
index ded8739..a14b45e 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig	2017-01-31 18:03:04.646466474 +0000
+--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig	2017-02-01 14:48:47.318295132 +0000
 +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
 @@ -0,0 +1,1387 @@
 +//===-- NativeProcessNetBSD.cpp -------------------------------- -*- C++ -*-===//


Home | Main Index | Thread Index | Old Index