[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2019-01-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.



Comment at: include/lldb/Core/Architecture.h:119-123
+  virtual std::vector
+  ConfigurationRegisterNames() const { return {}; }
+
+  using ConfigurationRegisterValues = std::map;
+  virtual bool SetFlagsFrom(const ConfigurationRegisterValues &) { return 
true; }

Any reason these definitions need to be in this class? Seems like something the 
plug-ins that access these should do, and this code shouldn't be in this file.



Comment at: include/lldb/Core/Architecture.h:125
+
+  virtual bool TestFlag(Flags::ValueType bit) const { return false; }
+

We should add a "Flags m_flags" as an instance variable and just provide 
accessors:

```
class Architecture {
  Flags GetFlags() { return m_flags; }
  const Flags GetFlags() const { return m_flags; }
};
```



Comment at: include/lldb/Core/Architecture.h:127
+
+  virtual bool MatchFlags(const ArchSpec &spec) const { return true; }
+

It is not clear what this function does and it doesn't seem like a function 
that belongs on this class.



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.cpp:44-71
+bool ArchitectureArc::SetFlagsFrom(const ConfigurationRegisterValues ®s) {
+  ConstString rf_build("rf_build");
+  auto it = regs.find(rf_build);
+  if (it == regs.end())
+return false;
+
+  // RF_BUILD "Number of Entries" bit.

This entire function's contents should be placed where it is called and not in 
the Architecture class.



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.cpp:73-75
+bool ArchitectureArc::TestFlag(Flags::ValueType bit) const {
+  return m_flags.Test(bit);
+}

Remove and use accessor to m_flags.



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.cpp:77-79
+std::vector ArchitectureArc::ConfigurationRegisterNames() const {
+  return { ConstString("rf_build"), ConstString("isa_config") };
+}

Remove from this class and inline at call site.



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.cpp:81-86
+bool ArchitectureArc::MatchFlags(const ArchSpec &spec) const {
+  return ((spec.GetByteOrder() == eByteOrderBig) ==
+ m_flags.Test(arc_features::big_endian)) &&
+ ((spec.GetAddressByteSize() == 4) ==
+ m_flags.Test(arc_features::address_size_32));
+}

Remove from this class and inline at call site.



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.h:36-42
+  std::vector ConfigurationRegisterNames() const override;
+
+  bool SetFlagsFrom(const ConfigurationRegisterValues &) override;
+
+  bool TestFlag(Flags::ValueType bit) const override;
+
+  bool MatchFlags(const ArchSpec &spec) const override;

These four functions don't seem like they belong on the Architecture class. It 
would be best to just have the code that calls these methods inline the code 
where needed.



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.h:48
+
+  lldb_private::Flags m_flags;
+};

I would put this in the base class and then add just an accessor:

```
class Architecture {
  Flags GetFlags() { return m_flags; }
  const Flags GetFlags() const { return m_flags; }
};
```


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55718/new/

https://reviews.llvm.org/D55718



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


[Lldb-commits] [PATCH] D57037: BreakpadRecords: Address post-commit feedback

2019-01-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Let me know what you think of the UUID code and if you want to include that in 
this patch




Comment at: source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp:67
+/// to the endian-specific integer N. Return true on success.
+template  static bool consume_integer(llvm::StringRef &str, T &N) {
+  llvm::StringRef chunk = str.take_front(hex_digits());

rename to "consume_hex_integer" or an extra parameter for the base instead of 
hard coding to 16?



Comment at: source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp:111-112
   // match the native uuid format of these platforms.
-  return UUID::fromData(&data, os == llvm::Triple::Win32 ? 20 : 16);
+  return UUID::fromData(&data, os == llvm::Triple::Win32 ? sizeof(data)
+ : sizeof(data.uuid));
 }

For Apple platforms Breakpad actually incorrectly byte swaps the first 32 bits 
and the next two 16 bit values. I have a patch for this, but since this is 
moving, it would be great to get that fix in here. Also, many linux breakpad 
file have the UUID field present but set to all zeroes which is bad as UUID 
parsing code will cause multiple modules to claim a UUID of all zeroes is valid 
and causes all modules with such a UUID to just use the first one it finds. The 
code I have in my unsubmitted patch is:

```
  if (pdb70_uuid->Age == 0) {
bool all_zeroes = true;
for (size_t i=0; all_zeroes && iUuid); ++i)
  all_zeroes = pdb70_uuid->Uuid[i] == 0;
// Many times UUIDs are not filled in at all, so avoid claiming that
// all such libraries have a valid UUID that is all zeroes.
if (all_zeroes)
  return UUID();
if (arch.GetTriple().getVendor() == llvm::Triple::Apple) {
  // Breakpad incorrectly byte swaps the first 32 bit and next 2 16 bit
  // values in the UUID field. Undo this so we can match things up
  // with our symbol files
  uint8_t apple_uuid[16];
  // Byte swap the first 32 bits
  apple_uuid[0] = pdb70_uuid->Uuid[3];
  apple_uuid[1] = pdb70_uuid->Uuid[2];
  apple_uuid[2] = pdb70_uuid->Uuid[1];
  apple_uuid[3] = pdb70_uuid->Uuid[0];
  // Byte swap the next 16 bit value
  apple_uuid[4] = pdb70_uuid->Uuid[5];
  apple_uuid[5] = pdb70_uuid->Uuid[4];
  // Byte swap the next 16 bit value
  apple_uuid[6] = pdb70_uuid->Uuid[7];
  apple_uuid[7] = pdb70_uuid->Uuid[6];
  for (size_t i=8; iUuid); ++i)
apple_uuid[i] = pdb70_uuid->Uuid[i];
  return UUID::fromData(apple_uuid, sizeof(apple_uuid));
} else
  return UUID::fromData(pdb70_uuid->Uuid, sizeof(pdb70_uuid->Uuid));
  } else
return UUID::fromData(pdb70_uuid, sizeof(*pdb70_uuid));
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57037/new/

https://reviews.llvm.org/D57037



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


[Lldb-commits] [lldb] r351830 - [CMake] Turn LLDB_FRAMEWORK_TOOLS into STRING to allow overrides from cache files

2019-01-22 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Tue Jan 22 07:59:47 2019
New Revision: 351830

URL: http://llvm.org/viewvc/llvm-project?rev=351830&view=rev
Log:
[CMake] Turn LLDB_FRAMEWORK_TOOLS into STRING to allow overrides from cache 
files

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

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=351830&r1=351829&r2=351830&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue Jan 22 07:59:47 2019
@@ -62,7 +62,7 @@ if(LLDB_BUILD_FRAMEWORK)
   set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default 
is A)")
   set(LLDB_FRAMEWORK_BUILD_DIR bin CACHE STRING "Output directory for 
LLDB.framework")
   set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Install 
directory for LLDB.framework")
-  set(LLDB_FRAMEWORK_TOOLS darwin-debug;debugserver;lldb-argdumper;lldb-server 
CACHE INTERNAL
+  set(LLDB_FRAMEWORK_TOOLS darwin-debug;debugserver;lldb-argdumper;lldb-server 
CACHE STRING
   "List of tools to include in LLDB.framework/Resources")
 
   # Set designated directory for all dSYMs. Essentially, this emits the


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


[Lldb-commits] [PATCH] D57037: BreakpadRecords: Address post-commit feedback

2019-01-22 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 2 inline comments as done.
labath added inline comments.



Comment at: source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp:67
+/// to the endian-specific integer N. Return true on success.
+template  static bool consume_integer(llvm::StringRef &str, T &N) {
+  llvm::StringRef chunk = str.take_front(hex_digits());

clayborg wrote:
> rename to "consume_hex_integer" or an extra parameter for the base instead of 
> hard coding to 16?
I'll rename the function before submitting.



Comment at: source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp:111-112
   // match the native uuid format of these platforms.
-  return UUID::fromData(&data, os == llvm::Triple::Win32 ? 20 : 16);
+  return UUID::fromData(&data, os == llvm::Triple::Win32 ? sizeof(data)
+ : sizeof(data.uuid));
 }

clayborg wrote:
> For Apple platforms Breakpad actually incorrectly byte swaps the first 32 
> bits and the next two 16 bit values. I have a patch for this, but since this 
> is moving, it would be great to get that fix in here. Also, many linux 
> breakpad file have the UUID field present but set to all zeroes which is bad 
> as UUID parsing code will cause multiple modules to claim a UUID of all 
> zeroes is valid and causes all modules with such a UUID to just use the first 
> one it finds. The code I have in my unsubmitted patch is:
> 
> ```
>   if (pdb70_uuid->Age == 0) {
> bool all_zeroes = true;
> for (size_t i=0; all_zeroes && iUuid); ++i)
>   all_zeroes = pdb70_uuid->Uuid[i] == 0;
> // Many times UUIDs are not filled in at all, so avoid claiming that
> // all such libraries have a valid UUID that is all zeroes.
> if (all_zeroes)
>   return UUID();
> if (arch.GetTriple().getVendor() == llvm::Triple::Apple) {
>   // Breakpad incorrectly byte swaps the first 32 bit and next 2 16 
> bit
>   // values in the UUID field. Undo this so we can match things up
>   // with our symbol files
>   uint8_t apple_uuid[16];
>   // Byte swap the first 32 bits
>   apple_uuid[0] = pdb70_uuid->Uuid[3];
>   apple_uuid[1] = pdb70_uuid->Uuid[2];
>   apple_uuid[2] = pdb70_uuid->Uuid[1];
>   apple_uuid[3] = pdb70_uuid->Uuid[0];
>   // Byte swap the next 16 bit value
>   apple_uuid[4] = pdb70_uuid->Uuid[5];
>   apple_uuid[5] = pdb70_uuid->Uuid[4];
>   // Byte swap the next 16 bit value
>   apple_uuid[6] = pdb70_uuid->Uuid[7];
>   apple_uuid[7] = pdb70_uuid->Uuid[6];
>   for (size_t i=8; iUuid); ++i)
> apple_uuid[i] = pdb70_uuid->Uuid[i];
>   return UUID::fromData(apple_uuid, sizeof(apple_uuid));
> } else
>   return UUID::fromData(pdb70_uuid->Uuid, sizeof(pdb70_uuid->Uuid));
>   } else
> return UUID::fromData(pdb70_uuid, sizeof(*pdb70_uuid));
> ```
The byte swapping is already handled in this code (that's why it's this 
complicated). My impression was that the swapping is not apple-specific, but 
rather depends where you read the UUID from (MODULE record has it swapped, INFO 
record doesn't). Though that may depend on how we chose to interpret the raw 
bytes in other UUID sources (object files, pdb files, ...).

As for the all-zero case, that should be easily fixable, by changing fromData 
to fromOptionalData, but I'm surprised that this is necessary, as I was under 
the impression that breakpad invent's its own UUIDs in case the original object 
file doesn't have them. (This would actually be the better case, as otherwise 
we'd have to figure out how to tell the fictional and non-fictional uuids 
apart.) @lemo: Can you shed any light on this?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57037/new/

https://reviews.llvm.org/D57037



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


[Lldb-commits] [PATCH] D57037: BreakpadRecords: Address post-commit feedback

2019-01-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp:87-97
   // The textual module id encoding should be between 33 and 40 bytes long,
   // depending on the size of the age field, which is of variable length.
   // The first three chunks of the id are encoded in big endian, so we need to
   // byte-swap those.
-  if (str.size() < 33 || str.size() > 40)
+  if (str.size() <= hex_digits() ||
+  str.size() > hex_digits())
 return UUID();

This is OK as long as the UUIDs for ELF don't fall into this category. I am 
able to match up UUIDs for ELF just fine for breakpad files for Android.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57037/new/

https://reviews.llvm.org/D57037



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


[Lldb-commits] [PATCH] D57037: BreakpadRecords: Address post-commit feedback

2019-01-22 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added inline comments.



Comment at: source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp:87-97
   // The textual module id encoding should be between 33 and 40 bytes long,
   // depending on the size of the age field, which is of variable length.
   // The first three chunks of the id are encoded in big endian, so we need to
   // byte-swap those.
-  if (str.size() < 33 || str.size() > 40)
+  if (str.size() <= hex_digits() ||
+  str.size() > hex_digits())
 return UUID();

clayborg wrote:
> This is OK as long as the UUIDs for ELF don't fall into this category. I am 
> able to match up UUIDs for ELF just fine for breakpad files for Android.
Normally on linux you should always have the INFO record, which will have the 
unmangled UUID, and which we will give preference to if it is available.

If for some reason we don't find an INFO record, then we will use the version 
from the MODULE record, which we will manually unmangle. But that should be the 
right thing to do as it matches what the breakpad generator does. (You can see 
this by looking at a file which has both of these records -- they will differ 
in that the first one will be mangled and will have an extra zero at the end).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57037/new/

https://reviews.llvm.org/D57037



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


[Lldb-commits] [lldb] r351863 - [CMake] Replace use of llvm-config with LLVM and Clang CMake packages

2019-01-22 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Jan 22 11:26:42 2019
New Revision: 351863

URL: http://llvm.org/viewvc/llvm-project?rev=351863&view=rev
Log:
[CMake] Replace use of llvm-config with LLVM and Clang CMake packages

Summary:
I did this for two reasons:
- Using the CMake packages simplifies building LLDB Standalone. This is for two
  reasons: 1) We were doing a decent amount of work that is already done in the
  LLVMConfig.cmake that we want to import, 2) We had to do some manual work to 
call
  llvm-config, parse its output, and populate variables that the build system
  uses.
- As far as I understand, using llvm-config makes it difficult if not impossible
  to cross-compile LLDB standalone.

Reviewers: sgraenitz, labath, zturner, JDevlieghere, davide, aprantl, 
stella.stamenova

Subscribers: mgorny, lldb-commits

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

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

Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBStandalone.cmake?rev=351863&r1=351862&r2=351863&view=diff
==
--- lldb/trunk/cmake/modules/LLDBStandalone.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBStandalone.cmake Tue Jan 22 11:26:42 2019
@@ -5,73 +5,26 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
 
   option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 
'install' target." OFF)
 
-  # Rely on llvm-config.
-  set(CONFIG_OUTPUT)
-  find_program(LLVM_CONFIG "llvm-config")
-  if(LLVM_CONFIG)
-message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
-set(CONFIG_COMMAND ${LLVM_CONFIG}
-  "--assertion-mode"
-  "--bindir"
-  "--libdir"
-  "--includedir"
-  "--prefix"
-  "--src-root"
-  "--cmakedir")
-execute_process(
-  COMMAND ${CONFIG_COMMAND}
-  RESULT_VARIABLE HAD_ERROR
-  OUTPUT_VARIABLE CONFIG_OUTPUT
-)
-if(NOT HAD_ERROR)
-  string(REGEX REPLACE
-"[ \t]*[\r\n]+[ \t]*" ";"
-CONFIG_OUTPUT ${CONFIG_OUTPUT})
-
-else()
-  string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
-  message(STATUS "${CONFIG_COMMAND_STR}")
-  message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
-endif()
-  else()
-message(FATAL_ERROR "llvm-config not found -- ${LLVM_CONFIG}")
-  endif()
+  set(LLDB_PATH_TO_LLVM_BUILD "" CACHE PATH "Path to LLVM build tree")
+  set(LLDB_PATH_TO_CLANG_BUILD "" CACHE PATH "Path to Clang build tree")
 
-  list(GET CONFIG_OUTPUT 0 ENABLE_ASSERTIONS)
-  list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
-  list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
-  list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
-  list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
-  list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
-  list(GET CONFIG_OUTPUT 6 LLVM_CMAKE_PATH)
-
-  if(NOT MSVC_IDE)
-set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
-  CACHE BOOL "Enable assertions")
-# Assertions should follow llvm-config's.
-mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
-  endif()
+  file(TO_CMAKE_PATH LLDB_PATH_TO_LLVM_BUILD "${LLDB_PATH_TO_LLVM_BUILD}")
+  file(TO_CMAKE_PATH LLDB_PATH_TO_CLANG_BUILD "${LLDB_PATH_TO_CLANG_BUILD}")
 
-  set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
-  set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
-  set(LLVM_MAIN_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
-  set(LLVM_DIR ${LLVM_OBJ_ROOT}/cmake/modules/CMakeFiles CACHE PATH "Path to 
LLVM build tree CMake files")
-  set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
-  set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
-  set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to 
llvm-lit")
+  find_package(LLVM REQUIRED CONFIG
+HINTS "${LLDB_PATH_TO_LLVM_BUILD}" NO_CMAKE_FIND_ROOT_PATH)
+  find_package(Clang REQUIRED CONFIG
+HINTS "${LLDB_PATH_TO_CLANG_BUILD}" NO_CMAKE_FIND_ROOT_PATH)
+
+  # We set LLVM_MAIN_INCLUDE_DIR so that it gets included in TableGen flags.
+  set(LLVM_MAIN_INCLUDE_DIR "${LLVM_BUILD_MAIN_INCLUDE_DIR}" CACHE PATH "Path 
to LLVM's source include dir")
+  # We set LLVM_CMAKE_PATH so that GetSVN.cmake is found correctly when 
building SVNVersion.inc
+  set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake 
modules")
 
+  set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to 
llvm-lit")
   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
 NO_DEFAULT_PATH)
 
-  set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
-  if(EXISTS ${LLVMCONFIG_FILE})
-file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH}" LLVM_CMAKE_PATH)
-list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
-include(${LLVMCONFIG_FILE})
-  else()
-message(FATAL_ERROR "Not found: ${LLVMCONFIG_FILE}")
-  endif()
-
   # They are used as destination of target generators.
   set(LLVM_RUNTIME_

[Lldb-commits] [PATCH] D56531: [CMake] Replace use of llvm-config with LLVM and Clang CMake packages

2019-01-22 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL351863: [CMake] Replace use of llvm-config with LLVM and 
Clang CMake packages (authored by xiaobai, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56531/new/

https://reviews.llvm.org/D56531

Files:
  lldb/trunk/cmake/modules/LLDBStandalone.cmake

Index: lldb/trunk/cmake/modules/LLDBStandalone.cmake
===
--- lldb/trunk/cmake/modules/LLDBStandalone.cmake
+++ lldb/trunk/cmake/modules/LLDBStandalone.cmake
@@ -5,73 +5,26 @@
 
   option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
 
-  # Rely on llvm-config.
-  set(CONFIG_OUTPUT)
-  find_program(LLVM_CONFIG "llvm-config")
-  if(LLVM_CONFIG)
-message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
-set(CONFIG_COMMAND ${LLVM_CONFIG}
-  "--assertion-mode"
-  "--bindir"
-  "--libdir"
-  "--includedir"
-  "--prefix"
-  "--src-root"
-  "--cmakedir")
-execute_process(
-  COMMAND ${CONFIG_COMMAND}
-  RESULT_VARIABLE HAD_ERROR
-  OUTPUT_VARIABLE CONFIG_OUTPUT
-)
-if(NOT HAD_ERROR)
-  string(REGEX REPLACE
-"[ \t]*[\r\n]+[ \t]*" ";"
-CONFIG_OUTPUT ${CONFIG_OUTPUT})
-
-else()
-  string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
-  message(STATUS "${CONFIG_COMMAND_STR}")
-  message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
-endif()
-  else()
-message(FATAL_ERROR "llvm-config not found -- ${LLVM_CONFIG}")
-  endif()
+  set(LLDB_PATH_TO_LLVM_BUILD "" CACHE PATH "Path to LLVM build tree")
+  set(LLDB_PATH_TO_CLANG_BUILD "" CACHE PATH "Path to Clang build tree")
 
-  list(GET CONFIG_OUTPUT 0 ENABLE_ASSERTIONS)
-  list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
-  list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
-  list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
-  list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
-  list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
-  list(GET CONFIG_OUTPUT 6 LLVM_CMAKE_PATH)
-
-  if(NOT MSVC_IDE)
-set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
-  CACHE BOOL "Enable assertions")
-# Assertions should follow llvm-config's.
-mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
-  endif()
+  file(TO_CMAKE_PATH LLDB_PATH_TO_LLVM_BUILD "${LLDB_PATH_TO_LLVM_BUILD}")
+  file(TO_CMAKE_PATH LLDB_PATH_TO_CLANG_BUILD "${LLDB_PATH_TO_CLANG_BUILD}")
 
-  set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
-  set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
-  set(LLVM_MAIN_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
-  set(LLVM_DIR ${LLVM_OBJ_ROOT}/cmake/modules/CMakeFiles CACHE PATH "Path to LLVM build tree CMake files")
-  set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
-  set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
-  set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to llvm-lit")
+  find_package(LLVM REQUIRED CONFIG
+HINTS "${LLDB_PATH_TO_LLVM_BUILD}" NO_CMAKE_FIND_ROOT_PATH)
+  find_package(Clang REQUIRED CONFIG
+HINTS "${LLDB_PATH_TO_CLANG_BUILD}" NO_CMAKE_FIND_ROOT_PATH)
+
+  # We set LLVM_MAIN_INCLUDE_DIR so that it gets included in TableGen flags.
+  set(LLVM_MAIN_INCLUDE_DIR "${LLVM_BUILD_MAIN_INCLUDE_DIR}" CACHE PATH "Path to LLVM's source include dir")
+  # We set LLVM_CMAKE_PATH so that GetSVN.cmake is found correctly when building SVNVersion.inc
+  set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules")
 
+  set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to llvm-lit")
   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
 NO_DEFAULT_PATH)
 
-  set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
-  if(EXISTS ${LLVMCONFIG_FILE})
-file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH}" LLVM_CMAKE_PATH)
-list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
-include(${LLVMCONFIG_FILE})
-  else()
-message(FATAL_ERROR "Not found: ${LLVMCONFIG_FILE}")
-  endif()
-
   # They are used as destination of target generators.
   set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
   set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
@@ -82,6 +35,9 @@
 set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
   endif()
 
+  # We append the directory in which LLVMConfig.cmake lives. We expect LLVM's
+  # CMake modules to be in that directory as well.
+  list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}")
   include(AddLLVM)
   include(TableGen)
   include(HandleLLVMOptions)
@@ -99,28 +55,15 @@
 message("-- Found PythonInterp: ${PYTHON_EXECUTABLE}")
   endif()
 
-  # Import CMake library targets from LLVM and Clang.
-  include("${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm/LLVMConfig.c

[Lldb-commits] [PATCH] D57011: Refactor HAVE_LIBCOMPRESSION and related code in GDBRemoteCommunication

2019-01-22 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

I'll test this later today.  The cleanup looks good; the goal of the most 
recent changes was to make HAVE_LIBCOMPESSION always enabled on Darwin systems 
- the setting would occasionally get lost in the Xcode project settings and 
we'd have slow channels using uncompressed communication until we looked into 
the perf regressions.  After this sequence happened twice, I wanted to make it 
always-on (it also needed to be conditional for a while because these API were 
only added to Darwin ~4 years ago)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57011/new/

https://reviews.llvm.org/D57011



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


[Lldb-commits] [lldb] r351879 - [CMake] Fix two details from r351863

2019-01-22 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Tue Jan 22 13:14:51 2019
New Revision: 351879

URL: http://llvm.org/viewvc/llvm-project?rev=351879&view=rev
Log:
[CMake] Fix two details from r351863

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

Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBStandalone.cmake?rev=351879&r1=351878&r2=351879&view=diff
==
--- lldb/trunk/cmake/modules/LLDBStandalone.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBStandalone.cmake Tue Jan 22 13:14:51 2019
@@ -6,10 +6,10 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 
'install' target." OFF)
 
   set(LLDB_PATH_TO_LLVM_BUILD "" CACHE PATH "Path to LLVM build tree")
-  set(LLDB_PATH_TO_CLANG_BUILD "" CACHE PATH "Path to Clang build tree")
+  set(LLDB_PATH_TO_CLANG_BUILD "${LLDB_PATH_TO_LLVM_BUILD}" CACHE PATH "Path 
to Clang build tree")
 
-  file(TO_CMAKE_PATH LLDB_PATH_TO_LLVM_BUILD "${LLDB_PATH_TO_LLVM_BUILD}")
-  file(TO_CMAKE_PATH LLDB_PATH_TO_CLANG_BUILD "${LLDB_PATH_TO_CLANG_BUILD}")
+  file(TO_CMAKE_PATH "${LLDB_PATH_TO_LLVM_BUILD}" LLDB_PATH_TO_LLVM_BUILD)
+  file(TO_CMAKE_PATH "${LLDB_PATH_TO_CLANG_BUILD}" LLDB_PATH_TO_CLANG_BUILD)
 
   find_package(LLVM REQUIRED CONFIG
 HINTS "${LLDB_PATH_TO_LLVM_BUILD}" NO_CMAKE_FIND_ROOT_PATH)


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


[Lldb-commits] [PATCH] D56531: [CMake] Replace use of llvm-config with LLVM and Clang CMake packages

2019-01-22 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

FYI Fixed two small details with https://reviews.llvm.org/rL351879, hope that's 
ok:

- `LLDB_PATH_TO_CLANG_BUILD` defaults to `LLDB_PATH_TO_LLVM_BUILD`
- switch args for `file(TO_CMAKE_PATH "" )`


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56531/new/

https://reviews.llvm.org/D56531



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


[Lldb-commits] [PATCH] D56531: [CMake] Replace use of llvm-config with LLVM and Clang CMake packages

2019-01-22 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

@sgraenitz: I don't mind at all, I view those changes as improvements. Thanks 
for that!


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56531/new/

https://reviews.llvm.org/D56531



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


[Lldb-commits] [lldb] r351902 - Revert "[dotest] Add logging to investigate CI issue."

2019-01-22 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Jan 22 16:13:47 2019
New Revision: 351902

URL: http://llvm.org/viewvc/llvm-project?rev=351902&view=rev
Log:
Revert "[dotest] Add logging to investigate CI issue."

We figured out the issue so the logging is no longer necessary. It turns
out we were using a session format that was not unique for inline tests.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=351902&r1=351901&r2=351902&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Tue Jan 22 16:13:47 
2019
@@ -1228,12 +1228,7 @@ class Base(unittest2.TestCase):
 remove_file(dst)
 
 lldbutil.mkdir_p(os.path.dirname(dst))
-try:
-os.rename(src, dst)
-except OSError:
-print("src (exists={}): 
{}".format(os.path.exists(src), src))
-print("dst (exists={}): 
{}".format(os.path.exists(dst), dst))
-raise
+os.rename(src, dst)
 else:
 # success!  (and we don't want log files) delete log files
 for log_file in log_files_for_this_test:


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