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

2019-01-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 183265.
teemperor added a comment.

- Added missing include.

Thanks for testing Jason!


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

https://reviews.llvm.org/D57011

Files:
  include/lldb/Host/Config.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -18,6 +18,7 @@
 #include 
 
 #include "lldb/Core/Communication.h"
+#include "lldb/Host/Config.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Utility/Args.h"
 #include "lldb/Utility/Listener.h"
@@ -217,8 +218,10 @@
   HostThread m_listen_thread;
   std::string m_listen_url;
 
-  CompressionType m_decompression_scratch_type;
-  void *m_decompression_scratch;
+#if defined(HAVE_LIBCOMPRESSION)
+  CompressionType m_decompression_scratch_type = CompressionType::None;
+  void *m_decompression_scratch = nullptr;
+#endif
 
   DISALLOW_COPY_AND_ASSIGN(GDBRemoteCommunication);
 };
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -41,8 +41,7 @@
 #define DEBUGSERVER_BASENAME "lldb-server"
 #endif
 
-#if defined(__APPLE__)
-#define HAVE_LIBCOMPRESSION
+#if defined(HAVE_LIBCOMPRESSION)
 #include 
 #endif
 
@@ -67,10 +66,7 @@
 #endif
   m_echo_number(0), m_supports_qEcho(eLazyBoolCalculate), m_history(512),
   m_send_acks(true), m_compression_type(CompressionType::None),
-  m_listen_url(), m_decompression_scratch_type(CompressionType::None),
-  m_decompression_scratch(nullptr) {
-  // Unused unless HAVE_LIBCOMPRESSION is defined.
-  (void)m_decompression_scratch_type;
+  m_listen_url() {
 }
 
 //--
@@ -81,8 +77,10 @@
 Disconnect();
   }
 
+#if defined(HAVE_LIBCOMPRESSION)
   if (m_decompression_scratch)
 free (m_decompression_scratch);
+#endif
 
   // Stop the communications read thread which is used to parse all incoming
   // packets.  This function will block until the read thread returns.
Index: include/lldb/Host/Config.h
===
--- include/lldb/Host/Config.h
+++ include/lldb/Host/Config.h
@@ -25,6 +25,8 @@
 
 #define HAVE_SIGACTION 1
 
+#define HAVE_LIBCOMPRESSION 1
+
 #else
 
 #error This file is only used by the Xcode build.


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -18,6 +18,7 @@
 #include 
 
 #include "lldb/Core/Communication.h"
+#include "lldb/Host/Config.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Utility/Args.h"
 #include "lldb/Utility/Listener.h"
@@ -217,8 +218,10 @@
   HostThread m_listen_thread;
   std::string m_listen_url;
 
-  CompressionType m_decompression_scratch_type;
-  void *m_decompression_scratch;
+#if defined(HAVE_LIBCOMPRESSION)
+  CompressionType m_decompression_scratch_type = CompressionType::None;
+  void *m_decompression_scratch = nullptr;
+#endif
 
   DISALLOW_COPY_AND_ASSIGN(GDBRemoteCommunication);
 };
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -41,8 +41,7 @@
 #define DEBUGSERVER_BASENAME "lldb-server"
 #endif
 
-#if defined(__APPLE__)
-#define HAVE_LIBCOMPRESSION
+#if defined(HAVE_LIBCOMPRESSION)
 #include 
 #endif
 
@@ -67,10 +66,7 @@
 #endif
   m_echo_number(0), m_supports_qEcho(eLazyBoolCalculate), m_history(512),
   m_send_acks(true), m_compression_type(CompressionType::None),
-  m_listen_url(), m_decompression_scratch_type(CompressionType::None),
-  m_decompression_scratch(nullptr) {
-  // Unused unless HAVE_LIBCOMPRESSION is defined.
-  (void)m_decompression_scratch_type;
+  m_listen_url() {
 }
 
 //--
@@ -81,8 +77,10 @@
 Disconnect();
   }
 
+#if defined(HAVE_LIBCOMPRESSION)
   if (m_decompression_scratch)
 free (m_decompression_scratch);
+#endif
 
   // Stop the communications read thread which is used to parse all incoming
   // packets.  This function will block until the read thread returns.
Index: include/lldb/Host/Config.h
===
--- include/lldb/Host/C

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

2019-01-24 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added inline comments.



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.cpp:1-8
+//===-- ArchitectureArc.cpp -*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//

clayborg wrote:
> Does this file need to exist anymore? If not remove it. If so, fill in at 
> least one virtual function that is needed.
It's needed to not keep static functions implementation in the header file. And 
it will definitely be required when I'll implement `GetBreakableLoadAddress` to 
handle delay slots, but this will not be in this revision.



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.h:34
+
+  void OverrideStopInfo(Thread &thread) const override {}
+

clayborg wrote:
> Are we missing this? Any reason for this to exist? If this function need to 
> doesn't exist then this ArchitectureArc class doesn't need to exist and can 
> be removed.
It's because `OverrideStopInfo` is a pure virtual function. No one but 
`ArchitectureArm` really needs to override this. I'll be glad to replace `= 0` 
in the base class with the empty body (by a separate commit). 


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55718



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


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

2019-01-24 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 183301.
tatyana-krasnukha added a comment.
Herald added subscribers: jsji, atanasyan, kbarton, nemanjai, sdardis.

Moved ARC flags enum inside the `ArchitectureArc` class;

Made `OverrideStopInfo` with empty body instead of being pure virtual. If this 
change is Ok I'll commit it before ARC support.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718

Files:
  include/lldb/Core/Architecture.h
  include/lldb/Utility/ArchSpec.h
  source/API/SystemInitializerFull.cpp
  source/Plugins/Architecture/Arc/ArchitectureArc.cpp
  source/Plugins/Architecture/Arc/ArchitectureArc.h
  source/Plugins/Architecture/Arc/CMakeLists.txt
  source/Plugins/Architecture/CMakeLists.txt
  source/Plugins/Architecture/Mips/ArchitectureMips.h
  source/Plugins/Architecture/PPC64/ArchitecturePPC64.h
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/Utility/DynamicRegisterInfo.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/Platform.cpp
  source/Target/Thread.cpp
  source/Utility/ArchSpec.cpp

Index: source/Utility/ArchSpec.cpp
===
--- source/Utility/ArchSpec.cpp
+++ source/Utility/ArchSpec.cpp
@@ -220,7 +220,8 @@
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba4,
  "kalimba4"},
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba5,
- "kalimba5"}};
+ "kalimba5"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arc, ArchSpec::eCore_arc, "arc"}};
 
 // Ensure that we have an entry in the g_core_definitions for each core. If you
 // comment out an entry above, you will need to comment out the corresponding
@@ -457,7 +458,9 @@
 {ArchSpec::eCore_kalimba4, llvm::ELF::EM_CSR_KALIMBA,
  llvm::Triple::KalimbaSubArch_v4, 0xu, 0xu}, // KALIMBA
 {ArchSpec::eCore_kalimba5, llvm::ELF::EM_CSR_KALIMBA,
- llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu} // KALIMBA
+ llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu}, // KALIMBA
+{ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
+ 0xu, 0xu } // ARC
 };
 
 static const ArchDefinition g_elf_arch_def = {
Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2060,6 +2060,7 @@
 switch (machine) {
 case llvm::Triple::x86_64:
 case llvm::Triple::x86:
+case llvm::Triple::arc:
 case llvm::Triple::arm:
 case llvm::Triple::aarch64:
 case llvm::Triple::thumb:
Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1868,6 +1868,12 @@
   size_t trap_opcode_size = 0;
 
   switch (arch.GetMachine()) {
+  case llvm::Triple::arc: {
+static const uint8_t g_hex_opcode[] = { 0xff, 0x7f };
+trap_opcode = g_hex_opcode;
+trap_opcode_size = sizeof(g_hex_opcode);
+  } break;
+
   case llvm::Triple::aarch64: {
 static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x20, 0xd4};
 trap_opcode = g_aarch64_opcode;
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -70,6 +70,7 @@
 #include "lldb/Utility/Timer.h"
 
 #include "GDBRemoteRegisterContext.h"
+#include "Plugins/Architecture/Arc/ArchitectureArc.h"
 #include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
 #include "Plugins/Process/Utility/GDBRemoteSignals.h"
 #include "Plugins/Process/Utility/InferiorCallPOSIX.h"
@@ -81,6 +82,8 @@
 #include "lldb/Utility/StringExtractorGDBRemote.h"
 
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -1090,6 +1093,77 @@
   return error;
 }
 
+namespace arc {
+bool CheckArchitectureCompatibility(const ArchSpec &arch_spec,
+Flags arch_features) {
+  return ((arch_spec.GetByteOrder() == eByteOrderBig) ==
+  arch_features.Test(ArchitectureArc::eBigEndian)) &&
+  ((arch_spec.GetAddressByteSize() == 4) ==
+  arch_features.Test(ArchitectureArc::eAddressSize32));
+}
+
+Status SetArchitectureFlags(ProcessGDBRemote &process,
+const DynamicRegisterInfo ®isters,
+Architecture &arch) {
+  auto read_register_value = [®isters, &process] (ConstString reg_name)
+  -> llvm::Expected {
+bool case_sensitive = false;
+auto reg_info = registers.GetRegisterInfo(reg_name, case

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

2019-01-24 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 183310.
tatyana-krasnukha added a comment.

Updated new file headers to reflect the new license


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718

Files:
  include/lldb/Core/Architecture.h
  include/lldb/Utility/ArchSpec.h
  source/API/SystemInitializerFull.cpp
  source/Plugins/Architecture/Arc/ArchitectureArc.cpp
  source/Plugins/Architecture/Arc/ArchitectureArc.h
  source/Plugins/Architecture/Arc/CMakeLists.txt
  source/Plugins/Architecture/CMakeLists.txt
  source/Plugins/Architecture/Mips/ArchitectureMips.h
  source/Plugins/Architecture/PPC64/ArchitecturePPC64.h
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/Utility/DynamicRegisterInfo.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/Platform.cpp
  source/Target/Thread.cpp
  source/Utility/ArchSpec.cpp

Index: source/Utility/ArchSpec.cpp
===
--- source/Utility/ArchSpec.cpp
+++ source/Utility/ArchSpec.cpp
@@ -220,7 +220,8 @@
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba4,
  "kalimba4"},
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba5,
- "kalimba5"}};
+ "kalimba5"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arc, ArchSpec::eCore_arc, "arc"}};
 
 // Ensure that we have an entry in the g_core_definitions for each core. If you
 // comment out an entry above, you will need to comment out the corresponding
@@ -457,7 +458,9 @@
 {ArchSpec::eCore_kalimba4, llvm::ELF::EM_CSR_KALIMBA,
  llvm::Triple::KalimbaSubArch_v4, 0xu, 0xu}, // KALIMBA
 {ArchSpec::eCore_kalimba5, llvm::ELF::EM_CSR_KALIMBA,
- llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu} // KALIMBA
+ llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu}, // KALIMBA
+{ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
+ 0xu, 0xu } // ARC
 };
 
 static const ArchDefinition g_elf_arch_def = {
Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2060,6 +2060,7 @@
 switch (machine) {
 case llvm::Triple::x86_64:
 case llvm::Triple::x86:
+case llvm::Triple::arc:
 case llvm::Triple::arm:
 case llvm::Triple::aarch64:
 case llvm::Triple::thumb:
Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1868,6 +1868,12 @@
   size_t trap_opcode_size = 0;
 
   switch (arch.GetMachine()) {
+  case llvm::Triple::arc: {
+static const uint8_t g_hex_opcode[] = { 0xff, 0x7f };
+trap_opcode = g_hex_opcode;
+trap_opcode_size = sizeof(g_hex_opcode);
+  } break;
+
   case llvm::Triple::aarch64: {
 static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x20, 0xd4};
 trap_opcode = g_aarch64_opcode;
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -70,6 +70,7 @@
 #include "lldb/Utility/Timer.h"
 
 #include "GDBRemoteRegisterContext.h"
+#include "Plugins/Architecture/Arc/ArchitectureArc.h"
 #include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
 #include "Plugins/Process/Utility/GDBRemoteSignals.h"
 #include "Plugins/Process/Utility/InferiorCallPOSIX.h"
@@ -81,6 +82,8 @@
 #include "lldb/Utility/StringExtractorGDBRemote.h"
 
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -1090,6 +1093,77 @@
   return error;
 }
 
+namespace arc {
+bool CheckArchitectureCompatibility(const ArchSpec &arch_spec,
+Flags arch_features) {
+  return ((arch_spec.GetByteOrder() == eByteOrderBig) ==
+  arch_features.Test(ArchitectureArc::eBigEndian)) &&
+  ((arch_spec.GetAddressByteSize() == 4) ==
+  arch_features.Test(ArchitectureArc::eAddressSize32));
+}
+
+Status SetArchitectureFlags(ProcessGDBRemote &process,
+const DynamicRegisterInfo ®isters,
+Architecture &arch) {
+  auto read_register_value = [®isters, &process] (ConstString reg_name)
+  -> llvm::Expected {
+bool case_sensitive = false;
+auto reg_info = registers.GetRegisterInfo(reg_name, case_sensitive);
+if (!reg_info)
+  return llvm::createStringError(llvm::errc::result_out_of_range,
+  "Cannot find register info for \"%s\"", reg_name.AsCString());
+
+// Configuration reg

[Lldb-commits] [lldb] r352058 - [CMake] Get back some variables used in AddLLVM.cmake

2019-01-24 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Thu Jan 24 08:02:21 2019
New Revision: 352058

URL: http://llvm.org/viewvc/llvm-project?rev=352058&view=rev
Log:
[CMake] Get back some variables used in AddLLVM.cmake

This fixes 'gtest/gtest.h' file not found when building unit tests after 
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=352058&r1=352057&r2=352058&view=diff
==
--- lldb/trunk/cmake/modules/LLDBStandalone.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBStandalone.cmake Thu Jan 24 08:02:21 2019
@@ -21,7 +21,12 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   # 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_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR} CACHE PATH "Path to LLVM 
source tree")
+  set(LLVM_MAIN_INCLUDE_DIR ${LLVM_BUILD_MAIN_INCLUDE_DIR} CACHE PATH "Path to 
llvm/include")
+  set(LLVM_LIBRARY_DIR ${LLVM_BUILD_LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
+  set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build 
tree")
   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)
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://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-24 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

Thanks -- and one more :) https://reviews.llvm.org/rL352058


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
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57091: [www] Remove implemented Open Project

2019-01-24 Thread Kirill Bobyrev via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352065: [www] Remove implemented Open Project (authored by 
omtcyfz, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57091?vs=183071&id=183330#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57091

Files:
  www/trunk/OpenProjects.html


Index: www/trunk/OpenProjects.html
===
--- www/trunk/OpenProjects.html
+++ www/trunk/OpenProjects.html
@@ -38,10 +38,6 @@
   Implement a DSL for LLDB data 
formatters
   
 
-  Reimplement lldb-mi on top of the
-  LLDB public API
-  
-
   Reimplement LLDB's
   command-line commands using the public SB API.
   
@@ -322,31 +318,6 @@
   
 
 
-
-
-
-  Reimplement lldb-mi on top of the LLDB
-public SB API.
-
-
-
-
-  Description of the project:  lldb-mi implements a
-machine-readable interface that is supported by many IDEs and text
-editors. The current support is incomplete and does not implement
-enough commands to work with most text editors. More importantly,
-it isn't using the right abstraction layer: Instead of executing
-textual commands via handleCommand() and scraping LLDB's
-textual output, it should be using the methods and data structures
-provided by the public SB API.
-  
-  Confirmed Mentor: Adrian Prantl
-
-  Desirable skills:
-Intermediate knowledge of C++.
-  
-
-
 
 
   Add support for batch-testing to the LLDB
@@ -449,7 +420,7 @@
 
 
   Description of the project: 
-The C++ std::string class provides a c_str() method that returns a raw 
pointer to a string's inner character buffer. When a std::string is destroyed, 
the character buffer is deallocated. A common bug is to access a dangling raw 
pointer to the buffer after string deallocation. These "use after free" bugs 
can cause crashes or other unexpected behavior. 
+The C++ std::string class provides a c_str() method that returns a raw 
pointer to a string's inner character buffer. When a std::string is destroyed, 
the character buffer is deallocated. A common bug is to access a dangling raw 
pointer to the buffer after string deallocation. These "use after free" bugs 
can cause crashes or other unexpected behavior.
 
 This project will add a new checker to the static analyzer to find when a 
dangling inner string pointer is used. This will help find bugs not only with 
std::string and c_str() but also with LLVM's StringRef class and the new C++17 
std::string_view.
   
@@ -466,7 +437,7 @@
 
   Description of the project: 
 The static analyzer finds bugs by exploring many possible paths through a 
program. To reduce false positives, it uses a very fast but imprecise custom 
constraint manager to rule out infeasible paths that cannot actually be 
executed at run time.
-
+
 This project will extend the analyzer to use the https://github.com/Z3Prover/z3/wiki";>Z3 SMT solver to rule out 
additional infeasible paths by postprocessing bug reports. This will help the 
analyzer reduce false positives when the path involves complicated branches 
that the built-in constraint manager cannot reason about.
   
   Confirmed Mentor: George Karpenkov


Index: www/trunk/OpenProjects.html
===
--- www/trunk/OpenProjects.html
+++ www/trunk/OpenProjects.html
@@ -38,10 +38,6 @@
   Implement a DSL for LLDB data formatters
   
 
-  Reimplement lldb-mi on top of the
-  LLDB public API
-  
-
   Reimplement LLDB's
   command-line commands using the public SB API.
   
@@ -322,31 +318,6 @@
   
 
 
-
-
-
-  Reimplement lldb-mi on top of the LLDB
-public SB API.
-
-
-
-
-  Description of the project:  lldb-mi implements a
-machine-readable interface that is supported by many IDEs and text
-editors. The current support is incomplete and does not implement
-enough commands to work with most text editors. More importantly,
-it isn't using the right abstraction layer: Instead of executing
-textual commands via handleCommand() and scraping LLDB's
-textual output, it should be using the methods and data structures
-provided by the public SB API.
-  
-  Confirmed Mentor: Adrian Prantl
-
-  Desirable skills:
-Intermediate knowledge of C++.
-  
-
-
 
 
   Add support for batch-testing to the LLDB
@@ -449,7 +420,7 @@
 
 
   Description of the project: 
-The C++ std::string class provides a c_str() method that returns a raw pointer to a string's inner character buffer. When a std::string is destroyed, the character buffer is deallocated. A common bug is to access a dangling raw pointer to the buffer after string deallocation. These "use after free" bugs can cause crashes or other unexpected behavior. 
+The

[Lldb-commits] [lldb] r352072 - Add decorator support for the DWARF version produced by the compiler

2019-01-24 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Jan 24 10:24:14 2019
New Revision: 352072

URL: http://llvm.org/viewvc/llvm-project?rev=352072&view=rev
Log:
Add decorator support for the DWARF version produced by the compiler
and mark up some tests failing in
  http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/

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

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/blocks/TestObjCIvarsInBlocks.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=352072&r1=352071&r2=352072&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Thu Jan 24 10:24:14 
2019
@@ -162,7 +162,7 @@ def _decorateTest(mode,
   debug_info=None,
   swig_version=None, py_version=None,
   macos_version=None,
-  remote=None):
+  remote=None, dwarf_version=None):
 def fn(self):
 skip_for_os = _match_decorator_property(
 lldbplatform.translate(oslist), self.getPlatform())
@@ -197,6 +197,9 @@ def _decorateTest(mode,
 macos_version[0],
 macos_version[1],
 platform.mac_ver()[0])))
+skip_for_dwarf_version = (
+dwarf_version is None) or _check_expected_version(
+dwarf_version[0], dwarf_version[1], self.getDwarfVersion())
 
 # For the test to be skipped, all specified (e.g. not None) parameters 
must be True.
 # An unspecified parameter means "any", so those are marked skip by 
default.  And we skip
@@ -210,7 +213,8 @@ def _decorateTest(mode,
   (swig_version, skip_for_swig_version, "swig version"),
   (py_version, skip_for_py_version, "python version"),
   (macos_version, skip_for_macos_version, "macOS version"),
-  (remote, skip_for_remote, "platform locality 
(remote/local)")]
+  (remote, skip_for_remote, "platform locality 
(remote/local)"),
+  (dwarf_version, skip_for_dwarf_version, "dwarf version")]
 reasons = []
 final_skip_result = True
 for this_condition in conditions:
@@ -254,7 +258,7 @@ def expectedFailureAll(bugnumber=None,
debug_info=None,
swig_version=None, py_version=None,
macos_version=None,
-   remote=None):
+   remote=None, dwarf_version=None):
 return _decorateTest(DecorateMode.Xfail,
  bugnumber=bugnumber,
  oslist=oslist, hostoslist=hostoslist,
@@ -263,7 +267,7 @@ def expectedFailureAll(bugnumber=None,
  debug_info=debug_info,
  swig_version=swig_version, py_version=py_version,
  macos_version=None,
- remote=remote)
+ remote=remote,dwarf_version=dwarf_version)
 
 
 # provide a function to skip on defined oslist, compiler version, and archs
@@ -279,7 +283,7 @@ def skipIf(bugnumber=None,
debug_info=None,
swig_version=None, py_version=None,
macos_version=None,
-   remote=None):
+   remote=None, dwarf_version=None):
 return _decorateTest(DecorateMode.Skip,
  bugnumber=bugnumber,
  oslist=oslist, hostoslist=hostoslist,
@@ -288,7 +292,7 @@ def skipIf(bugnumber=None,
  debug_info=debug_info,
  swig_version=swig_version, py_version=py_version,
  macos_version=macos_version,
- remote=remote)
+ remote=remote, dwarf_version=dwarf_version)
 
 
 def _skip_for_android(reason, api_levels, archs):

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py?rev=352072&r1=352071&r2=352072&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expressio

[Lldb-commits] [lldb] r352073 - Rename test directory

2019-01-24 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Jan 24 10:24:17 2019
New Revision: 352073

URL: http://llvm.org/viewvc/llvm-project?rev=352073&view=rev
Log:
Rename test directory

Added:
lldb/trunk/packages/Python/lldbsuite/test/expression_command/scoped_enums/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/scoped_enums/Makefile
  - copied, changed from r352072, 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/scoped_enums/TestScopedEnumType.py
  - copied, changed from r352072, 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/scoped_enums/main.cpp
  - copied, changed from r352072, 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp
Removed:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile?rev=352072&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
 (removed)
@@ -1,6 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-CXXFLAGS += -std=c++11
-
-include $(LEVEL)/Makefile.rules

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py?rev=352072&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
 (removed)
@@ -1,45 +0,0 @@
-from __future__ import print_function
-
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class ScopedEnumType(TestBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-@skipIf(dwarf_version=['<', '4'])
-def test(self):
-self.build()
-
-self.main_source = "main.cpp"
-self.main_source_spec = lldb.SBFileSpec(self.main_source)
-(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
-  '// Set break point at this line.', 
self.main_source_spec)
-frame = thread.GetFrameAtIndex(0)
-
-self.expect("expr f == Foo::FooBar",
-substrs=['(bool) $0 = true'])
-
-value = frame.EvaluateExpression("f == Foo::FooBar")
-self.assertTrue(value.IsValid())
-self.assertTrue(value.GetError().Success())
-self.assertEqual(value.GetValueAsUnsigned(), 1)
-
-value = frame.EvaluateExpression("b == BarBar")
-self.assertTrue(value.IsValid())
-self.assertTrue(value.GetError().Success())
-self.assertEqual(value.GetValueAsUnsigned(), 1)
-
-## b is not a Foo
-value = frame.EvaluateExpression("b == Foo::FooBar")
-self.assertTrue(value.IsValid())
-self.assertFalse(value.GetError().Success())
-
-## integral is not implicitly convertible to a scoped enum
-value = frame.EvaluateExpression("1 == Foo::FooBar")
-self.assertTrue(value.IsValid())
-self.assertFalse(value.GetError().Success())

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp?rev=352072&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp
 (removed)
@@ -1,16 +0,0 @@
-enum class Foo {
-  FooBar = 42
-};
-
-enum Bar {
-BarBar = 3,
-BarBarBar = 42
-};
-
-int main(int argc, const char **argv) {
-  Foo f = Foo::FooBar;
-  Bar b = BarBar;
-  bool b1 = f == Foo::FooBar;
-  bool b2 = b == BarBar;
-  return 0; // Set break point at this line.
-}

Copied: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/scoped_enums/Makefile
 (from r352072, 
lldb/

[Lldb-commits] [PATCH] D56196: ProcessLaunchInfo: Remove Target reference

2019-01-24 Thread Hui Huang via Phabricator via lldb-commits
Hui added inline comments.



Comment at: lldb/trunk/source/Target/ProcessLaunchInfo.cpp:220
+  if (!m_pty->OpenFirstAvailableMaster(open_flags, nullptr, 0)) {
+return llvm::createStringError(llvm::inconvertibleErrorCode(),
+   "PTY::OpenFirstAvailableMaster failed");

Look like the windows implementation of OpenFirstAvailableMaster is missing.

There was no error before these changes. 

$ ./lldb-server.exe g *:2000 --log-channels="lldb all:gdb-remote all" 
"d:\\m.exe"
1548354703.504552364 lldb-server launch
1548354703.504905224 argv[0] = 'g'
1548354703.505040407 argv[1] = '--log-channels=lldb all:gdb-remote all'
1548354703.505141735 argv[2] = '*:2000'
1548354703.505235672 argv[3] = 'd:\m.exe'
1548354703.505473614 00DBF458F040 
Broadcaster::Broadcaster("gdb-remote.server")
1548354703.505620718 00DBF458F040 Communication::Communication (name = 
gdb-remote.server)
1548354703.507417917 00DBF458F658 Broadcaster::Broadcaster("process.stdio")
1548354703.507594585 00DBF458F658 Communication::Communication (name = 
process.stdio)
1548354703.510816097 processlaunchinfo.cpp:SetUpPtyRedirection  
  Generating a pty to use for stdin/out/err
error: failed to launch 'd:\m.exe': PTY::OpenFirstAvailableMaster failed



Repository:
  rL LLVM

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

https://reviews.llvm.org/D56196



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


[Lldb-commits] [PATCH] D56237: Implement GetFileLoadAddress for the Windows process plugin

2019-01-24 Thread Hui Huang via Phabricator via lldb-commits
Hui added a comment.

In D56237#1344682 , @labath wrote:

> I think there is something wrong here. Normally, it should be the job of the 
> dynamic loader plugin to figure out where a module got loaded (and populate 
> the target section load list). `Process::GetFileLoadAddress` is there to help 
> it with this job. So, the fact that `ProcessWindows::GetFileLoadAddress` goes 
> back to the target section load list to get the data creates a weird loop. 
> The only way I can see this working is if this implementation happens to 
> return the module base address, as specified in the object file, and that 
> base address happens to be correct (no ASLR). The kind of code I would expect 
> to see here is a call to some windows API to determine the load address 
> straight from the OS (if such a thing is possible). For example, on Linux, we 
> parse the `/proc//maps` file to determine this information.


The Process::GetFileLoadAddress is needed for both process clients mentioned 
here. For the remote process, it will be the remote platform's responsibility 
to provide the load address. The remote platform could be lldb-server or other 
server eligible to connect to lldb.  Currently the processwindows plugin knows 
about the load address since the plugin is notified the process base address 
(or say the randomized image base) by windows debug event when the process is 
loaded on Windows. So the processwindows::GetFileLoadAddress actually does a 
job for dyld's convenience. Later on, if a native windows process is just a 
pass-through to processwindows, it will benefit the same feature (I am thinking 
processwindows is working as a common implementation for windows specific).

It is doable on windows to get the process base address by enumerate the 
process's module. I tried the following. The load address has the same result 
as processwindows::GetFileLoaddAddress().

+lldb::addr_t Host::GetProcessBaseAddress(lldb::pid_t pid) {
+  AutoHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid));
+  if (!snapshot.IsValid())
+return LLDB_INVALID_ADDRESS;
+
+  MODULEENTRY32W me;
+  me.dwSize = sizeof(MODULEENTRY32W);
+  if (Module32FirstW(snapshot.get(), &me)) {
+// The first module is always the EXE or DLL itself.
+return (addr_t)me.modBaseAddr;
+  }
+
+  return LLDB_INVALID_ADDRESS;
+}
+


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D56237



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


[Lldb-commits] [lldb] r352078 - [CMake] Remove duplicated cache variable. NFC.

2019-01-24 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Thu Jan 24 10:52:19 2019
New Revision: 352078

URL: http://llvm.org/viewvc/llvm-project?rev=352078&view=rev
Log:
[CMake] Remove duplicated cache variable. NFC.

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=352078&r1=352077&r2=352078&view=diff
==
--- lldb/trunk/cmake/modules/LLDBStandalone.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBStandalone.cmake Thu Jan 24 10:52:19 2019
@@ -16,8 +16,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   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")
 


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


[Lldb-commits] [lldb] r352086 - Unbreak windows bots

2019-01-24 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Jan 24 11:16:45 2019
New Revision: 352086

URL: http://llvm.org/viewvc/llvm-project?rev=352086&view=rev
Log:
Unbreak windows bots

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=352086&r1=352085&r2=352086&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Thu Jan 24 11:16:45 
2019
@@ -1311,15 +1311,16 @@ class Base(unittest2.TestCase):
 
 def getDwarfVersion(self):
 """ Returns the dwarf version generated by clang or 'unknown'. """
-if 'clang' not in self.getCompiler():
-return 'unknown'
-driver_output = check_output(
-[self.getCompiler()] + '-g -c -x c - -o - -###'.split(),
-stderr=STDOUT)
-for line in driver_output.split(os.linesep):
-m = re.search('dwarf-version=([0-9])', line)
-if m:
-return m.group(1)
+if 'clang' in self.getCompiler():
+try:
+driver_output = check_output(
+[self.getCompiler()] + '-g -c -x c - -o - -###'.split(),
+stderr=STDOUT)
+for line in driver_output.split(os.linesep):
+m = re.search('dwarf-version=([0-9])', line)
+if m:
+return m.group(1)
+except: pass
 return 'unknown'
 
 def platformIsDarwin(self):


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


[Lldb-commits] [lldb] r352094 - Only check the dwarf version when using the dwarf category

2019-01-24 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Jan 24 12:09:17 2019
New Revision: 352094

URL: http://llvm.org/viewvc/llvm-project?rev=352094&view=rev
Log:
Only check the dwarf version when using the dwarf category

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=352094&r1=352093&r2=352094&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Thu Jan 24 12:09:17 
2019
@@ -198,8 +198,10 @@ def _decorateTest(mode,
 macos_version[1],
 platform.mac_ver()[0])))
 skip_for_dwarf_version = (
-dwarf_version is None) or _check_expected_version(
-dwarf_version[0], dwarf_version[1], self.getDwarfVersion())
+ dwarf_version is None) or (
+ (self.getDebugInfo() is 'dwarf') and
+ _check_expected_version(
+ dwarf_version[0], dwarf_version[1], 
self.getDwarfVersion()))
 
 # For the test to be skipped, all specified (e.g. not None) parameters 
must be True.
 # An unspecified parameter means "any", so those are marked skip by 
default.  And we skip

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=352094&r1=352093&r2=352094&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Thu Jan 24 12:09:17 
2019
@@ -1310,7 +1310,7 @@ class Base(unittest2.TestCase):
 return version
 
 def getDwarfVersion(self):
-""" Returns the dwarf version generated by clang or 'unknown'. """
+""" Returns the dwarf version generated by clang or '0'. """
 if 'clang' in self.getCompiler():
 try:
 driver_output = check_output(
@@ -1321,7 +1321,7 @@ class Base(unittest2.TestCase):
 if m:
 return m.group(1)
 except: pass
-return 'unknown'
+return '0'
 
 def platformIsDarwin(self):
 """Returns true if the OS triple for the selected platform is any 
valid apple OS"""


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


[Lldb-commits] [lldb] r352103 - [Scalar] Clarify the constructor from APInt and document through a test.

2019-01-24 Thread Davide Italiano via lldb-commits
Author: davide
Date: Thu Jan 24 12:55:12 2019
New Revision: 352103

URL: http://llvm.org/viewvc/llvm-project?rev=352103&view=rev
Log:
[Scalar] Clarify the constructor from APInt and document through a test.

I want to add 512-bits support but I first want to make sure I'm
not breaking anything obvious. This is the first of a series of commit
adding tests. The first oddity found is that Scalar from APInt(s)
always constructed signed. Maybe at some point we want to revisit
this, but at least now we have a test to document how the API behaves.



Modified:
lldb/trunk/include/lldb/Utility/Scalar.h
lldb/trunk/unittests/Utility/ScalarTest.cpp

Modified: lldb/trunk/include/lldb/Utility/Scalar.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Scalar.h?rev=352103&r1=352102&r2=352103&view=diff
==
--- lldb/trunk/include/lldb/Utility/Scalar.h (original)
+++ lldb/trunk/include/lldb/Utility/Scalar.h Thu Jan 24 12:55:12 2019
@@ -12,6 +12,7 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private-types.h"
+#include "lldb/Utility/LLDBAssert.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APInt.h"
 #include 
@@ -97,30 +98,19 @@ public:
 case 8:
 case 16:
 case 32:
-  if (m_integer.isSignedIntN(sizeof(sint_t) * 8))
-m_type = e_sint;
-  else
-m_type = e_uint;
-  break;
+  m_type = e_sint;
+  return;
 case 64:
-  if (m_integer.isSignedIntN(sizeof(slonglong_t) * 8))
-m_type = e_slonglong;
-  else
-m_type = e_ulonglong;
-  break;
+  m_type = e_slonglong;
+  return;
 case 128:
-  if (m_integer.isSignedIntN(BITWIDTH_INT128))
-m_type = e_sint128;
-  else
-m_type = e_uint128;
-  break;
+  m_type = e_sint128;
+  return;
 case 256:
-  if (m_integer.isSignedIntN(BITWIDTH_INT256))
-m_type = e_sint256;
-  else
-m_type = e_uint256;
-  break;
+  m_type = e_sint256;
+  return;
 }
+lldbassert(false && "unsupported bitwidth");
   }
   Scalar(const Scalar &rhs);
   // Scalar(const RegisterValue& reg_value);

Modified: lldb/trunk/unittests/Utility/ScalarTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ScalarTest.cpp?rev=352103&r1=352102&r2=352103&view=diff
==
--- lldb/trunk/unittests/Utility/ScalarTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ScalarTest.cpp Thu Jan 24 12:55:12 2019
@@ -263,3 +263,18 @@ TEST(ScalarTest, SetValueFromCString) {
   a.SetValueFromCString("-123", lldb::eEncodingUint, 8).ToError(),
   Failed());
 }
+
+TEST(ScalarTest, APIntConstructor) {
+  auto width_array = {8, 16, 32};
+  for (auto &w : width_array) {
+Scalar A(APInt(w, 24));
+EXPECT_EQ(A.GetType(), Scalar::e_sint);
+  }
+
+  Scalar B(APInt(64, 42));
+  EXPECT_EQ(B.GetType(), Scalar::e_slonglong);
+  Scalar C(APInt(128, 96));
+  EXPECT_EQ(C.GetType(), Scalar::e_sint128);
+  Scalar D(APInt(256, 156));
+  EXPECT_EQ(D.GetType(), Scalar::e_sint256);
+}


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


[Lldb-commits] [lldb] r352111 - Remove NO_DEBUGINFO_TESTCASE from testcase.

2019-01-24 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Jan 24 13:32:32 2019
New Revision: 352111

URL: http://llvm.org/viewvc/llvm-project?rev=352111&view=rev
Log:
Remove NO_DEBUGINFO_TESTCASE from testcase.

This makes it easier to exclude the test n bots that test earlier
DWARF formats, also it feels like this is the better decision for this
testcase anyway.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py?rev=352111&r1=352110&r2=352111&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py
 Thu Jan 24 13:32:32 2019
@@ -10,11 +10,6 @@ from lldbsuite.test.lldbtest import *
 class TestTailCallFrameSBAPI(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
-# If your test case doesn't stress debug info, the
-# set this to true.  That way it won't be run once for
-# each debug info format.
-NO_DEBUG_INFO_TESTCASE = True
-
 @skipIf(compiler="clang", compiler_version=['<', '8.0'])
 @skipIf(dwarf_version=['<', '4'])
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265")


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


[Lldb-commits] [lldb] r352114 - Add unittests to the Xcode gtest target.

2019-01-24 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Jan 24 14:03:36 2019
New Revision: 352114

URL: http://llvm.org/viewvc/llvm-project?rev=352114&view=rev
Log:
Add unittests to the Xcode gtest target.

A handful of test files had been added to lldb, but not to the
appropriate target in the Xcode project.  So they weren't being
run in the Xcode gtest run.  Add them here.

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=352114&r1=352113&r2=352114&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jan 24 14:03:36 2019
@@ -92,6 +92,7 @@
2689002C13353E0400698AC0 /* AddressResolver.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9AC7034011752C6B0086C050 /* AddressResolver.cpp 
*/; };
2689002D13353E0400698AC0 /* AddressResolverFileLine.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9AC7034211752C720086C050 /* 
AddressResolverFileLine.cpp */; };
2689002E13353E0400698AC0 /* AddressResolverName.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9AC7034411752C790086C050 /* 
AddressResolverName.cpp */; };
+   4C639ED521FA684900A7B957 /* AnsiTerminalTest.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 4C639EC721FA684800A7B957 /* 
AnsiTerminalTest.cpp */; };
4CD44CFD20B37C440003557C /* AppleDWARFIndex.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CD44CFA20B37C440003557C /* AppleDWARFIndex.cpp 
*/; };
AF0E22F018A09FB20009B7D1 /* AppleGetItemInfoHandler.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = AF0E22EE18A09FB20009B7D1 /* 
AppleGetItemInfoHandler.cpp */; };
AF1F7B07189C904B0087DB9C /* AppleGetPendingItemsHandler.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = AF1F7B05189C904B0087DB9C /* 
AppleGetPendingItemsHandler.cpp */; };
@@ -220,6 +221,7 @@
2657AFB71B86910100958979 /* CompilerDeclContext.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2657AFB61B86910100958979 /* 
CompilerDeclContext.cpp */; };
268900D213353E6F00698AC0 /* CompilerType.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 49E45FAD11F660FE008F7B28 /* CompilerType.cpp */; 
};
58EC744120EAEB5200695209 /* CompletionRequest.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 58EC744020EAEB5200695209 /* 
CompletionRequest.cpp */; };
+   4C639ED721FA684900A7B957 /* CompletionRequestTest.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4C639EC921FA684800A7B957 /* 
CompletionRequestTest.cpp */; };
2689003313353E0400698AC0 /* Connection.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 26BC7E6F10F1B85900F91463 /* Connection.cpp */; };
AFDFDFD119E34D3400EAE509 /* ConnectionFileDescriptorPosix.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = AFDFDFD019E34D3400EAE509 /* 
ConnectionFileDescriptorPosix.cpp */; };
26764C971E48F482008D3573 /* ConstString.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26764C961E48F482008D3573 /* ConstString.cpp */; 
};
@@ -295,8 +297,10 @@
AFDBC36E204663AF00B9C8F2 /* EmulateInstructionPPC64.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = AFDBC36C204663AF00B9C8F2 /* 
EmulateInstructionPPC64.cpp */; };
9A22A163135E30370024DDC3 /* EmulationStateARM.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 9A22A15F135E30370024DDC3 /* 
EmulationStateARM.cpp */; };
6B74D89B200696BB0074051B /* Environment.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 22DC561920064C9600A7E9E8 /* Environment.cpp */; 
};
+   4C639ECB21FA684900A7B957 /* EnvironmentTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4C639EBD21FA684600A7B957 /* EnvironmentTest.cpp 
*/; };
2647B63C21C436B400A81D15 /* Event.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 2647B63B21C436B400A81D15 /* Event.cpp */; };
2647B63421C4367A00A81D15 /* Event.h in Headers */ = {isa = 
PBXBuildFile; fileRef = 2647B63321C4367A00A81D15 /* Event.h */; };
+   4C639ED321FA684900A7B957 /* EventTest.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 4C639EC521FA684800A7B957 /* EventTest.cpp */; };
2660387A211CA90F00329572 /* ExceptionBreakpoint.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 26603874211CA90E00329572 /* 
ExceptionBreakpoint.cpp */; };
268900EB13353E6F00698AC0 /* ExecutionContext.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 26BC7F3510F1B90C00F91463 /* 
ExecutionContext.cpp */; };
4C88BC2A1BA3722B00AA0964 /* Expression.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 4C88BC291BA3722B00AA0964 /* Expression.cpp */; };
@@ -313,6 +317,7 @@
250D6AE31A9679440049CC70 /* FileSyste

[Lldb-commits] [PATCH] D57193: [lldb] [Process/NetBSD] Add missing linkage to -lutil

2019-01-24 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added a reviewer: krytarowski.
Herald added a subscriber: abidh.

Add missing linkage to fix build failure with LLD:

  ld: error: undefined symbol: kinfo_getvmmap
  >>> referenced by NativeProcessNetBSD.cpp
  >>>   
NativeProcessNetBSD.cpp.o:(lldb_private::process_netbsd::NativeProcessNetBSD::PopulateMemoryRegionCache())
 in archive lib/liblldbPluginProcessNetBSD.a


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D57193

Files:
  source/Plugins/Process/NetBSD/CMakeLists.txt


Index: source/Plugins/Process/NetBSD/CMakeLists.txt
===
--- source/Plugins/Process/NetBSD/CMakeLists.txt
+++ source/Plugins/Process/NetBSD/CMakeLists.txt
@@ -11,6 +11,7 @@
 lldbUtility
 lldbPluginProcessPOSIX
 lldbPluginProcessUtility
+util
   LINK_COMPONENTS
 Support
   )


Index: source/Plugins/Process/NetBSD/CMakeLists.txt
===
--- source/Plugins/Process/NetBSD/CMakeLists.txt
+++ source/Plugins/Process/NetBSD/CMakeLists.txt
@@ -11,6 +11,7 @@
 lldbUtility
 lldbPluginProcessPOSIX
 lldbPluginProcessUtility
+util
   LINK_COMPONENTS
 Support
   )
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57195: Add UUID::SetFromOptionalStringRef, use it in DynamicLoaderDarwin

2019-01-24 Thread Jim Ingham via Phabricator via lldb-commits
jingham created this revision.
jingham added reviewers: jasonmolenda, labath.
Herald added subscribers: lldb-commits, abidh.

When you build a macOS binary with -no_uuid, we get a binary blob of all 0's 
from the file, and we read that in with UUID::fromOptionalData, so we get an 
invalid UUID.  When debugserver tells us about the binaries that have been 
loaded, it returns a UUID string of all 0's.  We need these two to match.  If 
we use SetFromStringRef in the latter case, we end up with a valid UUID of all 
0's, so they don't match.

This patch adds SetFromOptionalStringRef to mirror the from...Bytes API's, and 
use it in the macOS Dynamic loader.

I added tests in UUIDTests.cpp to ensure this behavior.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D57195

Files:
  include/lldb/Utility/UUID.h
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  source/Utility/UUID.cpp
  unittests/Utility/UUIDTest.cpp


Index: unittests/Utility/UUIDTest.cpp
===
--- unittests/Utility/UUIDTest.cpp
+++ unittests/Utility/UUIDTest.cpp
@@ -41,11 +41,18 @@
   UUID a20 = UUID::fromData(zeroes.data(), 20);
   UUID a16_0 = UUID::fromOptionalData(zeroes.data(), 16);
   UUID a20_0 = UUID::fromOptionalData(zeroes.data(), 20);
+  UUID from_str;
+  from_str.SetFromStringRef("----");
+  UUID opt_from_str;
+  
opt_from_str.SetFromOptionalStringRef("----");
+  
   EXPECT_FALSE(empty);
   EXPECT_TRUE(a16);
   EXPECT_TRUE(a20);
+  EXPECT_TRUE(from_str);
   EXPECT_FALSE(a16_0);
   EXPECT_FALSE(a20_0);
+  EXPECT_FALSE(opt_from_str);
 }
 
 TEST(UUIDTest, SetFromStringRef) {
Index: source/Utility/UUID.cpp
===
--- source/Utility/UUID.cpp
+++ source/Utility/UUID.cpp
@@ -109,3 +109,15 @@
   // Else return zero to indicate we were not able to parse a UUID value
   return 0;
 }
+
+size_t UUID::SetFromOptionalStringRef(llvm::StringRef str, 
+  uint32_t num_uuid_bytes) {
+  size_t num_chars_consumed = SetFromStringRef(str, num_uuid_bytes);
+  if (num_chars_consumed) {
+if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; }))
+Clear();
+  }
+  
+  return num_chars_consumed;
+}
+
Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -476,7 +476,7 @@
   image_infos[i].segments.push_back(segment);
 }
 
-image_infos[i].uuid.SetFromStringRef(
+image_infos[i].uuid.SetFromOptionalStringRef(
 image->GetValueForKey("uuid")->GetAsString()->GetValue());
 
 // All sections listed in the dyld image info structure will all either be
Index: include/lldb/Utility/UUID.h
===
--- include/lldb/Utility/UUID.h
+++ include/lldb/Utility/UUID.h
@@ -67,6 +67,11 @@
   std::string GetAsString(llvm::StringRef separator = "-") const;
 
   size_t SetFromStringRef(llvm::StringRef str, uint32_t num_uuid_bytes = 16);
+  
+  // Same as SetFromStringRef, but if the resultant UUID is all 0 bytes, set 
the 
+  // UUID to invalid.
+  size_t SetFromOptionalStringRef(llvm::StringRef str, 
+  uint32_t num_uuid_bytes = 16);
 
   // Decode as many UUID bytes (up to 16) as possible from the C string "cstr"
   // This is used for auto completion where a partial UUID might have been


Index: unittests/Utility/UUIDTest.cpp
===
--- unittests/Utility/UUIDTest.cpp
+++ unittests/Utility/UUIDTest.cpp
@@ -41,11 +41,18 @@
   UUID a20 = UUID::fromData(zeroes.data(), 20);
   UUID a16_0 = UUID::fromOptionalData(zeroes.data(), 16);
   UUID a20_0 = UUID::fromOptionalData(zeroes.data(), 20);
+  UUID from_str;
+  from_str.SetFromStringRef("----");
+  UUID opt_from_str;
+  opt_from_str.SetFromOptionalStringRef("----");
+  
   EXPECT_FALSE(empty);
   EXPECT_TRUE(a16);
   EXPECT_TRUE(a20);
+  EXPECT_TRUE(from_str);
   EXPECT_FALSE(a16_0);
   EXPECT_FALSE(a20_0);
+  EXPECT_FALSE(opt_from_str);
 }
 
 TEST(UUIDTest, SetFromStringRef) {
Index: source/Utility/UUID.cpp
===
--- source/Utility/UUID.cpp
+++ source/Utility/UUID.cpp
@@ -109,3 +109,15 @@
   // Else return zero to indicate we were not able to parse a UUID value
   return 0;
 }
+
+size_t UUID::SetFromOptionalStringRef(llvm::StringRef str, 
+  uint32_t num_uuid_bytes) {
+  size_t num_chars_consumed = SetFromStringRef(str, num_uuid_bytes);
+  if (num_chars_consumed) {
+if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; }))
+

[Lldb-commits] [PATCH] D57194: [CMake] Use llvm-tblgen from NATIVE LLVM build when cross-compiling

2019-01-24 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: compnerd, sgraenitz.
Herald added a subscriber: mgorny.

When cross-compiling LLDB, we want to use llvm-tblgen built for the
host, not the target.


https://reviews.llvm.org/D57194

Files:
  cmake/modules/LLDBStandalone.cmake


Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -25,8 +25,29 @@
   set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build 
tree")
   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)
+  if(CMAKE_CROSSCOMPILING)
+set(LLVM_NATIVE_BUILD "${LLDB_PATH_TO_LLVM_BUILD}/NATIVE")
+if (NOT EXISTS "${LLVM_NATIVE_BUILD}")
+  message(FATAL_ERROR
+"Attempting to cross-compile LLDB standalone but no native LLVM build
+found. Please cross-compile LLVM as well.")
+endif()
+
+if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+  set(HOST_EXECUTABLE_SUFFIX ".exe")
+endif()
+
+if (NOT CMAKE_CONFIGURATION_TYPES)
+  set(LLVM_TABLEGEN_EXE
+"${LLVM_NATIVE_BUILD}/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}")
+else()
+  set(LLVM_TABLEGEN_EXE
+
"${LLVM_NATIVE_BUILD}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}")
+endif()
+  else()
+find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
+  NO_DEFAULT_PATH)
+  endif()
 
   # They are used as destination of target generators.
   set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)


Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -25,8 +25,29 @@
   set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build tree")
   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)
+  if(CMAKE_CROSSCOMPILING)
+set(LLVM_NATIVE_BUILD "${LLDB_PATH_TO_LLVM_BUILD}/NATIVE")
+if (NOT EXISTS "${LLVM_NATIVE_BUILD}")
+  message(FATAL_ERROR
+"Attempting to cross-compile LLDB standalone but no native LLVM build
+found. Please cross-compile LLVM as well.")
+endif()
+
+if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+  set(HOST_EXECUTABLE_SUFFIX ".exe")
+endif()
+
+if (NOT CMAKE_CONFIGURATION_TYPES)
+  set(LLVM_TABLEGEN_EXE
+"${LLVM_NATIVE_BUILD}/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}")
+else()
+  set(LLVM_TABLEGEN_EXE
+"${LLVM_NATIVE_BUILD}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}")
+endif()
+  else()
+find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
+  NO_DEFAULT_PATH)
+  endif()
 
   # They are used as destination of target generators.
   set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r352116 - [Process/NetBSD] Add missing linkage to -lutil

2019-01-24 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Thu Jan 24 14:20:47 2019
New Revision: 352116

URL: http://llvm.org/viewvc/llvm-project?rev=352116&view=rev
Log:
[Process/NetBSD] Add missing linkage to -lutil

Add missing linkage to fix build failure with LLD:

  ld: error: undefined symbol: kinfo_getvmmap
  >>> referenced by NativeProcessNetBSD.cpp
  >>>   
NativeProcessNetBSD.cpp.o:(lldb_private::process_netbsd::NativeProcessNetBSD::PopulateMemoryRegionCache())
 in archive lib/liblldbPluginProcessNetBSD.a

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

Modified:
lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt?rev=352116&r1=352115&r2=352116&view=diff
==
--- lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt Thu Jan 24 14:20:47 
2019
@@ -11,6 +11,7 @@ add_lldb_library(lldbPluginProcessNetBSD
 lldbUtility
 lldbPluginProcessPOSIX
 lldbPluginProcessUtility
+util
   LINK_COMPONENTS
 Support
   )


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


[Lldb-commits] [PATCH] D57193: [lldb] [Process/NetBSD] Add missing linkage to -lutil

2019-01-24 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352116: [Process/NetBSD] Add missing linkage to -lutil 
(authored by mgorny, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57193?vs=183397&id=183400#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57193

Files:
  lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt


Index: lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
+++ lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
@@ -11,6 +11,7 @@
 lldbUtility
 lldbPluginProcessPOSIX
 lldbPluginProcessUtility
+util
   LINK_COMPONENTS
 Support
   )


Index: lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
+++ lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
@@ -11,6 +11,7 @@
 lldbUtility
 lldbPluginProcessPOSIX
 lldbPluginProcessUtility
+util
   LINK_COMPONENTS
 Support
   )
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57195: Add UUID::SetFromOptionalStringRef, use it in DynamicLoaderDarwin

2019-01-24 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.

lgtm


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D57195



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


[Lldb-commits] [lldb] r352122 - Add UUID::SetFromOptionalStringRef, use it in DynamicLoaderDarwin

2019-01-24 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Jan 24 14:43:44 2019
New Revision: 352122

URL: http://llvm.org/viewvc/llvm-project?rev=352122&view=rev
Log:
Add UUID::SetFromOptionalStringRef, use it in DynamicLoaderDarwin

We use UUID::fromOptionalData to read UUID's from the Mach-O files, so UUID's
of all 0's are invalid UUID's.
We also get uuid's from debugserver, which need to match the file UUID's.  So
we need an API that treats "0" as invalid as well.  Added that and use 
it.

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

Modified:
lldb/trunk/include/lldb/Utility/UUID.h
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/trunk/source/Utility/UUID.cpp
lldb/trunk/unittests/Utility/UUIDTest.cpp

Modified: lldb/trunk/include/lldb/Utility/UUID.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/UUID.h?rev=352122&r1=352121&r2=352122&view=diff
==
--- lldb/trunk/include/lldb/Utility/UUID.h (original)
+++ lldb/trunk/include/lldb/Utility/UUID.h Thu Jan 24 14:43:44 2019
@@ -67,6 +67,11 @@ public:
   std::string GetAsString(llvm::StringRef separator = "-") const;
 
   size_t SetFromStringRef(llvm::StringRef str, uint32_t num_uuid_bytes = 16);
+  
+  // Same as SetFromStringRef, but if the resultant UUID is all 0 bytes, set 
the 
+  // UUID to invalid.
+  size_t SetFromOptionalStringRef(llvm::StringRef str, 
+  uint32_t num_uuid_bytes = 16);
 
   // Decode as many UUID bytes (up to 16) as possible from the C string "cstr"
   // This is used for auto completion where a partial UUID might have been

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp?rev=352122&r1=352121&r2=352122&view=diff
==
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp 
(original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp 
Thu Jan 24 14:43:44 2019
@@ -476,7 +476,7 @@ bool DynamicLoaderDarwin::JSONImageInfor
   image_infos[i].segments.push_back(segment);
 }
 
-image_infos[i].uuid.SetFromStringRef(
+image_infos[i].uuid.SetFromOptionalStringRef(
 image->GetValueForKey("uuid")->GetAsString()->GetValue());
 
 // All sections listed in the dyld image info structure will all either be

Modified: lldb/trunk/source/Utility/UUID.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/UUID.cpp?rev=352122&r1=352121&r2=352122&view=diff
==
--- lldb/trunk/source/Utility/UUID.cpp (original)
+++ lldb/trunk/source/Utility/UUID.cpp Thu Jan 24 14:43:44 2019
@@ -109,3 +109,15 @@ size_t UUID::SetFromStringRef(llvm::Stri
   // Else return zero to indicate we were not able to parse a UUID value
   return 0;
 }
+
+size_t UUID::SetFromOptionalStringRef(llvm::StringRef str, 
+  uint32_t num_uuid_bytes) {
+  size_t num_chars_consumed = SetFromStringRef(str, num_uuid_bytes);
+  if (num_chars_consumed) {
+if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; }))
+Clear();
+  }
+  
+  return num_chars_consumed;
+}
+

Modified: lldb/trunk/unittests/Utility/UUIDTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/UUIDTest.cpp?rev=352122&r1=352121&r2=352122&view=diff
==
--- lldb/trunk/unittests/Utility/UUIDTest.cpp (original)
+++ lldb/trunk/unittests/Utility/UUIDTest.cpp Thu Jan 24 14:43:44 2019
@@ -41,11 +41,18 @@ TEST(UUIDTest, Validity) {
   UUID a20 = UUID::fromData(zeroes.data(), 20);
   UUID a16_0 = UUID::fromOptionalData(zeroes.data(), 16);
   UUID a20_0 = UUID::fromOptionalData(zeroes.data(), 20);
+  UUID from_str;
+  from_str.SetFromStringRef("----");
+  UUID opt_from_str;
+  
opt_from_str.SetFromOptionalStringRef("----");
+  
   EXPECT_FALSE(empty);
   EXPECT_TRUE(a16);
   EXPECT_TRUE(a20);
+  EXPECT_TRUE(from_str);
   EXPECT_FALSE(a16_0);
   EXPECT_FALSE(a20_0);
+  EXPECT_FALSE(opt_from_str);
 }
 
 TEST(UUIDTest, SetFromStringRef) {


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


[Lldb-commits] [PATCH] D57195: Add UUID::SetFromOptionalStringRef, use it in DynamicLoaderDarwin

2019-01-24 Thread Jim Ingham via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB352122: Add UUID::SetFromOptionalStringRef, use it in 
DynamicLoaderDarwin (authored by jingham, committed by ).

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D57195

Files:
  include/lldb/Utility/UUID.h
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  source/Utility/UUID.cpp
  unittests/Utility/UUIDTest.cpp


Index: unittests/Utility/UUIDTest.cpp
===
--- unittests/Utility/UUIDTest.cpp
+++ unittests/Utility/UUIDTest.cpp
@@ -41,11 +41,18 @@
   UUID a20 = UUID::fromData(zeroes.data(), 20);
   UUID a16_0 = UUID::fromOptionalData(zeroes.data(), 16);
   UUID a20_0 = UUID::fromOptionalData(zeroes.data(), 20);
+  UUID from_str;
+  from_str.SetFromStringRef("----");
+  UUID opt_from_str;
+  
opt_from_str.SetFromOptionalStringRef("----");
+  
   EXPECT_FALSE(empty);
   EXPECT_TRUE(a16);
   EXPECT_TRUE(a20);
+  EXPECT_TRUE(from_str);
   EXPECT_FALSE(a16_0);
   EXPECT_FALSE(a20_0);
+  EXPECT_FALSE(opt_from_str);
 }
 
 TEST(UUIDTest, SetFromStringRef) {
Index: source/Utility/UUID.cpp
===
--- source/Utility/UUID.cpp
+++ source/Utility/UUID.cpp
@@ -109,3 +109,15 @@
   // Else return zero to indicate we were not able to parse a UUID value
   return 0;
 }
+
+size_t UUID::SetFromOptionalStringRef(llvm::StringRef str, 
+  uint32_t num_uuid_bytes) {
+  size_t num_chars_consumed = SetFromStringRef(str, num_uuid_bytes);
+  if (num_chars_consumed) {
+if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; }))
+Clear();
+  }
+  
+  return num_chars_consumed;
+}
+
Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -476,7 +476,7 @@
   image_infos[i].segments.push_back(segment);
 }
 
-image_infos[i].uuid.SetFromStringRef(
+image_infos[i].uuid.SetFromOptionalStringRef(
 image->GetValueForKey("uuid")->GetAsString()->GetValue());
 
 // All sections listed in the dyld image info structure will all either be
Index: include/lldb/Utility/UUID.h
===
--- include/lldb/Utility/UUID.h
+++ include/lldb/Utility/UUID.h
@@ -67,6 +67,11 @@
   std::string GetAsString(llvm::StringRef separator = "-") const;
 
   size_t SetFromStringRef(llvm::StringRef str, uint32_t num_uuid_bytes = 16);
+  
+  // Same as SetFromStringRef, but if the resultant UUID is all 0 bytes, set 
the 
+  // UUID to invalid.
+  size_t SetFromOptionalStringRef(llvm::StringRef str, 
+  uint32_t num_uuid_bytes = 16);
 
   // Decode as many UUID bytes (up to 16) as possible from the C string "cstr"
   // This is used for auto completion where a partial UUID might have been


Index: unittests/Utility/UUIDTest.cpp
===
--- unittests/Utility/UUIDTest.cpp
+++ unittests/Utility/UUIDTest.cpp
@@ -41,11 +41,18 @@
   UUID a20 = UUID::fromData(zeroes.data(), 20);
   UUID a16_0 = UUID::fromOptionalData(zeroes.data(), 16);
   UUID a20_0 = UUID::fromOptionalData(zeroes.data(), 20);
+  UUID from_str;
+  from_str.SetFromStringRef("----");
+  UUID opt_from_str;
+  opt_from_str.SetFromOptionalStringRef("----");
+  
   EXPECT_FALSE(empty);
   EXPECT_TRUE(a16);
   EXPECT_TRUE(a20);
+  EXPECT_TRUE(from_str);
   EXPECT_FALSE(a16_0);
   EXPECT_FALSE(a20_0);
+  EXPECT_FALSE(opt_from_str);
 }
 
 TEST(UUIDTest, SetFromStringRef) {
Index: source/Utility/UUID.cpp
===
--- source/Utility/UUID.cpp
+++ source/Utility/UUID.cpp
@@ -109,3 +109,15 @@
   // Else return zero to indicate we were not able to parse a UUID value
   return 0;
 }
+
+size_t UUID::SetFromOptionalStringRef(llvm::StringRef str, 
+  uint32_t num_uuid_bytes) {
+  size_t num_chars_consumed = SetFromStringRef(str, num_uuid_bytes);
+  if (num_chars_consumed) {
+if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; }))
+Clear();
+  }
+  
+  return num_chars_consumed;
+}
+
Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -476,7 +476,7 @@
   image_infos[i].segments.push_back(segment);
 }
 
-image_infos[i].uuid

Re: [Lldb-commits] [lldb] r352116 - [Process/NetBSD] Add missing linkage to -lutil

2019-01-24 Thread Hans Wennborg via lldb-commits
Merged to 8.0 in r352134. Please let me know if there are any follow-ups.

Thanks,
Hans

On Thu, Jan 24, 2019 at 2:20 PM Michal Gorny via lldb-commits
 wrote:
>
> Author: mgorny
> Date: Thu Jan 24 14:20:47 2019
> New Revision: 352116
>
> URL: http://llvm.org/viewvc/llvm-project?rev=352116&view=rev
> Log:
> [Process/NetBSD] Add missing linkage to -lutil
>
> Add missing linkage to fix build failure with LLD:
>
>   ld: error: undefined symbol: kinfo_getvmmap
>   >>> referenced by NativeProcessNetBSD.cpp
>   >>>   
> NativeProcessNetBSD.cpp.o:(lldb_private::process_netbsd::NativeProcessNetBSD::PopulateMemoryRegionCache())
>  in archive lib/liblldbPluginProcessNetBSD.a
>
> Differential Revision: https://reviews.llvm.org/D57193
>
> Modified:
> lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
>
> Modified: lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt?rev=352116&r1=352115&r2=352116&view=diff
> ==
> --- lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt (original)
> +++ lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt Thu Jan 24 
> 14:20:47 2019
> @@ -11,6 +11,7 @@ add_lldb_library(lldbPluginProcessNetBSD
>  lldbUtility
>  lldbPluginProcessPOSIX
>  lldbPluginProcessUtility
> +util
>LINK_COMPONENTS
>  Support
>)
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D56822: [WIP] Tool to insert SBReproducer macros

2019-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 183442.
JDevlieghere added a comment.

- Update files in place.
- Check for existing macros.


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

https://reviews.llvm.org/D56822

Files:
  tools/CMakeLists.txt
  tools/sbrepro/CMakeLists.txt
  tools/sbrepro/SBRepro.cpp

Index: tools/sbrepro/SBRepro.cpp
===
--- /dev/null
+++ tools/sbrepro/SBRepro.cpp
@@ -0,0 +1,221 @@
+#include "clang/AST/AST.h"
+#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/Frontend/ASTConsumers.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendActions.h"
+#include "clang/Rewrite/Core/Rewriter.h"
+#include "clang/Tooling/CommonOptionsParser.h"
+#include "clang/Tooling/Tooling.h"
+
+#include "llvm/Support/raw_ostream.h"
+
+#include 
+#include 
+
+using namespace clang;
+using namespace clang::driver;
+using namespace clang::tooling;
+
+static llvm::cl::OptionCategory ReproCategory("SB Reproducer");
+
+static std::string Join(const std::vector &V) {
+  std::string Str;
+  llvm::raw_string_ostream OS(Str);
+  for (std::size_t I = 0, E = V.size(); I < E; ++I) {
+OS << V[I];
+if (I != E - 1)
+  OS << ", ";
+  }
+  return OS.str();
+}
+
+static std::string GetRecordMethodMacroName(bool Static, bool Const,
+bool NoArgs) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+
+  OS << "SB_RECORD";
+  if (Static)
+OS << "_STATIC";
+  OS << "_METHOD";
+  if (Const)
+OS << "_CONST";
+  if (NoArgs)
+OS << "_NO_ARGS";
+
+  return OS.str();
+}
+
+static std::string GetRegisterMethodMacroName(bool Static, bool Const) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+
+  OS << "SB_REGISTER";
+  if (Static)
+OS << "_STATIC";
+  OS << "_METHOD";
+  if (Const)
+OS << "_CONST";
+
+  return OS.str();
+}
+
+static std::string GetRecordMethodMacro(StringRef Result, StringRef Class,
+StringRef Method, StringRef Signature,
+StringRef Values, bool Static,
+bool Const) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+
+  OS << GetRecordMethodMacroName(Static, Const, Values.empty());
+
+  OS << "(" << Result << ", " << Class << ", " << Method;
+
+  if (!Values.empty()) {
+OS << ", (" << Signature << "), " << Values << ");\n";
+  } else {
+OS << ", ());\n";
+  }
+
+  return OS.str();
+}
+
+static std::string GetRecordConstructorMacro(StringRef Class,
+ StringRef Signature,
+ StringRef Values) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+  if (!Values.empty()) {
+OS << "SB_RECORD_CONSTRUCTOR(" << Class << ", (" << Signature << "), "
+   << Values << ");\n";
+  } else {
+OS << "SB_RECORD_CONSTRUCTOR_NO_ARGS(" << Class << ");\n";
+  }
+  return OS.str();
+}
+
+static std::string GetRegisterConstructorMacroMacro(StringRef Class,
+StringRef Signature) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+  OS << "REGISTER_CONSTRUCTOR(" << Class << ", (" << Signature << "))\n";
+  return OS.str();
+}
+
+static std::string GetRegisterMethodMacro(StringRef Result, StringRef Class,
+  StringRef Method, StringRef Signature,
+  bool Static, bool Const) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+  OS << GetRegisterMethodMacroName(Static, Const);
+  OS << "(" << Result << ", " << Class << ", " << Method << ", (" << Signature
+ << "));\n";
+  return OS.str();
+}
+
+class SBVisitor : public RecursiveASTVisitor {
+public:
+  SBVisitor(Rewriter &R) : MyRewriter(R) {}
+
+  bool VisitCXXMethodDecl(CXXMethodDecl *Decl) {
+SourceManager &SM = MyRewriter.getSourceMgr();
+
+// We don't want to modify anything outside the main file.
+if (!SM.isInMainFile(Decl->getBeginLoc()))
+  return false;
+
+Stmt *Body = Decl->getBody();
+if (!Body)
+  return false;
+
+bool IsConstructor = dyn_cast(Decl) != nullptr;
+CXXRecordDecl *Record = Decl->getParent();
+QualType ReturnType = Decl->getReturnType();
+
+std::vector ParamTypes;
+std::vector ParamNames;
+for (auto *P : Decl->parameters()) {
+  QualType T = P->getType();
+  ParamTypes.push_back(T.getAsString());
+  ParamNames.push_back(P->getNameAsString());
+}
+
+std::string Macro;
+
+if (IsConstructor) {
+  llvm::outs() << GetRegisterConstructorMacroMacro(
+  Record->getNameAsString(), Join(ParamTypes));
+
+  Macro = GetRecordConstructorMacro(Record->getNameAsString(),
+Join(ParamTypes), Join(ParamNames))

[Lldb-commits] [PATCH] D57213: [Scalar] Add support for 512-bits values.

2019-01-24 Thread Davide Italiano via Phabricator via lldb-commits
davide created this revision.
davide added a reviewer: clayborg.

rdar://problem/46886288


https://reviews.llvm.org/D57213

Files:
  lldb/include/lldb/Utility/Scalar.h
  lldb/source/Utility/RegisterValue.cpp
  lldb/source/Utility/Scalar.cpp
  lldb/unittests/Utility/ScalarTest.cpp

Index: lldb/unittests/Utility/ScalarTest.cpp
===
--- lldb/unittests/Utility/ScalarTest.cpp
+++ lldb/unittests/Utility/ScalarTest.cpp
@@ -277,4 +277,27 @@
   EXPECT_EQ(C.GetType(), Scalar::e_sint128);
   Scalar D(APInt(256, 156));
   EXPECT_EQ(D.GetType(), Scalar::e_sint256);
+  Scalar E(APInt(512, 456));
+  EXPECT_EQ(E.GetType(), Scalar::e_sint512);
+}
+
+TEST(ScalarTest, Scalar_512) {
+  Scalar Z(APInt(512, 0));
+  ASSERT_TRUE(Z.IsZero());
+  Z.MakeUnsigned();
+  ASSERT_TRUE(Z.IsZero());
+
+  Scalar S(APInt(512, 2000));
+  EXPECT_EQ(S.GetTypeAsCString(), "int512_t");
+  EXPECT_EQ(S.GetValueTypeAsCString(Scalar::e_sint512), "int512_t");
+
+  ASSERT_TRUE(S.MakeUnsigned());
+  EXPECT_EQ(S.GetType(), Scalar::e_uint512);
+  EXPECT_EQ(S.GetTypeAsCString(), "unsigned int512_t");
+  EXPECT_EQ(S.GetValueTypeAsCString(Scalar::e_uint512), "uint512_t");
+  EXPECT_EQ(S.GetByteSize(), 64U);
+
+  ASSERT_TRUE(S.MakeSigned());
+  EXPECT_EQ(S.GetType(), Scalar::e_sint512);
+  EXPECT_EQ(S.GetByteSize(), 64U);
 }
Index: lldb/source/Utility/Scalar.cpp
===
--- lldb/source/Utility/Scalar.cpp
+++ lldb/source/Utility/Scalar.cpp
@@ -106,7 +106,7 @@
   const uint8_t *bytes;
   static float_t flt_val;
   static double_t dbl_val;
-  static uint64_t swapped_words[4];
+  static uint64_t swapped_words[8];
   switch (m_type) {
   case e_void:
 break;
@@ -151,6 +151,24 @@
   apint_words = swapped_words;
 }
 return reinterpret_cast(apint_words);
+  case e_sint512:
+  case e_uint512:
+apint_words = m_integer.getRawData();
+// getRawData always returns a pointer to an array of four uint64_t values,
+// where the least-significant word always comes first.  On big-endian
+// systems we need to swap the four words.
+if (endian::InlHostByteOrder() == eByteOrderBig) {
+  swapped_words[0] = apint_words[7];
+  swapped_words[1] = apint_words[6];
+  swapped_words[2] = apint_words[5];
+  swapped_words[3] = apint_words[4];
+  swapped_words[4] = apint_words[3];
+  swapped_words[5] = apint_words[2];
+  swapped_words[6] = apint_words[1];
+  swapped_words[7] = apint_words[0];
+  apint_words = swapped_words;
+}
+return reinterpret_cast(apint_words);
   case e_float:
 flt_val = m_float.convertToFloat();
 return reinterpret_cast(&flt_val);
@@ -187,6 +205,8 @@
   case e_uint128:
   case e_sint256:
   case e_uint256:
+  case e_sint512:
+  case e_uint512:
 return (m_integer.getBitWidth() / 8);
   case e_float:
 return sizeof(float_t);
@@ -213,6 +233,8 @@
   case e_uint128:
   case e_sint256:
   case e_uint256:
+  case e_uint512:
+  case e_sint512:
 return llvm::APInt::isSameValue(zero_int, m_integer);
   case e_float:
   case e_double:
@@ -234,6 +256,7 @@
   case e_slonglong:
   case e_sint128:
   case e_sint256:
+  case e_sint512:
 s->PutCString(m_integer.toString(10, true));
 break;
   case e_uint:
@@ -241,6 +264,7 @@
   case e_ulonglong:
   case e_uint128:
   case e_uint256:
+  case e_uint512:
 s->PutCString(m_integer.toString(10, false));
 break;
   case e_float:
@@ -277,6 +301,10 @@
 return "int256_t";
   case e_uint256:
 return "unsigned int256_t";
+  case e_sint512:
+return "int512_t";
+  case e_uint512:
+return "unsigned int512_t";
   case e_float:
 return "float";
   case e_double:
@@ -386,6 +414,12 @@
 else
   m_type = e_uint256;
 break;
+  case 512:
+if (m_integer.isSignedIntN(BITWIDTH_INT512))
+  m_type = e_sint512;
+else
+  m_type = e_uint512;
+break;
   }
   return *this;
 }
@@ -442,6 +476,12 @@
   success = true;
   break;
 
+case e_sint512:
+case e_uint512:
+  m_integer = m_integer.sextOrTrunc(BITWIDTH_INT512);
+  success = true;
+  break;
+
 case e_float:
   m_float = llvm::APFloat(llvm::APFloat::IEEEsingle());
   m_float.convertFromAPInt(m_integer, true,
@@ -506,6 +546,12 @@
   success = true;
   break;
 
+case e_sint512:
+case e_uint512:
+  m_integer = m_integer.zextOrTrunc(BITWIDTH_INT512);
+  success = true;
+  break;
+
 case e_float:
   m_float = llvm::APFloat(llvm::APFloat::IEEEsingle());
   m_float.convertFromAPInt(m_integer, false,
@@ -566,6 +612,12 @@
   success = true;
   break;
 
+case e_sint512:
+case e_uint512:
+  m_integer = m_integer.sextOrTrunc(BITWIDTH_INT512);
+  success = true;
+  break;
+
 case e_float:
   m_float = llvm::APFloat(llvm::APFloat::IEEEsingle());
   m_float.convertFromAPInt(m_integer, true,
@@ -622,6 +674,12 @@
   success =

[Lldb-commits] [PATCH] D57213: [Scalar] Add support for 512-bits values.

2019-01-24 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

@clayborg, this is fairly mechanical, but I would appreciate if you can sign it 
off.


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

https://reviews.llvm.org/D57213



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


[Lldb-commits] [PATCH] D56322: SBReproducer prototype

2019-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 183458.
JDevlieghere added a comment.

Rebase on recent reproducer changes.


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

https://reviews.llvm.org/D56322

Files:
  include/lldb/API/SBReproducer.h
  include/lldb/Utility/Reproducer.h.rej
  source/API/CMakeLists.txt
  source/API/SBCommandInterpreter.cpp
  source/API/SBCommandReturnObject.cpp
  source/API/SBDebugger.cpp
  source/API/SBFileSpec.cpp
  source/API/SBHostOS.cpp
  source/API/SBReproducer.cpp
  source/API/SBReproducerPrivate.h
  tools/driver/Driver.cpp

Index: tools/driver/Driver.cpp
===
--- tools/driver/Driver.cpp
+++ tools/driver/Driver.cpp
@@ -13,6 +13,7 @@
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBHostOS.h"
 #include "lldb/API/SBLanguageRuntime.h"
+#include "lldb/API/SBReproducer.h"
 #include "lldb/API/SBStream.h"
 #include "lldb/API/SBStringList.h"
 
@@ -909,6 +910,11 @@
 return 1;
   }
 
+  SBReproducer reproducer;
+  if (reproducer.Replay()) {
+return 0;
+  }
+
   SBHostOS::ThreadCreated("");
 
   signal(SIGINT, sigint_handler);
Index: source/API/SBReproducerPrivate.h
===
--- /dev/null
+++ source/API/SBReproducerPrivate.h
@@ -0,0 +1,735 @@
+//===-- SBReproducerPrivate.h ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLDB_API_SBREPRODUCER_PRIVATE_H
+#define LLDB_API_SBREPRODUCER_PRIVATE_H
+
+#include "lldb/API/SBReproducer.h"
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Reproducer.h"
+
+#include "llvm/ADT/DenseMap.h"
+
+#include 
+
+namespace lldb_private {
+namespace repro {
+
+/// Mapping between serialized indices and their corresponding objects.
+///
+/// This class is used during replay to map indices back to in-memory objects.
+///
+/// When objects are constructed, they are added to this mapping using
+/// AddObjectForIndex.
+///
+/// When an object is passed to a function, its index is deserialized and
+/// AddObjectForIndex returns the corresponding object. If there is no object
+/// for the given index, a nullptr is returend. The latter is valid when custom
+/// replay code is in place and the actual object is ignored.
+class SBIndexToObject {
+public:
+  /// Returns an object as a pointer for the given index or nullptr if not
+  /// present in the map.
+  template  T *GetObjectForIndex(int idx) {
+assert(idx != 0 && "Cannot get object for sentinel");
+void *object = GetObjectForIndexImpl(idx);
+return static_cast::type *>(object);
+  }
+
+  /// Adds a pointer to an object to the mapping for the given index.
+  template  void AddObjectForIndex(int idx, T *object) {
+AddObjectForIndexImpl(
+idx, static_cast(
+ const_cast::type *>(object)));
+  }
+
+  /// Adds a reference to an object to the mapping for the given index.
+  template  void AddObjectForIndex(int idx, T &object) {
+AddObjectForIndexImpl(
+idx, static_cast(
+ const_cast::type *>(&object)));
+  }
+
+private:
+  /// Helper method that does the actual lookup. The void* result is later cast
+  /// by the caller.
+  void *GetObjectForIndexImpl(int idx) {
+auto it = m_mapping.find(idx);
+if (it == m_mapping.end()) {
+  return nullptr;
+}
+return m_mapping[idx];
+  }
+
+  /// Helper method that does the actual insertion.
+  void AddObjectForIndexImpl(int idx, void *object) {
+assert(idx != 0 && "Cannot add object for sentinel");
+m_mapping[idx] = object;
+  }
+
+  /// Keeps a mapping between indices and their corresponding object.
+  llvm::DenseMap m_mapping;
+};
+
+/// Base class for tag dispatch used in the SBDeserializer. Different tags are
+/// instantiated with different values.
+template  struct SBTag {};
+
+/// We need to differentiate between pointers to fundamental and
+/// non-fundamental types. See the corresponding SBDeserializer::Read method
+/// for the reason why.
+typedef SBTag<0> PointerTag;
+typedef SBTag<1> ReferenceTag;
+typedef SBTag<2> ValueTag;
+typedef SBTag<3> FundamentalPointerTag;
+typedef SBTag<4> FundamentalReferenceTag;
+
+/// Return the deserialization tag for the given type T.
+template  struct serializer_tag { typedef ValueTag type; };
+template  struct serializer_tag {
+  typedef
+  typename std::conditional::value,
+FundamentalPointerTag, PointerTag>::type type;
+};
+template  struct serializer_tag {
+  typedef typename std::conditional::value,
+FundamentalReferenceTag, ReferenceTag>::type
+  type;
+};
+
+/// Deserializes data from a buffer. It

[Lldb-commits] [PATCH] D56822: [WIP] Tool to insert SBReproducer macros

2019-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 183470.
JDevlieghere added a comment.

- Skip unsupported signatures (function pointers and void*)


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

https://reviews.llvm.org/D56822

Files:
  tools/CMakeLists.txt
  tools/sbrepro/CMakeLists.txt
  tools/sbrepro/SBRepro.cpp

Index: tools/sbrepro/SBRepro.cpp
===
--- /dev/null
+++ tools/sbrepro/SBRepro.cpp
@@ -0,0 +1,246 @@
+#include "clang/AST/AST.h"
+#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/Frontend/ASTConsumers.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendActions.h"
+#include "clang/Rewrite/Core/Rewriter.h"
+#include "clang/Tooling/CommonOptionsParser.h"
+#include "clang/Tooling/Tooling.h"
+
+#include "llvm/Support/raw_ostream.h"
+
+#include 
+#include 
+
+using namespace clang;
+using namespace clang::driver;
+using namespace clang::tooling;
+
+static llvm::cl::OptionCategory ReproCategory("SB Reproducer");
+
+static std::string Join(const std::vector &V) {
+  std::string Str;
+  llvm::raw_string_ostream OS(Str);
+  for (std::size_t I = 0, E = V.size(); I < E; ++I) {
+OS << V[I];
+if (I != E - 1)
+  OS << ", ";
+  }
+  return OS.str();
+}
+
+static std::string GetRecordMethodMacroName(bool Static, bool Const,
+bool NoArgs) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+
+  OS << "SB_RECORD";
+  if (Static)
+OS << "_STATIC";
+  OS << "_METHOD";
+  if (Const)
+OS << "_CONST";
+  if (NoArgs)
+OS << "_NO_ARGS";
+
+  return OS.str();
+}
+
+static std::string GetRegisterMethodMacroName(bool Static, bool Const) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+
+  OS << "SB_REGISTER";
+  if (Static)
+OS << "_STATIC";
+  OS << "_METHOD";
+  if (Const)
+OS << "_CONST";
+
+  return OS.str();
+}
+
+static std::string GetRecordMethodMacro(StringRef Result, StringRef Class,
+StringRef Method, StringRef Signature,
+StringRef Values, bool Static,
+bool Const) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+
+  OS << GetRecordMethodMacroName(Static, Const, Values.empty());
+
+  OS << "(" << Result << ", " << Class << ", " << Method;
+
+  if (!Values.empty()) {
+OS << ", (" << Signature << "), " << Values << ");\n";
+  } else {
+OS << ");\n";
+  }
+
+  return OS.str();
+}
+
+static std::string GetRecordConstructorMacro(StringRef Class,
+ StringRef Signature,
+ StringRef Values) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+  if (!Values.empty()) {
+OS << "SB_RECORD_CONSTRUCTOR(" << Class << ", (" << Signature << "), "
+   << Values << ");\n";
+  } else {
+OS << "SB_RECORD_CONSTRUCTOR_NO_ARGS(" << Class << ");\n";
+  }
+  return OS.str();
+}
+
+static std::string GetRegisterConstructorMacroMacro(StringRef Class,
+StringRef Signature) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+  OS << "REGISTER_CONSTRUCTOR(" << Class << ", (" << Signature << "))\n";
+  return OS.str();
+}
+
+static std::string GetRegisterMethodMacro(StringRef Result, StringRef Class,
+  StringRef Method, StringRef Signature,
+  bool Static, bool Const) {
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+  OS << GetRegisterMethodMacroName(Static, Const);
+  OS << "(" << Result << ", " << Class << ", " << Method << ", (" << Signature
+ << "));\n";
+  return OS.str();
+}
+
+class SBVisitor : public RecursiveASTVisitor {
+public:
+  SBVisitor(Rewriter &R, ASTContext &Context)
+  : MyRewriter(R), Context(Context) {}
+
+  bool VisitCXXMethodDecl(CXXMethodDecl *Decl) {
+SourceManager &SM = MyRewriter.getSourceMgr();
+
+// We don't want to modify anything outside the main file.
+if (!SM.isInMainFile(Decl->getBeginLoc()))
+  return false;
+
+Stmt *Body = Decl->getBody();
+if (!Body)
+  return false;
+
+bool IsConstructor = dyn_cast(Decl) != nullptr;
+bool IsDestructor = dyn_cast(Decl) != nullptr;
+
+// Do nothing for private decls.
+AccessSpecifier AS = Decl->getAccess();
+if (AS != AccessSpecifier::AS_public)
+  return false;
+
+// Do nothing for destructor.
+if (IsDestructor)
+  return false;
+
+CXXRecordDecl *Record = Decl->getParent();
+QualType ReturnType = Decl->getReturnType().getDesugaredType(Context);
+
+std::vector ParamTypes;
+std::vector ParamNames;
+for (auto *P : Decl->parameters()) {
+  QualType T = P->getType();
+
+  // Currently we don't support functions that have f

[Lldb-commits] [lldb] r352158 - Remove a warning in DynamicLoaderDarwin::UpdateImageLoadAddress

2019-01-24 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Thu Jan 24 19:01:48 2019
New Revision: 352158

URL: http://llvm.org/viewvc/llvm-project?rev=352158&view=rev
Log:
Remove a warning in DynamicLoaderDarwin::UpdateImageLoadAddress
when the binary loaded in memory has a section that we cannot find
in the on-disk version.  I added this warning out of an overabundance
of caution originally, but I've never seen an instance of it being
hit in the past few years, and there are some changes for the shared
cache on darwin systems where a segment is added when the shared
cache is constructed so we're now hitting this warning.  I've decided
to remove it altogether.

 


Modified:
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp?rev=352158&r1=352157&r2=352158&view=diff
==
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp 
(original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp 
Thu Jan 24 19:01:48 2019
@@ -255,15 +255,7 @@ bool DynamicLoaderDarwin::UpdateImageLoa
 
   changed = m_process->GetTarget().SetSectionLoadAddress(
   section_sp, new_section_load_addr, warn_multiple);
-} else {
-  Host::SystemLog(
-  Host::eSystemLogWarning,
-  "warning: unable to find and load segment named '%s' at "
-  "0x%" PRIx64 " in '%s' in macosx dynamic loader plug-in.\n",
-  info.segments[i].name.AsCString(""),
-  (uint64_t)new_section_load_addr,
-  image_object_file->GetFileSpec().GetPath().c_str());
-}
+} 
   }
 }
 


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


[Lldb-commits] [lldb] r352159 - Define the _fltused symbol in one lldb test as well, post-r352076.

2019-01-24 Thread James Y Knight via lldb-commits
Author: jyknight
Date: Thu Jan 24 19:21:23 2019
New Revision: 352159

URL: http://llvm.org/viewvc/llvm-project?rev=352159&view=rev
Log:
Define the _fltused symbol in one lldb test as well, post-r352076.

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp?rev=352159&r1=352158&r2=352159&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp Thu Jan 24 
19:21:23 2019
@@ -11,6 +11,10 @@
 // This technique in general allows us to exercise most of LLDB's type
 // system without a running process.
 
+// Define _fltused, since we're not linking against the MS C runtime, but use
+// floats.
+extern "C" int _fltused = 0;
+
 template
 struct MakeResult {
   static T result() {


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