[Lldb-commits] [lldb] r370440 - [lldb][NFC] Move Clang-specific flags to ClangUserExpression

2019-08-30 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Aug 30 00:44:29 2019
New Revision: 370440

URL: http://llvm.org/viewvc/llvm-project?rev=370440&view=rev
Log:
[lldb][NFC] Move Clang-specific flags to ClangUserExpression

LLVMUserExpression doesn't use these variables and they are all specific to 
Clang.

Also removes m_const_object as this was actually never used by anyone (and Clang
didn't report it as we assigned it in the constructor which seems to count as 
use).

Modified:
lldb/trunk/include/lldb/Expression/LLVMUserExpression.h
lldb/trunk/source/Expression/LLVMUserExpression.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h

Modified: lldb/trunk/include/lldb/Expression/LLVMUserExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/LLVMUserExpression.h?rev=370440&r1=370439&r2=370440&view=diff
==
--- lldb/trunk/include/lldb/Expression/LLVMUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/LLVMUserExpression.h Fri Aug 30 00:44:29 
2019
@@ -103,22 +103,6 @@ protected:
/// when running the
/// expression.
   lldb::ModuleWP m_jit_module_wp;
-  bool m_enforce_valid_object; ///< True if the expression parser should 
enforce
-   ///the presence of a valid class pointer
-  /// in order to generate the expression as a method.
-  bool m_in_cplusplus_method;  ///< True if the expression is compiled as a C++
-   ///member function (true if it was parsed
-   /// when exe_ctx was in a C++ method).
-  bool m_in_objectivec_method; ///< True if the expression is compiled as an
-   ///Objective-C method (true if it was parsed
-   /// when exe_ctx was in an Objective-C method).
-  bool m_in_static_method; ///< True if the expression is compiled as a static
-   ///(or class) method (currently true if it
-  /// was parsed when exe_ctx was in an Objective-C class method).
-  bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and
-   ///passed in.  False if the expression
-   /// doesn't really use them and they can be NULL.
-  bool m_const_object; ///< True if "this" is const.
   Target *m_target; ///< The target for storing persistent data like types and
 ///variables.
 

Modified: lldb/trunk/source/Expression/LLVMUserExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/LLVMUserExpression.cpp?rev=370440&r1=370439&r2=370440&view=diff
==
--- lldb/trunk/source/Expression/LLVMUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/LLVMUserExpression.cpp Fri Aug 30 00:44:29 2019
@@ -48,9 +48,7 @@ LLVMUserExpression::LLVMUserExpression(E
   m_stack_frame_bottom(LLDB_INVALID_ADDRESS),
   m_stack_frame_top(LLDB_INVALID_ADDRESS), m_allow_cxx(false),
   m_allow_objc(false), m_transformed_text(), m_execution_unit_sp(),
-  m_materializer_up(), m_jit_module_wp(), m_enforce_valid_object(true),
-  m_in_cplusplus_method(false), m_in_objectivec_method(false),
-  m_in_static_method(false), m_needs_object_ptr(false), m_target(nullptr),
+  m_materializer_up(), m_jit_module_wp(),
   m_can_interpret(false), m_materialized_address(LLDB_INVALID_ADDRESS) {}
 
 LLVMUserExpression::~LLVMUserExpression() {

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h?rev=370440&r1=370439&r2=370440&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h Fri 
Aug 30 00:44:29 2019
@@ -223,6 +223,23 @@ private:
 
   /// True iff this expression explicitly imported C++ modules.
   bool m_imported_cpp_modules = false;
+
+  /// True if the expression parser should enforce the presence of a valid 
class
+  /// pointer in order to generate the expression as a method.
+  bool m_enforce_valid_object = true;
+  /// True if the expression is compiled as a C++ member function (true if it
+  /// was parsed when exe_ctx was in a C++ method).
+  bool m_in_cplusplus_method = false;
+  /// True if the expression is compiled as an Objective-C method (true if it
+  /// was parsed when exe_ctx was in an Objective-C method).
+  bool m_in_objectivec_method = false;
+  /// True if the expression is compiled as a static (or class) method
+  /// (currently true if it was parsed when exe_ctx was in an Objective-C clas

[Lldb-commits] [PATCH] D66791: [lldb][ELF] Read symbols from .gnu_debugdata sect.

2019-08-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D66791#1651300 , @kwk wrote:

> Currently the test 
> `lldb/packages/Python/lldbsuite/test/linux/minidebuginfo/TestMiniDebugInfo.py`
>  fails if `LLVM_ENABLE_LZMA` is not defined because the test stupidly assumes 
> that support for minidebuginfo is available.


For this you'll need to make sure that the information about whether lzma is 
found or not is piped into the test suite. Take a look at `lldb/lit/lit.cfg.py` 
to see how it's done for python for instance. Then you can have a `REQUIRES: 
lzma` test which checks that the section is decompressed and a `REQUIRES: 
!lzma` test which ensures the warning gets printed.

I'd also like to see the yaml test resurrected. I find that one to be pretty 
important as it has nearly to system dependencies, and so it can run anywhere. 
If you don't want to tackle the yaml2obj thing now, you can always remove the 
extra symtab section via objcopy.




Comment at: lldb/include/lldb/Host/LZMA.h:24-30
+llvm::Error getUncompressedSize(const uint8_t *compressedBuffer,
+uint64_t compressedBufferSize,
+uint64_t &uncompressedSize);
+
+llvm::Error uncompress(const uint8_t *compressedBuffer,
+   uint64_t compressedBufferSize, uint8_t 
*uncompressedData,
+   uint64_t uncompressedSize);

How about an API like `llvm::Error uncompress(ArrayRef InputBuffer, 
SmallVectorImpl &Uncompressed)`, where the `uncompress` function 
automatically figures out the appropriate size of the buffer, and resizes it 
accordingly?

 As it stands now, this interface is neither easy to use, nor consistent with 
the llvm API. The above signature will make your use case easy, while still 
(slightly) improving consistency with the llvm API. If it makes anything 
easier, feel free to replace `uint8_t` with `char`, and `ArrayRef` with 
`StringRef` -- that would improve consistency, but I thing that the usage of 
StringRef/char in that API is a mistake that just keeps propagating itself.



Comment at: 
lldb/packages/Python/lldbsuite/test/linux/minidebuginfo/Makefile:1-55
+LEVEL = ../../make
+C_SOURCES := main.c
+
+all: clean binary
+
+.PHONY: binary
+binary: a.out

All of this would be much easier if you wrote it as a lit test.
```
// RUN: %clangxx %s -o %t
// RUN: llvm-nm ...
// ...
// RUN: %lldb %t -o "br set -n multiplyByThree" -o run -o exit | FileCheck %s

// CHECK: Breakpoint 1 hit
```



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1849-1851
+  if (m_gnuDebugDataObjectFile != nullptr) {
+return m_gnuDebugDataObjectFile;
+  }

Not a big deal, but we usually don't put braces around short blocks like this. 
If the block spans multiple lines, then the braces are fine, even if the block 
technically consists of a single statement only.



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1866
+  // Determine size of uncompressed data
+  auto data = DataExtractor();
+  section->GetSectionData(data);

`DataExtractor data`. llvm does not "always use auto".



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1868-1881
+  uint64_t uncompressedSize = 0;
+  auto err = lldb_private::lzma::getUncompressedSize(data.GetDataStart(), 
data.GetByteSize(), uncompressedSize);
+  if (err) {
+GetModule()->ReportWarning(
+"Failed to get size of uncompressed LZMA buffer from section %s: %s",
+section->GetName().AsCString(), Status(std::move(err)).AsCString());
+return nullptr;

With the new API, this would be something like
```
SmallVector uncompressed;
if (llvm::Error error = lzma::uncompress(data.GetData(), uncompressed) {
  GetModule()->ReportWarning(""An error occured while decompression the section 
%s: %s", section->GetName().AsCString(), 
llvm::toString(std::move(error)).c_str());
  return nullptr;
}



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1901
+  ArchSpec spec = m_gnuDebugDataObjectFile->GetArchitecture();
+  if (spec && m_gnuDebugDataObjectFile->SetModulesArchitecture(spec)) {
+return m_gnuDebugDataObjectFile;

Are you sure you want to do that? Presumably, the architecture of the module 
was already set by the containing object file, and that file probably has a 
more correct understanding of what the right architecture is...



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:2711-2731
 Section *symtab =
 section_list->FindSectionByType(eSectionTypeELFSymbolTable, 
true).get();
-if (!symtab) {
-  // The symtab section is non-allocable and can be stripped, so if it
-  // doesn't exist then use the dynsym section which should always be
-  // there.
-  symtab =
-  section_list->Fin

[Lldb-commits] [PATCH] D66962: [lldb][NFC] Remove TestFormats.py as is tests nothing

2019-08-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Actually, it looks like this test was committed with the regex stuff already 
being commented out (back in 2015/r228207), so the test never really tested 
anything..


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66962



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


[Lldb-commits] [lldb] r370449 - dotest: improvements to the pexpect tests

2019-08-30 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Aug 30 02:07:42 2019
New Revision: 370449

URL: http://llvm.org/viewvc/llvm-project?rev=370449&view=rev
Log:
dotest: improvements to the pexpect tests

Summary:
While working on r370054, i've found it frustrating that the test output
was compeletely unhelpful in case of failures. Therefore I've decided to
improve that. In this I reuse the PExpectTest class, which was one of
our mechanisms for running pexpect tests, but which has gotten orhpaned
in the mean time.

I've replaced the existing send methods with a "expect" method, which
I've tried to design so that it has a similar interface to the expect
method in regular non-pexpect dotest tests (as it essentially does
something very similar). I've kept the ability to dump the transcript of
the pexpect communication to stdout in the "trace" mode, as that is a
very handy way to figure out what the test is doing. I've also removed
the "expect_string" method used in the existing tests -- I've found this
to be unhelpful because it hides the message that would be normally
displayed by the EOF exception. Although vebose, this message includes
some important information, like what strings we were searching for,
what were the last bits of lldb output, etc. I've also beefed up the
class to automatically disable the debug info test duplication, and
auto-skip tests when the host platform does not support pexpect.

This patch ports TestMultilineCompletion and TestIOHandlerCompletion to
the new class. It also deletes TestFormats as it is not testing anything
(definitely not formats) -- it was committed with the test code
commented out (r228207), and then the testing code was deleted in
r356000.

Reviewers: teemperor, JDevlieghere, davide

Subscribers: aprantl, lldb-commits

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

Removed:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/format/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/format/TestFormats.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/format/main.c
Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py

lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py
lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py?rev=370449&r1=370448&r2=370449&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
 Fri Aug 30 02:07:42 2019
@@ -5,48 +5,28 @@ Test completion for multiline expression
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
 
-class MultilineCompletionTest(TestBase):
+class MultilineCompletionTest(PExpectTest):
 
 mydir = TestBase.compute_mydir(__file__)
-NO_DEBUG_INFO_TESTCASE = True
 
-def setUp(self):
-TestBase.setUp(self)
-self.source = 'main.c'
-
-def expect_string(self, string):
-import pexpect
-"""This expects for "string", with timeout & EOF being test fails."""
-try:
-self.child.expect_exact(string)
-except pexpect.EOF:
-self.fail("Got EOF waiting for '%s'" % (string))
-except pexpect.TIMEOUT:
-self.fail("Timed out waiting for '%s'" % (string))
-
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
 def test_basic_completion(self):
 """Test that we can complete a simple multiline expression"""
 self.build()
-self.setTearDownCleanup()
 
-import pexpect
-exe = self.getBuildArtifact("a.out")
 prompt = "(lldb) "
 
-run_commands = ' -o "b main" -o "r"'
-self.child = pexpect.spawn(
-'%s %s %s %s' %
-(lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
-child = self.child
+self.launch(executable=self.getBuildArtifact("a.out"))
+self.expect("b main", substrs=["Breakpoint 1", "address ="])
+self.expect("run", substrs=["stop reason ="])
 
-self.expect_string(prompt)
 self.child.sendline("expr")
-self.expect_string("terminate with an empty line to evaluate")
+self.child.expect_exact("terminate with an empty line to evaluate")
 self.child.send("to_\t")
-self.expect_string("to_complete")
+self.child.expect_exac

[Lldb-commits] [PATCH] D66954: dotest: improvements to the pexpect tests

2019-08-30 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370449: dotest: improvements to the pexpect tests (authored 
by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66954

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
  lldb/trunk/packages/Python/lldbsuite/test/functionalities/format/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/format/TestFormats.py
  lldb/trunk/packages/Python/lldbsuite/test/functionalities/format/main.c
  
lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py
  lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py

Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
@@ -5,48 +5,28 @@
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
 
-class MultilineCompletionTest(TestBase):
+class MultilineCompletionTest(PExpectTest):
 
 mydir = TestBase.compute_mydir(__file__)
-NO_DEBUG_INFO_TESTCASE = True
 
-def setUp(self):
-TestBase.setUp(self)
-self.source = 'main.c'
-
-def expect_string(self, string):
-import pexpect
-"""This expects for "string", with timeout & EOF being test fails."""
-try:
-self.child.expect_exact(string)
-except pexpect.EOF:
-self.fail("Got EOF waiting for '%s'" % (string))
-except pexpect.TIMEOUT:
-self.fail("Timed out waiting for '%s'" % (string))
-
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
 def test_basic_completion(self):
 """Test that we can complete a simple multiline expression"""
 self.build()
-self.setTearDownCleanup()
 
-import pexpect
-exe = self.getBuildArtifact("a.out")
 prompt = "(lldb) "
 
-run_commands = ' -o "b main" -o "r"'
-self.child = pexpect.spawn(
-'%s %s %s %s' %
-(lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
-child = self.child
+self.launch(executable=self.getBuildArtifact("a.out"))
+self.expect("b main", substrs=["Breakpoint 1", "address ="])
+self.expect("run", substrs=["stop reason ="])
 
-self.expect_string(prompt)
 self.child.sendline("expr")
-self.expect_string("terminate with an empty line to evaluate")
+self.child.expect_exact("terminate with an empty line to evaluate")
 self.child.send("to_\t")
-self.expect_string("to_complete")
+self.child.expect_exact("to_complete")
 
-self.deletePexpectChild()
+self.child.send("\n\n")
+self.expect_prompt()
+
+self.quit()
Index: lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py
+++ lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py
@@ -7,70 +7,46 @@
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
 
-class IOHandlerCompletionTest(TestBase):
+class IOHandlerCompletionTest(PExpectTest):
 
 mydir = TestBase.compute_mydir(__file__)
-NO_DEBUG_INFO_TESTCASE = True
 
-def setUp(self):
-TestBase.setUp(self)
-
-def expect_string(self, string):
-import pexpect
-"""This expects for "string", with timeout & EOF being test fails."""
-try:
-self.child.expect_exact(string)
-except pexpect.EOF:
-self.fail("Got EOF waiting for '%s'" % (string))
-except pexpect.TIMEOUT:
-self.fail("Timed out waiting for '%s'" % (string))
-
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
 def test_completion(self):
-self.setTearDownCleanup()
-
-import pexpect
-exe = self.getBuildArtifact("a.out")
-prompt = "(lldb) "
-
-self.child = pexpect.spawn(
-'%s %s %s %s' %
-(lldbtest_config.lldbExec, self.lldbOption, "", exe),
-dimensions=(100, 500))
+s

[Lldb-commits] [PATCH] D66994: [lldb][CMake] Fix windows-x86-debug compilation with python enabled using multi-target generator

2019-08-30 Thread Leonid Mashinskiy via Phabricator via lldb-commits
leonid.mashinskiy created this revision.
leonid.mashinskiy added reviewers: labath, JDevlieghere.
leonid.mashinskiy added a project: LLDB.
Herald added subscribers: lldb-commits, mgorny.

Visual Studio CMake generator is multi-target and does not define 
CMAKE_BUILD_TYPE, so Debug build on VS was failing due selection of release 
python library.
This patch reverts back some of latest changes and fixes building by raw VS 
using CMake expression generators.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D66994

Files:
  cmake/modules/LLDBConfig.cmake

Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -161,56 +161,118 @@
   file(TO_CMAKE_PATH "${PYTHON_HOME}" PYTHON_HOME)
   # TODO(compnerd) when CMake Policy `CMP0091` is set to NEW, we should use
   # if(CMAKE_MSVC_RUNTIME_LIBRARY MATCHES MultiThreadedDebug)
-  if(CMAKE_BUILD_TYPE STREQUAL Debug)
-file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_EXE)
-file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}_d.lib" PYTHON_LIB)
-file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}_d.dll" PYTHON_DLL)
-  else()
-file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_EXE)
-file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}.lib" PYTHON_LIB)
-file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}.dll" PYTHON_DLL)
-  endif()
-
-  foreach(component PYTHON_EXE;PYTHON_LIB;PYTHON_DLL)
-if(NOT EXISTS ${${component}})
-  message(WARNING "unable to find ${component}")
-  unset(${component})
+  if (NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL Debug)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe"   PYTHON_DEBUG_EXE)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}_d.lib" PYTHON_DEBUG_LIB)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}_d.dll"  PYTHON_DEBUG_DLL)
+
+foreach(component PYTHON_DEBUG_EXE;PYTHON_DEBUG_LIB;PYTHON_DEBUG_DLL)
+  if(NOT EXISTS ${${component}})
+message(WARNING "unable to find ${component}")
+unset(${component})
+  endif()
+endforeach()
+
+if (NOT PYTHON_DEBUG_EXE OR NOT PYTHON_DEBUG_LIB OR NOT PYTHON_DEBUG_DLL)
+  message(WARNING "Unable to find all Python components.  Python support will be disabled for this build.")
+  set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
+  return()
 endif()
-  endforeach()
 
-  if (NOT PYTHON_EXE OR NOT PYTHON_LIB OR NOT PYTHON_DLL)
-message(WARNING "Unable to find all Python components.  Python support will be disabled for this build.")
-set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
-return()
+# Find the version of the Python interpreter.
+execute_process(COMMAND "${PYTHON_DEBUG_EXE}" -c
+"import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))"
+OUTPUT_VARIABLE PYTHON_DEBUG_VERSION_OUTPUT
+RESULT_VARIABLE PYTHON_DEBUG_VERSION_RESULT
+ERROR_QUIET)
+if(NOT PYTHON_DEBUG_VERSION_RESULT)
+  string(REPLACE ";" "." PYTHON_DEBUG_VERSION_STRING "${PYTHON_DEBUG_VERSION_OUTPUT}")
+  list(GET PYTHON_DEBUG_VERSION_OUTPUT 0 PYTHON_DEBUG_VERSION_MAJOR)
+  list(GET PYTHON_DEBUG_VERSION_OUTPUT 1 PYTHON_DEBUG_VERSION_MINOR)
+  list(GET PYTHON_DEBUG_VERSION_OUTPUT 2 PYTHON_DEBUG_VERSION_PATCH)
+endif()
   endif()
-
-  # Find the version of the Python interpreter.
-  execute_process(COMMAND "${PYTHON_EXE}" -c
-  "import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))"
-  OUTPUT_VARIABLE PYTHON_VERSION_OUTPUT
-  RESULT_VARIABLE PYTHON_VERSION_RESULT
-  ERROR_QUIET)
-  if(NOT PYTHON_VERSION_RESULT)
-string(REPLACE ";" "." PYTHON_VERSION_STRING "${PYTHON_VERSION_OUTPUT}")
-list(GET PYTHON_VERSION_OUTPUT 0 PYTHON_VERSION_MAJOR)
-list(GET PYTHON_VERSION_OUTPUT 1 PYTHON_VERSION_MINOR)
-list(GET PYTHON_VERSION_OUTPUT 2 PYTHON_VERSION_PATCH)
+  
+  if (NOT DEFINED CMAKE_BUILD_TYPE OR NOT CMAKE_BUILD_TYPE STREQUAL Debug)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_RELEASE_EXE)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}.lib"   PYTHON_RELEASE_LIB)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}.dll"PYTHON_RELEASE_DLL)
+
+foreach(component PYTHON_RELEASE_EXE;PYTHON_RELEASE_LIB;PYTHON_RELEASE_DLL)
+  if(NOT EXISTS ${${component}})
+message(WARNING "unable to find ${component}")
+unset(${component})
+  endif()
+endforeach()
+  
+if (NOT PYTHON_RELEASE_EXE OR NOT PYTHON_RELEASE_LIB OR NOT PYTHON_RELEASE_DLL)
+  message(WARNING "Unable to find all Python components.  Python support will be disabled for this build.")
+  set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)

[Lldb-commits] [lldb] r370462 - [dotest] Finish removing -q

2019-08-30 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Aug 30 04:02:58 2019
New Revision: 370462

URL: http://llvm.org/viewvc/llvm-project?rev=370462&view=rev
Log:
[dotest] Finish removing -q

One usage of this option remained, and caused dotest to error out if one
happened to pass the -v flag.

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=370462&r1=370461&r2=370462&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Fri Aug 30 04:02:58 2019
@@ -243,7 +243,7 @@ def parseOptionsAndInitTestdirs():
 lldbtest_config.inferior_env = ' '.join(args.set_inferior_env_vars)
 
 # Only print the args if being verbose.
-if args.v and not args.q:
+if args.v:
 print(get_dotest_invocation())
 
 if args.h:


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


[Lldb-commits] [PATCH] D66994: [lldb][CMake] Fix windows-x86-debug compilation with python enabled using multi-target generator

2019-08-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added reviewers: amccarth, stella.stamenova.
labath added a comment.

+windows folks, then can speak to the substance of this change.

As for the implementation, I get the impression that there is a lot of 
duplicated code in here. The code for finding the release and debug pythons is 
nearly identical. Can this be extracted into an utility function?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66994



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


[Lldb-commits] [PATCH] D67001: [lldb] Limit the amount of zeroes we use for padding when printing small floats

2019-08-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere.
Herald added a project: LLDB.

We got a radar that printing small floats is not very user-friendly in LLDB as 
we print them with up to
100 leading zeroes before starting to use scientific notation. This patch 
changes this by already using
scientific notation when we hit 6 padding zeroes by default and moves this 
value into a target setting
so that users can just set this number back to 100 if they for some reason 
preferred the old behaviour.

This new setting is influencing how we format data, so that's why we have to 
reset the data visualisation
cache when it is changed.

Note that we have always been using scientific notation for large numbers 
because it seems that
the LLVM implementation doesn't support printing out the padding zeroes for 
them. I would have fixed
that if it was trivial, but looking at the LLVM implementation for this it 
seems that this is not as trivial
as it sounds. I would say we look into this if we ever get a bug report about 
someone wanting to have
a large amount of trailing zeroes in their numbers instead of using scientific 
notation.

Fixes rdar://39744137


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67001

Files:
  lldb/include/lldb/Target/Target.h
  lldb/packages/Python/lldbsuite/test/functionalities/float-display/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/float-display/TestFloatDisplay.py
  lldb/packages/Python/lldbsuite/test/functionalities/float-display/main.c
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/DumpDataExtractor.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/TargetProperties.td

Index: lldb/source/Target/TargetProperties.td
===
--- lldb/source/Target/TargetProperties.td
+++ lldb/source/Target/TargetProperties.td
@@ -60,6 +60,9 @@
   def SaveObjects: Property<"save-jit-objects", "Boolean">,
 DefaultFalse,
 Desc<"Save intermediate object files generated by the LLVM JIT">;
+  def MaxZeroPaddingInFloatFormat: Property<"max-zero-padding-in-float-format", "UInt64">,
+DefaultUnsignedValue<6>,
+Desc<"The maximum number of zeroes to insert when displaying a very small float before falling back to scientific notation.">;
   def MaxChildrenCount: Property<"max-children-count", "SInt64">,
 DefaultUnsignedValue<256>,
 Desc<"Maximum number of children to expand in any level of depth.">;
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -3789,6 +3789,12 @@
   nullptr, idx, g_target_properties[idx].default_uint_value != 0);
 }
 
+uint32_t TargetProperties::GetMaxZeroPaddingInFloatFormat() const {
+  const uint32_t idx = ePropertyMaxZeroPaddingInFloatFormat;
+  return m_collection_sp->GetPropertyAtIndexAsUInt64(
+  nullptr, idx, g_target_properties[idx].default_uint_value);
+}
+
 uint32_t TargetProperties::GetMaximumNumberOfChildrenToDisplay() const {
   const uint32_t idx = ePropertyMaxChildrenCount;
   return m_collection_sp->GetPropertyAtIndexAsSInt64(
Index: lldb/source/Core/DumpDataExtractor.cpp
===
--- lldb/source/Core/DumpDataExtractor.cpp
+++ lldb/source/Core/DumpDataExtractor.cpp
@@ -563,7 +563,8 @@
 llvm::SmallVector sv;
 // Show full precision when printing float values
 const unsigned format_precision = 0;
-const unsigned format_max_padding = 100;
+const unsigned format_max_padding =
+target_sp->GetMaxZeroPaddingInFloatFormat();
 size_t item_bit_size = item_byte_size * 8;
 
 if (item_bit_size == ast->getTypeSize(ast->FloatTy)) {
Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -257,7 +257,14 @@
   llvm::StringRef value) {
   bool is_load_script =
   (property_path == "target.load-script-from-symbol-file");
-  bool is_escape_non_printables = (property_path == "escape-non-printables");
+  // These properties might change how we visualize data.
+  bool invalidate_data_vis = (property_path == "escape-non-printables");
+  invalidate_data_vis |=
+  (property_path == "target.max-zero-padding-in-float-format");
+  if (invalidate_data_vis) {
+DataVisualization::ForceUpdate();
+  }
+
   TargetSP target_sp;
   LoadScriptFromSymFile load_script_old_value;
   if (is_load_script && exe_ctx->GetTargetSP()) {
@@ -300,8 +307,6 @@
   }
 }
   }
-} else if (is_escape_non_printables) {
-  DataVisualization::ForceUpdate();
 }
   }
   return error;
Index: lldb/packages/Python/lldbsuite/test/functionalities/float-display/main.c
==

[Lldb-commits] [PATCH] D66863: [lldb] Unify target checking in CommandObject

2019-08-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 218084.
teemperor added a comment.

- Removed target requirement where we already have another flag that's implying 
that we need a target.
- Properly formatted some strings.
- Extended check in GetSelectedTarget to also check for flags that imply 
eCommandRequiresTarget.


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

https://reviews.llvm.org/D66863

Files:
  lldb/include/lldb/Interpreter/CommandObject.h
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/CommandObjectWatchpoint.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Interpreter/CommandObject.cpp

Index: lldb/source/Interpreter/CommandObject.cpp
===
--- lldb/source/Interpreter/CommandObject.cpp
+++ lldb/source/Interpreter/CommandObject.cpp
@@ -925,6 +925,15 @@
   return *m_interpreter.GetDebugger().GetSelectedOrDummyTarget(prefer_dummy);
 }
 
+Target &CommandObject::GetSelectedTarget() {
+  assert(m_flags.AnySe(eCommandRequiresTarget | eCommandProcessMustBePaused |
+   eCommandProcessMustBeLaunched | eCommandRequiresFrame |
+   eCommandRequiresThread | eCommandRequiresProcess |
+   eCommandRequiresRegContext) &&
+ "GetSelectedTarget called from object that may have no target");
+  return *m_interpreter.GetDebugger().GetSelectedTarget();
+}
+
 Thread *CommandObject::GetDefaultThread() {
   Thread *thread_to_use = m_exe_ctx.GetThreadPtr();
   if (thread_to_use)
Index: lldb/source/Commands/CommandObjectWatchpointCommand.cpp
===
--- lldb/source/Commands/CommandObjectWatchpointCommand.cpp
+++ lldb/source/Commands/CommandObjectWatchpointCommand.cpp
@@ -59,7 +59,7 @@
   : CommandObjectParsed(interpreter, "add",
 "Add a set of LLDB commands to a watchpoint, to be "
 "executed whenever the watchpoint is hit.",
-nullptr),
+nullptr, eCommandRequiresTarget),
 IOHandlerDelegateMultiline("DONE",
IOHandlerDelegate::Completion::LLDBCommand),
 m_options() {
@@ -389,14 +389,7 @@
 
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) override {
-Target *target = GetDebugger().GetSelectedTarget().get();
-
-if (target == nullptr) {
-  result.AppendError("There is not a current executable; there are no "
- "watchpoints to which to add commands");
-  result.SetStatus(eReturnStatusFailed);
-  return false;
-}
+Target *target = &GetSelectedTarget();
 
 const WatchpointList &watchpoints = target->GetWatchpointList();
 size_t num_watchpoints = watchpoints.GetSize();
@@ -486,7 +479,7 @@
   CommandObjectWatchpointCommandDelete(CommandInterpreter &interpreter)
   : CommandObjectParsed(interpreter, "delete",
 "Delete the set of commands from a watchpoint.",
-nullptr) {
+nullptr, eCommandRequiresTarget) {
 CommandArgumentEntry arg;
 CommandArgumentData wp_id_arg;
 
@@ -506,14 +499,7 @@
 
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) override {
-Target *target = GetDebugger().GetSelectedTarget().get();
-
-if (target == nullptr) {
-  result.AppendError("There is not a current executable; there are no "
- "watchpoints from which to delete commands");
-  result.SetStatus(eReturnStatusFailed);
-  return false;
-}
+Target *target = &GetSelectedTarget();
 
 const WatchpointList &watchpoints = target->GetWatchpointList();
 size_t num_watchpoints = watchpoints.GetSize();
@@ -562,10 +548,11 @@
 class CommandObjectWatchpointCommandList : public CommandObjectParsed {
 public:
   CommandObjectWatchpointCommandList(CommandInterpreter &interpreter)
-  : CommandObjectParsed(interpreter, "list", "List the script or set of "
- "commands to be executed when "
- "the watchpoint is hit.",
-nullptr) {
+  : CommandObjectParsed(interpreter, "list",
+"List the script or set of "
+"commands to be executed when "
+"the watchpoint is hit.",
+nullptr, eCommandRequiresTarget) {
 CommandArgumentEntry arg;
 CommandArgumentData wp_id_arg;
 
@@ -585,14 +572,7 @@
 
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) overr

[Lldb-commits] [PATCH] D67001: [lldb] Limit the amount of zeroes we use for padding when printing small floats

2019-08-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor planned changes to this revision.
teemperor added a comment.

Just realised I didn't update any other tests that are maybe broken now due to 
the changed format.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67001



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


[Lldb-commits] [PATCH] D66863: [lldb] Unify target checking in CommandObject

2019-08-30 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Just a few string reflows and fix a typo




Comment at: lldb/source/Commands/CommandObjectBreakpointCommand.cpp:593
+  : CommandObjectParsed(interpreter, "list",
+"List the script or set of  commands to be "
+"executed when the breakpoint is hit.",

replace multiple spaces with just one



Comment at: lldb/source/Commands/CommandObjectTarget.cpp:2615-2617
+"Set the load addresses for "
+"one or more sections in a "
+"target module.",

Fix string



Comment at: lldb/source/Commands/CommandObjectWatchpointCommand.cpp:552-554
+"List the script or set of "
+"commands to be executed when "
+"the watchpoint is hit.",

reflow the string



Comment at: lldb/source/Interpreter/CommandObject.cpp:929
+Target &CommandObject::GetSelectedTarget() {
+  assert(m_flags.AnySe(eCommandRequiresTarget | eCommandProcessMustBePaused |
+   eCommandProcessMustBeLaunched | eCommandRequiresFrame |

s/AnySe/AnySet/


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

https://reviews.llvm.org/D66863



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


[Lldb-commits] [lldb] r370483 - [lit] Fix my earlier bogus fix to not set DYLD_LIBRARY_PATH with Asan.

2019-08-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Aug 30 08:56:14 2019
New Revision: 370483

URL: http://llvm.org/viewvc/llvm-project?rev=370483&view=rev
Log:
[lit] Fix my earlier bogus fix to not set DYLD_LIBRARY_PATH with Asan.

My follow-up commit to mess with DYLD_LIBRARY_PATH was bogus for two
reasons:

 - The condition was inverted.
 - We were checking the OS's environment, instead of the config's.

Two wrongs don't make a right, but the second mistake meant that the
sanitizer bot passed.

Modified:
lldb/trunk/lit/Suite/lit.cfg

Modified: lldb/trunk/lit/Suite/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.cfg?rev=370483&r1=370482&r2=370483&view=diff
==
--- lldb/trunk/lit/Suite/lit.cfg (original)
+++ lldb/trunk/lit/Suite/lit.cfg Fri Aug 30 08:56:14 2019
@@ -39,7 +39,7 @@ def find_shlibpath_var():
   elif platform.system() == 'Windows':
 yield 'PATH'
 
-if 'DYLD_INSERT_LIBRARIES' in os.environ:
+if not 'DYLD_INSERT_LIBRARIES' in config.environment:
   # Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
   # This clashes with DYLD_INSERT_LIBRARIES which is needed on Darwin.
   for shlibpath_var in find_shlibpath_var():


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


[Lldb-commits] [PATCH] D66934: [ARM64] Simplify RegisterInfos_arm64.h with macro based RegisterInfo array

2019-08-30 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Just a few nits around DEFINE_GPR64 and how the "alt" names are specified. See 
inline comments.




Comment at: source/Plugins/Process/Utility/RegisterInfos_arm64.h:492
+// Defines a 64-bit general purpose register
+#define DEFINE_GPR64(reg, alt, generic_kind)   
\
+  {
\

Since most definitions don't have an alt, might be nice to make two:
```
DEFINE_GPR64(reg, generic_kind) ...
DEFINE_GPR64_ALT(reg, alt, generic_kind) ...
```
Also be nice to not assume "alt" is already a string and just add the #alt into 
the definition. See comment below for more details



Comment at: source/Plugins/Process/Utility/RegisterInfos_arm64.h:534
+// DEFINE_GPR64(name, alternate name, GENERIC KIND)
+DEFINE_GPR64(x0, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+DEFINE_GPR64(x1, nullptr, LLDB_REGNUM_GENERIC_ARG2),

If we make changes to remote "alt" from DEFINE_GPR64 this becomes:
```
DEFINE_GPR64(x0, LLDB_REGNUM_GENERIC_ARG1),
```



Comment at: source/Plugins/Process/Utility/RegisterInfos_arm64.h:563
+DEFINE_GPR64(x28, nullptr, LLDB_INVALID_REGNUM),
+DEFINE_GPR64(fp, "x29", LLDB_REGNUM_GENERIC_FP),
+DEFINE_GPR64(lr, "x30", LLDB_REGNUM_GENERIC_RA),

If we make suggested changes to DEFINE_GPR64 by adding a DEFINE_GPR64_ALT this 
becomes:
```
DEFINE_GPR64_alt(fp, x29, LLDB_REGNUM_GENERIC_FP),
```
Note no quotes on the "x29"



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

https://reviews.llvm.org/D66934



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


[Lldb-commits] [PATCH] D66863: [lldb] Unify target checking in CommandObject

2019-08-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 218117.
teemperor marked 3 inline comments as done.
teemperor added a comment.

- Fix typo in code and comment.
- Reflow some changed strings.


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

https://reviews.llvm.org/D66863

Files:
  lldb/include/lldb/Interpreter/CommandObject.h
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/CommandObjectWatchpoint.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Interpreter/CommandObject.cpp

Index: lldb/source/Interpreter/CommandObject.cpp
===
--- lldb/source/Interpreter/CommandObject.cpp
+++ lldb/source/Interpreter/CommandObject.cpp
@@ -925,6 +925,15 @@
   return *m_interpreter.GetDebugger().GetSelectedOrDummyTarget(prefer_dummy);
 }
 
+Target &CommandObject::GetSelectedTarget() {
+  assert(m_flags.AnySet(eCommandRequiresTarget | eCommandProcessMustBePaused |
+eCommandProcessMustBeLaunched | eCommandRequiresFrame |
+eCommandRequiresThread | eCommandRequiresProcess |
+eCommandRequiresRegContext) &&
+ "GetSelectedTarget called from object that may have no target");
+  return *m_interpreter.GetDebugger().GetSelectedTarget();
+}
+
 Thread *CommandObject::GetDefaultThread() {
   Thread *thread_to_use = m_exe_ctx.GetThreadPtr();
   if (thread_to_use)
Index: lldb/source/Commands/CommandObjectWatchpointCommand.cpp
===
--- lldb/source/Commands/CommandObjectWatchpointCommand.cpp
+++ lldb/source/Commands/CommandObjectWatchpointCommand.cpp
@@ -59,7 +59,7 @@
   : CommandObjectParsed(interpreter, "add",
 "Add a set of LLDB commands to a watchpoint, to be "
 "executed whenever the watchpoint is hit.",
-nullptr),
+nullptr, eCommandRequiresTarget),
 IOHandlerDelegateMultiline("DONE",
IOHandlerDelegate::Completion::LLDBCommand),
 m_options() {
@@ -389,14 +389,7 @@
 
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) override {
-Target *target = GetDebugger().GetSelectedTarget().get();
-
-if (target == nullptr) {
-  result.AppendError("There is not a current executable; there are no "
- "watchpoints to which to add commands");
-  result.SetStatus(eReturnStatusFailed);
-  return false;
-}
+Target *target = &GetSelectedTarget();
 
 const WatchpointList &watchpoints = target->GetWatchpointList();
 size_t num_watchpoints = watchpoints.GetSize();
@@ -486,7 +479,7 @@
   CommandObjectWatchpointCommandDelete(CommandInterpreter &interpreter)
   : CommandObjectParsed(interpreter, "delete",
 "Delete the set of commands from a watchpoint.",
-nullptr) {
+nullptr, eCommandRequiresTarget) {
 CommandArgumentEntry arg;
 CommandArgumentData wp_id_arg;
 
@@ -506,14 +499,7 @@
 
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) override {
-Target *target = GetDebugger().GetSelectedTarget().get();
-
-if (target == nullptr) {
-  result.AppendError("There is not a current executable; there are no "
- "watchpoints from which to delete commands");
-  result.SetStatus(eReturnStatusFailed);
-  return false;
-}
+Target *target = &GetSelectedTarget();
 
 const WatchpointList &watchpoints = target->GetWatchpointList();
 size_t num_watchpoints = watchpoints.GetSize();
@@ -562,10 +548,10 @@
 class CommandObjectWatchpointCommandList : public CommandObjectParsed {
 public:
   CommandObjectWatchpointCommandList(CommandInterpreter &interpreter)
-  : CommandObjectParsed(interpreter, "list", "List the script or set of "
- "commands to be executed when "
- "the watchpoint is hit.",
-nullptr) {
+  : CommandObjectParsed(interpreter, "list",
+"List the script or set of commands to be executed "
+"when the watchpoint is hit.",
+nullptr, eCommandRequiresTarget) {
 CommandArgumentEntry arg;
 CommandArgumentData wp_id_arg;
 
@@ -585,14 +571,7 @@
 
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) override {
-Target *target = GetDebugger().GetSelectedTarget().get();
-
-if (target == nullptr) {
-  result.AppendError("There is not a current executa

[Lldb-commits] [PATCH] D66994: [lldb][CMake] Fix windows-x86-debug compilation with python enabled using multi-target generator

2019-08-30 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

I'll look at this in detail soon, but a few caveats:

- lldb tests don't work with the debug Python interpreter, which is why I've 
been complaining about test failures approximately forever when the bots seem 
fine.

- Some of these changes you're undoing caused a lot of pain when they were 
first put in, so let's be really sure if we need to undo this.

- I use the VS project only for code browsing and debugging.  For building and 
tests, I use the ninja project.  So I'm not very familiar with the problem 
you're trying to fix.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66994



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


[Lldb-commits] [PATCH] D67012: [lit] Only set DYLD_LIBRARY_PATH for shared builds

2019-08-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, mgorny.
Herald added subscribers: llvm-commits, abidh.
Herald added projects: LLDB, LLVM.
JDevlieghere updated this revision to Diff 218133.

In r370135 I committed a temporary workaround for the sanitized bot to not set 
(DY)LD_LIBRARY_PATH when (DY)LD_INSERT_LIBRARIES was set. Setting 
(DY)LD_LIBRARY_PATH is only necessary for (standalone) shared-library builds, 
so a better solution is to only set the environment variable when necessary.


https://reviews.llvm.org/D67012

Files:
  lldb/lit/CMakeLists.txt
  lldb/lit/Suite/lit.cfg
  lldb/lit/Suite/lit.site.cfg.in
  llvm/cmake/modules/LLVMConfig.cmake.in


Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -84,6 +84,7 @@
 set(LLVM_TOOLS_INSTALL_DIR "@LLVM_TOOLS_INSTALL_DIR@")
 set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@)
 set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
+set(LLVM_SHARED_LIBS @BUILD_SHARED_LIBS@)
 
 if(NOT TARGET LLVMSupport)
   set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@")
Index: lldb/lit/Suite/lit.site.cfg.in
===
--- lldb/lit/Suite/lit.site.cfg.in
+++ lldb/lit/Suite/lit.site.cfg.in
@@ -13,6 +13,7 @@
 config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
 config.host_os = "@HOST_OS@"
 config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.shared_libs = "@LLVM_SHARED_LIBS@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
Index: lldb/lit/Suite/lit.cfg
===
--- lldb/lit/Suite/lit.cfg
+++ lldb/lit/Suite/lit.cfg
@@ -39,21 +39,18 @@
   elif platform.system() == 'Windows':
 yield 'PATH'
 
-if not 'DYLD_INSERT_LIBRARIES' in config.environment:
-  # Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
-  # This clashes with DYLD_INSERT_LIBRARIES which is needed on Darwin.
+# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
+if config.shared_libs:
   for shlibpath_var in find_shlibpath_var():
 # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory while
 # llvm_libs_dir specifies LLVM's lib directory.
 shlibpath = os.path.pathsep.join(
-  (config.llvm_shlib_dir,
-  config.llvm_libs_dir,
-  config.environment.get(shlibpath_var, '')))
+(config.llvm_shlib_dir, config.llvm_libs_dir,
+ config.environment.get(shlibpath_var, '')))
 config.environment[shlibpath_var] = shlibpath
-break
   else:
-lit_config.warning("unable to inject shared library path on '{}'"
-  .format(platform.system()))
+lit_config.warning("unable to inject shared library path on '{}'".format(
+platform.system()))
 
 # Build dotest command.
 dotest_cmd = [config.dotest_path]
Index: lldb/lit/CMakeLists.txt
===
--- lldb/lit/CMakeLists.txt
+++ lldb/lit/CMakeLists.txt
@@ -69,6 +69,7 @@
 llvm_canonicalize_cmake_booleans(
   LLDB_DISABLE_PYTHON
   LLVM_ENABLE_ZLIB
+  LLVM_SHARED_LIBS
   LLDB_IS_64_BITS)
 
 configure_lit_site_cfg(


Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -84,6 +84,7 @@
 set(LLVM_TOOLS_INSTALL_DIR "@LLVM_TOOLS_INSTALL_DIR@")
 set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@)
 set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
+set(LLVM_SHARED_LIBS @BUILD_SHARED_LIBS@)
 
 if(NOT TARGET LLVMSupport)
   set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@")
Index: lldb/lit/Suite/lit.site.cfg.in
===
--- lldb/lit/Suite/lit.site.cfg.in
+++ lldb/lit/Suite/lit.site.cfg.in
@@ -13,6 +13,7 @@
 config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
 config.host_os = "@HOST_OS@"
 config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.shared_libs = "@LLVM_SHARED_LIBS@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
Index: lldb/lit/Suite/lit.cfg
===
--- lldb/lit/Suite/lit.cfg
+++ lldb/lit/Suite/lit.cfg
@@ -39,21 +39,18 @@
   elif platform.system() == 'Windows':
 yield 'PATH'
 
-if not 'DYLD_INSERT_LIBRARIES' in config.environment:
-  # Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
-  # This clashes with DYLD_INSERT_LIBRARIES which is needed on Darwin.
+# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
+if config.shared_libs:
   for shlibpath_var in find_shli

[Lldb-commits] [PATCH] D67012: [lit] Only set DYLD_LIBRARY_PATH for shared builds

2019-08-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 218133.

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

https://reviews.llvm.org/D67012

Files:
  lldb/lit/CMakeLists.txt
  lldb/lit/Suite/lit.cfg
  lldb/lit/Suite/lit.site.cfg.in
  llvm/cmake/modules/LLVMConfig.cmake.in


Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -84,6 +84,7 @@
 set(LLVM_TOOLS_INSTALL_DIR "@LLVM_TOOLS_INSTALL_DIR@")
 set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@)
 set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
+set(LLVM_SHARED_LIBS @BUILD_SHARED_LIBS@)
 
 if(NOT TARGET LLVMSupport)
   set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@")
Index: lldb/lit/Suite/lit.site.cfg.in
===
--- lldb/lit/Suite/lit.site.cfg.in
+++ lldb/lit/Suite/lit.site.cfg.in
@@ -13,6 +13,7 @@
 config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
 config.host_os = "@HOST_OS@"
 config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.shared_libs = "@LLVM_SHARED_LIBS@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
Index: lldb/lit/Suite/lit.cfg
===
--- lldb/lit/Suite/lit.cfg
+++ lldb/lit/Suite/lit.cfg
@@ -39,21 +39,18 @@
   elif platform.system() == 'Windows':
 yield 'PATH'
 
-if not 'DYLD_INSERT_LIBRARIES' in config.environment:
-  # Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
-  # This clashes with DYLD_INSERT_LIBRARIES which is needed on Darwin.
+# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
+if config.shared_libs:
   for shlibpath_var in find_shlibpath_var():
 # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory while
 # llvm_libs_dir specifies LLVM's lib directory.
 shlibpath = os.path.pathsep.join(
-  (config.llvm_shlib_dir,
-  config.llvm_libs_dir,
-  config.environment.get(shlibpath_var, '')))
+(config.llvm_shlib_dir, config.llvm_libs_dir,
+ config.environment.get(shlibpath_var, '')))
 config.environment[shlibpath_var] = shlibpath
-break
   else:
-lit_config.warning("unable to inject shared library path on '{}'"
-  .format(platform.system()))
+lit_config.warning("unable to inject shared library path on '{}'".format(
+platform.system()))
 
 # Build dotest command.
 dotest_cmd = [config.dotest_path]
Index: lldb/lit/CMakeLists.txt
===
--- lldb/lit/CMakeLists.txt
+++ lldb/lit/CMakeLists.txt
@@ -69,6 +69,7 @@
 llvm_canonicalize_cmake_booleans(
   LLDB_DISABLE_PYTHON
   LLVM_ENABLE_ZLIB
+  LLVM_SHARED_LIBS
   LLDB_IS_64_BITS)
 
 configure_lit_site_cfg(


Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -84,6 +84,7 @@
 set(LLVM_TOOLS_INSTALL_DIR "@LLVM_TOOLS_INSTALL_DIR@")
 set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@)
 set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
+set(LLVM_SHARED_LIBS @BUILD_SHARED_LIBS@)
 
 if(NOT TARGET LLVMSupport)
   set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@")
Index: lldb/lit/Suite/lit.site.cfg.in
===
--- lldb/lit/Suite/lit.site.cfg.in
+++ lldb/lit/Suite/lit.site.cfg.in
@@ -13,6 +13,7 @@
 config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
 config.host_os = "@HOST_OS@"
 config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.shared_libs = "@LLVM_SHARED_LIBS@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
Index: lldb/lit/Suite/lit.cfg
===
--- lldb/lit/Suite/lit.cfg
+++ lldb/lit/Suite/lit.cfg
@@ -39,21 +39,18 @@
   elif platform.system() == 'Windows':
 yield 'PATH'
 
-if not 'DYLD_INSERT_LIBRARIES' in config.environment:
-  # Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
-  # This clashes with DYLD_INSERT_LIBRARIES which is needed on Darwin.
+# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
+if config.shared_libs:
   for shlibpath_var in find_shlibpath_var():
 # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory while
 # llvm_libs_dir specifies LLVM's lib directory.
 shlibpath = os.path.pathsep.join(
-  (config.llvm_shlib_dir,
-  config.llvm_libs_dir,
-  config.environment.get(shlibpath_var, '')))
+(config.llvm_shlib_dir, config.llvm_libs_dir,
+ config.environment.get(shlibpath_var, '')))

[Lldb-commits] [PATCH] D66994: [lldb][CMake] Fix windows-x86-debug compilation with python enabled using multi-target generator

2019-08-30 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

Is there a way to reduce some of the code duplication? The more duplication 
there is, the harder it is to maintain.




Comment at: cmake/modules/LLDBConfig.cmake:240
+  if (NOT DEFINED CMAKE_BUILD_TYPE)
+# multiconfiguration generator was selected (i.e. Visual Studio)
+# so print both debug and release variables related to python

Nit: multi-configuration


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66994



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


[Lldb-commits] [lldb] r370503 - [lldb][NFC] More tests for invalid register command invocations

2019-08-30 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Aug 30 12:19:25 2019
New Revision: 370503

URL: http://llvm.org/viewvc/llvm-project?rev=370503&view=rev
Log:
[lldb][NFC] More tests for invalid register command invocations

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py?rev=370503&r1=370502&r2=370503&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
 Fri Aug 30 12:19:25 2019
@@ -488,3 +488,18 @@ class RegisterCommandsTestCase(TestBase)
 
 self.expect("register read --set 0 r", error=True,
 substrs=["the --set  option can't be used when 
registers names are supplied as arguments"])
+
+self.expect("register write a", error=True,
+substrs=["register write takes exactly 2 arguments: 
 "])
+self.expect("register write a b c", error=True,
+substrs=["register write takes exactly 2 arguments: 
 "])
+
+@skipIfiOSSimulator
+@skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64']))
+@expectedFailureNetBSD
+def test_write_unknown_register(self):
+self.build()
+self.common_setup()
+
+self.expect("register write blub 1", error=True,
+substrs=["error: Register not found for 'blub'."])


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


[Lldb-commits] [PATCH] D67018: [lldb][NFC] Add basic test for GUI command

2019-08-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Given how much fun Pavel had fixing my previous pexpect tests, I thought: "Why 
stop the fun after just two tests?". So here we go!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67018



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


[Lldb-commits] [PATCH] D67018: [lldb][NFC] Add basic test for GUI command

2019-08-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: labath, clayborg.
Herald added subscribers: lldb-commits, JDevlieghere.
Herald added a project: LLDB.
teemperor added a comment.

Given how much fun Pavel had fixing my previous pexpect tests, I thought: "Why 
stop the fun after just two tests?". So here we go!


This adds a basic test for the GUI command. Just tests that it starts up, that 
we can quit the gui
and help window, and that the basic UI elements are rendered. Mostly testing 
the waters how
testing this command will do on the bots or if that will cause some serious 
issues when we do
fancy ncurses stuff.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67018

Files:
  lldb/packages/Python/lldbsuite/test/functionalities/gui_command/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/gui_command/TestGuiBasic.py
  lldb/packages/Python/lldbsuite/test/functionalities/gui_command/main.c


Index: lldb/packages/Python/lldbsuite/test/functionalities/gui_command/main.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/gui_command/main.c
@@ -0,0 +1,5 @@
+int main(int argc, char **argv) {
+  lldb_enable_attach();
+  int funky_var_name_that_should_be_rendered = 22;
+  return 0;
+}
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/gui_command/TestGuiBasic.py
===
--- /dev/null
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/gui_command/TestGuiBasic.py
@@ -0,0 +1,58 @@
+"""
+Test that the 'gui' displays the help window and basic UI.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class BasicGuiCommandTest(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_gui(self):
+self.build()
+
+self.launch(executable=self.getBuildArtifact("a.out"))
+self.expect("b main.c:4", substrs=["Breakpoint 1", "address ="])
+self.expect("run", substrs=["stop reason ="])
+
+
+escape_key = chr(27).encode()
+
+# Start the GUI for the first time and check for the welcome window.
+self.child.sendline("gui")
+self.child.expect_exact("Welcome to the LLDB curses GUI.")
+
+# Press escape to quit the welcome screen
+self.child.send(escape_key)
+# Press escape again to quit the gui
+self.child.send(escape_key)
+self.expect_prompt()
+
+# Start the GUI a second time, this time we should have the normal GUI.
+self.child.sendline("gui")
+# Check for GUI elements in the menu bar.
+self.child.expect_exact("Target")
+self.child.expect_exact("Process")
+self.child.expect_exact("Thread")
+self.child.expect_exact("View")
+self.child.expect_exact("Help")
+
+# Check the sources window.
+self.child.expect_exact("Sources")
+self.child.expect_exact("main")
+self.child.expect_exact("funky_var_name_that_should_be_rendered")
+
+# Check the variable window.
+self.child.expect_exact("Variables")
+self.child.expect_exact("(int) funky_var_name_that_should_be_rendered 
= 22")
+
+# Check the bar at the bottom.
+self.child.expect_exact("Frame:")
+
+# Press escape to quit the gui
+self.child.send(escape_key)
+
+self.quit()
Index: lldb/packages/Python/lldbsuite/test/functionalities/gui_command/Makefile
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/gui_command/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules


Index: lldb/packages/Python/lldbsuite/test/functionalities/gui_command/main.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/gui_command/main.c
@@ -0,0 +1,5 @@
+int main(int argc, char **argv) {
+  lldb_enable_attach();
+  int funky_var_name_that_should_be_rendered = 22;
+  return 0;
+}
Index: lldb/packages/Python/lldbsuite/test/functionalities/gui_command/TestGuiBasic.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/gui_command/TestGuiBasic.py
@@ -0,0 +1,58 @@
+"""
+Test that the 'gui' displays the help window and basic UI.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class BasicGuiCommandTest(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_gui(self):
+self.build()
+
+self.launch(executable=self.getBuildArtifact("a.out"))
+self.expect("b main.c:4", substrs=["Breakpoint 1", "address ="])
+self.

[Lldb-commits] [PATCH] D67018: [lldb][NFC] Add basic test for GUI command

2019-08-30 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

It is great to have tests. The main issue I would see is some of the text might 
not render correctly if the screen size is too small. Can we control the size 
(char width and height) of the screen in pexpect tests?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67018



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


[Lldb-commits] [PATCH] D67018: [lldb][NFC] Add basic test for GUI command

2019-08-30 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Seems like revision 370054 sets the screen size quite wide. Just checking that 
this change will be used for this test?


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

https://reviews.llvm.org/D67018



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


[Lldb-commits] [PATCH] D67018: [lldb][NFC] Add basic test for GUI command

2019-08-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 218161.
teemperor added a comment.

- Set terminal dimension.

Yeah, Pavel added support for that (but I forgot to set them here because the 
test I used as a template didn't had the dimensions set).


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

https://reviews.llvm.org/D67018

Files:
  lldb/packages/Python/lldbsuite/test/functionalities/gui_command/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/gui_command/TestGuiBasic.py
  lldb/packages/Python/lldbsuite/test/functionalities/gui_command/main.c


Index: lldb/packages/Python/lldbsuite/test/functionalities/gui_command/main.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/gui_command/main.c
@@ -0,0 +1,5 @@
+int main(int argc, char **argv) {
+  lldb_enable_attach();
+  int funky_var_name_that_should_be_rendered = 22;
+  return 0;
+}
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/gui_command/TestGuiBasic.py
===
--- /dev/null
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/gui_command/TestGuiBasic.py
@@ -0,0 +1,59 @@
+"""
+Test that the 'gui' displays the help window and basic UI.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class BasicGuiCommandTest(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_gui(self):
+self.build()
+
+self.launch(executable=self.getBuildArtifact("a.out"),
+dimensions=(100,500))
+self.expect("b main.c:4", substrs=["Breakpoint 1", "address ="])
+self.expect("run", substrs=["stop reason ="])
+
+
+escape_key = chr(27).encode()
+
+# Start the GUI for the first time and check for the welcome window.
+self.child.sendline("gui")
+self.child.expect_exact("Welcome to the LLDB curses GUI.")
+
+# Press escape to quit the welcome screen
+self.child.send(escape_key)
+# Press escape again to quit the gui
+self.child.send(escape_key)
+self.expect_prompt()
+
+# Start the GUI a second time, this time we should have the normal GUI.
+self.child.sendline("gui")
+# Check for GUI elements in the menu bar.
+self.child.expect_exact("Target")
+self.child.expect_exact("Process")
+self.child.expect_exact("Thread")
+self.child.expect_exact("View")
+self.child.expect_exact("Help")
+
+# Check the sources window.
+self.child.expect_exact("Sources")
+self.child.expect_exact("main")
+self.child.expect_exact("funky_var_name_that_should_be_rendered")
+
+# Check the variable window.
+self.child.expect_exact("Variables")
+self.child.expect_exact("(int) funky_var_name_that_should_be_rendered 
= 22")
+
+# Check the bar at the bottom.
+self.child.expect_exact("Frame:")
+
+# Press escape to quit the gui
+self.child.send(escape_key)
+
+self.quit()
Index: lldb/packages/Python/lldbsuite/test/functionalities/gui_command/Makefile
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/gui_command/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules


Index: lldb/packages/Python/lldbsuite/test/functionalities/gui_command/main.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/gui_command/main.c
@@ -0,0 +1,5 @@
+int main(int argc, char **argv) {
+  lldb_enable_attach();
+  int funky_var_name_that_should_be_rendered = 22;
+  return 0;
+}
Index: lldb/packages/Python/lldbsuite/test/functionalities/gui_command/TestGuiBasic.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/gui_command/TestGuiBasic.py
@@ -0,0 +1,59 @@
+"""
+Test that the 'gui' displays the help window and basic UI.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class BasicGuiCommandTest(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_gui(self):
+self.build()
+
+self.launch(executable=self.getBuildArtifact("a.out"),
+dimensions=(100,500))
+self.expect("b main.c:4", substrs=["Breakpoint 1", "address ="])
+self.expect("run", substrs=["stop reason ="])
+
+
+escape_key = chr(27).encode()
+
+# Start the GUI for the first time and check for the welcome window.
+self.child.sendline("gui")
+self.child.expect_exact("Welcome to the LLDB curses GUI.")

[Lldb-commits] [lldb] r370526 - [test] Make sure PROMPT is a string

2019-08-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Aug 30 13:46:55 2019
New Revision: 370526

URL: http://llvm.org/viewvc/llvm-project?rev=370526&view=rev
Log:
[test] Make sure PROMPT is a string

Currently tests using expect_prompt are failing on the Python 3 bot with
an error saying "argument must be str, not bytes". I don't have a Python
3 build handy, but I suspect this might fix that.

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py?rev=370526&r1=370525&r2=370526&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py Fri Aug 30 
13:46:55 2019
@@ -22,7 +22,7 @@ else:
 class PExpectTest(TestBase):
 
 NO_DEBUG_INFO_TESTCASE = True
-PROMPT = "(lldb) "
+PROMPT = str("(lldb) ")
 
 def expect_prompt(self):
 self.child.expect_exact(self.PROMPT)


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


[Lldb-commits] [PATCH] D67022: Skip getting declarations for repeated DIEs (WIP)

2019-08-30 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade created this revision.
guiandrade added reviewers: clayborg, labath.
guiandrade added a project: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere, aprantl.
guiandrade added a comment.

Hey guys,

This change is more for me to get to know what you guys think. I've noticed 
that GetDeclForUIDFromDWARF() calls inside 
SymbolFileDWARF::ParseDeclsForContext 
(https://github.com/llvm/llvm-project/blob/ef82098a800178a1f973abb8af86eaa690a29734/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L1216)
 often end up having no side effect besides generating a llvm::DenseMap::find 
invocation 
(https://github.com/llvm/llvm-project/blob/f07b4aff06d83c6ad25d95f456fbc12b2d2a0a0c/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L3322),
 especially when we evaluate multiple expressions inside the same scope. So I 
was wondering if there's a way to improve that. Do you guys think we could do 
something like what this change proposes, or am I missing something important? 
Thanks!


This change creates a map that keeps track of the number of DIEs for each 
CompilerDeclContext so we can skip the ones we have already seen
inside SymbolFileDWARF::ParseDeclsForContext.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67022

Files:
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -489,6 +489,10 @@
   llvm::DenseMap
   m_type_unit_support_files;
   std::vector m_lldb_cu_to_dwarf_unit;
+
+  typedef std::pair DeclContextToOffsetKey;
+  typedef std::map DeclContextToOffsetMap;
+  DeclContextToOffsetMap m_decl_context_to_offset_map;
 };
 
 #endif // SymbolFileDWARF_SymbolFileDWARF_h_
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1209,11 +1209,17 @@
   DWARFASTParser *ast_parser = type_system->GetDWARFParser();
   std::vector decl_ctx_die_list =
   ast_parser->GetDIEForDeclContext(decl_ctx);
+  DeclContextToOffsetKey offset_key =
+  std::make_pair(decl_ctx.GetOpaqueDeclContext(), type_system);
+  uint32_t &offset = m_decl_context_to_offset_map[offset_key];
 
-  for (DWARFDIE decl_ctx_die : decl_ctx_die_list)
-for (DWARFDIE decl = decl_ctx_die.GetFirstChild(); decl;
+  for (auto decl_ctx_die_it = decl_ctx_die_list.begin() + offset;
+   decl_ctx_die_it != decl_ctx_die_list.end(); ++decl_ctx_die_it)
+for (DWARFDIE decl = decl_ctx_die_it->GetFirstChild(); decl;
  decl = decl.GetSibling())
   ast_parser->GetDeclForUIDFromDWARF(decl);
+
+  offset = decl_ctx_die_list.size();
 }
 
 user_id_t SymbolFileDWARF::GetUID(DIERef ref) {


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -489,6 +489,10 @@
   llvm::DenseMap
   m_type_unit_support_files;
   std::vector m_lldb_cu_to_dwarf_unit;
+
+  typedef std::pair DeclContextToOffsetKey;
+  typedef std::map DeclContextToOffsetMap;
+  DeclContextToOffsetMap m_decl_context_to_offset_map;
 };
 
 #endif // SymbolFileDWARF_SymbolFileDWARF_h_
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1209,11 +1209,17 @@
   DWARFASTParser *ast_parser = type_system->GetDWARFParser();
   std::vector decl_ctx_die_list =
   ast_parser->GetDIEForDeclContext(decl_ctx);
+  DeclContextToOffsetKey offset_key =
+  std::make_pair(decl_ctx.GetOpaqueDeclContext(), type_system);
+  uint32_t &offset = m_decl_context_to_offset_map[offset_key];
 
-  for (DWARFDIE decl_ctx_die : decl_ctx_die_list)
-for (DWARFDIE decl = decl_ctx_die.GetFirstChild(); decl;
+  for (auto decl_ctx_die_it = decl_ctx_die_list.begin() + offset;
+   decl_ctx_die_it != decl_ctx_die_list.end(); ++decl_ctx_die_it)
+for (DWARFDIE decl = decl_ctx_die_it->GetFirstChild(); decl;
  decl = decl.GetSibling())
   ast_parser->GetDeclForUIDFromDWARF(decl);
+
+  offset = decl_ctx_die_list.size();
 }
 
 user_id_t SymbolFileDWARF::GetUID(DIERef ref) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67022: Skip getting declarations for repeated DIEs (WIP)

2019-08-30 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade added a comment.

Hey guys,

This change is more for me to get to know what you guys think. I've noticed 
that GetDeclForUIDFromDWARF() calls inside 
SymbolFileDWARF::ParseDeclsForContext 
(https://github.com/llvm/llvm-project/blob/ef82098a800178a1f973abb8af86eaa690a29734/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L1216)
 often end up having no side effect besides generating a llvm::DenseMap::find 
invocation 
(https://github.com/llvm/llvm-project/blob/f07b4aff06d83c6ad25d95f456fbc12b2d2a0a0c/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L3322),
 especially when we evaluate multiple expressions inside the same scope. So I 
was wondering if there's a way to improve that. Do you guys think we could do 
something like what this change proposes, or am I missing something important? 
Thanks!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67022



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


[Lldb-commits] [PATCH] D66994: [lldb][CMake] Fix windows-x86-debug compilation with python enabled using multi-target generator

2019-08-30 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth requested changes to this revision.
amccarth added inline comments.
This revision now requires changes to proceed.



Comment at: cmake/modules/LLDBConfig.cmake:164
   # if(CMAKE_MSVC_RUNTIME_LIBRARY MATCHES MultiThreadedDebug)
-  if(CMAKE_BUILD_TYPE STREQUAL Debug)
-file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_EXE)
-file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}_d.lib" 
PYTHON_LIB)
-file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}_d.dll" 
PYTHON_DLL)
-  else()
-file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_EXE)
-file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}.lib" 
PYTHON_LIB)
-file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}.dll" PYTHON_DLL)
-  endif()
-
-  foreach(component PYTHON_EXE;PYTHON_LIB;PYTHON_DLL)
-if(NOT EXISTS ${${component}})
-  message(WARNING "unable to find ${component}")
-  unset(${component})
+  if (NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL Debug)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe"   
PYTHON_DEBUG_EXE)

This first changed line seems useful.

The rest seems of dubious benefit, even if the duplication can be reduced.  Are 
folks really using the VS project to build both Debug and Release?  I'd be 
surprised, since the debug version won't pass half of the tests.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66994



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


[Lldb-commits] [PATCH] D67012: [lit] Only set DYLD_LIBRARY_PATH for shared builds

2019-08-30 Thread Frederic Riss via Phabricator via lldb-commits
friss accepted this revision.
friss added a comment.
This revision is now accepted and ready to land.

This looks good to me with one small provision:




Comment at: lldb/lit/CMakeLists.txt:72
   LLVM_ENABLE_ZLIB
+  LLVM_SHARED_LIBS
   LLDB_IS_64_BITS)

The other booleans have names that match boolean values (_DISABLE_, _ENABLE_, 
_IS_). Should we rename this to something like LLVM_IS_SHARED_BUILD? I'm 
terrible at names.


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

https://reviews.llvm.org/D67012



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


[Lldb-commits] [lldb] r370545 - [test] Fix 'argument must be str, not bytes' for Python 3.

2019-08-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Aug 30 15:53:38 2019
New Revision: 370545

URL: http://llvm.org/viewvc/llvm-project?rev=370545&view=rev
Log:
[test] Fix 'argument must be str, not bytes' for Python 3.

Use `sys.stdout.buffer` instead of `sys.stdout` in lldbpexpect.py.

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py?rev=370545&r1=370544&r2=370545&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py Fri Aug 30 
15:53:38 2019
@@ -22,13 +22,13 @@ else:
 class PExpectTest(TestBase):
 
 NO_DEBUG_INFO_TESTCASE = True
-PROMPT = str("(lldb) ")
+PROMPT = "(lldb) "
 
 def expect_prompt(self):
 self.child.expect_exact(self.PROMPT)
 
 def launch(self, executable=None, timeout=30, dimensions=None):
-logfile = sys.stdout if self.TraceOn() else None
+logfile = sys.stdout.buffer if self.TraceOn() else None
 args = ['--no-lldbinit', '--no-use-colors']
 for cmd in self.setUpCommands():
 args += ['-O', cmd]


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


[Lldb-commits] [lldb] r370549 - [lit] Only set DYLD_LIBRARY_PATH for shared builds

2019-08-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Aug 30 16:16:02 2019
New Revision: 370549

URL: http://llvm.org/viewvc/llvm-project?rev=370549&view=rev
Log:
[lit] Only set DYLD_LIBRARY_PATH for shared builds

In r370135 I committed a temporary workaround for the sanitized bot to
not set (DY)LD_LIBRARY_PATH when (DY)LD_INSERT_LIBRARIES was set.
Setting (DY)LD_LIBRARY_PATH is only necessary for (standalone)
shared-library builds, so a better solution is to only set the
environment variable when necessary.

Differential revision: https://reviews.llvm.org/D67012

Modified:
lldb/trunk/lit/CMakeLists.txt
lldb/trunk/lit/Suite/lit.cfg
lldb/trunk/lit/Suite/lit.site.cfg.in

Modified: lldb/trunk/lit/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=370549&r1=370548&r2=370549&view=diff
==
--- lldb/trunk/lit/CMakeLists.txt (original)
+++ lldb/trunk/lit/CMakeLists.txt Fri Aug 30 16:16:02 2019
@@ -69,6 +69,7 @@ endif()
 llvm_canonicalize_cmake_booleans(
   LLDB_DISABLE_PYTHON
   LLVM_ENABLE_ZLIB
+  LLVM_ENABLE_SHARED_LIBS
   LLDB_IS_64_BITS)
 
 configure_lit_site_cfg(

Modified: lldb/trunk/lit/Suite/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.cfg?rev=370549&r1=370548&r2=370549&view=diff
==
--- lldb/trunk/lit/Suite/lit.cfg (original)
+++ lldb/trunk/lit/Suite/lit.cfg Fri Aug 30 16:16:02 2019
@@ -39,21 +39,18 @@ def find_shlibpath_var():
   elif platform.system() == 'Windows':
 yield 'PATH'
 
-if not 'DYLD_INSERT_LIBRARIES' in config.environment:
-  # Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
-  # This clashes with DYLD_INSERT_LIBRARIES which is needed on Darwin.
+# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
+if config.shared_libs:
   for shlibpath_var in find_shlibpath_var():
 # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory while
 # llvm_libs_dir specifies LLVM's lib directory.
 shlibpath = os.path.pathsep.join(
-  (config.llvm_shlib_dir,
-  config.llvm_libs_dir,
-  config.environment.get(shlibpath_var, '')))
+(config.llvm_shlib_dir, config.llvm_libs_dir,
+ config.environment.get(shlibpath_var, '')))
 config.environment[shlibpath_var] = shlibpath
-break
   else:
-lit_config.warning("unable to inject shared library path on '{}'"
-  .format(platform.system()))
+lit_config.warning("unable to inject shared library path on '{}'".format(
+platform.system()))
 
 # Build dotest command.
 dotest_cmd = [config.dotest_path]

Modified: lldb/trunk/lit/Suite/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.site.cfg.in?rev=370549&r1=370548&r2=370549&view=diff
==
--- lldb/trunk/lit/Suite/lit.site.cfg.in (original)
+++ lldb/trunk/lit/Suite/lit.site.cfg.in Fri Aug 30 16:16:02 2019
@@ -13,6 +13,7 @@ config.lldb_src_root = "@LLDB_SOURCE_DIR
 config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
 config.host_os = "@HOST_OS@"
 config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.shared_libs = @LLVM_ENABLE_SHARED_LIBS@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"


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


[Lldb-commits] [PATCH] D67012: [lit] Only set DYLD_LIBRARY_PATH for shared builds

2019-08-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370549: [lit] Only set DYLD_LIBRARY_PATH for shared builds 
(authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D67012?vs=218133&id=218186#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67012

Files:
  lldb/trunk/lit/CMakeLists.txt
  lldb/trunk/lit/Suite/lit.cfg
  lldb/trunk/lit/Suite/lit.site.cfg.in
  llvm/trunk/cmake/modules/LLVMConfig.cmake.in


Index: llvm/trunk/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/trunk/cmake/modules/LLVMConfig.cmake.in
+++ llvm/trunk/cmake/modules/LLVMConfig.cmake.in
@@ -84,6 +84,7 @@
 set(LLVM_TOOLS_INSTALL_DIR "@LLVM_TOOLS_INSTALL_DIR@")
 set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@)
 set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
+set(LLVM_ENABLE_SHARED_LIBS @BUILD_SHARED_LIBS@)
 
 if(NOT TARGET LLVMSupport)
   set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@")
Index: lldb/trunk/lit/CMakeLists.txt
===
--- lldb/trunk/lit/CMakeLists.txt
+++ lldb/trunk/lit/CMakeLists.txt
@@ -69,6 +69,7 @@
 llvm_canonicalize_cmake_booleans(
   LLDB_DISABLE_PYTHON
   LLVM_ENABLE_ZLIB
+  LLVM_ENABLE_SHARED_LIBS
   LLDB_IS_64_BITS)
 
 configure_lit_site_cfg(
Index: lldb/trunk/lit/Suite/lit.cfg
===
--- lldb/trunk/lit/Suite/lit.cfg
+++ lldb/trunk/lit/Suite/lit.cfg
@@ -39,21 +39,18 @@
   elif platform.system() == 'Windows':
 yield 'PATH'
 
-if not 'DYLD_INSERT_LIBRARIES' in config.environment:
-  # Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
-  # This clashes with DYLD_INSERT_LIBRARIES which is needed on Darwin.
+# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
+if config.shared_libs:
   for shlibpath_var in find_shlibpath_var():
 # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory while
 # llvm_libs_dir specifies LLVM's lib directory.
 shlibpath = os.path.pathsep.join(
-  (config.llvm_shlib_dir,
-  config.llvm_libs_dir,
-  config.environment.get(shlibpath_var, '')))
+(config.llvm_shlib_dir, config.llvm_libs_dir,
+ config.environment.get(shlibpath_var, '')))
 config.environment[shlibpath_var] = shlibpath
-break
   else:
-lit_config.warning("unable to inject shared library path on '{}'"
-  .format(platform.system()))
+lit_config.warning("unable to inject shared library path on '{}'".format(
+platform.system()))
 
 # Build dotest command.
 dotest_cmd = [config.dotest_path]
Index: lldb/trunk/lit/Suite/lit.site.cfg.in
===
--- lldb/trunk/lit/Suite/lit.site.cfg.in
+++ lldb/trunk/lit/Suite/lit.site.cfg.in
@@ -13,6 +13,7 @@
 config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
 config.host_os = "@HOST_OS@"
 config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.shared_libs = @LLVM_ENABLE_SHARED_LIBS@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"


Index: llvm/trunk/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/trunk/cmake/modules/LLVMConfig.cmake.in
+++ llvm/trunk/cmake/modules/LLVMConfig.cmake.in
@@ -84,6 +84,7 @@
 set(LLVM_TOOLS_INSTALL_DIR "@LLVM_TOOLS_INSTALL_DIR@")
 set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@)
 set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
+set(LLVM_ENABLE_SHARED_LIBS @BUILD_SHARED_LIBS@)
 
 if(NOT TARGET LLVMSupport)
   set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@")
Index: lldb/trunk/lit/CMakeLists.txt
===
--- lldb/trunk/lit/CMakeLists.txt
+++ lldb/trunk/lit/CMakeLists.txt
@@ -69,6 +69,7 @@
 llvm_canonicalize_cmake_booleans(
   LLDB_DISABLE_PYTHON
   LLVM_ENABLE_ZLIB
+  LLVM_ENABLE_SHARED_LIBS
   LLDB_IS_64_BITS)
 
 configure_lit_site_cfg(
Index: lldb/trunk/lit/Suite/lit.cfg
===
--- lldb/trunk/lit/Suite/lit.cfg
+++ lldb/trunk/lit/Suite/lit.cfg
@@ -39,21 +39,18 @@
   elif platform.system() == 'Windows':
 yield 'PATH'
 
-if not 'DYLD_INSERT_LIBRARIES' in config.environment:
-  # Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
-  # This clashes with DYLD_INSERT_LIBRARIES which is needed on Darwin.
+# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
+if config.shared_libs:
   for shlibpath_var in find_shlibpath_var():
 # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory while
 # llvm_libs_dir specifies LLVM's lib directory.
 shlibpath = os.pa

[Lldb-commits] [lldb] r370552 - [test] Make sys.stdout compatible with both Python 2 & 3

2019-08-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Aug 30 16:54:13 2019
New Revision: 370552

URL: http://llvm.org/viewvc/llvm-project?rev=370552&view=rev
Log:
[test] Make sys.stdout compatible with both Python 2 & 3

This time's the charm.

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py?rev=370552&r1=370551&r2=370552&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py Fri Aug 30 
16:54:13 2019
@@ -28,7 +28,8 @@ else:
 self.child.expect_exact(self.PROMPT)
 
 def launch(self, executable=None, timeout=30, dimensions=None):
-logfile = sys.stdout.buffer if self.TraceOn() else None
+logfile = getattr(sys.stdout, 'buffer',
+  sys.stdout) if self.TraceOn() else None
 args = ['--no-lldbinit', '--no-use-colors']
 for cmd in self.setUpCommands():
 args += ['-O', cmd]


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


[Lldb-commits] [PATCH] D67033: [lldb] Restructure test folders to match LLDB command hierarchy

2019-08-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: LLDB.
Herald added a reviewer: jfb.
Herald added subscribers: lldb-commits, JDevlieghere, arphaman.
Herald added a project: LLDB.

As discussed on lldb-dev, this patch moves some LLDB tests into a hierarchy 
that more closely
resembles the commands we use in the LLDB interpreter. This patch should only 
move tests
that use the command interpreter and shouldn't touch any tests that primarily 
test the SB API.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67033

Files:
  lldb/packages/Python/lldbsuite/test/commands/add-dsym/uuid/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/add-dsym/uuid/TestAddDsymCommand.py
  lldb/packages/Python/lldbsuite/test/commands/add-dsym/uuid/main.cpp.template
  lldb/packages/Python/lldbsuite/test/commands/apropos/basic/TestApropos.py
  lldb/packages/Python/lldbsuite/test/commands/apropos/with-process/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/apropos/with-process/TestAproposWithProcess.py
  lldb/packages/Python/lldbsuite/test/commands/apropos/with-process/main.cpp
  lldb/packages/Python/lldbsuite/test/commands/breakpoint/basic/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/breakpoint/basic/TestBreakpointCommand.py
  
lldb/packages/Python/lldbsuite/test/commands/breakpoint/basic/TestBreakpointCommandsFromPython.py
  
lldb/packages/Python/lldbsuite/test/commands/breakpoint/basic/TestRegexpBreakCommand.py
  lldb/packages/Python/lldbsuite/test/commands/breakpoint/basic/a.c
  lldb/packages/Python/lldbsuite/test/commands/breakpoint/basic/b.c
  lldb/packages/Python/lldbsuite/test/commands/breakpoint/basic/bktptcmd.py
  lldb/packages/Python/lldbsuite/test/commands/breakpoint/basic/main.c
  lldb/packages/Python/lldbsuite/test/commands/breakpoint/basic/side_effect.py
  lldb/packages/Python/lldbsuite/test/commands/command/history/.categories
  
lldb/packages/Python/lldbsuite/test/commands/command/history/TestCommandHistory.py
  lldb/packages/Python/lldbsuite/test/commands/command/nested_alias/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/command/nested_alias/TestNestedAlias.py
  lldb/packages/Python/lldbsuite/test/commands/command/nested_alias/main.cpp
  lldb/packages/Python/lldbsuite/test/commands/command/script/.categories
  lldb/packages/Python/lldbsuite/test/commands/command/script/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py
  lldb/packages/Python/lldbsuite/test/commands/command/script/bug11569.py
  lldb/packages/Python/lldbsuite/test/commands/command/script/decorated.py
  lldb/packages/Python/lldbsuite/test/commands/command/script/import/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/TestImport.py
  lldb/packages/Python/lldbsuite/test/commands/command/script/import/bar/bar.py
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/bar/barutil.py
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/dummymodule.py
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/bar/foobar.py
  lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/foo.py
  lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/foo2.py
  lldb/packages/Python/lldbsuite/test/commands/command/script/import/main.c
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/TestRdar12586188.py
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/fail12586188.py
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/fail212586188.py
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/TPunitA.py
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/TPunitB.py
  
lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/__init__.py
  lldb/packages/Python/lldbsuite/test/commands/command/script/main.cpp
  lldb/packages/Python/lldbsuite/test/commands/command/script/mysto.py
  lldb/packages/Python/lldbsuite/test/commands/command/script/py_import
  lldb/packages/Python/lldbsuite/test/commands/command/script/welcome.py
  lldb/packages/Python/lldbsuite/test/commands/command/script_alias/.categories
  
lldb/packages/Python/lldbsuite/test/commands/command/script_alias/TestCommandScriptAlias.py
  lldb/packages/Python/lldbsuite/test/commands/command/script_alias/tcsacmd.py
  lldb/packages/Python/lldbsuite/test/commands/command/source/.categories
  lldb/packages/Python/lldbsuite/test/commands/command/source/.lldb
  
lldb/packages/Python/lldbsuite/test/commands/command/source/TestCommandSource.py
  lldb/packages/Python/lldbsuite/test/commands/command/source/commands.txt
  lldb/packages/Python/lldbsuite/test/commands/command/source/my.py
  lldb/packages/Python/lldbsuite/test/commands/disassemble/basic/Makefile
  
lld