[Lldb-commits] [lldb] r293625 - Add NetBSD support in Host::GetCurrentThreadID

2017-01-31 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Tue Jan 31 07:38:42 2017
New Revision: 293625

URL: http://llvm.org/viewvc/llvm-project?rev=293625&view=rev
Log:
Add NetBSD support in Host::GetCurrentThreadID

Summary:
To retrieve the native thread ID there must be called _lwp_self().

Sponsored by 

Reviewers: joerg, clayborg, emaste, labath

Reviewed By: joerg, clayborg, labath

Subscribers: #lldb

Tags: #lldb

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

Modified:
lldb/trunk/source/Host/common/Host.cpp

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=293625&r1=293624&r2=293625&view=diff
==
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Tue Jan 31 07:38:42 2017
@@ -40,6 +40,10 @@
 #include 
 #endif
 
+#if defined(__NetBSD__)
+#include 
+#endif
+
 // C++ Includes
 
 // Other libraries and framework includes
@@ -320,6 +324,8 @@ lldb::tid_t Host::GetCurrentThreadID() {
   return thread_self;
 #elif defined(__FreeBSD__)
   return lldb::tid_t(pthread_getthreadid_np());
+#elif defined(__NetBSD__)
+  return lldb::tid_t(_lwp_self());
 #elif defined(__ANDROID__)
   return lldb::tid_t(gettid());
 #elif defined(__linux__)


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29266: Synchronize PlatformNetBSD with Linux

2017-01-31 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

Diff

diff -u source/Plugins/Platform/Linux/PlatformLinux.cpp 
source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp

Mostly everything is the same for now.

  --- source/Plugins/Platform/Linux/PlatformLinux.cpp   2016-12-19 
17:48:18.156356172 +0100
  +++ source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp 2017-01-31 
16:48:56.313379692 +0100
  @@ -1,4 +1,4 @@
  -//===-- PlatformLinux.cpp ---*- C++ 
-*-===//
  +//===-- PlatformNetBSD.cpp -*- C++ 
-*-===//
   //
   // The LLVM Compiler Infrastructure
   //
  @@ -7,7 +7,7 @@
   //
   
//===--===//
   
  -#include "PlatformLinux.h"
  +#include "PlatformNetBSD.h"
   #include "lldb/Host/Config.h"
   
   // C Includes
  @@ -36,27 +36,27 @@
   #include "lldb/Target/Process.h"
   #include "lldb/Target/Target.h"
   
  -// Define these constants from Linux mman.h for use when targeting
  +// Define these constants from NetBSD mman.h for use when targeting
   // remote linux systems even when host has different values.
  -#define MAP_PRIVATE 2
  -#define MAP_ANON 0x20
  +#define MAP_PRIVATE 0x0002
  +#define MAP_ANON 0x1000
   
   using namespace lldb;
   using namespace lldb_private;
  -using namespace lldb_private::platform_linux;
  +using namespace lldb_private::platform_netbsd;
   
   static uint32_t g_initialize_count = 0;
   
   //--
  -/// Code to handle the PlatformLinux settings
  +/// Code to handle the PlatformNetBSD settings
   //--
   
   namespace {
  -class PlatformLinuxProperties : public Properties {
  +class PlatformNetBSDProperties : public Properties {
   public:
  -  PlatformLinuxProperties();
  +  PlatformNetBSDProperties();
   
  -  ~PlatformLinuxProperties() override = default;
  +  ~PlatformNetBSDProperties() override = default;
   
 static ConstString &GetSettingName();
   
  @@ -64,49 +64,49 @@
 static const PropertyDefinition *GetStaticPropertyDefinitions();
   };
   
  -typedef std::shared_ptr PlatformLinuxPropertiesSP;
  +typedef std::shared_ptr PlatformNetBSDPropertiesSP;
   
   } // anonymous namespace
   
  -PlatformLinuxProperties::PlatformLinuxProperties() : Properties() {
  +PlatformNetBSDProperties::PlatformNetBSDProperties() : Properties() {
 m_collection_sp.reset(new OptionValueProperties(GetSettingName()));
 m_collection_sp->Initialize(GetStaticPropertyDefinitions());
   }
   
  -ConstString &PlatformLinuxProperties::GetSettingName() {
  -  static ConstString g_setting_name("linux");
  +ConstString &PlatformNetBSDProperties::GetSettingName() {
  +  static ConstString g_setting_name("netbsd");
 return g_setting_name;
   }
   
   const PropertyDefinition *
  -PlatformLinuxProperties::GetStaticPropertyDefinitions() {
  +PlatformNetBSDProperties::GetStaticPropertyDefinitions() {
 static PropertyDefinition g_properties[] = {
 {NULL, OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL}};
   
 return g_properties;
   }
   
  -static const PlatformLinuxPropertiesSP &GetGlobalProperties() {
  -  static PlatformLinuxPropertiesSP g_settings_sp;
  +static const PlatformNetBSDPropertiesSP &GetGlobalProperties() {
  +  static PlatformNetBSDPropertiesSP g_settings_sp;
 if (!g_settings_sp)
  -g_settings_sp.reset(new PlatformLinuxProperties());
  +g_settings_sp.reset(new PlatformNetBSDProperties());
 return g_settings_sp;
   }
   
  -void PlatformLinux::DebuggerInitialize(Debugger &debugger) {
  +void PlatformNetBSD::DebuggerInitialize(Debugger &debugger) {
 if (!PluginManager::GetSettingForPlatformPlugin(
  -  debugger, PlatformLinuxProperties::GetSettingName())) {
  +  debugger, PlatformNetBSDProperties::GetSettingName())) {
   const bool is_global_setting = true;
   PluginManager::CreateSettingForPlatformPlugin(
   debugger, GetGlobalProperties()->GetValueProperties(),
  -ConstString("Properties for the PlatformLinux plug-in."),
  +ConstString("Properties for the PlatformNetBSD plug-in."),
   is_global_setting);
 }
   }
   
   //--
   
  -PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) {
  +PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) {
 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
 if (log) {
   const char *arch_name;
  @@ -118,7 +118,7 @@
   const char *triple_cstr =
   arch ? arch->GetTriple().getTriple().c_str() : "";
   
  -log->Printf("PlatformLinux::%s(force=%s, arch={%s,%s})", __FUNCTION__,
  +log->Printf("PlatformNetBSD::%s(force=%s, arch={%s,%s})", __FUNCTION__,
   force ? "true" : "false", arch_name, triple_cstr);
 }
   
  @

[Lldb-commits] [PATCH] D29078: This patch implements a command to access and manipulate the Intel(R) MPX Boundary Tables.

2017-01-31 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

If we can add a comment around "bndcfgu" where we use an SBData since it is a 
vector register and SBValue::GetValueAsUnsigned(...) won't work because it is a 
vector that would be nice for people to know. Other than that this is good to 
go!




Comment at: tools/intel-mpx/IntelMPXTablePlugin.cpp:293-294
+
+  lldb::SBData bndcfgu_data = bndcfgu_val.GetData();
+  bndcfgu = bndcfgu_data.GetUnsignedInt64(error, 0);
+  if (!error.Success()) {

Might be nice to comment that we need to use SBData because this is a vector 
register.


https://reviews.llvm.org/D29078



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r293646 - NFC. Remove unused header include.

2017-01-31 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan 31 10:48:20 2017
New Revision: 293646

URL: http://llvm.org/viewvc/llvm-project?rev=293646&view=rev
Log:
NFC. Remove unused header include.

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=293646&r1=293645&r2=293646&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
Tue Jan 31 10:48:20 2017
@@ -35,7 +35,6 @@
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "clang/Rewrite/Frontend/FrontendActions.h"
 #include "clang/Sema/SemaConsumer.h"
-#include "clang/StaticAnalyzer/Frontend/FrontendActions.h"
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r293647 - [CMake] Add LINK_LIBS and LINK_COMPONENTS options

2017-01-31 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan 31 10:59:46 2017
New Revision: 293647

URL: http://llvm.org/viewvc/llvm-project?rev=293647&view=rev
Log:
[CMake] Add LINK_LIBS and LINK_COMPONENTS options

This patch adds CMake options to add_lldb_library and add_lldb_executable for 
specifying LLVM components and direct library links.

This patch is NFC, but it is a small separable bit of a series of much larger 
patches that I'll be landing over the next day or two.

Modified:
lldb/trunk/cmake/modules/AddLLDB.cmake

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=293647&r1=293646&r2=293647&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Tue Jan 31 10:59:46 2017
@@ -23,9 +23,10 @@ function(add_lldb_library name)
   cmake_parse_arguments(PARAM
 "MODULE;SHARED;STATIC;OBJECT"
 ""
-"DEPENDS"
+"DEPENDS;LINK_LIBS;LINK_COMPONENTS"
 ${ARGN})
   llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
+  list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})
 
   if (MSVC_IDE OR XCODE)
 string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
@@ -56,22 +57,19 @@ function(add_lldb_library name)
   if (PARAM_OBJECT)
 add_library(${name} ${libkind} ${srcs})
   else()
-if (PARAM_SHARED)
-  if (LLDB_LINKER_SUPPORTS_GROUPS)
-llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
--Wl,--start-group ${LLDB_USED_LIBS} 
-Wl,--end-group
--Wl,--start-group ${CLANG_USED_LIBS} 
-Wl,--end-group
-DEPENDS ${PARAM_DEPENDS}
-  )
-  else()
-llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
-${LLDB_USED_LIBS} ${CLANG_USED_LIBS}
-DEPENDS ${PARAM_DEPENDS}
-  )
-  endif()
-else()
-  llvm_add_library(${name} ${libkind} ${srcs} DEPENDS ${PARAM_DEPENDS})
+if (PARAM_SHARED AND LLDB_LINKER_SUPPORTS_GROUPS)
+  set(start_group -Wl,--start-group)
+  set(end_group -Wl,--end-group)
 endif()
+llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
+${start_group}
+${LLDB_USED_LIBS}
+${end_group}
+${start_group}
+${CLANG_USED_LIBS}
+${end_group}
+${PARAM_LINK_LIBS}
+DEPENDS ${PARAM_DEPENDS})
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "liblldb")
   if (PARAM_SHARED)
@@ -112,8 +110,17 @@ function(add_lldb_library name)
 endfunction(add_lldb_library)
 
 function(add_lldb_executable name)
-  cmake_parse_arguments(ARG "INCLUDE_IN_FRAMEWORK;GENERATE_INSTALL" "" "" 
${ARGN})
+  cmake_parse_arguments(ARG
+"INCLUDE_IN_FRAMEWORK;GENERATE_INSTALL"
+""
+"LINK_LIBS;LINK_COMPONENTS"
+${ARGN}
+)
+
+  list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
   add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
+
+  target_link_libraries(${name} ${ARG_LINK_LIBS})
   set_target_properties(${name} PROPERTIES
 FOLDER "lldb executables")
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r293660 - Add a command to access and manipulate the Intel(R) MPX Boundary Tables.

2017-01-31 Thread Valentina Giusti via lldb-commits
Author: valentinagiusti
Date: Tue Jan 31 12:02:54 2017
New Revision: 293660

URL: http://llvm.org/viewvc/llvm-project?rev=293660&view=rev
Log:
Add a command to access and manipulate the Intel(R) MPX Boundary Tables.

Summary:
The Boundary Table Entries are stored in the application memory and allow
to store boundary info for all the pointers of the program, also those that
otherwise wouldn't fit in the 4 bound registers provided by the HW.

Here is an example of how it works:
 * mpx-table show 
lbound = 0x..., ubound = 0x..., (pointer value = 0x..., metadata = 
0x...)
 * mpx-table set 

Signed-off-by: Valentina Giusti 

Reviewers: labath, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, mgorny

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

Added:
lldb/trunk/tools/intel-mpx/
lldb/trunk/tools/intel-mpx/CMakeLists.txt
lldb/trunk/tools/intel-mpx/IntelMPXTablePlugin.cpp
lldb/trunk/tools/intel-mpx/test/
lldb/trunk/tools/intel-mpx/test/Makefile
lldb/trunk/tools/intel-mpx/test/README.txt
lldb/trunk/tools/intel-mpx/test/TestMPXTable.py
lldb/trunk/tools/intel-mpx/test/main.cpp
Modified:
lldb/trunk/tools/CMakeLists.txt

Modified: lldb/trunk/tools/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/CMakeLists.txt?rev=293660&r1=293659&r2=293660&view=diff
==
--- lldb/trunk/tools/CMakeLists.txt (original)
+++ lldb/trunk/tools/CMakeLists.txt Tue Jan 31 12:02:54 2017
@@ -8,3 +8,4 @@ add_subdirectory(lldb-mi)
 if (LLDB_CAN_USE_LLDB_SERVER)
   add_subdirectory(lldb-server)
 endif()
+add_subdirectory(intel-mpx)

Added: lldb/trunk/tools/intel-mpx/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/intel-mpx/CMakeLists.txt?rev=293660&view=auto
==
--- lldb/trunk/tools/intel-mpx/CMakeLists.txt (added)
+++ lldb/trunk/tools/intel-mpx/CMakeLists.txt Tue Jan 31 12:02:54 2017
@@ -0,0 +1,23 @@
+if (NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
+  return ()
+endif ()
+
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
+add_library(lldb-intel-mpxtable SHARED
+  IntelMPXTablePlugin.cpp
+  )
+
+target_link_libraries(lldb-intel-mpxtable PUBLIC liblldb)
+
+if (LLDB_LINKER_SUPPORTS_GROUPS)
+  target_link_libraries(lldb-intel-mpxtable PUBLIC
+-Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+else()
+  target_link_libraries(lldb-intel-mpxtable PUBLIC ${LLDB_USED_LIBS})
+endif()
+llvm_config(lldb-intel-mpxtable ${LLVM_LINK_COMPONENTS})
+
+
+install(TARGETS lldb-intel-mpxtable
+  LIBRARY DESTINATION bin)

Added: lldb/trunk/tools/intel-mpx/IntelMPXTablePlugin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/intel-mpx/IntelMPXTablePlugin.cpp?rev=293660&view=auto
==
--- lldb/trunk/tools/intel-mpx/IntelMPXTablePlugin.cpp (added)
+++ lldb/trunk/tools/intel-mpx/IntelMPXTablePlugin.cpp Tue Jan 31 12:02:54 2017
@@ -0,0 +1,426 @@
+//===-- IntelMPXTablePlugin.cpp--*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+// C++ includes
+#include 
+
+// Project includes
+#include "lldb/API/SBCommandInterpreter.h"
+#include "lldb/API/SBCommandReturnObject.h"
+#include "lldb/API/SBMemoryRegionInfo.h"
+#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBTarget.h"
+#include "lldb/API/SBThread.h"
+
+#include "llvm/ADT/Triple.h"
+
+namespace lldb {
+bool PluginInitialize(lldb::SBDebugger debugger);
+}
+
+static bool GetPtr(char *cptr, uint64_t &ptr, lldb::SBFrame &frame,
+   lldb::SBCommandReturnObject &result) {
+  if (!cptr) {
+result.SetError("Bad argument.");
+result.SetStatus(lldb::eReturnStatusFailed);
+return false;
+  }
+
+  lldb::SBValue ptr_addr = frame.GetValueForVariablePath(cptr);
+  if (!ptr_addr.IsValid()) {
+result.SetError("Invalid pointer.");
+result.SetStatus(lldb::eReturnStatusFailed);
+return false;
+  }
+  ptr = ptr_addr.GetLoadAddress();
+  return true;
+}
+
+enum {
+  mpx_base_mask_64 = ~(uint64_t)0xFFFULL,
+  mpx_bd_mask_64 = 0xFFF0ULL,
+  bd_r_shift_64 = 20,
+  bd_l_shift_64 = 3,
+  bt_r_shift_64 = 3,
+  bt_l_shift_64 = 5,
+  bt_mask_64 = 0x0008ULL,
+
+  mpx_base_mask_32 = 0xF000ULL,
+  mpx_bd_mask_32 = 0xF000ULL,
+  bd_r_shift_32 = 12,
+  bd_l_shift_32 = 2,
+  bt_r_shift_32 = 2,
+  bt_l_shift_32 = 4,
+  bt_mask_32 = 0x0FFCULL,
+};
+
+static void PrintBTEntry(lldb::addr_t lbound, lldb::addr_t ubound,
+ uint64_t value, uint64_t meta,
+ lldb::SBCommandReturnObject &result) {
+  cons

[Lldb-commits] [PATCH] D29078: This patch implements a command to access and manipulate the Intel(R) MPX Boundary Tables.

2017-01-31 Thread Valentina Giusti via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL293660: Add a command to access and manipulate the Intel(R) 
MPX Boundary Tables. (authored by valentinagiusti).

Changed prior to commit:
  https://reviews.llvm.org/D29078?vs=85906&id=86453#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29078

Files:
  lldb/trunk/tools/CMakeLists.txt
  lldb/trunk/tools/intel-mpx/CMakeLists.txt
  lldb/trunk/tools/intel-mpx/IntelMPXTablePlugin.cpp
  lldb/trunk/tools/intel-mpx/test/Makefile
  lldb/trunk/tools/intel-mpx/test/README.txt
  lldb/trunk/tools/intel-mpx/test/TestMPXTable.py
  lldb/trunk/tools/intel-mpx/test/main.cpp

Index: lldb/trunk/tools/intel-mpx/test/main.cpp
===
--- lldb/trunk/tools/intel-mpx/test/main.cpp
+++ lldb/trunk/tools/intel-mpx/test/main.cpp
@@ -0,0 +1,48 @@
+//===-- main.cpp *- C++ -*-===//
+
+ The LLVM Compiler Infrastructure
+
+ This file is distributed under the University of Illinois Open Source
+ License. See LICENSE.TXT for details.
+
+===--===//
+//
+
+const int size = 5;
+
+#include 
+#include 
+#include 
+
+void func(int *ptr) {
+  int *tmp;
+
+#if defined  __GNUC__ && !defined __INTEL_COMPILER
+  __builtin___bnd_store_ptr_bounds ((void**)&ptr, ptr);
+#endif
+  tmp = ptr + size - 1;
+#if defined  __GNUC__ && !defined __INTEL_COMPILER
+  __builtin___bnd_store_ptr_bounds ((void**)&tmp, tmp);
+#endif
+  tmp = (int*)0x2; // Break 2.
+
+  return; // Break 3.
+}
+
+int
+main(int argc, char const *argv[])
+{
+  // This call returns 0 only if the CPU and the kernel support Intel(R) MPX.
+  if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0)
+return -1;
+
+  int*  a = (int *) calloc(size, sizeof(int));
+#if defined  __GNUC__ && !defined __INTEL_COMPILER
+  __builtin___bnd_store_ptr_bounds ((void**)&a, a);
+#endif
+  func(a); // Break 1.
+
+  free(a); // Break 4.
+
+  return 0;
+}
Index: lldb/trunk/tools/intel-mpx/test/TestMPXTable.py
===
--- lldb/trunk/tools/intel-mpx/test/TestMPXTable.py
+++ lldb/trunk/tools/intel-mpx/test/TestMPXTable.py
@@ -0,0 +1,168 @@
+"""
+Test mpx-table command.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import re
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestMPXTable(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+
+@skipIf(compiler="clang")
+@skipIf(oslist=no_match(['linux']))
+@skipIf(archs=no_match(['i386', 'x86_64']))
+@skipIf(compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports Intel(R) MPX.
+def test_show_command(self):
+"""Test 'mpx-table show' command"""
+self.build()
+
+lldb_exec_dir = os.environ["LLDB_IMPLIB_DIR"]
+lldb_lib_dir = os.path.join(lldb_exec_dir, os.pardir, "lib")
+plugin_file = os.path.join(lldb_lib_dir, "liblldb-intel-mpxtable.so")
+if not os.path.isfile(plugin_file):
+self.skipTest("Intel(R) mpx-table plugin missing.")
+plugin_command = " "
+seq = ("plugin", "load", plugin_file)
+plugin_command = plugin_command.join(seq)
+self.runCmd(plugin_command)
+
+exe = os.path.join(os.getcwd(), "a.out")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+self.b1 = line_number('main.cpp', '// Break 1.')
+self.b2 = line_number('main.cpp', '// Break 2.')
+self.b3 = line_number('main.cpp', '// Break 3.')
+self.b4 = line_number('main.cpp', '// Break 4.')
+lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.b1, num_expected_locations=1)
+lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.b2, num_expected_locations=1)
+lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.b3, num_expected_locations=1)
+lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.b4, num_expected_locations=1)
+self.runCmd("run", RUN_SUCCEEDED)
+
+target = self.dbg.GetSelectedTarget()
+process = target.GetProcess()
+
+if (process.GetState() == lldb.eStateExited):
+self.skipTest("Intel(R) MPX is not supported.")
+else:
+self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
+substrs = ["stop reason = breakpoint 1."])
+
+self.expect("mpx-table show a",
+ substrs = ['lbound = 0x',
+', ubound = 0x',
+'(pointer value = 0x',
+', metadata = 0x',
+')'],
+

[Lldb-commits] [PATCH] D29266: Synchronize PlatformNetBSD with Linux

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

After looking at this closer, I don't think we will even need a separate class 
to achieve deduplication. The code is so heavily duplicated (see comments on 
the first three non-boilerplate functions, I did not look at the rest yet, but 
I expect the situation to be the same) already that we can just push the 
definitions down the existing class hierarchy and achieve massive savings that 
way. After we're done with that, I think we'll find that the PlatformLinux 
class will be so small that your current s/linux/netbsd/ approach will no 
longer be a problem.

If @clayborg agrees with this approach, I can help you prepare the ground for 
that.




Comment at: source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp:200
 
 Error PlatformNetBSD::ResolveExecutable(
+const ModuleSpec &ms, lldb::ModuleSP &exe_module_sp,

PlatformLinux, PlatformFreeBSD and PlatformWindows have copies of this code 
already. Proposal:
- put this code into `Platform::ResolveExecutable`
- remove other identical copies



Comment at: source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp:325
 
-// From PlatformMacOSX only
 Error PlatformNetBSD::GetFileWithUUID(const FileSpec &platform_file,
+ const UUID *uuid_ptr,

Every platform except `PlatformDarwin` already defines this function to the 
exact same code. Proposal:
- put this code into `Platform::GetFileWithUUID`
- remove other definitions with the same code



Comment at: source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp:354
 
 bool PlatformNetBSD::GetProcessInfo(lldb::pid_t pid,
+   ProcessInstanceInfo &process_info) {

Every platform already defines this function to the same code. Proposal:
- move this code into `Platform::GetProcessInfo`
- remove other (*all*) identical definitions


Repository:
  rL LLVM

https://reviews.llvm.org/D29266



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I like where this is going. I am not sure about a couple of details though. 
Please see comments.




Comment at: source/Breakpoint/CMakeLists.txt:32
+lldbPluginObjCLanguage
+LLVMSupport
   )

Shouldn't this be: `LINK_COMPONENTS Support`? I have a feeling that if you 
specify it this way, it will break LLVM_LINK_LLVM_DYLIB build.



Comment at: tools/lldb-server/CMakeLists.txt:63
+# few LLDB libraries directly.
+if (NOT LLDB_EXPORT_ALL_SYMBOLS)
+  set(EXTRA_LLDB_LIBS

This seems wrong. lldb-server does not link to liblldb at all, so it's link 
line should not be affected by the LLDB_EXPORT_ALL_SYMBOLS setting. lldb-server 
links agains the .a files directly.


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r293666 - Move the stop point to somewhere before the final use of the

2017-01-31 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Tue Jan 31 12:26:20 2017
New Revision: 293666

URL: http://llvm.org/viewvc/llvm-project?rev=293666&view=rev
Log:
Move the stop point to somewhere before the final use of the
variable we are inspecting.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp?rev=293666&r1=293665&r2=293666&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp
 Tue Jan 31 12:26:20 2017
@@ -65,5 +65,6 @@ int main()
 vBool.push_back(true);
 vBool.push_back(true);
 
-return 0; // Set break point at this line.
+printf ("size: %d", (int) vBool.size()); // Set break point at this line.
+return 0; 
 }


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Chris Bieneman via Phabricator via lldb-commits
beanz updated this revision to Diff 86461.
beanz added a comment.

Updates based on post commit feedback from labath.

He was right on both points. LLVM libs should be done through LINK_COMPONENTS, 
and I messed up lldb-server's dependencies.


https://reviews.llvm.org/D29333

Files:
  source/Breakpoint/CMakeLists.txt
  source/Commands/CMakeLists.txt
  source/Core/CMakeLists.txt
  source/DataFormatters/CMakeLists.txt
  source/Expression/CMakeLists.txt
  source/Host/CMakeLists.txt
  source/Initialization/CMakeLists.txt
  source/Interpreter/CMakeLists.txt
  source/Symbol/CMakeLists.txt
  source/Target/CMakeLists.txt
  source/Utility/CMakeLists.txt
  tools/argdumper/CMakeLists.txt
  tools/debugserver/source/CMakeLists.txt
  tools/debugserver/source/MacOSX/CMakeLists.txt
  tools/driver/CMakeLists.txt
  tools/lldb-mi/CMakeLists.txt
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -23,90 +23,6 @@
 
 include_directories(../../source)
 
-
-set( LLDB_USED_LIBS
-  lldbBase
-  lldbBreakpoint
-  lldbCommands
-  lldbDataFormatters
-  lldbHost
-  lldbCore
-  lldbExpression
-  lldbInitialization
-  lldbInterpreter
-  lldbSymbol
-  lldbTarget
-  lldbUtility
-
-  # Plugins
-  lldbPluginDisassemblerLLVM
-  lldbPluginSymbolFileDWARF
-  lldbPluginSymbolFilePDB
-  lldbPluginSymbolFileSymtab
-  lldbPluginDynamicLoaderPosixDYLD
-
-  lldbPluginCPlusPlusLanguage
-  lldbPluginGoLanguage
-  lldbPluginJavaLanguage
-  lldbPluginObjCLanguage
-  lldbPluginObjCPlusPlusLanguage
-  lldbPluginOCamlLanguage
-
-  lldbPluginObjectFileELF
-  lldbPluginObjectFileJIT
-  lldbPluginSymbolVendorELF
-  lldbPluginPlatformPOSIX
-  lldbPluginObjectContainerBSDArchive
-  lldbPluginObjectContainerMachOArchive
-  lldbPluginProcessGDBRemote
-  lldbPluginProcessUtility
-  lldbPluginObjectContainerMachOArchive
-  lldbPluginObjectContainerBSDArchive
-  lldbPluginPlatformMacOSX
-  lldbPluginUnwindAssemblyInstEmulation
-  lldbPluginUnwindAssemblyX86
-  lldbPluginAppleObjCRuntime
-  lldbPluginCXXItaniumABI
-  lldbPluginInstructionARM
-  lldbPluginInstructionARM64
-  lldbPluginInstructionMIPS
-  lldbPluginInstructionMIPS64
-  lldbPluginObjectFilePECOFF
-  lldbPluginExpressionParserClang
-  lldbPluginExpressionParserGo
-  )
-
-# Linux-only libraries
-if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android" )
-  list(APPEND LLDB_USED_LIBS
-lldbPluginProcessLinux
-lldbPluginProcessPOSIX
-   )
-endif ()
-
-# Darwin-only libraries
-if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
-  list(APPEND LLDB_USED_LIBS
-lldbPluginObjectFileMachO
-)
-endif()
-
-set( CLANG_USED_LIBS
-  clangAnalysis
-  clangAST
-  clangBasic
-  clangCodeGen
-  clangDriver
-  clangEdit
-  clangFrontend
-  clangLex
-  clangParse
-  clangRewrite
-  clangRewriteFrontend
-  clangSema
-  clangSerialization
-  )
-
 set(LLDB_SYSTEM_LIBS)
 if (NOT LLDB_DISABLE_LIBEDIT)
   list(APPEND LLDB_SYSTEM_LIBS edit)
@@ -142,54 +58,25 @@
   endif()
 endif()
 
-set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
-  interpreter
-  asmparser
-  bitreader
-  bitwriter
-  codegen
-  demangle
-  ipo
-  selectiondag
-  bitreader
-  mc
-  mcjit
-  core
-  mcdisassembler
-  executionengine
-  runtimedyld
-  option
-  support
-  coverage
-  target
-  )
-
 add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK
 Acceptor.cpp
 lldb-gdbserver.cpp
 lldb-platform.cpp
 lldb-server.cpp
 LLDBServerUtilities.cpp
-)
 
-# The Darwin linker doesn't understand --start-group/--end-group.
-if (LLDB_LINKER_SUPPORTS_GROUPS)
-  target_link_libraries(lldb-server
--Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
-  target_link_libraries(lldb-server
--Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
-else()
-  target_link_libraries(lldb-server ${LLDB_USED_LIBS})
-  target_link_libraries(lldb-server ${CLANG_USED_LIBS})
-endif()
-if(NOT LLVM_LINK_LLVM_DYLIB)
-  # This is necessary in !LLVM_LINK_LLVM_DYLIB as LLDB's libs do not track their
-  # dependencies properly. It is conditional because in a LLVM_LINK_LLVM_DYLIB
-  # build it would introduce duplicate symbols (add_lldb_tool links to libLLVM,
-  # and this would add the individual .a files as well).
-  llvm_config(lldb-server ${LLVM_LINK_COMPONENTS})
-endif()
+LINK_LIBS
+  lldbBase
+  lldbCore
+  lldbHost
+  lldbInitialization
+  lldbInterpreter
+  ${LLDB_SYSTEM_LIBS}
+
+LINK_COMPONENTS
+  Support
+  MCJIT # TODO: Remove this after the plugins are updated
+)
 
 target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS})
 
Index: tools/lldb-mi/CMakeLists.txt
===
--- tools/lldb-mi/CMakeLists.txt
+++ tools/lldb-mi/CMakeLists.txt
@@ -1,4 +1,16 @@
-set(LLDB_MI_SOURCES
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
+  add_definitions( 

[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

Any reason this doesn't use the same strategy as LLVM?  I.e. at the top of the 
`CMakeLists.txt` file, write something like `set(LLVM_LINK_COMPONENTS Foo Bar 
Baz)`, then just call `add_lldb_library` etc.


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Chris Bieneman via Phabricator via lldb-commits
beanz added a comment.

@zturner That mechanism does work, however I generally find that it is cleaner 
to pass named parameters into CMake functions which provides a bit of a 
self-documenting API, as opposed to relying on known named variables. The 
named-parameter was introduced for LLD, and I think is the more-modern way of 
handling this. Eventually I think LLVM should be updated to do the same.


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

As long as you considered the tradeoffs then and you like this better, that's 
fine then.

Is CMake going to complain about circular dependencies?  For example, 
Breakpoint depends on Core and Core depends on Breakpoint.


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Chris Bieneman via Phabricator via lldb-commits
beanz added a comment.

Thankfully CMake will not complain about circular dependencies in static 
archive targets. If it did, we'd really be in trouble because the LLDB 
dependencies graph has *lots* of circular dependencies. Actually, I think CMake 
even handles them properly on Linux, which should eliminate our need to add 
`--start-group` and `--end-group` to the linker command lines.


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Zachary Turner via Phabricator via lldb-commits
zturner accepted this revision.
zturner added a comment.
This revision is now accepted and ready to land.

ok, lgtm with the caveat that if it breaks anything on Windows we might have to 
revert until we figure it out.


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Chris Bieneman via Phabricator via lldb-commits
beanz added a comment.

@zturner, absolutely! Thanks!

I expect this patch and the next one to be pretty safe because I'm not actually 
removing the existing dependency specifications, just adding new explicit ones.


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

In https://reviews.llvm.org/D29333#661960, @beanz wrote:

> Thankfully CMake will not complain about circular dependencies in static 
> archive targets. If it did, we'd really be in trouble because the LLDB 
> dependencies graph has *lots* of circular dependencies. Actually, I think 
> CMake even handles them properly on Linux, which should eliminate our need to 
> add `--start-group` and `--end-group` to the linker command lines.


I was thinking about that as well. I am not sure if it will work if we actually 
need multiple iterations of the loop to get all the dependencies converging, 
but it may be worth trying out.

I am hoping we will be able to reduce the loops in the future. My plan is that 
after finishing with the Log class,  to move it to a new module, with clean and 
well defined dependencies (I need to remove all ConstStrings and LLDB Streams 
from it first), After that I want start moving other low level functionalities 
there as well. That got a bit delayed now, but I should be back to that in a 
week or two.


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Chris Bieneman via Phabricator via lldb-commits
beanz added a comment.

In https://reviews.llvm.org/D29333#661979, @labath wrote:

> I was thinking about that as well. I am not sure if it will work if we 
> actually need multiple iterations of the loop to get all the dependencies 
> converging, but it may be worth trying out.


The way it is supposed to work, CMake will duplicate the libraries on the 
command line in the right order to avoid the need for looping at all.

> I am hoping we will be able to reduce the loops in the future. My plan is 
> that after finishing with the Log class,  to move it to a new module, with 
> clean and well defined dependencies (I need to remove all ConstStrings and 
> LLDB Streams from it first), After that I want start moving other low level 
> functionalities there as well. That got a bit delayed now, but I should be 
> back to that in a week or two.

This would be great!


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D29333#661994, @beanz wrote:

> In https://reviews.llvm.org/D29333#661979, @labath wrote:
>
> > I was thinking about that as well. I am not sure if it will work if we 
> > actually need multiple iterations of the loop to get all the dependencies 
> > converging, but it may be worth trying out.
>
>
> The way it is supposed to work, CMake will duplicate the libraries on the 
> command line in the right order to avoid the need for looping at all.


I am not sure that is enough. Imagine this:
X.a(x1.o x2.o)
Y.a(y1.o y2.o)

if X depends on Y and vice-versa, cmake will add something like -lX -lY -lX
however, if the dependency graph is something like:
main.o -> x1.o -> y1.o -> x2.o -> y2.o

then this won't be enough because by the time the linker figures out it really 
needs y2.o it will already have scanned past the -lY, and the link will still 
fail. It this example it is enough to repeat all libraries twice, but in theory 
the chain can be arbitrarily long and cmake has no way of figuring that out.

  labath4 /tmp/X $ nm x.a
  
  x1.o:
   T _x1
   U _y1
  
  x2.o:
   T _x2
   U _y2
  labath4 /tmp/X $ nm y.a
  
  y1.o:
   U _x2
   T _y1
  
  y2.o:
   T _y2
  
  labath4 /tmp/X $ gcc main.c
  /tmp/ccAoBLxC.o: In function `main':
  main.c:(.text+0xa): undefined reference to `_x1'
  collect2: error: ld returned 1 exit status
  
  labath4 /tmp/X $ gcc main.c x.a y.a x.a
  x.a(x2.o): In function `_x2':
  a.c:(.text+0xa): undefined reference to `_y2'
  collect2: error: ld returned 1 exit status
  
  labath4 /tmp/X $ gcc main.c x.a y.a x.a y.a && echo OK
  OK

That said, maybe the situation in lldb is not so dire, and it will actually 
work -- only one way to find out.


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL293686: [CMake] Add accurate dependency specifications 
(authored by cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D29333?vs=86461&id=86481#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29333

Files:
  lldb/trunk/source/Breakpoint/CMakeLists.txt
  lldb/trunk/source/Commands/CMakeLists.txt
  lldb/trunk/source/Core/CMakeLists.txt
  lldb/trunk/source/DataFormatters/CMakeLists.txt
  lldb/trunk/source/Expression/CMakeLists.txt
  lldb/trunk/source/Host/CMakeLists.txt
  lldb/trunk/source/Initialization/CMakeLists.txt
  lldb/trunk/source/Interpreter/CMakeLists.txt
  lldb/trunk/source/Symbol/CMakeLists.txt
  lldb/trunk/source/Target/CMakeLists.txt
  lldb/trunk/source/Utility/CMakeLists.txt
  lldb/trunk/tools/argdumper/CMakeLists.txt
  lldb/trunk/tools/debugserver/source/CMakeLists.txt
  lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
  lldb/trunk/tools/driver/CMakeLists.txt
  lldb/trunk/tools/lldb-mi/CMakeLists.txt
  lldb/trunk/tools/lldb-server/CMakeLists.txt

Index: lldb/trunk/source/Core/CMakeLists.txt
===
--- lldb/trunk/source/Core/CMakeLists.txt
+++ lldb/trunk/source/Core/CMakeLists.txt
@@ -69,5 +69,24 @@
   ValueObjectSyntheticFilter.cpp
   ValueObjectVariable.cpp
   VMRange.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbDataFormatters
+lldbExpression
+lldbHost
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbUtility
+lldbPluginProcessUtility
+lldbPluginCPlusPlusLanguage
+lldbPluginObjCLanguage
+lldbPluginObjectFileJIT
+lldbPluginExpressionParserClang
+
+  LINK_COMPONENTS
+Support
+Demangle
   )
 
Index: lldb/trunk/source/Initialization/CMakeLists.txt
===
--- lldb/trunk/source/Initialization/CMakeLists.txt
+++ lldb/trunk/source/Initialization/CMakeLists.txt
@@ -1,5 +1,36 @@
+if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
+  list(APPEND EXTRA_PLUGINS lldbPluginObjectFileMachO)
+endif()
+
+if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android|FreeBSD|NetBSD" )
+  list(APPEND EXTRA_PLUGINS lldbPluginProcessPOSIX)
+endif()
+
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessWindowsCommon
+ws2_32
+rpcrt4
+)
+endif ()
+
 add_lldb_library(lldbInitialization
   SystemInitializerCommon.cpp
   SystemInitializer.cpp
   SystemLifetimeManager.cpp
+
+  LINK_LIBS
+lldbCore
+lldbHost
+lldbPluginInstructionARM
+lldbPluginInstructionMIPS
+lldbPluginInstructionMIPS64
+lldbPluginObjectContainerBSDArchive
+lldbPluginObjectContainerMachOArchive
+lldbPluginObjectFileELF
+lldbPluginObjectFilePECOFF
+lldbPluginProcessGDBRemote
+${EXTRA_PLUGINS}
+  LINK_COMPONENTS
+Support
   )
Index: lldb/trunk/source/Target/CMakeLists.txt
===
--- lldb/trunk/source/Target/CMakeLists.txt
+++ lldb/trunk/source/Target/CMakeLists.txt
@@ -58,4 +58,20 @@
   ThreadSpec.cpp
   UnixSignals.cpp
   UnwindAssembly.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbExpression
+lldbHost
+lldbInterpreter
+lldbSymbol
+lldbUtility
+lldbPluginExpressionParserClang
+lldbPluginCPlusPlusLanguage
+lldbPluginObjCLanguage
+lldbPluginProcessUtility
+
+  LINK_COMPONENTS
+Support
   )
Index: lldb/trunk/source/Symbol/CMakeLists.txt
===
--- lldb/trunk/source/Symbol/CMakeLists.txt
+++ lldb/trunk/source/Symbol/CMakeLists.txt
@@ -36,4 +36,25 @@
   Variable.cpp
   VariableList.cpp
   VerifyDecl.cpp
+
+  LINK_LIBS
+clangAST
+clangBasic
+clangFrontend
+lldbCore
+lldbDataFormatters
+lldbExpression
+lldbHost
+lldbTarget
+lldbUtility
+lldbPluginExpressionParserClang
+lldbPluginExpressionParserGo
+lldbPluginSymbolFileDWARF
+lldbPluginSymbolFilePDB
+lldbPluginObjectContainerBSDArchive
+lldbPluginCPlusPlusLanguage
+lldbPluginObjCLanguage
+
+  LINK_COMPONENTS
+Support
   )
Index: lldb/trunk/source/Utility/CMakeLists.txt
===
--- lldb/trunk/source/Utility/CMakeLists.txt
+++ lldb/trunk/source/Utility/CMakeLists.txt
@@ -16,4 +16,12 @@
   StringLexer.cpp
   TaskPool.cpp
   UriParser.cpp
+
+  LINK_LIBS
+lldbCore
+lldbHost
+lldbTarget
+
+  LINK_COMPONENTS
+Support
   )
Index: lldb/trunk/source/Interpreter/CMakeLists.txt
===
--- lldb/trunk/source/Interpreter/CMakeLists.txt
+++ lldb/trunk/source/Interpreter/CMakeLists.txt
@@ -43,4 +43,15 @@
   Options.cpp
   Property.cpp
   ScriptInterpreter.cpp
+
+  LINK_LIBS
+lldbCommands
+lldbCore
+lldbDataFormatters
+lldbHost
+lldbTarget
+lldbUtility
+
+  LINK_COMPON

[Lldb-commits] [lldb] r293686 - [CMake] Add accurate dependency specifications

2017-01-31 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan 31 14:43:05 2017
New Revision: 293686

URL: http://llvm.org/viewvc/llvm-project?rev=293686&view=rev
Log:
[CMake] Add accurate dependency specifications

Summary:
This patch adds accurate dependency specifications to the mail LLDB libraries 
and tools.

In all cases except lldb-server, these dependencies are added in addition to 
existing dependencies (making this low risk), and I performed some code cleanup 
along the way.

For lldb-server I've cleaned up the LLVM dependencies down to just the minimum 
actually required. This is more than lldb-server actually directly references, 
and I've left a todo in the code to clean that up.

Reviewers: labath, zturner

Subscribers: lldb-commits, danalbert, srhines, ki.stfu, mgorny, jgosnell

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

Modified:
lldb/trunk/source/Breakpoint/CMakeLists.txt
lldb/trunk/source/Commands/CMakeLists.txt
lldb/trunk/source/Core/CMakeLists.txt
lldb/trunk/source/DataFormatters/CMakeLists.txt
lldb/trunk/source/Expression/CMakeLists.txt
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/source/Initialization/CMakeLists.txt
lldb/trunk/source/Interpreter/CMakeLists.txt
lldb/trunk/source/Symbol/CMakeLists.txt
lldb/trunk/source/Target/CMakeLists.txt
lldb/trunk/source/Utility/CMakeLists.txt
lldb/trunk/tools/argdumper/CMakeLists.txt
lldb/trunk/tools/debugserver/source/CMakeLists.txt
lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
lldb/trunk/tools/driver/CMakeLists.txt
lldb/trunk/tools/lldb-mi/CMakeLists.txt
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/source/Breakpoint/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/CMakeLists.txt?rev=293686&r1=293685&r2=293686&view=diff
==
--- lldb/trunk/source/Breakpoint/CMakeLists.txt (original)
+++ lldb/trunk/source/Breakpoint/CMakeLists.txt Tue Jan 31 14:43:05 2017
@@ -20,4 +20,16 @@ add_lldb_library(lldbBreakpoint
   Watchpoint.cpp
   WatchpointList.cpp
   WatchpointOptions.cpp
+
+  LINK_LIBS
+lldbCore
+lldbExpression
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbPluginCPlusPlusLanguage
+lldbPluginObjCLanguage
+
+  LINK_COMPONENTS
+Support
   )

Modified: lldb/trunk/source/Commands/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CMakeLists.txt?rev=293686&r1=293685&r2=293686&view=diff
==
--- lldb/trunk/source/Commands/CMakeLists.txt (original)
+++ lldb/trunk/source/Commands/CMakeLists.txt Tue Jan 31 14:43:05 2017
@@ -29,4 +29,19 @@ add_lldb_library(lldbCommands
   CommandObjectWatchpoint.cpp
   CommandObjectWatchpointCommand.cpp
   CommandObjectLanguage.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbDataFormatters
+lldbExpression
+lldbHost
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbUtility
+lldbPluginExpressionParserClang
+
+  LINK_COMPONENTS
+Support
   )

Modified: lldb/trunk/source/Core/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=293686&r1=293685&r2=293686&view=diff
==
--- lldb/trunk/source/Core/CMakeLists.txt (original)
+++ lldb/trunk/source/Core/CMakeLists.txt Tue Jan 31 14:43:05 2017
@@ -69,5 +69,24 @@ add_lldb_library(lldbCore
   ValueObjectSyntheticFilter.cpp
   ValueObjectVariable.cpp
   VMRange.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbDataFormatters
+lldbExpression
+lldbHost
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbUtility
+lldbPluginProcessUtility
+lldbPluginCPlusPlusLanguage
+lldbPluginObjCLanguage
+lldbPluginObjectFileJIT
+lldbPluginExpressionParserClang
+
+  LINK_COMPONENTS
+Support
+Demangle
   )
 

Modified: lldb/trunk/source/DataFormatters/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/CMakeLists.txt?rev=293686&r1=293685&r2=293686&view=diff
==
--- lldb/trunk/source/DataFormatters/CMakeLists.txt (original)
+++ lldb/trunk/source/DataFormatters/CMakeLists.txt Tue Jan 31 14:43:05 2017
@@ -16,4 +16,14 @@ add_lldb_library(lldbDataFormatters
   TypeValidator.cpp
   ValueObjectPrinter.cpp
   VectorType.cpp
+
+  LINK_LIBS
+lldbCore
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbUtility
+  
+  LINK_COMPONENTS
+Support
   )

Modified: lldb/trunk/source/Expression/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/CMakeLists.txt?rev=293686&r1=293685&r2=293686&view=diff
==
--- lldb/trunk/source/Expression/CMakeLists.txt (original)

[Lldb-commits] [PATCH] D29333: [CMake] Add accurate dependency specifications

2017-01-31 Thread Chris Bieneman via Phabricator via lldb-commits
beanz added a comment.

@labath, we'll have to see if CMake's handling is good enough. What CMake 
actually does is repeat the full chain of the cycle, so it would be something 
like adding `-lX -lY -lX -lY` in your example. This doesn't work for certain 
pathological cases, but CMake actually has mechanisms to help deal with that 
too if we need them:

https://cmake.org/cmake/help/v3.4/command/target_link_libraries.html#cyclic-dependencies-of-static-libraries


https://reviews.llvm.org/D29333



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r293687 - [CMake] Fix broken NetBSD bots

2017-01-31 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan 31 14:52:41 2017
New Revision: 293687

URL: http://llvm.org/viewvc/llvm-project?rev=293687&view=rev
Log:
[CMake] Fix broken NetBSD bots

http://lab.llvm.org:8011/builders/lldb-amd64-ninja-netbsd7/builds/4558/steps/cmake%20local/logs/stdio

Modified:
lldb/trunk/source/Host/CMakeLists.txt

Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=293687&r1=293686&r2=293687&view=diff
==
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Tue Jan 31 14:52:41 2017
@@ -163,6 +163,10 @@ if (${get_python_libdir})
   endif()
 endif()
 
+if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+ set(EXTRA_LIBS kvm)
+endif ()
+
 add_lldb_library(lldbHost
   ${HOST_SOURCES}
   
@@ -173,11 +177,8 @@ add_lldb_library(lldbHost
 lldbTarget
 lldbUtility
 ${LLDB_PLUGINS}
+${EXTRA_LIBS}
   
   LINK_COMPONENTS
 Support
   )
-
-if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
-target_link_libraries(lldbHost kvm)
-endif ()


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r293690 - [CMake] Partial revert of r293686

2017-01-31 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan 31 15:12:52 2017
New Revision: 293690

URL: http://llvm.org/viewvc/llvm-project?rev=293690&view=rev
Log:
[CMake] Partial revert of r293686

This change reverts the lldb-server part of r293686, which is having trouble on 
Linux bots. I'm not sure if I can make lldb-server work correctly until the 
full dependency graph is fixed.

Modified:
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=293690&r1=293689&r2=293690&view=diff
==
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Tue Jan 31 15:12:52 2017
@@ -23,6 +23,90 @@ endif ()
 
 include_directories(../../source)
 
+
+set( LLDB_USED_LIBS
+  lldbBase
+  lldbBreakpoint
+  lldbCommands
+  lldbDataFormatters
+  lldbHost
+  lldbCore
+  lldbExpression
+  lldbInitialization
+  lldbInterpreter
+  lldbSymbol
+  lldbTarget
+  lldbUtility
+
+  # Plugins
+  lldbPluginDisassemblerLLVM
+  lldbPluginSymbolFileDWARF
+  lldbPluginSymbolFilePDB
+  lldbPluginSymbolFileSymtab
+  lldbPluginDynamicLoaderPosixDYLD
+
+  lldbPluginCPlusPlusLanguage
+  lldbPluginGoLanguage
+  lldbPluginJavaLanguage
+  lldbPluginObjCLanguage
+  lldbPluginObjCPlusPlusLanguage
+  lldbPluginOCamlLanguage
+
+  lldbPluginObjectFileELF
+  lldbPluginObjectFileJIT
+  lldbPluginSymbolVendorELF
+  lldbPluginPlatformPOSIX
+  lldbPluginObjectContainerBSDArchive
+  lldbPluginObjectContainerMachOArchive
+  lldbPluginProcessGDBRemote
+  lldbPluginProcessUtility
+  lldbPluginObjectContainerMachOArchive
+  lldbPluginObjectContainerBSDArchive
+  lldbPluginPlatformMacOSX
+  lldbPluginUnwindAssemblyInstEmulation
+  lldbPluginUnwindAssemblyX86
+  lldbPluginAppleObjCRuntime
+  lldbPluginCXXItaniumABI
+  lldbPluginInstructionARM
+  lldbPluginInstructionARM64
+  lldbPluginInstructionMIPS
+  lldbPluginInstructionMIPS64
+  lldbPluginObjectFilePECOFF
+  lldbPluginExpressionParserClang
+  lldbPluginExpressionParserGo
+  )
+
+# Linux-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessLinux
+lldbPluginProcessPOSIX
+   )
+endif ()
+
+# Darwin-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginObjectFileMachO
+)
+endif()
+
+set( CLANG_USED_LIBS
+  clangAnalysis
+  clangAST
+  clangBasic
+  clangCodeGen
+  clangDriver
+  clangEdit
+  clangFrontend
+  clangLex
+  clangParse
+  clangRewrite
+  clangRewriteFrontend
+  clangSema
+  clangSerialization
+  )
+
 set(LLDB_SYSTEM_LIBS)
 if (NOT LLDB_DISABLE_LIBEDIT)
   list(APPEND LLDB_SYSTEM_LIBS edit)
@@ -58,26 +142,55 @@ if (LLVM_BUILD_STATIC)
   endif()
 endif()
 
+set(LLVM_LINK_COMPONENTS
+  ${LLVM_TARGETS_TO_BUILD}
+  interpreter
+  asmparser
+  bitreader
+  bitwriter
+  codegen
+  demangle
+  ipo
+  selectiondag
+  bitreader
+  mc
+  mcjit
+  core
+  mcdisassembler
+  executionengine
+  runtimedyld
+  option
+  support
+  coverage
+  target
+  )
+
 add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK
 Acceptor.cpp
 lldb-gdbserver.cpp
 lldb-platform.cpp
 lldb-server.cpp
 LLDBServerUtilities.cpp
-
-LINK_LIBS
-  lldbBase
-  lldbCore
-  lldbHost
-  lldbInitialization
-  lldbInterpreter
-  ${LLDB_SYSTEM_LIBS}
-
-LINK_COMPONENTS
-  Support
-  MCJIT # TODO: Remove this after the plugins are updated
 )
 
+# The Darwin linker doesn't understand --start-group/--end-group.
+if (LLDB_LINKER_SUPPORTS_GROUPS)
+  target_link_libraries(lldb-server
+-Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+  target_link_libraries(lldb-server
+-Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
+else()
+  target_link_libraries(lldb-server ${LLDB_USED_LIBS})
+  target_link_libraries(lldb-server ${CLANG_USED_LIBS})
+endif()
+if(NOT LLVM_LINK_LLVM_DYLIB)
+  # This is necessary in !LLVM_LINK_LLVM_DYLIB as LLDB's libs do not track 
their
+  # dependencies properly. It is conditional because in a LLVM_LINK_LLVM_DYLIB
+  # build it would introduce duplicate symbols (add_lldb_tool links to libLLVM,
+  # and this would add the individual .a files as well).
+  llvm_config(lldb-server ${LLVM_LINK_COMPONENTS})
+endif()
+
 target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS})
 
 set_target_properties(lldb-server PROPERTIES VERSION ${LLDB_VERSION})


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29256: Do not pass non-POD type variables through variadic function

2017-01-31 Thread Tobias Nygren via Phabricator via lldb-commits
tnn added a comment.

Attaching full error message as requested. Still reproducable on NetBSD's 
head-LLVM snapshot.
F3050737: lldb-build.txt 


Repository:
  rL LLVM

https://reviews.llvm.org/D29256



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29347: Add ProcessLauncherNetBSD to spawn a tracee

2017-01-31 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski created this revision.
krytarowski added a project: LLDB.
Herald added a subscriber: mgorny.

Base this code on Linux.

Sponsored by 


Repository:
  rL LLVM

https://reviews.llvm.org/D29347

Files:
  include/lldb/Host/netbsd/ProcessLauncherNetBSD.h
  source/Host/CMakeLists.txt
  source/Host/common/Host.cpp
  source/Host/netbsd/ProcessLauncherNetBSD.cpp

Index: source/Host/netbsd/ProcessLauncherNetBSD.cpp
===
--- /dev/null
+++ source/Host/netbsd/ProcessLauncherNetBSD.cpp
@@ -0,0 +1,170 @@
+//===-- ProcessLauncherNetBSD.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/netbsd/ProcessLauncherNetBSD.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 
+#include 
+#include 
+
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+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");
+
+  Args env = info.GetEnvironmentEntries();
+  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 ||
+  sigprocmask(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(argv),
+ const_cast(envp));
+
+  // ...unless exec fails.  In which case we definitely need to end the child
+  // here.
+  ExitWithError(error_fd, "execve");
+}
+
+HostProcess
+ProcessLauncherNetBSD::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 t

[Lldb-commits] [PATCH] D29347: Add ProcessLauncherNetBSD to spawn a tracee

2017-01-31 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

This patch was already open in a discussion with @labath, I'm pushing it here 
to point the appropriate solution during review.


Repository:
  rL LLVM

https://reviews.llvm.org/D29347



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29347: Add ProcessLauncherNetBSD to spawn a tracee

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

This is also copying a lot of code only to make tiny changes to it. Please put 
the Linux process launcher into the posix folder (I suggest naming it 
ProcessLauncherPosixFork). Ifdef out the linux-specific parts (ASLR, 
personality) and you're done. :)

For bonus points, you can put the ASLR code into a separate function, and then 
ifdef-out only that - should make main code flow better.


Repository:
  rL LLVM

https://reviews.llvm.org/D29347



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29347: Add ProcessLauncherNetBSD to spawn a tracee

2017-01-31 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

In https://reviews.llvm.org/D29347#662145, @labath wrote:

> This is also copying a lot of code only to make tiny changes to it. Please 
> put the Linux process launcher into the posix folder (I suggest naming it 
> ProcessLauncherPosixFork). Ifdef out the linux-specific parts (ASLR, 
> personality) and you're done. :)
>
> For bonus points, you can put the ASLR code into a separate function, and 
> then ifdef-out only that - should make main code flow better.


I will do it. Thank you for quick reply.


Repository:
  rL LLVM

https://reviews.llvm.org/D29347



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29348: [CMake] Add explicit dependencies to plugins

2017-01-31 Thread Chris Bieneman via Phabricator via lldb-commits
beanz created this revision.
Herald added subscribers: jgosnell, mgorny, nemanjai.

This patch does two things. First it updates all the ABI plugins with accurate 
dependencies, and second it adds a tracking mechanism for add_lldb_library to 
denote plugin libraries, allowing us to build up a list of all the configured 
plugins.

This list of generated plugins will be used during generating liblldb so that 
we can link all the plugins into the library.

If this patch looks good I will update all the other plugins in subsequent 
patches.


https://reviews.llvm.org/D29348

Files:
  cmake/modules/AddLLDB.cmake
  source/Plugins/ABI/MacOSX-arm/CMakeLists.txt
  source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt
  source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
  source/Plugins/ABI/SysV-arm/CMakeLists.txt
  source/Plugins/ABI/SysV-arm64/CMakeLists.txt
  source/Plugins/ABI/SysV-hexagon/CMakeLists.txt
  source/Plugins/ABI/SysV-i386/CMakeLists.txt
  source/Plugins/ABI/SysV-mips/CMakeLists.txt
  source/Plugins/ABI/SysV-mips64/CMakeLists.txt
  source/Plugins/ABI/SysV-ppc/CMakeLists.txt
  source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
  source/Plugins/ABI/SysV-s390x/CMakeLists.txt
  source/Plugins/ABI/SysV-x86_64/CMakeLists.txt

Index: source/Plugins/ABI/SysV-x86_64/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-x86_64/CMakeLists.txt
+++ source/Plugins/ABI/SysV-x86_64/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_x86_64
+add_lldb_library(lldbPluginABISysV_x86_64 PLUGIN
   ABISysV_x86_64.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: source/Plugins/ABI/SysV-s390x/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-s390x/CMakeLists.txt
+++ source/Plugins/ABI/SysV-s390x/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_s390x
+add_lldb_library(lldbPluginABISysV_s390x PLUGIN
   ABISysV_s390x.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
+++ source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_ppc64
+add_lldb_library(lldbPluginABISysV_ppc64 PLUGIN
   ABISysV_ppc64.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: source/Plugins/ABI/SysV-ppc/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-ppc/CMakeLists.txt
+++ source/Plugins/ABI/SysV-ppc/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_ppc
+add_lldb_library(lldbPluginABISysV_ppc PLUGIN
   ABISysV_ppc.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: source/Plugins/ABI/SysV-mips64/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-mips64/CMakeLists.txt
+++ source/Plugins/ABI/SysV-mips64/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_mips64
+add_lldb_library(lldbPluginABISysV_mips64 PLUGIN
   ABISysV_mips64.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: source/Plugins/ABI/SysV-mips/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-mips/CMakeLists.txt
+++ source/Plugins/ABI/SysV-mips/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_mips
+add_lldb_library(lldbPluginABISysV_mips PLUGIN
   ABISysV_mips.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: source/Plugins/ABI/SysV-i386/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-i386/CMakeLists.txt
+++ source/Plugins/ABI/SysV-i386/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_i386
+add_lldb_library(lldbPluginABISysV_i386 PLUGIN
   ABISysV_i386.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: source/Plugins/ABI/SysV-hexagon/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-hexagon/CMakeLists.txt
+++ source/Plugins/ABI/SysV-hexagon/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_hexagon
+add_lldb_library(lldbPluginABISysV_hexagon PLUGIN
   ABISysV_hexagon.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: source/Plugins/ABI/SysV-arm64/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-arm64/CMakeLists.txt
+++ source/Plugins/ABI/SysV-arm64/CMakeLis

[Lldb-commits] [PATCH] D29256: Do not pass non-POD type variables through variadic function

2017-01-31 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

@ki.stfu do you still agree with this patch?


Repository:
  rL LLVM

https://reviews.llvm.org/D29256



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29266: Synchronize PlatformNetBSD with Linux

2017-01-31 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

In https://reviews.llvm.org/D29266#661839, @labath wrote:

> After looking at this closer, I don't think we will even need a separate 
> class to achieve deduplication. The code is so heavily duplicated (see 
> comments on the first three non-boilerplate functions, I did not look at the 
> rest yet, but I expect the situation to be the same) already that we can just 
> push the definitions down the existing class hierarchy and achieve massive 
> savings that way. After we're done with that, I think we'll find that the 
> PlatformLinux class will be so small that your current s/linux/netbsd/ 
> approach will no longer be a problem.
>
> If @clayborg agrees with this approach, I can help you prepare the ground for 
> that.


I'm looking forward to this approach. In the past NetBSD code was almost exact 
copy of the FreeBSD one. Once we will deduplicate the code, FreeBSD will catch 
up.


Repository:
  rL LLVM

https://reviews.llvm.org/D29266



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r293696 - [CMake] Add explicit dependencies to plugins

2017-01-31 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan 31 16:12:59 2017
New Revision: 293696

URL: http://llvm.org/viewvc/llvm-project?rev=293696&view=rev
Log:
[CMake] Add explicit dependencies to plugins

Summary:
This patch does two things. First it updates all the ABI plugins with accurate 
dependencies, and second it adds a tracking mechanism for add_lldb_library to 
denote plugin libraries, allowing us to build up a list of all the configured 
plugins.

This list of generated plugins will be used during generating liblldb so that 
we can link all the plugins into the library.

If this patch looks good I will update all the other plugins in subsequent 
patches.

Reviewers: labath, zturner

Subscribers: nemanjai, mgorny, lldb-commits, jgosnell

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

Modified:
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-arm/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-arm64/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-hexagon/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-i386/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-mips/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-mips64/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-ppc/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-s390x/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-x86_64/CMakeLists.txt

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=293696&r1=293695&r2=293696&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Tue Jan 31 16:12:59 2017
@@ -21,13 +21,17 @@ function(add_lldb_library name)
   # only supported parameters to this macro are the optional
   # MODULE;SHARED;STATIC library type and source files
   cmake_parse_arguments(PARAM
-"MODULE;SHARED;STATIC;OBJECT"
+"MODULE;SHARED;STATIC;OBJECT;PLUGIN"
 ""
 "DEPENDS;LINK_LIBS;LINK_COMPONENTS"
 ${ARGN})
   llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
   list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})
 
+  if(PARAM_PLUGIN)
+set_property(GLOBAL APPEND PROPERTY LLDB_PLUGINS ${name})
+  endif()
+
   if (MSVC_IDE OR XCODE)
 string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
 list(GET split_path -1 dir)

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt?rev=293696&r1=293695&r2=293696&view=diff
==
--- lldb/trunk/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt Tue Jan 31 16:12:59 
2017
@@ -1,3 +1,11 @@
-add_lldb_library(lldbPluginABIMacOSX_arm
+add_lldb_library(lldbPluginABIMacOSX_arm PLUGIN
   ABIMacOSX_arm.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+lldbPluginProcessUtility
+  LINK_COMPONENTS
+Support
   )

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt?rev=293696&r1=293695&r2=293696&view=diff
==
--- lldb/trunk/source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt Tue Jan 31 
16:12:59 2017
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABIMacOSX_arm64
+add_lldb_library(lldbPluginABIMacOSX_arm64 PLUGIN
   ABIMacOSX_arm64.cpp
+  
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt?rev=293696&r1=293695&r2=293696&view=diff
==
--- lldb/trunk/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt Tue Jan 31 
16:12:59 2017
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABIMacOSX_i386
+add_lldb_library(lldbPluginABIMacOSX_i386 PLUGIN
   ABIMacOSX_i386.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )

Modified: lldb/trunk/source/Plugins/ABI/SysV-arm/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-arm/CMakeLists.txt?rev=293696&r1=293695&r2=293696&view=diff
=

[Lldb-commits] [PATCH] D29348: [CMake] Add explicit dependencies to plugins

2017-01-31 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL293696: [CMake] Add explicit dependencies to plugins 
(authored by cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D29348?vs=86490&id=86497#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29348

Files:
  lldb/trunk/cmake/modules/AddLLDB.cmake
  lldb/trunk/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-arm/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-arm64/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-hexagon/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-i386/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-mips/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-mips64/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-ppc/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-s390x/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-x86_64/CMakeLists.txt

Index: lldb/trunk/cmake/modules/AddLLDB.cmake
===
--- lldb/trunk/cmake/modules/AddLLDB.cmake
+++ lldb/trunk/cmake/modules/AddLLDB.cmake
@@ -21,13 +21,17 @@
   # only supported parameters to this macro are the optional
   # MODULE;SHARED;STATIC library type and source files
   cmake_parse_arguments(PARAM
-"MODULE;SHARED;STATIC;OBJECT"
+"MODULE;SHARED;STATIC;OBJECT;PLUGIN"
 ""
 "DEPENDS;LINK_LIBS;LINK_COMPONENTS"
 ${ARGN})
   llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
   list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})
 
+  if(PARAM_PLUGIN)
+set_property(GLOBAL APPEND PROPERTY LLDB_PLUGINS ${name})
+  endif()
+
   if (MSVC_IDE OR XCODE)
 string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
 list(GET split_path -1 dir)
Index: lldb/trunk/source/Plugins/ABI/SysV-arm/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/ABI/SysV-arm/CMakeLists.txt
+++ lldb/trunk/source/Plugins/ABI/SysV-arm/CMakeLists.txt
@@ -1,3 +1,11 @@
-add_lldb_library(lldbPluginABISysV_arm
+add_lldb_library(lldbPluginABISysV_arm PLUGIN
   ABISysV_arm.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+lldbPluginProcessUtility
+  LINK_COMPONENTS
+Support
   )
Index: lldb/trunk/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
+++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABIMacOSX_i386
+add_lldb_library(lldbPluginABIMacOSX_i386 PLUGIN
   ABIMacOSX_i386.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: lldb/trunk/source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt
+++ lldb/trunk/source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABIMacOSX_arm64
+add_lldb_library(lldbPluginABIMacOSX_arm64 PLUGIN
   ABIMacOSX_arm64.cpp
+  
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: lldb/trunk/source/Plugins/ABI/SysV-x86_64/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/CMakeLists.txt
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_x86_64
+add_lldb_library(lldbPluginABISysV_x86_64 PLUGIN
   ABISysV_x86_64.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: lldb/trunk/source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_ppc64
+add_lldb_library(lldbPluginABISysV_ppc64 PLUGIN
   ABISysV_ppc64.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: lldb/trunk/source/Plugins/ABI/SysV-i386/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/ABI/SysV-i386/CMakeLists.txt
+++ lldb/trunk/source/Plugins/ABI/SysV-i386/CMakeLists.txt
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginABISysV_i386
+add_lldb_library(lldbPluginABISysV_i386 PLUGIN
   ABISysV_i386.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
   )
Index: lldb/trunk/source/Plugins/ABI/SysV-hexagon/CMakeLists.txt
===

[Lldb-commits] [lldb] r293698 - [CMake] [1/4] Update a batch of plugins

2017-01-31 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan 31 16:21:19 2017
New Revision: 293698

URL: http://llvm.org/viewvc/llvm-project?rev=293698&view=rev
Log:
[CMake] [1/4] Update a batch of plugins

This is extending the updates from r293696 to more LLDB plugins.

Modified:
lldb/trunk/source/Plugins/Disassembler/llvm/CMakeLists.txt
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt
lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/CMakeLists.txt
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt
lldb/trunk/source/Plugins/DynamicLoader/Static/CMakeLists.txt
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt
lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/trunk/source/Plugins/ExpressionParser/Go/CMakeLists.txt
lldb/trunk/source/Plugins/Instruction/ARM/CMakeLists.txt
lldb/trunk/source/Plugins/Instruction/ARM64/CMakeLists.txt
lldb/trunk/source/Plugins/Instruction/MIPS/CMakeLists.txt
lldb/trunk/source/Plugins/Instruction/MIPS64/CMakeLists.txt

lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/CMakeLists.txt

lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/CMakeLists.txt
lldb/trunk/source/Plugins/JITLoader/GDB/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/CMakeLists.txt?rev=293698&r1=293697&r2=293698&view=diff
==
--- lldb/trunk/source/Plugins/Disassembler/llvm/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/CMakeLists.txt Tue Jan 31 
16:21:19 2017
@@ -1,3 +1,12 @@
-add_lldb_library(lldbPluginDisassemblerLLVM
+add_lldb_library(lldbPluginDisassemblerLLVM PLUGIN
   DisassemblerLLVMC.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+${LLVM_TARGETS_TO_BUILD}
+MC
+Support
   )

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt?rev=293698&r1=293697&r2=293698&view=diff
==
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt 
(original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt Tue 
Jan 31 16:21:19 2017
@@ -1,3 +1,13 @@
-add_lldb_library(lldbPluginDynamicLoaderDarwinKernel
+add_lldb_library(lldbPluginDynamicLoaderDarwinKernel PLUGIN
   DynamicLoaderDarwinKernel.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbHost
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbUtility
+lldbPluginPlatformMacOSX
   )

Modified: lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/CMakeLists.txt?rev=293698&r1=293697&r2=293698&view=diff
==
--- lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/CMakeLists.txt 
(original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/CMakeLists.txt Tue Jan 
31 16:21:19 2017
@@ -1,4 +1,10 @@
-add_lldb_library(lldbPluginDynamicLoaderHexagonDYLD
+add_lldb_library(lldbPluginDynamicLoaderHexagonDYLD PLUGIN
   HexagonDYLDRendezvous.cpp
   DynamicLoaderHexagonDYLD.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbSymbol
+lldbTarget
   )

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt?rev=293698&r1=293697&r2=293698&view=diff
==
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt 
(original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt Tue Jan 
31 16:21:19 2017
@@ -1,5 +1,16 @@
-add_lldb_library(lldbPluginDynamicLoaderMacOSXDYLD
+add_lldb_library(lldbPluginDynamicLoaderMacOSXDYLD PLUGIN
   DynamicLoaderMacOSXDYLD.cpp
   DynamicLoaderMacOS.cpp
   DynamicLoaderDarwin.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbExpression
+lldbHost
+lldbSymbol
+lldbTarget
+lldbUtility
+  LINK_COMPONENTS
+Support
   )

Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt?rev=293698&r1=293697&r2=293698&view=diff
==
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.

[Lldb-commits] [lldb] r293699 - [CMake] [2/4] Update a batch of plugins

2017-01-31 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan 31 16:23:49 2017
New Revision: 293699

URL: http://llvm.org/viewvc/llvm-project?rev=293699&view=rev
Log:
[CMake] [2/4] Update a batch of plugins

This is extending the updates from r293696 to more LLDB plugins.

Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/Go/CMakeLists.txt
lldb/trunk/source/Plugins/Language/Java/CMakeLists.txt
lldb/trunk/source/Plugins/Language/OCaml/CMakeLists.txt
lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt
lldb/trunk/source/Plugins/Language/ObjCPlusPlus/CMakeLists.txt

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt
lldb/trunk/source/Plugins/LanguageRuntime/Go/CMakeLists.txt
lldb/trunk/source/Plugins/LanguageRuntime/Java/CMakeLists.txt

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt
lldb/trunk/source/Plugins/MemoryHistory/asan/CMakeLists.txt
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/CMakeLists.txt
lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/CMakeLists.txt
lldb/trunk/source/Plugins/ObjectFile/ELF/CMakeLists.txt
lldb/trunk/source/Plugins/ObjectFile/JIT/CMakeLists.txt
lldb/trunk/source/Plugins/ObjectFile/Mach-O/CMakeLists.txt
lldb/trunk/source/Plugins/ObjectFile/PECOFF/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt?rev=293699&r1=293698&r2=293699&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt Tue Jan 31 
16:23:49 2017
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginCPlusPlusLanguage
+add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   BlockPointer.cpp
   CPlusPlusLanguage.cpp
   CxxStringTypes.cpp
@@ -12,4 +12,14 @@ add_lldb_library(lldbPluginCPlusPlusLang
   LibStdcpp.cpp
   LibStdcppTuple.cpp
   LibStdcppUniquePointer.cpp
+
+  LINK_LIBS
+lldbCore
+lldbDataFormatters
+lldbHost
+lldbSymbol
+lldbTarget
+lldbUtility
+  LINK_COMPONENTS
+Support
 )

Modified: lldb/trunk/source/Plugins/Language/Go/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/Go/CMakeLists.txt?rev=293699&r1=293698&r2=293699&view=diff
==
--- lldb/trunk/source/Plugins/Language/Go/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Language/Go/CMakeLists.txt Tue Jan 31 16:23:49 
2017
@@ -1,4 +1,13 @@
-add_lldb_library(lldbPluginGoLanguage
+add_lldb_library(lldbPluginGoLanguage PLUGIN
   GoLanguage.cpp
   GoFormatterFunctions.cpp
+
+  LINK_LIBS
+clangAST
+lldbCore
+lldbDataFormatters
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
 )

Modified: lldb/trunk/source/Plugins/Language/Java/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/Java/CMakeLists.txt?rev=293699&r1=293698&r2=293699&view=diff
==
--- lldb/trunk/source/Plugins/Language/Java/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Language/Java/CMakeLists.txt Tue Jan 31 16:23:49 
2017
@@ -1,4 +1,12 @@
-add_lldb_library(lldbPluginJavaLanguage
+add_lldb_library(lldbPluginJavaLanguage PLUGIN
   JavaFormatterFunctions.cpp
   JavaLanguage.cpp
+
+  LINK_LIBS
+lldbCore
+lldbDataFormatters
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
 )

Modified: lldb/trunk/source/Plugins/Language/OCaml/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/OCaml/CMakeLists.txt?rev=293699&r1=293698&r2=293699&view=diff
==
--- lldb/trunk/source/Plugins/Language/OCaml/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Language/OCaml/CMakeLists.txt Tue Jan 31 16:23:49 
2017
@@ -1,4 +1,12 @@
-add_lldb_library(lldbPluginOCamlLanguage
+add_lldb_library(lldbPluginOCamlLanguage PLUGIN
   OCamlLanguage.cpp
+
+  LINK_LIBS
+lldbCore
+lldbDataFormatters
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
 )
 

Modified: lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt?rev=293699&r1=293698&r2=293699&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt Tue Jan 31 16:23:49 
2017
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginObjCL

[Lldb-commits] [lldb] r293700 - [CMake] [3/4] Update a batch of plugins

2017-01-31 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan 31 16:29:11 2017
New Revision: 293700

URL: http://llvm.org/viewvc/llvm-project?rev=293700&view=rev
Log:
[CMake] [3/4] Update a batch of plugins

This is extending the updates from r293696 to more LLDB plugins.

Modified:
lldb/trunk/source/Plugins/OperatingSystem/Go/CMakeLists.txt
lldb/trunk/source/Plugins/OperatingSystem/Python/CMakeLists.txt
lldb/trunk/source/Plugins/Platform/Android/CMakeLists.txt
lldb/trunk/source/Plugins/Platform/FreeBSD/CMakeLists.txt
lldb/trunk/source/Plugins/Platform/Kalimba/CMakeLists.txt
lldb/trunk/source/Plugins/Platform/Linux/CMakeLists.txt
lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt
lldb/trunk/source/Plugins/Platform/NetBSD/CMakeLists.txt
lldb/trunk/source/Plugins/Platform/POSIX/CMakeLists.txt
lldb/trunk/source/Plugins/Platform/Windows/CMakeLists.txt
lldb/trunk/source/Plugins/Platform/gdb-server/CMakeLists.txt
lldb/trunk/source/Plugins/Process/FreeBSD/CMakeLists.txt
lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CMakeLists.txt
lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt
lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt
lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt
lldb/trunk/source/Plugins/Process/elf-core/CMakeLists.txt
lldb/trunk/source/Plugins/Process/gdb-remote/CMakeLists.txt
lldb/trunk/source/Plugins/Process/mach-core/CMakeLists.txt
lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/OperatingSystem/Go/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Go/CMakeLists.txt?rev=293700&r1=293699&r2=293700&view=diff
==
--- lldb/trunk/source/Plugins/OperatingSystem/Go/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/OperatingSystem/Go/CMakeLists.txt Tue Jan 31 
16:29:11 2017
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginOSGo
+add_lldb_library(lldbPluginOSGo PLUGIN
   OperatingSystemGo.cpp
+
+  LINK_LIBS
+lldbCore
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbPluginProcessUtility
   )

Modified: lldb/trunk/source/Plugins/OperatingSystem/Python/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Python/CMakeLists.txt?rev=293700&r1=293699&r2=293700&view=diff
==
--- lldb/trunk/source/Plugins/OperatingSystem/Python/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/OperatingSystem/Python/CMakeLists.txt Tue Jan 31 
16:29:11 2017
@@ -1,3 +1,10 @@
-add_lldb_library(lldbPluginOSPython
+add_lldb_library(lldbPluginOSPython PLUGIN
   OperatingSystemPython.cpp
+
+  LINK_LIBS
+lldbCore
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbPluginProcessUtility
   )

Modified: lldb/trunk/source/Plugins/Platform/Android/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/CMakeLists.txt?rev=293700&r1=293699&r2=293700&view=diff
==
--- lldb/trunk/source/Plugins/Platform/Android/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Platform/Android/CMakeLists.txt Tue Jan 31 
16:29:11 2017
@@ -1,5 +1,13 @@
-add_lldb_library(lldbPluginPlatformAndroid
+add_lldb_library(lldbPluginPlatformAndroid PLUGIN
   AdbClient.cpp
   PlatformAndroid.cpp
   PlatformAndroidRemoteGDBServer.cpp
+
+  LINK_LIBS
+lldbCore
+lldbHost
+lldbPluginPlatformLinux
+lldbPluginPlatformGDB
+  LINK_COMPONENTS
+Support
   )

Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/CMakeLists.txt?rev=293700&r1=293699&r2=293700&view=diff
==
--- lldb/trunk/source/Plugins/Platform/FreeBSD/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/CMakeLists.txt Tue Jan 31 
16:29:11 2017
@@ -1,3 +1,9 @@
-add_lldb_library(lldbPluginPlatformFreeBSD
+add_lldb_library(lldbPluginPlatformFreeBSD PLUGIN
   PlatformFreeBSD.cpp
+
+   LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbHost
+lldbTarget
   )

Modified: lldb/trunk/source/Plugins/Platform/Kalimba/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Kalimba/CMakeLists.txt?rev=293700&r1=293699&r2=293700&view=diff
==
--- lldb/trunk/source/Plugins/Platform/Kalimba/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Platform/Kalimba/CMakeLists.txt Tue Jan 31 
16:29:11 2017
@@ -1,3 +1,8 @@
-add_lldb_library(lldbPluginPlatformKalimba
+add_lldb_library(lldbPluginPlatformKalimba PLUGIN
   PlatformKalimba

[Lldb-commits] [lldb] r293701 - [CMake] [4/4] Update a batch of plugins

2017-01-31 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan 31 16:31:38 2017
New Revision: 293701

URL: http://llvm.org/viewvc/llvm-project?rev=293701&view=rev
Log:
[CMake] [4/4] Update a batch of plugins

This is extending the updates from r293696 to more LLDB plugins.

Modified:
lldb/trunk/source/Plugins/ScriptInterpreter/None/CMakeLists.txt
lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
lldb/trunk/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/Symtab/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolVendor/ELF/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/CMakeLists.txt
lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/CMakeLists.txt
lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/None/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/None/CMakeLists.txt?rev=293701&r1=293700&r2=293701&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/None/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/None/CMakeLists.txt Tue Jan 31 
16:31:38 2017
@@ -1,3 +1,7 @@
-add_lldb_library(lldbPluginScriptInterpreterNone
+add_lldb_library(lldbPluginScriptInterpreterNone PLUGIN
   ScriptInterpreterNone.cpp
+
+  LINK_LIBS
+lldbCore
+lldbInterpreter
   )
\ No newline at end of file

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt?rev=293701&r1=293700&r2=293701&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt Tue Jan 
31 16:31:38 2017
@@ -1,5 +1,15 @@
-add_lldb_library(lldbPluginScriptInterpreterPython
+add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
   PythonDataObjects.cpp
   PythonExceptionState.cpp
   ScriptInterpreterPython.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbDataFormatters
+lldbHost
+lldbInterpreter
+lldbTarget
+  LINK_COMPONENTS
+Support
   )

Modified: lldb/trunk/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt?rev=293701&r1=293700&r2=293701&view=diff
==
--- lldb/trunk/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt Tue Jan 
31 16:31:38 2017
@@ -1,5 +1,9 @@
-list(APPEND SOURCES
+add_lldb_library(lldbPluginStructuredDataDarwinLog PLUGIN
   StructuredDataDarwinLog.cpp
-  )
 
-add_lldb_library(lldbPluginStructuredDataDarwinLog ${SOURCES})
+  LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbInterpreter
+lldbTarget
+  )

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt?rev=293701&r1=293700&r2=293701&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt Tue Jan 31 
16:31:38 2017
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginSymbolFileDWARF
+add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
   DIERef.cpp
   DWARFAbbreviationDeclaration.cpp
   DWARFASTParserClang.cpp
@@ -32,4 +32,20 @@ add_lldb_library(lldbPluginSymbolFileDWA
   SymbolFileDWARFDwo.cpp
   SymbolFileDWARFDebugMap.cpp
   UniqueDWARFASTType.cpp
+
+  LINK_LIBS
+clangAST
+clangBasic
+lldbCore
+lldbExpression
+lldbHost
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbUtility
+lldbPluginObjCLanguage
+lldbPluginCPlusPlusLanguage
+lldbPluginExpressionParserClang
+  LINK_COMPONENTS
+Support
   )

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt?rev=293701&r1=293700&r2=293701&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt Tue Jan 31 16:31:38 
2017
@@ -1,7 +1,13 @@
-set(LLVM_LINK_COMPONENTS
-DebugInfoPDB)
-
-add_lldb_library(lldbPluginSymbolFilePDB
+add_lldb_library(lldbPluginSymbolFilePDB PLUGIN
   PDBASTPar

[Lldb-commits] [PATCH] D29352: [CMake] Final dependency cleanup patch!

2017-01-31 Thread Chris Bieneman via Phabricator via lldb-commits
beanz created this revision.
Herald added subscribers: jgosnell, mgorny, srhines, danalbert.

This patch removes the over-specified dependencies from LLDBDependencies and 
instead relies on the dependencies as expressed in each library and tool.

This also removes the library looping in favor of allowing CMake to do its 
thing. I've tested this patch on Darwin, and found no issues, but since linker 
semantics vary by system I'll also work on testing it on other platforms too.

Help testing would be greatly appreciated.


https://reviews.llvm.org/D29352

Files:
  cmake/LLDBDependencies.cmake
  cmake/modules/AddLLDB.cmake
  source/API/CMakeLists.txt
  source/Initialization/CMakeLists.txt
  source/Plugins/Process/Windows/Common/CMakeLists.txt
  tools/intel-mpx/CMakeLists.txt
  tools/lldb-server/CMakeLists.txt
  unittests/CMakeLists.txt

Index: unittests/CMakeLists.txt
===
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -31,8 +31,7 @@
 POST_BUILD
 COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Inputs)
 
-  lldb_link_common_libs(${test_name} EXE)
-  target_link_libraries(${test_name} ${CLANG_USED_LIBS} ${LLDB_SYSTEM_LIBS})
+  target_link_libraries(${test_name} ${LLDB_SYSTEM_LIBS})
   llvm_config(${test_name} ${LLVM_LINK_COMPONENTS})
 endfunction()
 
Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -23,90 +23,6 @@
 
 include_directories(../../source)
 
-
-set( LLDB_USED_LIBS
-  lldbBase
-  lldbBreakpoint
-  lldbCommands
-  lldbDataFormatters
-  lldbHost
-  lldbCore
-  lldbExpression
-  lldbInitialization
-  lldbInterpreter
-  lldbSymbol
-  lldbTarget
-  lldbUtility
-
-  # Plugins
-  lldbPluginDisassemblerLLVM
-  lldbPluginSymbolFileDWARF
-  lldbPluginSymbolFilePDB
-  lldbPluginSymbolFileSymtab
-  lldbPluginDynamicLoaderPosixDYLD
-
-  lldbPluginCPlusPlusLanguage
-  lldbPluginGoLanguage
-  lldbPluginJavaLanguage
-  lldbPluginObjCLanguage
-  lldbPluginObjCPlusPlusLanguage
-  lldbPluginOCamlLanguage
-
-  lldbPluginObjectFileELF
-  lldbPluginObjectFileJIT
-  lldbPluginSymbolVendorELF
-  lldbPluginPlatformPOSIX
-  lldbPluginObjectContainerBSDArchive
-  lldbPluginObjectContainerMachOArchive
-  lldbPluginProcessGDBRemote
-  lldbPluginProcessUtility
-  lldbPluginObjectContainerMachOArchive
-  lldbPluginObjectContainerBSDArchive
-  lldbPluginPlatformMacOSX
-  lldbPluginUnwindAssemblyInstEmulation
-  lldbPluginUnwindAssemblyX86
-  lldbPluginAppleObjCRuntime
-  lldbPluginCXXItaniumABI
-  lldbPluginInstructionARM
-  lldbPluginInstructionARM64
-  lldbPluginInstructionMIPS
-  lldbPluginInstructionMIPS64
-  lldbPluginObjectFilePECOFF
-  lldbPluginExpressionParserClang
-  lldbPluginExpressionParserGo
-  )
-
-# Linux-only libraries
-if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android" )
-  list(APPEND LLDB_USED_LIBS
-lldbPluginProcessLinux
-lldbPluginProcessPOSIX
-   )
-endif ()
-
-# Darwin-only libraries
-if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
-  list(APPEND LLDB_USED_LIBS
-lldbPluginObjectFileMachO
-)
-endif()
-
-set( CLANG_USED_LIBS
-  clangAnalysis
-  clangAST
-  clangBasic
-  clangCodeGen
-  clangDriver
-  clangEdit
-  clangFrontend
-  clangLex
-  clangParse
-  clangRewrite
-  clangRewriteFrontend
-  clangSema
-  clangSerialization
-  )
-
 set(LLDB_SYSTEM_LIBS)
 if (NOT LLDB_DISABLE_LIBEDIT)
   list(APPEND LLDB_SYSTEM_LIBS edit)
@@ -142,54 +58,25 @@
   endif()
 endif()
 
-set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
-  interpreter
-  asmparser
-  bitreader
-  bitwriter
-  codegen
-  demangle
-  ipo
-  selectiondag
-  bitreader
-  mc
-  mcjit
-  core
-  mcdisassembler
-  executionengine
-  runtimedyld
-  option
-  support
-  coverage
-  target
-  )
-
 add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK
 Acceptor.cpp
 lldb-gdbserver.cpp
 lldb-platform.cpp
 lldb-server.cpp
 LLDBServerUtilities.cpp
-)
 
-# The Darwin linker doesn't understand --start-group/--end-group.
-if (LLDB_LINKER_SUPPORTS_GROUPS)
-  target_link_libraries(lldb-server
--Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
-  target_link_libraries(lldb-server
--Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
-else()
-  target_link_libraries(lldb-server ${LLDB_USED_LIBS})
-  target_link_libraries(lldb-server ${CLANG_USED_LIBS})
-endif()
-if(NOT LLVM_LINK_LLVM_DYLIB)
-  # This is necessary in !LLVM_LINK_LLVM_DYLIB as LLDB's libs do not track their
-  # dependencies properly. It is conditional because in a LLVM_LINK_LLVM_DYLIB
-  # build it would introduce duplicate symbols (add_lldb_tool links to libLLVM,
-  # and this would add the individual .a files as well).
-  llvm_config(lldb-server ${LLVM_LINK_COMPONENTS})
-endif()
+LINK_LIBS
+  lldbBase
+  lldbCore
+  lldbHost
+  lldbInitialization
+  lldbInterpreter

[Lldb-commits] [lldb] r293714 - Open ELF core dumps with more than 64K sections

2017-01-31 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Jan 31 17:09:46 2017
New Revision: 293714

URL: http://llvm.org/viewvc/llvm-project?rev=293714&view=rev
Log:
Open ELF core dumps with more than 64K sections

Summary:
Problem:

There are three filelds in the ELF header - e_phnum, e_shnum, and e_shstrndx -
that could be bigger than 64K and therefore do not fit in 16 bits reserved for
them in the header. If this happens, pretty often there is a special section at
index 0 which contains their real values for these fields in the section header
in the fields sh_info, sh_size, and sh_link respectively.

Fix:

- Rename original fields in the header declaration. We want to have them around
just in case.

- Reintroduce these fields as 32-bit members at the end of the header. By 
default
they are initialized from the header in Parse() method.

- In Parse(), detect the situation when the header might have been extended into
section info #0 and try to read it from the same data source.

- ObjectFileELF::GetModuleSpecifications accesses some of these fields but the
original parse uses too small data source. Re-parse the header if necessary
using bigger data source.

- ProcessElfCore::CreateInstance uses header with potentially sentinel values,
but it does not access these fields, so a comment here is enough.

Reviewers: labath

Reviewed By: labath

Subscribers: davidb, lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D29095
Author: Eugene Birukov 

Added:
lldb/trunk/unittests/ObjectFile/
lldb/trunk/unittests/ObjectFile/CMakeLists.txt
lldb/trunk/unittests/ObjectFile/ELF/
lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt
lldb/trunk/unittests/ObjectFile/ELF/TestELFHeader.cpp
Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/trunk/unittests/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp?rev=293714&r1=293713&r2=293714&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp Tue Jan 31 17:09:46 
2017
@@ -81,6 +81,39 @@ ByteOrder ELFHeader::GetByteOrder() cons
   return eByteOrderInvalid;
 }
 
+bool ELFHeader::HasHeaderExtension() const {
+  bool result = false;
+
+  // Check if any of these values looks like sentinel.
+  result |= e_phnum_hdr == 0x; // PN_XNUM
+  result |= e_shnum_hdr == SHN_UNDEF;
+  result |= e_shstrndx_hdr == SHN_XINDEX;
+
+  // If header extension is present, the section offset cannot be null.
+  result &= e_shoff != 0;
+
+  // Done.
+  return result;
+}
+
+void ELFHeader::ParseHeaderExtension(lldb_private::DataExtractor &data) {
+  // Extract section #0 header.
+  ELFSectionHeader section_zero;
+  lldb::offset_t offset = 0;
+  lldb_private::DataExtractor sh_data(data, e_shoff, e_shentsize);
+  bool ok = section_zero.Parse(sh_data, &offset);
+
+  // If we succeeded, fix the header.
+  if (ok) {
+if (e_phnum_hdr == 0x) // PN_XNUM
+  e_phnum = section_zero.sh_info;
+if (e_shnum_hdr == SHN_UNDEF)
+  e_shnum = section_zero.sh_size;
+if (e_shstrndx_hdr == SHN_XINDEX)
+  e_shstrndx = section_zero.sh_link;
+  }
+}
+
 bool ELFHeader::Parse(lldb_private::DataExtractor &data,
   lldb::offset_t *offset) {
   // Read e_ident.  This provides byte order and address size info.
@@ -112,6 +145,16 @@ bool ELFHeader::Parse(lldb_private::Data
   if (data.GetU16(offset, &e_ehsize, 6) == NULL)
 return false;
 
+  // Initialize e_phnum, e_shnum, and e_shstrndx with the values
+  // read from the header.
+  e_phnum = e_phnum_hdr;
+  e_shnum = e_shnum_hdr;
+  e_shstrndx = e_shstrndx_hdr;
+
+  // See if we have extended header in section #0.
+  if (HasHeaderExtension())
+ParseHeaderExtension(data);
+
   return true;
 }
 

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h?rev=293714&r1=293713&r2=293714&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h Tue Jan 31 17:09:46 
2017
@@ -24,6 +24,7 @@
 #include "llvm/Support/ELF.h"
 
 #include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-types.h"
 
 namespace lldb_private {
 class DataExtractor;
@@ -65,10 +66,17 @@ struct ELFHeader {
   elf_half e_machine;   ///< Target architecture.
   elf_half e_ehsize;///< Byte size of the ELF header.
   elf_half e_phentsize; ///< Size of a program header table entry.
-  elf_half e_phnum; ///< Number of

[Lldb-commits] [PATCH] D29095: Open ELF core dumps with more than 64K sections

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL293714: Open ELF core dumps with more than 64K sections 
(authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D29095?vs=86148&id=86507#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29095

Files:
  lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
  lldb/trunk/unittests/CMakeLists.txt
  lldb/trunk/unittests/ObjectFile/CMakeLists.txt
  lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt
  lldb/trunk/unittests/ObjectFile/ELF/TestELFHeader.cpp

Index: lldb/trunk/unittests/CMakeLists.txt
===
--- lldb/trunk/unittests/CMakeLists.txt
+++ lldb/trunk/unittests/CMakeLists.txt
@@ -53,6 +53,7 @@
 add_subdirectory(Host)
 add_subdirectory(Interpreter)
 add_subdirectory(Language)
+add_subdirectory(ObjectFile)
 add_subdirectory(Platform)
 add_subdirectory(Process)
 add_subdirectory(ScriptInterpreter)
Index: lldb/trunk/unittests/ObjectFile/ELF/TestELFHeader.cpp
===
--- lldb/trunk/unittests/ObjectFile/ELF/TestELFHeader.cpp
+++ lldb/trunk/unittests/ObjectFile/ELF/TestELFHeader.cpp
@@ -0,0 +1,62 @@
+//===-- TestELFHeader.cpp ---*- C++ -*-===//
+//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "Plugins/ObjectFile/ELF/ELFHeader.h"
+#include "lldb/Core/DataExtractor.h"
+#include "gtest/gtest.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+
+TEST(ELFHeader, ParseHeaderExtension) {
+  uint8_t data[] = {
+  // e_ident
+  0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00,
+
+  // e_type, e_machine, e_version, e_entry
+  0x03, 0x00, 0x3e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x48, 0x40, 0x00,
+  0x00, 0x00, 0x00, 0x00,
+
+  // e_phoff, e_shoff
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00,
+
+  // e_flags, e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum,
+  // e_shstrndx
+  0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x38, 0x00, 0xff, 0xff, 0x40, 0x00,
+  0x00, 0x00, 0xff, 0xff,
+
+  // sh_name, sh_type, sh_flags
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00,
+
+  // sh_addr, sh_offset
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00,
+
+  // sh_size, sh_link, sh_info
+  0x23, 0x45, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x56, 0x78, 0x00,
+  0x12, 0x34, 0x56, 0x00,
+
+  // sh_addralign, sh_entsize
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00,
+  };
+
+  DataExtractor extractor(data, sizeof data, eByteOrderLittle, 8);
+  elf::ELFHeader header;
+  offset_t offset = 0;
+  ASSERT_TRUE(header.Parse(extractor, &offset));
+  EXPECT_EQ(0x563412u, header.e_phnum);
+  EXPECT_EQ(0x785634u, header.e_shstrndx);
+  EXPECT_EQ(0x674523u, header.e_shnum);
+}
Index: lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt
===
--- lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt
+++ lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_lldb_unittest(ObjectFileELFTests
+  TestELFHeader.cpp
+  )
Index: lldb/trunk/unittests/ObjectFile/CMakeLists.txt
===
--- lldb/trunk/unittests/ObjectFile/CMakeLists.txt
+++ lldb/trunk/unittests/ObjectFile/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(ELF)
Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h
===
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h
@@ -24,6 +24,7 @@
 #include "llvm/Support/ELF.h"
 
 #include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-types.h"
 
 namespace lldb_private {
 class DataExtractor;
@@ -65,10 +66,17 @@
   elf_half e_machine;   ///< Target architecture.
   elf_half e_ehsize;///< Byte size of the ELF header.
   elf_half e_phentsize; ///< Size of a program header table entry.
-  elf_half e_phnum; ///< Number of program header entries.
+  elf_half e_phnum_hdr; ///< Number of program header entries.
   elf_half e_shentsize; ///< Size of a section header table entry.
-  elf_half e_shnum; ///< Number of section header entries.
-  elf_half e_

[Lldb-commits] [PATCH] D29095: Open ELF core dumps with more than 64K sections

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Sorry, I have been a bit busy.

I've committed this in now. Thank you for the patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D29095



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29352: [CMake] Final dependency cleanup patch!

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I'll give this a spin on linux now.


https://reviews.llvm.org/D29352



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29352: [CMake] Final dependency cleanup patch!

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

When linking liblldb.so:
/usr/bin/ld.gold: error: cannot find -llldbPluginDynamicLoaderDarwinKernel


https://reviews.llvm.org/D29352



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29352: [CMake] Final dependency cleanup patch!

2017-01-31 Thread Chris Bieneman via Phabricator via lldb-commits
beanz updated this revision to Diff 86509.
beanz added a comment.

Fixing the issue labath reported in the review. Generally speaking we shouldn't 
be configuring or compiling plugins that can't be used.


https://reviews.llvm.org/D29352

Files:
  cmake/LLDBDependencies.cmake
  cmake/modules/AddLLDB.cmake
  source/API/CMakeLists.txt
  source/Initialization/CMakeLists.txt
  source/Plugins/Process/CMakeLists.txt
  source/Plugins/Process/Windows/Common/CMakeLists.txt
  tools/intel-mpx/CMakeLists.txt
  tools/lldb-server/CMakeLists.txt
  unittests/CMakeLists.txt

Index: unittests/CMakeLists.txt
===
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -31,8 +31,7 @@
 POST_BUILD
 COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Inputs)
 
-  lldb_link_common_libs(${test_name} EXE)
-  target_link_libraries(${test_name} ${CLANG_USED_LIBS} ${LLDB_SYSTEM_LIBS})
+  target_link_libraries(${test_name} ${LLDB_SYSTEM_LIBS})
   llvm_config(${test_name} ${LLVM_LINK_COMPONENTS})
 endfunction()
 
Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -23,90 +23,6 @@
 
 include_directories(../../source)
 
-
-set( LLDB_USED_LIBS
-  lldbBase
-  lldbBreakpoint
-  lldbCommands
-  lldbDataFormatters
-  lldbHost
-  lldbCore
-  lldbExpression
-  lldbInitialization
-  lldbInterpreter
-  lldbSymbol
-  lldbTarget
-  lldbUtility
-
-  # Plugins
-  lldbPluginDisassemblerLLVM
-  lldbPluginSymbolFileDWARF
-  lldbPluginSymbolFilePDB
-  lldbPluginSymbolFileSymtab
-  lldbPluginDynamicLoaderPosixDYLD
-
-  lldbPluginCPlusPlusLanguage
-  lldbPluginGoLanguage
-  lldbPluginJavaLanguage
-  lldbPluginObjCLanguage
-  lldbPluginObjCPlusPlusLanguage
-  lldbPluginOCamlLanguage
-
-  lldbPluginObjectFileELF
-  lldbPluginObjectFileJIT
-  lldbPluginSymbolVendorELF
-  lldbPluginPlatformPOSIX
-  lldbPluginObjectContainerBSDArchive
-  lldbPluginObjectContainerMachOArchive
-  lldbPluginProcessGDBRemote
-  lldbPluginProcessUtility
-  lldbPluginObjectContainerMachOArchive
-  lldbPluginObjectContainerBSDArchive
-  lldbPluginPlatformMacOSX
-  lldbPluginUnwindAssemblyInstEmulation
-  lldbPluginUnwindAssemblyX86
-  lldbPluginAppleObjCRuntime
-  lldbPluginCXXItaniumABI
-  lldbPluginInstructionARM
-  lldbPluginInstructionARM64
-  lldbPluginInstructionMIPS
-  lldbPluginInstructionMIPS64
-  lldbPluginObjectFilePECOFF
-  lldbPluginExpressionParserClang
-  lldbPluginExpressionParserGo
-  )
-
-# Linux-only libraries
-if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android" )
-  list(APPEND LLDB_USED_LIBS
-lldbPluginProcessLinux
-lldbPluginProcessPOSIX
-   )
-endif ()
-
-# Darwin-only libraries
-if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
-  list(APPEND LLDB_USED_LIBS
-lldbPluginObjectFileMachO
-)
-endif()
-
-set( CLANG_USED_LIBS
-  clangAnalysis
-  clangAST
-  clangBasic
-  clangCodeGen
-  clangDriver
-  clangEdit
-  clangFrontend
-  clangLex
-  clangParse
-  clangRewrite
-  clangRewriteFrontend
-  clangSema
-  clangSerialization
-  )
-
 set(LLDB_SYSTEM_LIBS)
 if (NOT LLDB_DISABLE_LIBEDIT)
   list(APPEND LLDB_SYSTEM_LIBS edit)
@@ -142,54 +58,25 @@
   endif()
 endif()
 
-set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
-  interpreter
-  asmparser
-  bitreader
-  bitwriter
-  codegen
-  demangle
-  ipo
-  selectiondag
-  bitreader
-  mc
-  mcjit
-  core
-  mcdisassembler
-  executionengine
-  runtimedyld
-  option
-  support
-  coverage
-  target
-  )
-
 add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK
 Acceptor.cpp
 lldb-gdbserver.cpp
 lldb-platform.cpp
 lldb-server.cpp
 LLDBServerUtilities.cpp
-)
 
-# The Darwin linker doesn't understand --start-group/--end-group.
-if (LLDB_LINKER_SUPPORTS_GROUPS)
-  target_link_libraries(lldb-server
--Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
-  target_link_libraries(lldb-server
--Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
-else()
-  target_link_libraries(lldb-server ${LLDB_USED_LIBS})
-  target_link_libraries(lldb-server ${CLANG_USED_LIBS})
-endif()
-if(NOT LLVM_LINK_LLVM_DYLIB)
-  # This is necessary in !LLVM_LINK_LLVM_DYLIB as LLDB's libs do not track their
-  # dependencies properly. It is conditional because in a LLVM_LINK_LLVM_DYLIB
-  # build it would introduce duplicate symbols (add_lldb_tool links to libLLVM,
-  # and this would add the individual .a files as well).
-  llvm_config(lldb-server ${LLVM_LINK_COMPONENTS})
-endif()
+LINK_LIBS
+  lldbBase
+  lldbCore
+  lldbHost
+  lldbInitialization
+  lldbInterpreter
+  ${EXTRA_LLDB_LIBS}
+  ${LLDB_SYSTEM_LIBS}
+
+LINK_COMPONENTS
+  Support
+)
 
 target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS})
 
Index: tools/intel-mpx/CMakeLists.txt
===
--- tools/intel-mpx/C

[Lldb-commits] [PATCH] D29352: [CMake] Final dependency cleanup patch!

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

The main code seems to be fine now, but linking of unit tests (check-lldb-unit 
target) fails now. You'll probably need to explicitly set their dependencies as 
well before this can be removed.


https://reviews.llvm.org/D29352



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Zachary Turner via Phabricator via lldb-commits
zturner created this revision.
Herald added a subscriber: mgorny.

The goal here is to make `lldbUtility` a library which depends on no other 
libraries.  It seems like this library already exists in spirit as a place to 
house very low level code which is commonly used by all parts of LLDB, so it 
makes sense to designate this as the one top-level library.  We can change the 
name in the future to something like `Support` if we choose to (implying that 
it is analogous to LLVMSupport), but for now I just want to break the 
dependencies.

So, this patch deletes a bunch of dead code and moves some code that is 
actually only used in 1-2 places up to where it's actually used.

This is not enough to get `Utility` dependency free.  Further tasks that I've 
identified, but which are too large to fit into this patch, include:

1. Move `RegularExpression` from Core -> Utility  (Long term: Delete and use 
LLVM)
2. Move `Stream` from Core -> Utility  (Long term: Delete and use 
llvm::raw_ostream)
3. Move `ConstString` from Core -> Utility
4. Move `ProcessStructReader` from Utility -> Process
5. Move `RegisterNumber` from Utility -> Target
6. Move `Error` from Core -> Utility
7. Try to convert `ValueObject::GetSP()` from SharingPtr to `std::shared_ptr`, 
then delete `SharingPtr`.
8. Move `ModuleCache` from Utility -> Target

Finally, once all of those things are done, we can begin breaking up the 
`lldb-private.h`, and `lldb-enumerations.h`, etc header files and moving the 
enumerations to more appropriate locations, which will finally break this up.


https://reviews.llvm.org/D29359

Files:
  lldb/include/lldb/Utility/ConvertEnum.h
  lldb/include/lldb/Utility/PriorityPointerPair.h
  lldb/include/lldb/Utility/Utils.h
  lldb/include/lldb/lldb-private-enumerations.h
  lldb/source/Commands/CommandObjectPlatform.cpp
  lldb/source/Core/Section.cpp
  lldb/source/Interpreter/OptionGroupArchitecture.cpp
  lldb/source/Interpreter/OptionGroupFormat.cpp
  lldb/source/Interpreter/OptionGroupOutputFile.cpp
  lldb/source/Interpreter/OptionGroupPlatform.cpp
  lldb/source/Interpreter/OptionGroupUUID.cpp
  lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
  lldb/source/Interpreter/OptionGroupVariable.cpp
  lldb/source/Interpreter/OptionGroupWatchpoint.cpp
  lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/ThreadList.cpp
  lldb/source/Target/ThreadPlan.cpp
  lldb/source/Utility/ARM64_DWARF_Registers.cpp
  lldb/source/Utility/ARM64_DWARF_Registers.h
  lldb/source/Utility/ARM_DWARF_Registers.cpp
  lldb/source/Utility/ARM_DWARF_Registers.h
  lldb/source/Utility/CMakeLists.txt
  lldb/source/Utility/ConvertEnum.cpp

Index: lldb/source/Utility/ConvertEnum.cpp
===
--- lldb/source/Utility/ConvertEnum.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-//===-- ConvertEnum.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/Utility/ConvertEnum.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-const char *lldb_private::GetVoteAsCString(Vote vote) {
-  switch (vote) {
-  case eVoteNo:
-return "no";
-  case eVoteNoOpinion:
-return "no opinion";
-  case eVoteYes:
-return "yes";
-  }
-  return "invalid";
-}
-
-const char *lldb_private::GetSectionTypeAsCString(lldb::SectionType sect_type) {
-  switch (sect_type) {
-  case eSectionTypeInvalid:
-return "invalid";
-  case eSectionTypeCode:
-return "code";
-  case eSectionTypeContainer:
-return "container";
-  case eSectionTypeData:
-return "data";
-  case eSectionTypeDataCString:
-return "data-cstr";
-  case eSectionTypeDataCStringPointers:
-return "data-cstr-ptr";
-  case eSectionTypeDataSymbolAddress:
-return "data-symbol-addr";
-  case eSectionTypeData4:
-return "data-4-byte";
-  case eSectionTypeData8:
-return "data-8-byte";
-  case eSectionTypeData16:
-return "data-16-byte";
-  case eSectionTypeDataPointers:
-return "data-ptrs";
-  case eSectionTypeDebug:
-return "debug";
-  case eSectionTypeZeroFill:
-return "zero-fill";
-  case eSectionTypeDataObjCMessageRefs:
-return "objc-message-refs";
-  case eSectionTypeDataObjCCFStrings:
-return "objc-cfstrings";
-  case eSectionTypeDWARFDebugAbbrev:
-return "dwarf-abbrev";
-  case eSectionTypeDWARFDebugAddr:
-return "dwarf-addr";
-  case eSectionTypeDWARFDebugAranges:
-return "dwarf-aranges";
-  case eSectionTypeDWARFDebugFrame:
-return "dwarf-frame";
-  case eSectionTypeDWARFDebugInfo:
-return "dwarf-info";
-  case eSectionTypeDWARFDebugLine:
-return "dwarf-line";
-  cas

[Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

> Move Error from Core -> Utility

Also, I almost forgot.

Long term: Delete and use `llvm::Error`


https://reviews.llvm.org/D29359



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Looks reasonable. To make sure things stay this way, we should make sure that 
the Utility unit test has only this module specified as a dependency (I guess 
after @beanz is done with digging through that).




Comment at: lldb/source/Target/ThreadList.cpp:387
 if (log)
-  log->Printf("ThreadList::%s thread 0x%4.4" PRIx64
-  ": voted %s, but lost out because result was %s",
-  __FUNCTION__, thread_sp->GetID(), GetVoteAsCString(vote),
-  GetVoteAsCString(result));
+  log->Format(
+  __FILE__, __FUNCTION__,

Any reason for not using the log macro here? (replace `if(log) log->Format)` 
with `LLDB_LOG(log, ...)`).

I did not anticipate using this function directly as the `__FILE__` , ` 
__FUNCTION__` thingies make it very obnoxious.


https://reviews.llvm.org/D29359



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Zachary Turner via Phabricator via lldb-commits
zturner added inline comments.



Comment at: lldb/source/Target/ThreadList.cpp:387
 if (log)
-  log->Printf("ThreadList::%s thread 0x%4.4" PRIx64
-  ": voted %s, but lost out because result was %s",
-  __FUNCTION__, thread_sp->GetID(), GetVoteAsCString(vote),
-  GetVoteAsCString(result));
+  log->Format(
+  __FILE__, __FUNCTION__,

labath wrote:
> Any reason for not using the log macro here? (replace `if(log) log->Format)` 
> with `LLDB_LOG(log, ...)`).
> 
> I did not anticipate using this function directly as the `__FILE__` , ` 
> __FUNCTION__` thingies make it very obnoxious.
Ahh, this is the first time I've written a logging statement since your 
changes, I think I'm just not accustomed to the new way yet.  I can update this 
though.


https://reviews.llvm.org/D29359



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

In https://reviews.llvm.org/D29359#662417, @labath wrote:

> Looks reasonable. To make sure things stay this way, we should make sure that 
> the Utility unit test has only this module specified as a dependency (I guess 
> after @beanz is done with digging through that).


Yea, this was the plan.  After we're all done, drop all the dependencies from 
the `CMakeLists.txt` and the unit test exe and then everything else should 
happen automatically.


https://reviews.llvm.org/D29359



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Jim Ingham via lldb-commits

> On Jan 31, 2017, at 3:59 PM, Zachary Turner via Phabricator via lldb-commits 
>  wrote:
> 
> zturner created this revision.
> Herald added a subscriber: mgorny.
> 
> The goal here is to make `lldbUtility` a library which depends on no other 
> libraries.  It seems like this library already exists in spirit as a place to 
> house very low level code which is commonly used by all parts of LLDB, so it 
> makes sense to designate this as the one top-level library.  We can change 
> the name in the future to something like `Support` if we choose to (implying 
> that it is analogous to LLVMSupport), but for now I just want to break the 
> dependencies.
> 
> So, this patch deletes a bunch of dead code and moves some code that is 
> actually only used in 1-2 places up to where it's actually used.
> 
> This is not enough to get `Utility` dependency free.  Further tasks that I've 
> identified, but which are too large to fit into this patch, include:
> 
> 1. Move `RegularExpression` from Core -> Utility  (Long term: Delete and use 
> LLVM)
> 2. Move `Stream` from Core -> Utility  (Long term: Delete and use 
> llvm::raw_ostream)
> 3. Move `ConstString` from Core -> Utility
> 4. Move `ProcessStructReader` from Utility -> Process
> 5. Move `RegisterNumber` from Utility -> Target
> 6. Move `Error` from Core -> Utility
> 7. Try to convert `ValueObject::GetSP()` from SharingPtr to 
> `std::shared_ptr`, then delete `SharingPtr`.

The problem SharingPtr is solving is that the value objects form a cluster: the 
parent value object (representing some structure say) and any of it's children 
(the subelement or the subelement of the subelement...) that have been realized 
by the ChildAtIndex, ChildByPath, and Co. calls.  And the way the value objects 
work, the whole cluster has to stay alive as long as any of the children are 
alive.  That's because everybody just knows where they are in their parent (as 
they should since they all can move around.)  So you need them all for jobs 
like recomputing values when the stop ID changes.   But users are not (and 
shouldn't be) required to manually hold onto any more than the element they 
care about, which may very well be a deep child.  SharingPtr manages this 
cluster and makes sure it stays alive as long as any members of the cluster are 
alive.

I have no particular stake in how this is done, and if there's something clever 
in llvm that can do the same job, I'm all for that.  But you can't replace it 
with a std::shared_ptr, that won't work.

Jim


> 8. Move `ModuleCache` from Utility -> Target
> 
> Finally, once all of those things are done, we can begin breaking up the 
> `lldb-private.h`, and `lldb-enumerations.h`, etc header files and moving the 
> enumerations to more appropriate locations, which will finally break this up.
> 
> 
> https://reviews.llvm.org/D29359
> 
> Files:
>  lldb/include/lldb/Utility/ConvertEnum.h
>  lldb/include/lldb/Utility/PriorityPointerPair.h
>  lldb/include/lldb/Utility/Utils.h
>  lldb/include/lldb/lldb-private-enumerations.h
>  lldb/source/Commands/CommandObjectPlatform.cpp
>  lldb/source/Core/Section.cpp
>  lldb/source/Interpreter/OptionGroupArchitecture.cpp
>  lldb/source/Interpreter/OptionGroupFormat.cpp
>  lldb/source/Interpreter/OptionGroupOutputFile.cpp
>  lldb/source/Interpreter/OptionGroupPlatform.cpp
>  lldb/source/Interpreter/OptionGroupUUID.cpp
>  lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
>  lldb/source/Interpreter/OptionGroupVariable.cpp
>  lldb/source/Interpreter/OptionGroupWatchpoint.cpp
>  lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
>  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
>  lldb/source/Target/Platform.cpp
>  lldb/source/Target/ThreadList.cpp
>  lldb/source/Target/ThreadPlan.cpp
>  lldb/source/Utility/ARM64_DWARF_Registers.cpp
>  lldb/source/Utility/ARM64_DWARF_Registers.h
>  lldb/source/Utility/ARM_DWARF_Registers.cpp
>  lldb/source/Utility/ARM_DWARF_Registers.h
>  lldb/source/Utility/CMakeLists.txt
>  lldb/source/Utility/ConvertEnum.cpp
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Zachary Turner via lldb-commits
Thanks for the clarification, I wrote "try to convert" there because I
didn't look closely enough to see what problem it was solving.  Since it
seems to be specific to ValueObject (which a grep confirms), we may be able
to just move the code for SharingPtr next to ValueObject.  That said,
SharingPtr.h / .cpp don't actually have any reverse dependencies, so we
could also just leave it alone.  I mostly just put that on the list because
if we intend for this to be a general purpose library of reusable stuff, we
might as well remove things that are not seeing broad use.

On Tue, Jan 31, 2017 at 4:32 PM Jim Ingham  wrote:

>
> > On Jan 31, 2017, at 3:59 PM, Zachary Turner via Phabricator via
> lldb-commits  wrote:
> >
> > zturner created this revision.
> > Herald added a subscriber: mgorny.
> >
> > The goal here is to make `lldbUtility` a library which depends on no
> other libraries.  It seems like this library already exists in spirit as a
> place to house very low level code which is commonly used by all parts of
> LLDB, so it makes sense to designate this as the one top-level library.  We
> can change the name in the future to something like `Support` if we choose
> to (implying that it is analogous to LLVMSupport), but for now I just want
> to break the dependencies.
> >
> > So, this patch deletes a bunch of dead code and moves some code that is
> actually only used in 1-2 places up to where it's actually used.
> >
> > This is not enough to get `Utility` dependency free.  Further tasks that
> I've identified, but which are too large to fit into this patch, include:
> >
> > 1. Move `RegularExpression` from Core -> Utility  (Long term: Delete and
> use LLVM)
> > 2. Move `Stream` from Core -> Utility  (Long term: Delete and use
> llvm::raw_ostream)
> > 3. Move `ConstString` from Core -> Utility
> > 4. Move `ProcessStructReader` from Utility -> Process
> > 5. Move `RegisterNumber` from Utility -> Target
> > 6. Move `Error` from Core -> Utility
> > 7. Try to convert `ValueObject::GetSP()` from SharingPtr to
> `std::shared_ptr`, then delete `SharingPtr`.
>
> The problem SharingPtr is solving is that the value objects form a
> cluster: the parent value object (representing some structure say) and any
> of it's children (the subelement or the subelement of the subelement...)
> that have been realized by the ChildAtIndex, ChildByPath, and Co. calls.
> And the way the value objects work, the whole cluster has to stay alive as
> long as any of the children are alive.  That's because everybody just knows
> where they are in their parent (as they should since they all can move
> around.)  So you need them all for jobs like recomputing values when the
> stop ID changes.   But users are not (and shouldn't be) required to
> manually hold onto any more than the element they care about, which may
> very well be a deep child.  SharingPtr manages this cluster and makes sure
> it stays alive as long as any members of the cluster are alive.
>
> I have no particular stake in how this is done, and if there's something
> clever in llvm that can do the same job, I'm all for that.  But you can't
> replace it with a std::shared_ptr, that won't work.
>
> Jim
>
>
> > 8. Move `ModuleCache` from Utility -> Target
> >
> > Finally, once all of those things are done, we can begin breaking up the
> `lldb-private.h`, and `lldb-enumerations.h`, etc header files and moving
> the enumerations to more appropriate locations, which will finally break
> this up.
> >
> >
> > https://reviews.llvm.org/D29359
> >
> > Files:
> >  lldb/include/lldb/Utility/ConvertEnum.h
> >  lldb/include/lldb/Utility/PriorityPointerPair.h
> >  lldb/include/lldb/Utility/Utils.h
> >  lldb/include/lldb/lldb-private-enumerations.h
> >  lldb/source/Commands/CommandObjectPlatform.cpp
> >  lldb/source/Core/Section.cpp
> >  lldb/source/Interpreter/OptionGroupArchitecture.cpp
> >  lldb/source/Interpreter/OptionGroupFormat.cpp
> >  lldb/source/Interpreter/OptionGroupOutputFile.cpp
> >  lldb/source/Interpreter/OptionGroupPlatform.cpp
> >  lldb/source/Interpreter/OptionGroupUUID.cpp
> >  lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
> >  lldb/source/Interpreter/OptionGroupVariable.cpp
> >  lldb/source/Interpreter/OptionGroupWatchpoint.cpp
> >  lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
> >  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
> >  lldb/source/Target/Platform.cpp
> >  lldb/source/Target/ThreadList.cpp
> >  lldb/source/Target/ThreadPlan.cpp
> >  lldb/source/Utility/ARM64_DWARF_Registers.cpp
> >  lldb/source/Utility/ARM64_DWARF_Registers.h
> >  lldb/source/Utility/ARM_DWARF_Registers.cpp
> >  lldb/source/Utility/ARM_DWARF_Registers.h
> >  lldb/source/Utility/CMakeLists.txt
> >  lldb/source/Utility/ConvertEnum.cpp
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
>
_

Re: [Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Jim Ingham via lldb-commits
My vote is to err on the side of leaving stuff in Utility that is general (like 
SharingPtr) but only used by one client, rather than moving it next to its 
current only client.  After all, you are likely to go dumpster diving in 
Utility when you need a tool, but you're less likely to look through the whole 
source base for this sort of thing.  And we'd really like people to be drawing 
out of Utility whenever they can...

Jim

> On Jan 31, 2017, at 4:37 PM, Zachary Turner  wrote:
> 
> Thanks for the clarification, I wrote "try to convert" there because I didn't 
> look closely enough to see what problem it was solving.  Since it seems to be 
> specific to ValueObject (which a grep confirms), we may be able to just move 
> the code for SharingPtr next to ValueObject.  That said, SharingPtr.h / .cpp 
> don't actually have any reverse dependencies, so we could also just leave it 
> alone.  I mostly just put that on the list because if we intend for this to 
> be a general purpose library of reusable stuff, we might as well remove 
> things that are not seeing broad use.
> 
> On Tue, Jan 31, 2017 at 4:32 PM Jim Ingham  wrote:
> 
> > On Jan 31, 2017, at 3:59 PM, Zachary Turner via Phabricator via 
> > lldb-commits  wrote:
> >
> > zturner created this revision.
> > Herald added a subscriber: mgorny.
> >
> > The goal here is to make `lldbUtility` a library which depends on no other 
> > libraries.  It seems like this library already exists in spirit as a place 
> > to house very low level code which is commonly used by all parts of LLDB, 
> > so it makes sense to designate this as the one top-level library.  We can 
> > change the name in the future to something like `Support` if we choose to 
> > (implying that it is analogous to LLVMSupport), but for now I just want to 
> > break the dependencies.
> >
> > So, this patch deletes a bunch of dead code and moves some code that is 
> > actually only used in 1-2 places up to where it's actually used.
> >
> > This is not enough to get `Utility` dependency free.  Further tasks that 
> > I've identified, but which are too large to fit into this patch, include:
> >
> > 1. Move `RegularExpression` from Core -> Utility  (Long term: Delete and 
> > use LLVM)
> > 2. Move `Stream` from Core -> Utility  (Long term: Delete and use 
> > llvm::raw_ostream)
> > 3. Move `ConstString` from Core -> Utility
> > 4. Move `ProcessStructReader` from Utility -> Process
> > 5. Move `RegisterNumber` from Utility -> Target
> > 6. Move `Error` from Core -> Utility
> > 7. Try to convert `ValueObject::GetSP()` from SharingPtr to 
> > `std::shared_ptr`, then delete `SharingPtr`.
> 
> The problem SharingPtr is solving is that the value objects form a cluster: 
> the parent value object (representing some structure say) and any of it's 
> children (the subelement or the subelement of the subelement...) that have 
> been realized by the ChildAtIndex, ChildByPath, and Co. calls.  And the way 
> the value objects work, the whole cluster has to stay alive as long as any of 
> the children are alive.  That's because everybody just knows where they are 
> in their parent (as they should since they all can move around.)  So you need 
> them all for jobs like recomputing values when the stop ID changes.   But 
> users are not (and shouldn't be) required to manually hold onto any more than 
> the element they care about, which may very well be a deep child.  SharingPtr 
> manages this cluster and makes sure it stays alive as long as any members of 
> the cluster are alive.
> 
> I have no particular stake in how this is done, and if there's something 
> clever in llvm that can do the same job, I'm all for that.  But you can't 
> replace it with a std::shared_ptr, that won't work.
> 
> Jim
> 
> 
> > 8. Move `ModuleCache` from Utility -> Target
> >
> > Finally, once all of those things are done, we can begin breaking up the 
> > `lldb-private.h`, and `lldb-enumerations.h`, etc header files and moving 
> > the enumerations to more appropriate locations, which will finally break 
> > this up.
> >
> >
> > https://reviews.llvm.org/D29359
> >
> > Files:
> >  lldb/include/lldb/Utility/ConvertEnum.h
> >  lldb/include/lldb/Utility/PriorityPointerPair.h
> >  lldb/include/lldb/Utility/Utils.h
> >  lldb/include/lldb/lldb-private-enumerations.h
> >  lldb/source/Commands/CommandObjectPlatform.cpp
> >  lldb/source/Core/Section.cpp
> >  lldb/source/Interpreter/OptionGroupArchitecture.cpp
> >  lldb/source/Interpreter/OptionGroupFormat.cpp
> >  lldb/source/Interpreter/OptionGroupOutputFile.cpp
> >  lldb/source/Interpreter/OptionGroupPlatform.cpp
> >  lldb/source/Interpreter/OptionGroupUUID.cpp
> >  lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
> >  lldb/source/Interpreter/OptionGroupVariable.cpp
> >  lldb/source/Interpreter/OptionGroupWatchpoint.cpp
> >  lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
> >  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
> >  lldb/source/Target/Pl

[Lldb-commits] [PATCH] D29347: Add ProcessLauncherNetBSD to spawn a tracee

2017-01-31 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski updated this revision to Diff 86524.
krytarowski added a comment.
Herald added subscribers: srhines, danalbert.

Transform ProcessLauncherLinux to ProcessLauncherPosixFork and attach to Linux 
and NetBSD.


Repository:
  rL LLVM

https://reviews.llvm.org/D29347

Files:
  include/lldb/Host/linux/ProcessLauncherLinux.h
  include/lldb/Host/posix/ProcessLauncherPosixFork.h
  source/Host/CMakeLists.txt
  source/Host/common/Host.cpp
  source/Host/linux/ProcessLauncherLinux.cpp
  source/Host/posix/ProcessLauncherPosixFork.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp

Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -33,7 +33,7 @@
 #include "lldb/Host/ThreadLauncher.h"
 #include "lldb/Host/common/NativeBreakpoint.h"
 #include "lldb/Host/common/NativeRegisterContext.h"
-#include "lldb/Host/linux/ProcessLauncherLinux.h"
+#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
@@ -332,7 +332,7 @@
   MaybeLogLaunchInfo(launch_info);
 
   ::pid_t pid =
-  ProcessLauncherLinux().LaunchProcess(launch_info, error).GetProcessId();
+  ProcessLauncherPosixFork().LaunchProcess(launch_info, error).GetProcessId();
   if (error.Fail())
 return error;
 
Index: source/Host/posix/ProcessLauncherPosixFork.cpp
===
--- /dev/null
+++ 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 
+#include 
+#include 
+
+#include 
+
+#ifdef __ANDROID__
+#include 
+#endif
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#include 
+#elif defined(__linux__)
+#include 
+#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 = 0x;
+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()) 

Re: [Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Jim Ingham via lldb-commits
I think we discussed this before, but we need an informational error object.  
IIRC, the llvm::Error has to be checked.  But for instance if you ask a value 
object to evaluate itself, but you've moved to a section of code where the 
variable has no location, then evaluating that value will result in an error.  
But that isn't an error the value object code needs to do anything about.  And 
it might go all the way up through the SB & Python API's before it's 
appropriate to check the error.

IIRC, the llvm::Error is one of those "you have to check it or you get smacked 
by the compiler" dealies.  That's appropriate for some of our uses of Error, 
but not all.

Jim


> On Jan 31, 2017, at 4:01 PM, Zachary Turner via Phabricator via lldb-commits 
>  wrote:
> 
> zturner added a comment.
> 
>> Move Error from Core -> Utility
> 
> Also, I almost forgot.
> 
> Long term: Delete and use `llvm::Error`
> 
> 
> https://reviews.llvm.org/D29359
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Zachary Turner via lldb-commits
llvm::Error only enforces checking at the point that it goes out of scope.
So the example you mention should be supported, as long as you propagate
the value all the way up and don't destroy it. There's also ways to
explicitly ignore an Error (similar to casting to void to make the compiler
not warn about unused variables), so as a last resort we could put code
like that in the SB implementation if we had to
On Tue, Jan 31, 2017 at 5:23 PM Jim Ingham  wrote:

> I think we discussed this before, but we need an informational error
> object.  IIRC, the llvm::Error has to be checked.  But for instance if you
> ask a value object to evaluate itself, but you've moved to a section of
> code where the variable has no location, then evaluating that value will
> result in an error.  But that isn't an error the value object code needs to
> do anything about.  And it might go all the way up through the SB & Python
> API's before it's appropriate to check the error.
>
> IIRC, the llvm::Error is one of those "you have to check it or you get
> smacked by the compiler" dealies.  That's appropriate for some of our uses
> of Error, but not all.
>
> Jim
>
>
> > On Jan 31, 2017, at 4:01 PM, Zachary Turner via Phabricator via
> lldb-commits  wrote:
> >
> > zturner added a comment.
> >
> >> Move Error from Core -> Utility
> >
> > Also, I almost forgot.
> >
> > Long term: Delete and use `llvm::Error`
> >
> >
> > https://reviews.llvm.org/D29359
> >
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Jim Ingham via lldb-commits
Yeah, I have no idea how you'd make sure that the SBError returned to Python in 
a Python SBValue was checked before it went out of scope, and I'm not sure it's 
our business to be enforcing that...  So we're going to have to do something 
special for those errors.  We also use the pattern where we return a count and 
an error, but ofttimes you don't care why you got nothing, so you just check 
the count.  The error is informational.  Making that obnoxious would also not 
be a plus.  I actually think there's some value to having "programming errors 
that must be checked" and informational errors.  Maybe we need both.

Jim

> On Jan 31, 2017, at 5:32 PM, Zachary Turner  wrote:
> 
> llvm::Error only enforces checking at the point that it goes out of scope. So 
> the example you mention should be supported, as long as you propagate the 
> value all the way up and don't destroy it. There's also ways to explicitly 
> ignore an Error (similar to casting to void to make the compiler not warn 
> about unused variables), so as a last resort we could put code like that in 
> the SB implementation if we had to
> On Tue, Jan 31, 2017 at 5:23 PM Jim Ingham  wrote:
> I think we discussed this before, but we need an informational error object.  
> IIRC, the llvm::Error has to be checked.  But for instance if you ask a value 
> object to evaluate itself, but you've moved to a section of code where the 
> variable has no location, then evaluating that value will result in an error. 
>  But that isn't an error the value object code needs to do anything about.  
> And it might go all the way up through the SB & Python API's before it's 
> appropriate to check the error.
> 
> IIRC, the llvm::Error is one of those "you have to check it or you get 
> smacked by the compiler" dealies.  That's appropriate for some of our uses of 
> Error, but not all.
> 
> Jim
> 
> 
> > On Jan 31, 2017, at 4:01 PM, Zachary Turner via Phabricator via 
> > lldb-commits  wrote:
> >
> > zturner added a comment.
> >
> >> Move Error from Core -> Utility
> >
> > Also, I almost forgot.
> >
> > Long term: Delete and use `llvm::Error`
> >
> >
> > https://reviews.llvm.org/D29359
> >
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> 

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Zachary Turner via lldb-commits
Yea, there may be value in both. If i ever tried to do this I'd probably
take the approach of converting all the obvious cases first that should
enforce checking and then see what's left. Then we could use llvm:Error and
lldb::Status, or something
On Tue, Jan 31, 2017 at 5:39 PM Jim Ingham  wrote:

> Yeah, I have no idea how you'd make sure that the SBError returned to
> Python in a Python SBValue was checked before it went out of scope, and I'm
> not sure it's our business to be enforcing that...  So we're going to have
> to do something special for those errors.  We also use the pattern where we
> return a count and an error, but ofttimes you don't care why you got
> nothing, so you just check the count.  The error is informational.  Making
> that obnoxious would also not be a plus.  I actually think there's some
> value to having "programming errors that must be checked" and informational
> errors.  Maybe we need both.
>
> Jim
>
> > On Jan 31, 2017, at 5:32 PM, Zachary Turner  wrote:
> >
> > llvm::Error only enforces checking at the point that it goes out of
> scope. So the example you mention should be supported, as long as you
> propagate the value all the way up and don't destroy it. There's also ways
> to explicitly ignore an Error (similar to casting to void to make the
> compiler not warn about unused variables), so as a last resort we could put
> code like that in the SB implementation if we had to
> > On Tue, Jan 31, 2017 at 5:23 PM Jim Ingham  wrote:
> > I think we discussed this before, but we need an informational error
> object.  IIRC, the llvm::Error has to be checked.  But for instance if you
> ask a value object to evaluate itself, but you've moved to a section of
> code where the variable has no location, then evaluating that value will
> result in an error.  But that isn't an error the value object code needs to
> do anything about.  And it might go all the way up through the SB & Python
> API's before it's appropriate to check the error.
> >
> > IIRC, the llvm::Error is one of those "you have to check it or you get
> smacked by the compiler" dealies.  That's appropriate for some of our uses
> of Error, but not all.
> >
> > Jim
> >
> >
> > > On Jan 31, 2017, at 4:01 PM, Zachary Turner via Phabricator via
> lldb-commits  wrote:
> > >
> > > zturner added a comment.
> > >
> > >> Move Error from Core -> Utility
> > >
> > > Also, I almost forgot.
> > >
> > > Long term: Delete and use `llvm::Error`
> > >
> > >
> > > https://reviews.llvm.org/D29359
> > >
> > >
> > >
> > > ___
> > > lldb-commits mailing list
> > > lldb-commits@lists.llvm.org
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> >
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29347: Transform ProcessLauncherLinux to ProcessLauncherPosixFork

2017-01-31 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski updated this revision to Diff 86536.
krytarowski added a comment.

Fix typo.


Repository:
  rL LLVM

https://reviews.llvm.org/D29347

Files:
  include/lldb/Host/linux/ProcessLauncherLinux.h
  include/lldb/Host/posix/ProcessLauncherPosixFork.h
  source/Host/CMakeLists.txt
  source/Host/common/Host.cpp
  source/Host/linux/ProcessLauncherLinux.cpp
  source/Host/posix/ProcessLauncherPosixFork.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp

Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -33,7 +33,7 @@
 #include "lldb/Host/ThreadLauncher.h"
 #include "lldb/Host/common/NativeBreakpoint.h"
 #include "lldb/Host/common/NativeRegisterContext.h"
-#include "lldb/Host/linux/ProcessLauncherLinux.h"
+#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
@@ -332,7 +332,7 @@
   MaybeLogLaunchInfo(launch_info);
 
   ::pid_t pid =
-  ProcessLauncherLinux().LaunchProcess(launch_info, error).GetProcessId();
+  ProcessLauncherPosixFork().LaunchProcess(launch_info, error).GetProcessId();
   if (error.Fail())
 return error;
 
Index: source/Host/posix/ProcessLauncherPosixFork.cpp
===
--- /dev/null
+++ 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 
+#include 
+#include 
+
+#include 
+
+#ifdef __ANDROID__
+#include 
+#endif
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#include 
+#elif defined(__linux__)
+#include 
+#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 = 0x;
+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");
+   

[Lldb-commits] [PATCH] D29347: Transform ProcessLauncherLinux to ProcessLauncherPosixFork

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Perfect. Thank you.




Comment at: include/lldb/Host/posix/ProcessLauncherPosixFork.h:19
+public:
+  virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+Error &error);

s/virtual/override/. (I know you just copied it, but still.. )


Repository:
  rL LLVM

https://reviews.llvm.org/D29347



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29347: Transform ProcessLauncherLinux to ProcessLauncherPosixFork

2017-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

@emaste: I'd suggest switching freebsd over to this process launcher as well. I 
think it's the last user of the ProcessLauncherPosix, and it would enable us to 
get rid of it.


Repository:
  rL LLVM

https://reviews.llvm.org/D29347



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Jim Ingham via lldb-commits
BTW, not to exclude the positive because it doesn't need discussing: all the 
rest of the changes you were proposing seem appropriate and good to me.  Thanks 
for taking the trouble to clean this up.

Jim

> On Jan 31, 2017, at 5:45 PM, Zachary Turner  wrote:
> 
> Yea, there may be value in both. If i ever tried to do this I'd probably take 
> the approach of converting all the obvious cases first that should enforce 
> checking and then see what's left. Then we could use llvm:Error and 
> lldb::Status, or something 
> On Tue, Jan 31, 2017 at 5:39 PM Jim Ingham  wrote:
> Yeah, I have no idea how you'd make sure that the SBError returned to Python 
> in a Python SBValue was checked before it went out of scope, and I'm not sure 
> it's our business to be enforcing that...  So we're going to have to do 
> something special for those errors.  We also use the pattern where we return 
> a count and an error, but ofttimes you don't care why you got nothing, so you 
> just check the count.  The error is informational.  Making that obnoxious 
> would also not be a plus.  I actually think there's some value to having 
> "programming errors that must be checked" and informational errors.  Maybe we 
> need both.
> 
> Jim
> 
> > On Jan 31, 2017, at 5:32 PM, Zachary Turner  wrote:
> >
> > llvm::Error only enforces checking at the point that it goes out of scope. 
> > So the example you mention should be supported, as long as you propagate 
> > the value all the way up and don't destroy it. There's also ways to 
> > explicitly ignore an Error (similar to casting to void to make the compiler 
> > not warn about unused variables), so as a last resort we could put code 
> > like that in the SB implementation if we had to
> > On Tue, Jan 31, 2017 at 5:23 PM Jim Ingham  wrote:
> > I think we discussed this before, but we need an informational error 
> > object.  IIRC, the llvm::Error has to be checked.  But for instance if you 
> > ask a value object to evaluate itself, but you've moved to a section of 
> > code where the variable has no location, then evaluating that value will 
> > result in an error.  But that isn't an error the value object code needs to 
> > do anything about.  And it might go all the way up through the SB & Python 
> > API's before it's appropriate to check the error.
> >
> > IIRC, the llvm::Error is one of those "you have to check it or you get 
> > smacked by the compiler" dealies.  That's appropriate for some of our uses 
> > of Error, but not all.
> >
> > Jim
> >
> >
> > > On Jan 31, 2017, at 4:01 PM, Zachary Turner via Phabricator via 
> > > lldb-commits  wrote:
> > >
> > > zturner added a comment.
> > >
> > >> Move Error from Core -> Utility
> > >
> > > Also, I almost forgot.
> > >
> > > Long term: Delete and use `llvm::Error`
> > >
> > >
> > > https://reviews.llvm.org/D29359
> > >
> > >
> > >
> > > ___
> > > lldb-commits mailing list
> > > lldb-commits@lists.llvm.org
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> >
> 

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29347: Transform ProcessLauncherLinux to ProcessLauncherPosixFork

2017-01-31 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski updated this revision to Diff 86546.
krytarowski added a comment.

virtual -> override


Repository:
  rL LLVM

https://reviews.llvm.org/D29347

Files:
  include/lldb/Host/linux/ProcessLauncherLinux.h
  include/lldb/Host/posix/ProcessLauncherPosixFork.h
  source/Host/CMakeLists.txt
  source/Host/common/Host.cpp
  source/Host/linux/ProcessLauncherLinux.cpp
  source/Host/posix/ProcessLauncherPosixFork.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp

Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -33,7 +33,7 @@
 #include "lldb/Host/ThreadLauncher.h"
 #include "lldb/Host/common/NativeBreakpoint.h"
 #include "lldb/Host/common/NativeRegisterContext.h"
-#include "lldb/Host/linux/ProcessLauncherLinux.h"
+#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
@@ -332,7 +332,7 @@
   MaybeLogLaunchInfo(launch_info);
 
   ::pid_t pid =
-  ProcessLauncherLinux().LaunchProcess(launch_info, error).GetProcessId();
+  ProcessLauncherPosixFork().LaunchProcess(launch_info, error).GetProcessId();
   if (error.Fail())
 return error;
 
Index: source/Host/posix/ProcessLauncherPosixFork.cpp
===
--- /dev/null
+++ 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 
+#include 
+#include 
+
+#include 
+
+#ifdef __ANDROID__
+#include 
+#endif
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#include 
+#elif defined(__linux__)
+#include 
+#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 = 0x;
+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, "clo

[Lldb-commits] [PATCH] D29347: Transform ProcessLauncherLinux to ProcessLauncherPosixFork

2017-01-31 Thread Ed Maste via Phabricator via lldb-commits
emaste added a comment.

In https://reviews.llvm.org/D29347#662503, @labath wrote:

> @emaste: I'd suggest switching freebsd over to this process launcher as well. 
> I think it's the last user of the ProcessLauncherPosix, and it would enable 
> us to get rid of it.


Indeed. I won't be able to look at it until next week, but will try to switch 
it over as soon as possible.


Repository:
  rL LLVM

https://reviews.llvm.org/D29347



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D28758: Fix typos and update "GDB To LLDB Command Map" to be a bit more clear

2017-01-31 Thread Saagar Jha via Phabricator via lldb-commits
saagarjha added a comment.

Sorry if this is a stupid question, but it's been a while and it doesn't appear 
that anything has happened with this patch; what should I do with it? Should I 
be sending this patch to lldb-commits to be merged? Or will this all happen 
automatically?  (Please bear with me–I've never committed to LLVM before, and 
I'm still trying to figure out how reviews work.)


Repository:
  rL LLVM

https://reviews.llvm.org/D28758



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D29359: Start breaking some dependencies in lldbUtility

2017-01-31 Thread Zachary Turner via lldb-commits
Are you interested in seeing the followup patches for review (moving
classes from Core -> Utility etc), or does it sound reasonable just based
on my description?

On Tue, Jan 31, 2017 at 6:05 PM Jim Ingham  wrote:

> BTW, not to exclude the positive because it doesn't need discussing: all
> the rest of the changes you were proposing seem appropriate and good to
> me.  Thanks for taking the trouble to clean this up.
>
> Jim
>
> > On Jan 31, 2017, at 5:45 PM, Zachary Turner  wrote:
> >
> > Yea, there may be value in both. If i ever tried to do this I'd probably
> take the approach of converting all the obvious cases first that should
> enforce checking and then see what's left. Then we could use llvm:Error and
> lldb::Status, or something
> > On Tue, Jan 31, 2017 at 5:39 PM Jim Ingham  wrote:
> > Yeah, I have no idea how you'd make sure that the SBError returned to
> Python in a Python SBValue was checked before it went out of scope, and I'm
> not sure it's our business to be enforcing that...  So we're going to have
> to do something special for those errors.  We also use the pattern where we
> return a count and an error, but ofttimes you don't care why you got
> nothing, so you just check the count.  The error is informational.  Making
> that obnoxious would also not be a plus.  I actually think there's some
> value to having "programming errors that must be checked" and informational
> errors.  Maybe we need both.
> >
> > Jim
> >
> > > On Jan 31, 2017, at 5:32 PM, Zachary Turner 
> wrote:
> > >
> > > llvm::Error only enforces checking at the point that it goes out of
> scope. So the example you mention should be supported, as long as you
> propagate the value all the way up and don't destroy it. There's also ways
> to explicitly ignore an Error (similar to casting to void to make the
> compiler not warn about unused variables), so as a last resort we could put
> code like that in the SB implementation if we had to
> > > On Tue, Jan 31, 2017 at 5:23 PM Jim Ingham  wrote:
> > > I think we discussed this before, but we need an informational error
> object.  IIRC, the llvm::Error has to be checked.  But for instance if you
> ask a value object to evaluate itself, but you've moved to a section of
> code where the variable has no location, then evaluating that value will
> result in an error.  But that isn't an error the value object code needs to
> do anything about.  And it might go all the way up through the SB & Python
> API's before it's appropriate to check the error.
> > >
> > > IIRC, the llvm::Error is one of those "you have to check it or you get
> smacked by the compiler" dealies.  That's appropriate for some of our uses
> of Error, but not all.
> > >
> > > Jim
> > >
> > >
> > > > On Jan 31, 2017, at 4:01 PM, Zachary Turner via Phabricator via
> lldb-commits  wrote:
> > > >
> > > > zturner added a comment.
> > > >
> > > >> Move Error from Core -> Utility
> > > >
> > > > Also, I almost forgot.
> > > >
> > > > Long term: Delete and use `llvm::Error`
> > > >
> > > >
> > > > https://reviews.llvm.org/D29359
> > > >
> > > >
> > > >
> > > > ___
> > > > lldb-commits mailing list
> > > > lldb-commits@lists.llvm.org
> > > > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> > >
> >
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r293742 - When I added the use of the new compression framework (present in

2017-01-31 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Jan 31 22:23:15 2017
New Revision: 293742

URL: http://llvm.org/viewvc/llvm-project?rev=293742&view=rev
Log:
When I added the use of the new compression framework (present in
Mac OS X 10.11, El Capitan, released c. Oct 2015) I conditionalized
the use of the framework on "if sdk == macosx 10.11".  But since
macOS 10.12 has shipped this year, the framework was no longer being
built in.  I can either start listing every OS 10.11 and newer, or
remove the version check.

This will break building lldb with xcodebuild / Xcode for people 
running Mac OS X 10.10 or older.  If so, I'll back this change out.
I'm not sure if we have many people working on macs running the
older OSes on their build systems.

 

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=293742&r1=293741&r2=293742&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jan 31 22:23:15 2017
@@ -7919,10 +7919,8 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
-   LLDB_COMPRESSION_CFLAGS = "";
-   "LLDB_COMPRESSION_CFLAGS[sdk=macosx10.11]" = 
"-DHAVE_LIBCOMPRESSION=1";
-   LLDB_COMPRESSION_LDFLAGS = "";
-   "LLDB_COMPRESSION_LDFLAGS[sdk=macosx10.11]" = 
"-weak-lcompression";
+   LLDB_COMPRESSION_CFLAGS = 
"-DHAVE_LIBCOMPRESSION=1";
+   LLDB_COMPRESSION_LDFLAGS = "-weak-lcompression";
LLDB_COVERAGE_CFLAGS = 
"$(LLDB_COVERAGE_CFLAGS_$(LLDB_ENABLE_COVERAGE))";
LLDB_COVERAGE_CFLAGS_1 = 
"-fprofile-instr-generate -fcoverage-mapping";
LLDB_COVERAGE_LDFLAGS = 
"$(LLDB_COVERAGE_LDFLAGS_$(LLDB_ENABLE_COVERAGE))";
@@ -8012,10 +8010,8 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
-   LLDB_COMPRESSION_CFLAGS = "";
-   "LLDB_COMPRESSION_CFLAGS[sdk=macosx10.11]" = 
"-DHAVE_LIBCOMPRESSION=1";
-   LLDB_COMPRESSION_LDFLAGS = "";
-   "LLDB_COMPRESSION_LDFLAGS[sdk=macosx10.11]" = 
"-weak-lcompression";
+   LLDB_COMPRESSION_CFLAGS = 
"-DHAVE_LIBCOMPRESSION=1";
+   LLDB_COMPRESSION_LDFLAGS = "-weak-lcompression";
LLDB_COVERAGE_CFLAGS = 
"$(LLDB_COVERAGE_CFLAGS_$(LLDB_ENABLE_COVERAGE))";
LLDB_COVERAGE_CFLAGS_1 = 
"-fprofile-instr-generate -fcoverage-mapping";
LLDB_COVERAGE_LDFLAGS = 
"$(LLDB_COVERAGE_LDFLAGS_$(LLDB_ENABLE_COVERAGE))";
@@ -8966,10 +8962,8 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
-   LLDB_COMPRESSION_CFLAGS = "";
-   "LLDB_COMPRESSION_CFLAGS[sdk=macosx10.11]" = 
"-DHAVE_LIBCOMPRESSION=1";
-   LLDB_COMPRESSION_LDFLAGS = "";
-   "LLDB_COMPRESSION_LDFLAGS[sdk=macosx10.11]" = 
"-weak-lcompression";
+   LLDB_COMPRESSION_CFLAGS = 
"-DHAVE_LIBCOMPRESSION=1";
+   LLDB_COMPRESSION_LDFLAGS = "-weak-lcompression";
LLDB_COVERAGE_CFLAGS = 
"$(LLDB_COVERAGE_CFLAGS_$(LLDB_ENABLE_COVERAGE))";
LLDB_COVERAGE_CFLAGS_1 = 
"-fprofile-instr-generate -fcoverage-mapping";
LLDB_COVERAGE_LDFLAGS = 
"$(LLDB_COVERAGE_LDFLAGS_$(LLDB_ENABLE_COVERAGE))";
@@ -9685,10 +9679,8 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
-   LLDB_COMPRESSION_CFLAGS = "";
-   
"LLDB_COMPRESSION_CFLAGS[sdk=macosx10.11internal]" = "-DHAVE_LIBCOMPRESSION=1";
-   LLDB_COMPRESSION_LDFLAGS = "";
-   "LLDB_COMPRESSION_LDFLAGS[sdk=macosx10.11]" = 
"-weak-lcompression";
+   LLDB_COMPRESSION_CFLAGS = 
"-DHAVE_LIBCOMPRESSION=1";
+   LLDB_COMPRESSION_LDFLAGS = "-weak-lcompression";

[Lldb-commits] [PATCH] D29256: Do not pass non-POD type variables through variadic function

2017-01-31 Thread Ilia K via Phabricator via lldb-commits
ki.stfu added a comment.

In https://reviews.llvm.org/D29256#662167, @krytarowski wrote:

> @ki.stfu do you still agree with this patch?


Please follow my comments and then we can go ahead.




Comment at: tools/lldb-mi/MIDriver.cpp:512
 CMICmnThreadMgrStd::Instance().GetErrorDescription().c_str());
-SetErrorDescriptionn(errMsg);
+SetErrorDescriptionn(errMsg.c_str());
 return MIstatus::failure;

`SetErrorDescription` accepts a const reference to `CMIUtilString` so it suits 
better than `SetErrorDescriptionn` (double `n`).
```
SetErrorDescription(errMsg);
```

//Oh, certainly it should be renamed//


Repository:
  rL LLVM

https://reviews.llvm.org/D29256



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits