[Lldb-commits] [PATCH] D49888: Stop building liblldb with CMake's framework functionality

2018-07-27 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Can't say I fully understand what's going on, but the changes seem reasonable 
to me.

If there is some public cmake bug describing the issue you ran into, it would 
be nice, for the sake of future archaeologists, to reference it somewhere 
(commit message and LLDBFramework.cmake?).


https://reviews.llvm.org/D49888



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


[Lldb-commits] [PATCH] D49909: Unit test for Symtab::InitNameIndexes

2018-07-27 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: labath, jingham, JDevlieghere.

In order to exploit the potential of LLVM's new ItaniumPartialDemangler for 
indexing in LLDB, we expect conceptual changes in the implementation of the 
InitNameIndexes function. Here is a unit test that aims at covering all 
relevant code paths in that function.


https://reviews.llvm.org/D49909

Files:
  unittests/Core/CMakeLists.txt
  unittests/Core/Inputs/mangled-function-names.yaml
  unittests/Core/MangledTest.cpp

Index: unittests/Core/MangledTest.cpp
===
--- unittests/Core/MangledTest.cpp
+++ unittests/Core/MangledTest.cpp
@@ -7,9 +7,21 @@
 //
 //===--===//
 
-#include "gtest/gtest.h"
+#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
+#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
+#include "TestingSupport/TestUtilities.h"
 
 #include "lldb/Core/Mangled.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/SymbolContext.h"
+
+#include "llvm/Support/FileUtilities.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Program.h"
+
+#include "gtest/gtest.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -36,3 +48,123 @@
 
   EXPECT_STREQ("", TheDemangled.GetCString());
 }
+
+#define ASSERT_NO_ERROR(x) \
+  if (std::error_code ASSERT_NO_ERROR_ec = x) {\
+llvm::SmallString<128> MessageStorage; \
+llvm::raw_svector_ostream Message(MessageStorage); \
+Message << #x ": did not return errc::success.\n"  \
+<< "error number: " << ASSERT_NO_ERROR_ec.value() << "\n"  \
+<< "error message: " << ASSERT_NO_ERROR_ec.message() << "\n";  \
+GTEST_FATAL_FAILURE_(MessageStorage.c_str());  \
+  } else { \
+  }
+
+TEST(MangledTest, NameIndexes_FindFunctionSymbols) {
+  HostInfo::Initialize();
+  ObjectFileELF::Initialize();
+  SymbolVendorELF::Initialize();
+
+  std::string Yaml = GetInputFilePath("mangled-function-names.yaml");
+  llvm::SmallString<128> Obj;
+  ASSERT_NO_ERROR(llvm::sys::fs::createTemporaryFile(
+  "mangled-function-names-%%", "obj", Obj));
+
+  llvm::FileRemover Deleter(Obj);
+  llvm::StringRef Args[] = {YAML2OBJ, Yaml};
+  llvm::StringRef ObjRef = Obj;
+  const llvm::Optional redirects[] = {llvm::None, ObjRef,
+   llvm::None};
+  ASSERT_EQ(0,
+llvm::sys::ExecuteAndWait(YAML2OBJ, Args, llvm::None, redirects));
+  uint64_t Size;
+  ASSERT_NO_ERROR(llvm::sys::fs::file_size(Obj, Size));
+  ASSERT_GT(Size, 0u);
+
+  ModuleSpec Spec{FileSpec(Obj, false)};
+  Spec.GetSymbolFileSpec().SetFile(Obj, false, FileSpec::Style::native);
+  auto M = std::make_shared(Spec);
+
+  auto Count = [M](const char *Name, FunctionNameType Type) -> int {
+SymbolContextList SymList;
+return M->FindFunctionSymbols(ConstString(Name), Type, SymList);
+  };
+
+  // Unmangled
+  EXPECT_EQ(1, Count("main", eFunctionNameTypeFull));
+  EXPECT_EQ(1, Count("main", eFunctionNameTypeBase));
+  EXPECT_EQ(0, Count("main", eFunctionNameTypeMethod));
+
+  // Itanium mangled
+  EXPECT_EQ(1, Count("_Z3foov", eFunctionNameTypeFull));
+  EXPECT_EQ(1, Count("_Z3foov", eFunctionNameTypeBase));
+  EXPECT_EQ(1, Count("foo", eFunctionNameTypeBase));
+  EXPECT_EQ(0, Count("foo", eFunctionNameTypeMethod));
+
+  // Unmangled with linker annotation
+  EXPECT_EQ(1, Count("puts@GLIBC_2.5", eFunctionNameTypeFull));
+  EXPECT_EQ(1, Count("puts@GLIBC_2.6", eFunctionNameTypeFull));
+  EXPECT_EQ(2, Count("puts", eFunctionNameTypeFull));
+  EXPECT_EQ(2, Count("puts", eFunctionNameTypeBase));
+  EXPECT_EQ(0, Count("puts", eFunctionNameTypeMethod));
+
+  // Itanium mangled with linker annotation
+  EXPECT_EQ(1, Count("_Z5annotv@VERSION3", eFunctionNameTypeFull));
+  EXPECT_EQ(1, Count("_Z5annotv", eFunctionNameTypeFull));
+  EXPECT_EQ(1, Count("_Z5annotv", eFunctionNameTypeBase));
+  EXPECT_EQ(0, Count("annot", eFunctionNameTypeBase));
+  EXPECT_EQ(0, Count("annot", eFunctionNameTypeMethod));
+
+  // Itanium mangled ctor A::A()
+  EXPECT_EQ(1, Count("_ZN1AC2Ev", eFunctionNameTypeFull));
+  EXPECT_EQ(1, Count("_ZN1AC2Ev", eFunctionNameTypeBase));
+  EXPECT_EQ(1, Count("A", eFunctionNameTypeMethod));
+  EXPECT_EQ(0, Count("A", eFunctionNameTypeBase));
+
+  // Itanium mangled dtor A::~A()
+  EXPECT_EQ(1, Count("_ZN1AD2Ev", eFunctionNameTypeFull));
+  EXPECT_EQ(1, Count("_ZN1AD2Ev", eFunctionNameTypeBase));
+  EXPECT_EQ(1, Count("~A", eFunctionNameTypeMethod));
+  EXPECT_EQ(0, Count("~A", eFunctionNameTypeBase));
+
+  // Itanium mangled method A::bar()
+  EXPECT_EQ(1, 

[Lldb-commits] [PATCH] D49685: LLDB does not respect platform sysroot when loading core on Linux

2018-07-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D49685#1177046, @EugeneBi wrote:

> It is specific to shared libraries. Opening the executable and core dump 
> follows different code path.


Which path is that? Is the path different even when you don't specify an 
executable when opening the core file (`target create --core /my/file.core`). I 
believe that in this case we should end up here 
https://github.com/llvm-mirror/lldb/blob/7c07b8a9314eef118f95b57b49fa099be0808eac/source/Plugins/Process/elf-core/ProcessElfCore.cpp#L255,
 which should eventually call `Platform::GetSharedModule`. Is that not the case?


https://reviews.llvm.org/D49685



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


[Lldb-commits] [PATCH] D49909: Unit test for Symtab::InitNameIndexes

2018-07-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I am wondering whether a test like this wouldn't be better of as a lit test 
instead of a unit test.

Right now, if you do a `lldb-test symbols foo.o` (and foo.o contains debug 
info), we will dump out a very similar index which is built from the 
information in the debug_info sections:

  Manual DWARF index for (x86_64) 'foo.o':
  Function basenames:
  0x62a4e88: {0x/0x005c} "__cxx_global_var_init"
  
  Function fullnames:
  0x6188e10: {0x/0x012a} "_ZN1AC2Ez"
  0x62a4e88: {0x/0x005c} "__cxx_global_var_init"
  ...

I think it makes sense to extend this dump to include the index information 
from the Symtab class too. Then it should be possible to write this test the 
traditional LLVM way as `yaml2obj | lldb-test | FileCheck`.

What do you think?


https://reviews.llvm.org/D49909



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


[Lldb-commits] [PATCH] D49909: Unit test for Symtab::InitNameIndexes

2018-07-27 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

Sounds very reasonable. I think unit tests are great for development, because 
turnaround times are fast and debugging easy. But I am happy to have a look on 
how to turn this into a lit test once that's done. Thanks for the remark.


https://reviews.llvm.org/D49909



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


[Lldb-commits] [PATCH] D49334: [LLDB} Added syntax highlighting support

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 157702.
teemperor added a comment.

- Removed extra semicolons that slipped in somehow.


https://reviews.llvm.org/D49334

Files:
  include/lldb/Core/Debugger.h
  include/lldb/Core/Highlighter.h
  include/lldb/Target/Language.h
  packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
  source/Core/CMakeLists.txt
  source/Core/Debugger.cpp
  source/Core/Highlighter.cpp
  source/Core/SourceManager.cpp
  source/Plugins/Language/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  source/Plugins/Language/ClangCommon/CMakeLists.txt
  source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
  source/Plugins/Language/ClangCommon/ClangHighlighter.h
  source/Plugins/Language/Go/GoLanguage.cpp
  source/Plugins/Language/Go/GoLanguage.h
  source/Plugins/Language/Java/JavaLanguage.cpp
  source/Plugins/Language/Java/JavaLanguage.h
  source/Plugins/Language/OCaml/OCamlLanguage.cpp
  source/Plugins/Language/OCaml/OCamlLanguage.h
  source/Plugins/Language/ObjC/CMakeLists.txt
  source/Plugins/Language/ObjC/ObjCLanguage.cpp
  source/Plugins/Language/ObjC/ObjCLanguage.h
  source/Plugins/Language/ObjCPlusPlus/CMakeLists.txt
  source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp
  source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
  source/Target/Language.cpp
  unittests/Language/CMakeLists.txt
  unittests/Language/Highlighting/CMakeLists.txt
  unittests/Language/Highlighting/HighlighterTest.cpp

Index: unittests/Language/Highlighting/HighlighterTest.cpp
===
--- /dev/null
+++ unittests/Language/Highlighting/HighlighterTest.cpp
@@ -0,0 +1,221 @@
+//===-- HighlighterTest.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "lldb/Core/Highlighter.h"
+
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+#include "Plugins/Language/Go/GoLanguage.h"
+#include "Plugins/Language/Java/JavaLanguage.h"
+#include "Plugins/Language/OCaml/OCamlLanguage.h"
+#include "Plugins/Language/ObjC/ObjCLanguage.h"
+#include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
+
+using namespace lldb_private;
+
+namespace {
+class HighlighterTest : public testing::Test {
+public:
+  static void SetUpTestCase();
+  static void TearDownTestCase();
+};
+} // namespace
+
+void HighlighterTest::SetUpTestCase() {
+  // The HighlighterManager uses the language plugins under the hood, so we
+  // have to initialize them here for our test process.
+  CPlusPlusLanguage::Initialize();
+  GoLanguage::Initialize();
+  JavaLanguage::Initialize();
+  ObjCLanguage::Initialize();
+  ObjCPlusPlusLanguage::Initialize();
+  OCamlLanguage::Initialize();
+}
+
+void HighlighterTest::TearDownTestCase() {
+  CPlusPlusLanguage::Terminate();
+  GoLanguage::Terminate();
+  JavaLanguage::Terminate();
+  ObjCLanguage::Terminate();
+  ObjCPlusPlusLanguage::Terminate();
+  OCamlLanguage::Terminate();
+}
+
+static std::string getName(lldb::LanguageType type) {
+  HighlighterManager m;
+  return m.getHighlighterFor(type, "").GetName().str();
+}
+
+static std::string getName(llvm::StringRef path) {
+  HighlighterManager m;
+  return m.getHighlighterFor(lldb::eLanguageTypeUnknown, path).GetName().str();
+}
+
+TEST_F(HighlighterTest, HighlighterSelectionType) {
+  EXPECT_EQ(getName(lldb::eLanguageTypeC_plus_plus), "clang");
+  EXPECT_EQ(getName(lldb::eLanguageTypeC_plus_plus_03), "clang");
+  EXPECT_EQ(getName(lldb::eLanguageTypeC_plus_plus_11), "clang");
+  EXPECT_EQ(getName(lldb::eLanguageTypeC_plus_plus_14), "clang");
+  EXPECT_EQ(getName(lldb::eLanguageTypeObjC), "clang");
+  EXPECT_EQ(getName(lldb::eLanguageTypeObjC_plus_plus), "clang");
+
+  EXPECT_EQ(getName(lldb::eLanguageTypeUnknown), "none");
+  EXPECT_EQ(getName(lldb::eLanguageTypeJulia), "none");
+  EXPECT_EQ(getName(lldb::eLanguageTypeJava), "none");
+  EXPECT_EQ(getName(lldb::eLanguageTypeHaskell), "none");
+}
+
+TEST_F(HighlighterTest, HighlighterSelectionPath) {
+  EXPECT_EQ(getName("myfile.cc"), "clang");
+  EXPECT_EQ(getName("moo.cpp"), "clang");
+  EXPECT_EQ(getName("mar.cxx"), "clang");
+  EXPECT_EQ(getName("foo.C"), "clang");
+  EXPECT_EQ(getName("bar.CC"), "clang");
+  EXPECT_EQ(getName("a/dir.CC"), "clang");
+  EXPECT_EQ(getName("/a/dir.hpp"), "clang");
+  EXPECT_EQ(getName("header.h"), "clang");
+
+  EXPECT_EQ(getName(""), "none");
+  EXPECT_EQ(getName("/dev/null"), "none");
+  EXPECT_EQ(getName("Factory.java"), "none");
+  EXPECT_EQ(getName("poll.py"), "none");
+  EXPECT_EQ(getName("reducer.hs"), "none");
+}
+
+TEST_F(HighlighterTest, Fallback

[Lldb-commits] [PATCH] D49334: [LLDB} Added syntax highlighting support

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor marked an inline comment as done.
teemperor added inline comments.



Comment at: source/Core/Highlighter.cpp:34
+  // Calculate how many bytes we have written.
+  return m_prefix.size() + value.size() + m_suffix.size();
+}

labath wrote:
> teemperor wrote:
> > labath wrote:
> > > This isn't correct, as you're not writing m_prefix, but it's 
> > > transmogrified version. Btw, do you really need this return value anyway?
> > Good catch. And the return value is just to make the SourceManager happy 
> > which always returns the total amount of bytes written. I'm working on a 
> > patch that will move all the 'written byte counting' in lldb into the 
> > Stream class, but as of now that's how it works.
> That sounds like a good idea. When you do that, could you please refer to the 
> llvm raw_ostream classes to see how they handle this. Long term, it would be 
> great if we could replace lldb's classes with those, so I'd like to avoid 
> diverging from them if possible.
raw_ostream has the same functionality with `tell()`, so that is actually in 
line with the idea of moving to LLVM's stream classes.


https://reviews.llvm.org/D49334



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


[Lldb-commits] [PATCH] D49888: Stop building liblldb with CMake's framework functionality

2018-07-27 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

In https://reviews.llvm.org/D49888#1177929, @labath wrote:

> Can't say I fully understand what's going on, but the changes seem reasonable 
> to me.


Let me know if I can clear anything up.

> If there is some public cmake bug describing the issue you ran into, it would 
> be nice, for the sake of future archaeologists, to reference it somewhere 
> (commit message and LLDBFramework.cmake?).

I haven't checked to see if a bug has been filed for this specific case but I 
have a minimal repro. I'll file a bug against CMake and add a link to the 
report in the commit message and in LLDBFramework.cmake before I actually 
commit this.


https://reviews.llvm.org/D49888



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


[Lldb-commits] [PATCH] D49322: Narrow the CompletionRequest API to being append-only.

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 157710.
teemperor added a comment.

- Rebased and fixed merge conflicts.
- Applied Pavel's suggestion for the duplicate filter (thanks!).


https://reviews.llvm.org/D49322

Files:
  include/lldb/Utility/CompletionRequest.h
  source/Commands/CommandCompletions.cpp
  source/Commands/CommandObjectCommands.cpp
  source/Commands/CommandObjectFrame.cpp
  source/Commands/CommandObjectMultiword.cpp
  source/Commands/CommandObjectPlatform.cpp
  source/Commands/CommandObjectPlugin.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Commands/CommandObjectSettings.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Core/FormatEntity.cpp
  source/Core/IOHandler.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Interpreter/CommandObject.cpp
  source/Interpreter/CommandObjectRegexCommand.cpp
  source/Interpreter/OptionValue.cpp
  source/Interpreter/OptionValueArch.cpp
  source/Interpreter/OptionValueBoolean.cpp
  source/Interpreter/OptionValueEnumeration.cpp
  source/Interpreter/OptionValueFileSpec.cpp
  source/Interpreter/OptionValueUUID.cpp
  source/Interpreter/Options.cpp
  source/Symbol/Variable.cpp
  source/Utility/ArchSpec.cpp
  source/Utility/CompletionRequest.cpp
  unittests/Utility/CompletionRequestTest.cpp

Index: unittests/Utility/CompletionRequestTest.cpp
===
--- unittests/Utility/CompletionRequestTest.cpp
+++ unittests/Utility/CompletionRequestTest.cpp
@@ -34,7 +34,70 @@
 
   EXPECT_EQ(request.GetPartialParsedLine().GetArgumentCount(), 2u);
   EXPECT_STREQ(request.GetPartialParsedLine().GetArgumentAtIndex(1), "b");
+}
+
+TEST(CompletionRequest, DuplicateFiltering) {
+  std::string command = "a bad c";
+  const unsigned cursor_pos = 3;
+  StringList matches;
+
+  CompletionRequest request(command, cursor_pos, 0, 0, matches);
+
+  EXPECT_EQ(0U, request.GetNumberOfMatches());
+
+  // Add foo twice
+  request.AddCompletion("foo");
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+
+  request.AddCompletion("foo");
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+
+  // Add bar twice
+  request.AddCompletion("bar");
+  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+
+  request.AddCompletion("bar");
+  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+
+  // Add foo again.
+  request.AddCompletion("foo");
+  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+
+  // Add something with an existing prefix
+  request.AddCompletion("foobar");
+  EXPECT_EQ(3U, request.GetNumberOfMatches());
+  EXPECT_EQ(3U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+  EXPECT_STREQ("foobar", matches.GetStringAtIndex(2));
+}
+
+TEST(CompletionRequest, TestCompletionOwnership) {
+  std::string command = "a bad c";
+  const unsigned cursor_pos = 3;
+  StringList matches;
+
+  CompletionRequest request(command, cursor_pos, 0, 0, matches);
+
+  std::string Temporary = "bar";
+  request.AddCompletion(Temporary);
+  // Manipulate our completion. The request should have taken a copy, so that
+  // shouldn't influence anything.
+  Temporary[0] = 'f';
 
-  // This is the generated matches should be equal to our passed string list.
-  EXPECT_EQ(&request.GetMatches(), &matches);
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(0));
 }
Index: source/Utility/CompletionRequest.cpp
===
--- source/Utility/CompletionRequest.cpp
+++ source/Utility/CompletionRequest.cpp
@@ -20,6 +20,7 @@
 : m_command(command_line), m_raw_cursor_pos(raw_cursor_pos),
   m_match_start_point(match_start_point),
   m_max_return_elements(max_return_elements), m_matches(&matches) {
+  matches.Clear();
 
   // We parse the argument up to the cursor, so the last argument in
   // parsed_line is the one containing the cursor, and the cursor is after the
Index: source/Utility/ArchSpec.cpp
===
--- source/Utility/ArchSpec.cpp
+++ source/Utility/ArchSpec.cpp
@@ -255,12 +255,14 @@
 for (uint32_t i = 0; i < llvm::array_lengthof(g_core_definitions); ++i) {
   if (NameMatches(g_core_definitions[i].name, NameMatch::StartsWith,
   request.GetCursorArgumentPrefix()))
-request.GetMatches().App

[Lldb-commits] [PATCH] D49888: Stop building liblldb with CMake's framework functionality

2018-07-27 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 157713.
xiaobai added a comment.

Add comment pointing to CMake bug report


https://reviews.llvm.org/D49888

Files:
  CMakeLists.txt
  cmake/modules/AddLLDB.cmake
  cmake/modules/LLDBConfig.cmake
  cmake/modules/LLDBFramework.cmake
  scripts/CMakeLists.txt
  source/API/CMakeLists.txt

Index: source/API/CMakeLists.txt
===
--- source/API/CMakeLists.txt
+++ source/API/CMakeLists.txt
@@ -110,10 +110,20 @@
 PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
 endif ()
 
-set_target_properties(liblldb
-  PROPERTIES
-  VERSION ${LLDB_VERSION}
-)
+if (LLDB_BUILD_FRAMEWORK)
+  set_target_properties(liblldb
+PROPERTIES
+LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_DIR}/Versions/${LLDB_FRAMEWORK_VERSION}
+PREFIX ""
+SUFFIX ""
+INSTALL_NAME_DIR "@rpath/LLDB.framework"
+OUTPUT_NAME LLDB)
+else()
+  set_target_properties(liblldb
+PROPERTIES
+VERSION ${LLDB_VERSION}
+OUTPUT_NAME lldb)
+endif()
 
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   if (NOT LLDB_EXPORT_ALL_SYMBOLS)
@@ -136,11 +146,6 @@
   if (MSVC AND NOT LLDB_DISABLE_PYTHON)
 target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
   endif()
-else()
-  set_target_properties(liblldb
-PROPERTIES
-OUTPUT_NAME lldb
-  )
 endif()
 
 if (LLDB_WRAP_PYTHON)
Index: scripts/CMakeLists.txt
===
--- scripts/CMakeLists.txt
+++ scripts/CMakeLists.txt
@@ -25,9 +25,9 @@
 if(LLDB_BUILD_FRAMEWORK)
   set(framework_arg --framework --target-platform Darwin)
   set(SWIG_PYTHON_DIR
-${LLDB_PYTHON_TARGET_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}/Python)
+${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}/Python)
   set(SWIG_INSTALL_DIR
-${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
+${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/${LLDB_FRAMEWORK_RESOURCE_DIR})
 endif()
 
 get_filename_component(CFGBLDDIR ${LLDB_WRAP_PYTHON} DIRECTORY)
@@ -52,7 +52,7 @@
   COMMENT "Python script building LLDB Python wrapper")
 add_custom_target(swig_wrapper ALL DEPENDS ${LLDB_WRAP_PYTHON})
 
-set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldb.py PROPERTIES GENERATED 1)
+set_source_files_properties(${LLDB_PYTHON_TARGET_DIR}/lldb.py PROPERTIES GENERATED 1)
 
 
 # Install the LLDB python module
Index: cmake/modules/LLDBFramework.cmake
===
--- cmake/modules/LLDBFramework.cmake
+++ cmake/modules/LLDBFramework.cmake
@@ -1,3 +1,16 @@
+# We intentionally do not use CMake's framework support because of a bug in
+# CMake. See: https://gitlab.kitware.com/cmake/cmake/issues/18216
+
+# We set up part of the framework structure first, as some scripts and build
+# rules assume they exist already.
+file(MAKE_DIRECTORY ${LLDB_FRAMEWORK_DIR} ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
+execute_process(
+  COMMAND
+${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${LLDB_FRAMEWORK_DIR}/Versions/Current
+  COMMAND
+${CMAKE_COMMAND} -E create_symlink Versions/Current/Resources ${LLDB_FRAMEWORK_DIR}/Resources
+)
+
 file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
 file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
 file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
@@ -16,28 +29,29 @@
 add_custom_target(lldb-framework-headers DEPENDS ${framework_headers})
 
 add_custom_command(TARGET lldb-framework POST_BUILD
-  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $/Headers
-  COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh $/Headers ${LLDB_VERSION}
+  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_HEADER_DIR}
+  COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_HEADER_DIR} ${LLDB_VERSION}
 )
 
 if (NOT IOS)
   if (NOT LLDB_BUILT_STANDALONE)
 add_dependencies(lldb-framework clang-headers)
   endif()
   add_custom_command(TARGET lldb-framework POST_BUILD
-COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${LLDB_FRAMEWORK_DIR}/LLDB.framework/Headers
-COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${LLDB_FRAMEWORK_DIR}/LLDB.framework/Versions/Current
-COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $/Resources/Clang
+COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${LLDB_FRAMEWORK_DIR}/Headers
+COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/LLDB ${LLDB_FRAMEWORK_DIR}/LLDB
+COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${LLDB_FRAMEWORK_DIR}/Versions/Current
+COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${L

[Lldb-commits] [PATCH] D49685: LLDB does not respect platform sysroot when loading core on Linux

2018-07-27 Thread Eugene Birukov via Phabricator via lldb-commits
EugeneBi added a comment.

In https://reviews.llvm.org/D49685#1178125, @labath wrote:

> In https://reviews.llvm.org/D49685#1177046, @EugeneBi wrote:
>
> > It is specific to shared libraries. Opening the executable and core dump 
> > follows different code path.
>
>
> Which path is that? Is the path different even when you don't specify an 
> executable when opening the core file (`target create --core /my/file.core`). 
> I believe that in this case we should end up here 
> https://github.com/llvm-mirror/lldb/blob/7c07b8a9314eef118f95b57b49fa099be0808eac/source/Plugins/Process/elf-core/ProcessElfCore.cpp#L255,
>  which should eventually call `Platform::GetSharedModule`. Is that not the 
> case?


I did not try not to specify executable - what's the point in doing that? LLDB 
would fail to find symbols.

Here is the stack I captured when I debugged the problem. I believe that 
DynamicLoaderPOSIXDYLD::LoadAllCurrentModules did not try to load the 
executable.

(gdb) bt
#0  lldb_private::ModuleList::GetSharedModule (module_spec=..., 
module_sp=std::shared_ptr (empty) 0x0,

  module_search_paths_ptr=0x83ad60, old_module_sp_ptr=0x7fffbb50, 
did_create_ptr=0x7fffbb07,
  always_create=false) at 
/home/eugene/llvm/tools/lldb/source/Core/ModuleList.cpp:710

#1  0x7fffedc2d130 in lldb_private::Platformoperator()(const lldb_private::ModuleSpec &) const 
(__closure=0x8581b0, spec=...)

  at /home/eugene/llvm/tools/lldb/source/Target/Platform.cpp:234

#2  0x7fffedc34ff2 in std::_Function_handler >::_M_invoke(const std::_Any_data &, const 
lldb_private::ModuleSpec &) (__functor=..., __args#0=...) at 
/usr/include/c++/5/functional:1857
#3  0x7fffedc37978 in std::function::operator()(lldb_private::ModuleSpec const&) 
const (this=0x7fffba80, __args#0=...) at /usr/include/c++/5/functional:2267
#4  0x7fffedc3375a in 
lldb_private::Platform::GetRemoteSharedModule(lldb_private::ModuleSpec const&, 
lldb_private::Process*, std::shared_ptr&, 
std::function const&, 
bool*) (this=0x839330, module_spec=..., process=0x84d310, 
module_sp=std::shared_ptr (empty) 0x0,

  module_resolver=..., did_create_ptr=0x7fffbb07)
  at /home/eugene/llvm/tools/lldb/source/Target/Platform.cpp:1628

#5  0x7fffedc2d2cd in lldb_private::Platform::GetSharedModule 
(this=0x839330, module_spec=...,

  process=0x84d310, module_sp=std::shared_ptr (empty) 0x0, 
module_search_paths_ptr=0x83ad60,
  old_module_sp_ptr=0x7fffbb50, did_create_ptr=0x7fffbb07)
  at /home/eugene/llvm/tools/lldb/source/Target/Platform.cpp:240

#6  0x7fffedc9957c in lldb_private::Target::GetSharedModule (this=0x846960, 
module_spec=..., error_ptr=0x0)

  at /home/eugene/llvm/tools/lldb/source/Target/Target.cpp:1952

#7  0x7fffef8e0d11 in lldb_private::DynamicLoader::LoadModuleAtAddress 
(this=0x9a0a70, file=...,

  link_map_addr=139700267943784, base_addr=139700263510016, 
base_addr_is_offset=true)
  at /home/eugene/llvm/tools/lldb/source/Core/DynamicLoader.cpp:171

#8  0x7fffedd8fb55 in DynamicLoaderPOSIXDYLD::LoadAllCurrentModules 
(this=0x9a0a70)

  at 
/home/eugene/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp:537

#9  0x7fffedd8de52 in DynamicLoaderPOSIXDYLD::DidAttach (this=0x9a0a70)

  at 
/home/eugene/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp:171

#10 0x7fffedc476d9 in lldb_private::Process::LoadCore (this=0x84d310)

  at /home/eugene/llvm/tools/lldb/source/Target/Process.cpp:2853


https://reviews.llvm.org/D49685



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


[Lldb-commits] [PATCH] D49322: Narrow the CompletionRequest API to being append-only.

2018-07-27 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

Although I'm not entirely sure whether this is safe (as in, it doesn't break 
anything), it's probably not worth to block this further. My understanding is 
that Raphael did a bunch of testing and he's willing to follow-up on eventual 
regressions. So, given this passes the test suite, I think it's OK for this 
patch to go in.


https://reviews.llvm.org/D49322



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


[Lldb-commits] [PATCH] D49685: LLDB does not respect platform sysroot when loading core on Linux

2018-07-27 Thread Eugene Birukov via Phabricator via lldb-commits
EugeneBi added a comment.

Hmm... I never thought I can do that :)
Anyway, with the change as it is now, LLDB would try to load executable in the 
sysroot, fail that, then open it without the sysroot.


https://reviews.llvm.org/D49685



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


[Lldb-commits] [PATCH] D49685: LLDB does not respect platform sysroot when loading core on Linux

2018-07-27 Thread Leonard Mosescu via Phabricator via lldb-commits
lemo added a comment.

> I never *ran LLDB tests*, not sure where they are and what they are.

I hope you're planning to look into this before submitting the change :)


https://reviews.llvm.org/D49685



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


Re: [Lldb-commits] [PATCH] D49685: LLDB does not respect platform sysroot when loading core on Linux

2018-07-27 Thread Leonard Mosescu via lldb-commits
>
> I never *ran LLDB tests*, not sure where they are and what they are.


I hope you're planning to look into this before submitting the change :)


On Fri, Jul 27, 2018 at 11:28 AM, Eugene Birukov via Phabricator <
revi...@reviews.llvm.org> wrote:

> EugeneBi added a comment.
>
> Hmm... I never thought I can do that :)
> Anyway, with the change as it is now, LLDB would try to load executable in
> the sysroot, fail that, then open it without the sysroot.
>
>
> https://reviews.llvm.org/D49685
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r338151 - Narrow the CompletionRequest API to being append-only.

2018-07-27 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Jul 27 11:42:46 2018
New Revision: 338151

URL: http://llvm.org/viewvc/llvm-project?rev=338151&view=rev
Log:
Narrow the CompletionRequest API to being append-only.

Summary:
We currently allow any completion handler to read and manipulate the list of 
matches we
calculated so far. This leads to a few problems:

Firstly, a completion handler's logic can now depend on previously calculated 
results
by another handlers. No completion handler should have such an implicit 
dependency,
but the current API makes it likely that this could happen (or already 
happens). Especially
the fact that some completion handler deleted all previously calculated results 
can mess
things up right now.

Secondly, all completion handlers have knowledge about our internal data 
structures with
this API. This makes refactoring this internal data structure much harder than 
it should be.
Especially planned changes like the support of descriptions for completions are 
currently
giant patches because we have to refactor every single completion handler.

This patch narrows the contract the CompletionRequest has with the different 
handlers to:

1. A handler can suggest a completion.
2. A handler can ask how many suggestions we already have.

Point 2 obviously means we still have a  dependency left between the different 
handlers, but
getting rid of this is too large to just append it to this patch.

Otherwise this patch just completely hides the internal StringList to the 
different handlers.

The CompletionRequest API now also ensures that the list of completions is 
unique and we
don't suggest the same value multiple times to the user. This property has been 
so far only
been ensured by the `Option` handler, but is now applied globally. This is part 
of this patch
as the OptionHandler is no longer able to implement this functionality itself.

Reviewers: jingham, davide, labath

Reviewed By: davide

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Utility/CompletionRequest.h
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectMultiword.cpp
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectPlugin.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Core/IOHandler.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
lldb/trunk/source/Interpreter/OptionValue.cpp
lldb/trunk/source/Interpreter/OptionValueArch.cpp
lldb/trunk/source/Interpreter/OptionValueBoolean.cpp
lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
lldb/trunk/source/Interpreter/OptionValueUUID.cpp
lldb/trunk/source/Interpreter/Options.cpp
lldb/trunk/source/Symbol/Variable.cpp
lldb/trunk/source/Utility/ArchSpec.cpp
lldb/trunk/source/Utility/CompletionRequest.cpp
lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Modified: lldb/trunk/include/lldb/Utility/CompletionRequest.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/CompletionRequest.h?rev=338151&r1=338150&r2=338151&view=diff
==
--- lldb/trunk/include/lldb/Utility/CompletionRequest.h (original)
+++ lldb/trunk/include/lldb/Utility/CompletionRequest.h Fri Jul 27 11:42:46 2018
@@ -13,6 +13,7 @@
 #include "lldb/Utility/Args.h"
 #include "lldb/Utility/StringList.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 
 namespace lldb_private {
 
@@ -77,8 +78,29 @@ public:
 
   void SetWordComplete(bool v) { m_word_complete = v; }
 
-  /// The array of matches returned.
-  StringList &GetMatches() { return *m_matches; }
+  /// Adds a possible completion string. If the completion was already
+  /// suggested before, it will not be added to the list of results. A copy of
+  /// the suggested completion is stored, so the given string can be free'd
+  /// afterwards.
+  ///
+  /// @param match The suggested completion.
+  void AddCompletion(llvm::StringRef completion) {
+// Add the completion if we haven't seen the same value before.
+if (m_match_set.insert(completion).second)
+  m_matches->AppendString(completion);
+  }
+
+  /// Adds multiple possible completion strings.
+  ///
+  /// \param completions The list of completions.
+  ///
+  /// @see AddCompletion
+  void AddCompletions(const StringList &completions) {
+for (std::size_t i = 0; i < completions.GetSize(); ++i)
+  AddComple

[Lldb-commits] [PATCH] D49322: Narrow the CompletionRequest API to being append-only.

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338151: Narrow the CompletionRequest API to being 
append-only. (authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49322?vs=157710&id=157726#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49322

Files:
  lldb/trunk/include/lldb/Utility/CompletionRequest.h
  lldb/trunk/source/Commands/CommandCompletions.cpp
  lldb/trunk/source/Commands/CommandObjectCommands.cpp
  lldb/trunk/source/Commands/CommandObjectFrame.cpp
  lldb/trunk/source/Commands/CommandObjectMultiword.cpp
  lldb/trunk/source/Commands/CommandObjectPlatform.cpp
  lldb/trunk/source/Commands/CommandObjectPlugin.cpp
  lldb/trunk/source/Commands/CommandObjectProcess.cpp
  lldb/trunk/source/Commands/CommandObjectSettings.cpp
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Core/FormatEntity.cpp
  lldb/trunk/source/Core/IOHandler.cpp
  lldb/trunk/source/Interpreter/CommandInterpreter.cpp
  lldb/trunk/source/Interpreter/CommandObject.cpp
  lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
  lldb/trunk/source/Interpreter/OptionValue.cpp
  lldb/trunk/source/Interpreter/OptionValueArch.cpp
  lldb/trunk/source/Interpreter/OptionValueBoolean.cpp
  lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
  lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
  lldb/trunk/source/Interpreter/OptionValueUUID.cpp
  lldb/trunk/source/Interpreter/Options.cpp
  lldb/trunk/source/Symbol/Variable.cpp
  lldb/trunk/source/Utility/ArchSpec.cpp
  lldb/trunk/source/Utility/CompletionRequest.cpp
  lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Index: lldb/trunk/include/lldb/Utility/CompletionRequest.h
===
--- lldb/trunk/include/lldb/Utility/CompletionRequest.h
+++ lldb/trunk/include/lldb/Utility/CompletionRequest.h
@@ -13,6 +13,7 @@
 #include "lldb/Utility/Args.h"
 #include "lldb/Utility/StringList.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 
 namespace lldb_private {
 
@@ -77,8 +78,29 @@
 
   void SetWordComplete(bool v) { m_word_complete = v; }
 
-  /// The array of matches returned.
-  StringList &GetMatches() { return *m_matches; }
+  /// Adds a possible completion string. If the completion was already
+  /// suggested before, it will not be added to the list of results. A copy of
+  /// the suggested completion is stored, so the given string can be free'd
+  /// afterwards.
+  ///
+  /// @param match The suggested completion.
+  void AddCompletion(llvm::StringRef completion) {
+// Add the completion if we haven't seen the same value before.
+if (m_match_set.insert(completion).second)
+  m_matches->AppendString(completion);
+  }
+
+  /// Adds multiple possible completion strings.
+  ///
+  /// \param completions The list of completions.
+  ///
+  /// @see AddCompletion
+  void AddCompletions(const StringList &completions) {
+for (std::size_t i = 0; i < completions.GetSize(); ++i)
+  AddCompletion(completions.GetStringAtIndex(i));
+  }
+
+  std::size_t GetNumberOfMatches() const { return m_matches->GetSize(); }
 
   llvm::StringRef GetCursorArgument() const {
 return GetParsedLine().GetArgumentAtIndex(GetCursorIndex());
@@ -111,8 +133,15 @@
   /// \btrue if this is a complete option value (a space will be inserted
   /// after the completion.)  \bfalse otherwise.
   bool m_word_complete = false;
-  // We don't own the list.
+
+  // Note: This list is kept private. This is by design to prevent that any
+  // completion depends on any already computed completion from another backend.
+  // Note: We don't own the list. It's owned by the creator of the
+  // CompletionRequest object.
   StringList *m_matches;
+
+  /// List of added completions so far. Used to filter out duplicates.
+  llvm::StringSet<> m_match_set;
 };
 
 } // namespace lldb_private
Index: lldb/trunk/unittests/Utility/CompletionRequestTest.cpp
===
--- lldb/trunk/unittests/Utility/CompletionRequestTest.cpp
+++ lldb/trunk/unittests/Utility/CompletionRequestTest.cpp
@@ -34,7 +34,70 @@
 
   EXPECT_EQ(request.GetPartialParsedLine().GetArgumentCount(), 2u);
   EXPECT_STREQ(request.GetPartialParsedLine().GetArgumentAtIndex(1), "b");
+}
+
+TEST(CompletionRequest, DuplicateFiltering) {
+  std::string command = "a bad c";
+  const unsigned cursor_pos = 3;
+  StringList matches;
+
+  CompletionRequest request(command, cursor_pos, 0, 0, matches);
+
+  EXPECT_EQ(0U, request.GetNumberOfMatches());
+
+  // Add foo twice
+  request.AddCompletion("foo");
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+
+  request.AddCompletion("foo");
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_STREQ("foo

[Lldb-commits] [PATCH] D49685: LLDB does not respect platform sysroot when loading core on Linux

2018-07-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D49685#1178528, @EugeneBi wrote:

> Hmm... I never thought I can do that :)
>  Anyway, with the change as it is now, LLDB would try to load executable in 
> the sysroot, fail that, then open it without the sysroot.


Does that mean it is possible to exercise this code path (by placing the 
executable in the sysroot for lldb to find it)?


https://reviews.llvm.org/D49685



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


[Lldb-commits] [PATCH] D49271: Adding libc++ formattors for std::optional

2018-07-27 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

Your latest update doesn't contain CMakeList.txt files and the Xcode project 
changes. That's why it failed to apply. Please upload a correct version and 
I'll commit it for you.


Repository:
  rL LLVM

https://reviews.llvm.org/D49271



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


[Lldb-commits] [PATCH] D49685: LLDB does not respect platform sysroot when loading core on Linux

2018-07-27 Thread Eugene Birukov via Phabricator via lldb-commits
EugeneBi added a comment.

In https://reviews.llvm.org/D49685#1178543, @lemo wrote:

> > I never *ran LLDB tests*, not sure where they are and what they are.
>
> I hope you're planning to look into this before submitting the change :)


Good idea :)

Scanning dependencies of target check-lldb
[100%] Built target check-lldb


https://reviews.llvm.org/D49685



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


[Lldb-commits] [PATCH] D49888: Stop building liblldb with CMake's framework functionality

2018-07-27 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338154: Stop building liblldb with CMake's framework 
functionality (authored by xiaobai, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D49888

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/cmake/modules/AddLLDB.cmake
  lldb/trunk/cmake/modules/LLDBConfig.cmake
  lldb/trunk/cmake/modules/LLDBFramework.cmake
  lldb/trunk/scripts/CMakeLists.txt
  lldb/trunk/source/API/CMakeLists.txt

Index: lldb/trunk/source/API/CMakeLists.txt
===
--- lldb/trunk/source/API/CMakeLists.txt
+++ lldb/trunk/source/API/CMakeLists.txt
@@ -110,10 +110,20 @@
 PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
 endif ()
 
-set_target_properties(liblldb
-  PROPERTIES
-  VERSION ${LLDB_VERSION}
-)
+if (LLDB_BUILD_FRAMEWORK)
+  set_target_properties(liblldb
+PROPERTIES
+LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_DIR}/Versions/${LLDB_FRAMEWORK_VERSION}
+PREFIX ""
+SUFFIX ""
+INSTALL_NAME_DIR "@rpath/LLDB.framework"
+OUTPUT_NAME LLDB)
+else()
+  set_target_properties(liblldb
+PROPERTIES
+VERSION ${LLDB_VERSION}
+OUTPUT_NAME lldb)
+endif()
 
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   if (NOT LLDB_EXPORT_ALL_SYMBOLS)
@@ -136,11 +146,6 @@
   if (MSVC AND NOT LLDB_DISABLE_PYTHON)
 target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
   endif()
-else()
-  set_target_properties(liblldb
-PROPERTIES
-OUTPUT_NAME lldb
-  )
 endif()
 
 if (LLDB_WRAP_PYTHON)
Index: lldb/trunk/scripts/CMakeLists.txt
===
--- lldb/trunk/scripts/CMakeLists.txt
+++ lldb/trunk/scripts/CMakeLists.txt
@@ -25,9 +25,9 @@
 if(LLDB_BUILD_FRAMEWORK)
   set(framework_arg --framework --target-platform Darwin)
   set(SWIG_PYTHON_DIR
-${LLDB_PYTHON_TARGET_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}/Python)
+${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}/Python)
   set(SWIG_INSTALL_DIR
-${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
+${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/${LLDB_FRAMEWORK_RESOURCE_DIR})
 endif()
 
 get_filename_component(CFGBLDDIR ${LLDB_WRAP_PYTHON} DIRECTORY)
@@ -52,7 +52,7 @@
   COMMENT "Python script building LLDB Python wrapper")
 add_custom_target(swig_wrapper ALL DEPENDS ${LLDB_WRAP_PYTHON})
 
-set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldb.py PROPERTIES GENERATED 1)
+set_source_files_properties(${LLDB_PYTHON_TARGET_DIR}/lldb.py PROPERTIES GENERATED 1)
 
 
 # Install the LLDB python module
Index: lldb/trunk/cmake/modules/LLDBFramework.cmake
===
--- lldb/trunk/cmake/modules/LLDBFramework.cmake
+++ lldb/trunk/cmake/modules/LLDBFramework.cmake
@@ -1,3 +1,16 @@
+# We intentionally do not use CMake's framework support because of a bug in
+# CMake. See: https://gitlab.kitware.com/cmake/cmake/issues/18216
+
+# We set up part of the framework structure first, as some scripts and build
+# rules assume they exist already.
+file(MAKE_DIRECTORY ${LLDB_FRAMEWORK_DIR} ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
+execute_process(
+  COMMAND
+${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${LLDB_FRAMEWORK_DIR}/Versions/Current
+  COMMAND
+${CMAKE_COMMAND} -E create_symlink Versions/Current/Resources ${LLDB_FRAMEWORK_DIR}/Resources
+)
+
 file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
 file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
 file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
@@ -16,28 +29,29 @@
 add_custom_target(lldb-framework-headers DEPENDS ${framework_headers})
 
 add_custom_command(TARGET lldb-framework POST_BUILD
-  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $/Headers
-  COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh $/Headers ${LLDB_VERSION}
+  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_HEADER_DIR}
+  COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_HEADER_DIR} ${LLDB_VERSION}
 )
 
 if (NOT IOS)
   if (NOT LLDB_BUILT_STANDALONE)
 add_dependencies(lldb-framework clang-headers)
   endif()
   add_custom_command(TARGET lldb-framework POST_BUILD
-COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${LLDB_FRAMEWORK_DIR}/LLDB.framework/Headers
-COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${LLDB_FRAMEWORK_DIR}/LLDB.framework/Versions/Current
-COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $/Resources/Clang
+COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${LLDB_FRAMEWORK_DIR}/Header

[Lldb-commits] [lldb] r338154 - Stop building liblldb with CMake's framework functionality

2018-07-27 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Fri Jul 27 12:41:17 2018
New Revision: 338154

URL: http://llvm.org/viewvc/llvm-project?rev=338154&view=rev
Log:
Stop building liblldb with CMake's framework functionality

Summary:
CMake has a bug in its ninja generator that prevents you from
installing targets that are built with framework support. Therefore, I want to
not rely on CMake's framework support.
See https://gitlab.kitware.com/cmake/cmake/issues/18216

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

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/cmake/modules/LLDBConfig.cmake
lldb/trunk/cmake/modules/LLDBFramework.cmake
lldb/trunk/scripts/CMakeLists.txt
lldb/trunk/source/API/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=338154&r1=338153&r2=338154&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Fri Jul 27 12:41:17 2018
@@ -51,15 +51,16 @@ if(LLDB_BUILD_FRAMEWORK)
 message(FATAL_ERROR "LLDB.framework can only be generated when targeting 
Apple platforms")
   endif()
 
+  add_custom_target(lldb-framework)
+  set(LLDB_SUITE_TARGET lldb-framework)
+  set(LLDB_FRAMEWORK_DIR
+
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework)
   # These are used to fill out LLDB-Info.plist. These are relevant when 
building
   # the framework, and must be defined before building liblldb.
   set(PRODUCT_NAME "LLDB")
   set(EXECUTABLE_NAME "LLDB")
   set(CURRENT_PROJECT_VERSION "360.99.0")
-  set(LLDB_SUITE_TARGET lldb-framework)
-
-  set(LLDB_FRAMEWORK_DIR
-${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
+  include(LLDBFramework)
 endif()
 
 add_subdirectory(docs)
@@ -71,7 +72,7 @@ if (NOT LLDB_DISABLE_PYTHON)
   set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts)
   set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
   if(LLDB_BUILD_FRAMEWORK)
-set(LLDB_PYTHON_TARGET_DIR ${LLDB_FRAMEWORK_DIR})
+set(LLDB_PYTHON_TARGET_DIR "${LLDB_FRAMEWORK_DIR}/..")
 set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp)
   else()
 # Don't set -m when building the framework.
@@ -162,11 +163,6 @@ if(LLDB_INCLUDE_TESTS)
   add_subdirectory(utils/lldb-dotest)
 endif()
 
-if (LLDB_BUILD_FRAMEWORK)
-  add_custom_target(lldb-framework)
-  include(LLDBFramework)
-endif()
-
 if (NOT LLDB_DISABLE_PYTHON)
 # Add a Post-Build Event to copy over Python files and create the symlink
 # to liblldb.so for the Python API(hardlink on Windows)

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=338154&r1=338153&r2=338154&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Fri Jul 27 12:41:17 2018
@@ -52,7 +52,7 @@ function(add_lldb_library name)
   if (PARAM_SHARED)
 set(out_dir lib${LLVM_LIBDIR_SUFFIX})
 if(${name} STREQUAL "liblldb" AND LLDB_BUILD_FRAMEWORK)
-  set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
+  set(out_dir 
${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION})
 endif()
 install(TARGETS ${name}
   COMPONENT ${name}
@@ -108,7 +108,7 @@ function(add_lldb_executable name)
   endif()
   string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR})
   set_target_properties(${name} PROPERTIES
-RUNTIME_OUTPUT_DIRECTORY $${resource_dir}
+RUNTIME_OUTPUT_DIRECTORY 
${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}
 BUILD_WITH_INSTALL_RPATH On
 INSTALL_RPATH 
"@loader_path/../../../${resource_dots}${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
 endif()
@@ -123,7 +123,7 @@ function(add_lldb_executable name)
   if(ARG_GENERATE_INSTALL)
 set(out_dir "bin")
 if (LLDB_BUILD_FRAMEWORK AND ARG_INCLUDE_IN_SUITE)
-  set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
+  set(out_dir 
${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/${LLDB_FRAMEWORK_RESOURCE_DIR})
 endif()
 install(TARGETS ${name}
   COMPONENT ${name}

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=338154&r1=338153&r2=338154&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Fri Jul 27 12:41:17 2018
@@ -326,7 +326,9 @@ if (APPLE)
   set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Output 
directory for LLDB.framework")
   set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework vers

[Lldb-commits] [PATCH] D49271: Adding libc++ formattors for std::optional

2018-07-27 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

Recommitted:

  a11963323fc Recommit [DataFormatters] Add formatter for C++17 std::optional.

Authentication realm: https://llvm.org:443 LLVM Subversion repository
Password for 'davide': ***

Sendinglldb/trunk/lldb.xcodeproj/project.pbxproj
Adding 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional
Adding 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile
Adding 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/TestDataFormatterLibcxxOptional.py
Adding 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/main.cpp
Sendinglldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
Sending
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
Sendinglldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
Sendinglldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.h
Adding lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp
Transmitting file data .done
Committing transaction...
Committed revision 338156.
Committed a11963323fc to svn.


Repository:
  rL LLVM

https://reviews.llvm.org/D49271



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


[Lldb-commits] [lldb] r338156 - Recommit [DataFormatters] Add formatter for C++17 std::optional.

2018-07-27 Thread Davide Italiano via lldb-commits
Author: davide
Date: Fri Jul 27 12:57:30 2018
New Revision: 338156

URL: http://llvm.org/viewvc/llvm-project?rev=338156&view=rev
Log:
Recommit [DataFormatters] Add formatter for C++17 std::optional.

This should have all the correct files now.

Patch by Shafik Yaghmour.

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/TestDataFormatterLibcxxOptional.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.h

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=338156&r1=338155&r2=338156&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jul 27 12:57:30 2018
@@ -388,6 +388,7 @@
945261C11B9A11FC00BF138D /* LibCxxInitializerList.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 945261B71B9A11E800BF138D /* 
LibCxxInitializerList.cpp */; };
945261C21B9A11FC00BF138D /* LibCxxList.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 945261B81B9A11E800BF138D /* LibCxxList.cpp */; };
945261C31B9A11FC00BF138D /* LibCxxMap.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 945261B91B9A11E800BF138D /* LibCxxMap.cpp */; };
+   E4A63A9120F55D28000D9548 /* LibCxxOptional.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = E4A63A9020F55D27000D9548 /* LibCxxOptional.cpp 
*/; };
AF9FF1F71FAA79FE00474976 /* LibCxxQueue.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */; 
};
AF9FF1F51FAA79A400474976 /* LibCxxTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */; 
};
945261C41B9A11FC00BF138D /* LibCxxUnorderedMap.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 945261BA1B9A11E800BF138D /* 
LibCxxUnorderedMap.cpp */; };
@@ -2000,6 +2001,7 @@
945261B71B9A11E800BF138D /* LibCxxInitializerList.cpp */ = {isa 
= PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxInitializerList.cpp; path = Language/CPlusPlus/LibCxxInitializerList.cpp; 
sourceTree = ""; };
945261B81B9A11E800BF138D /* LibCxxList.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxList.cpp; path = Language/CPlusPlus/LibCxxList.cpp; sourceTree = 
""; };
945261B91B9A11E800BF138D /* LibCxxMap.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LibCxxMap.cpp; 
path = Language/CPlusPlus/LibCxxMap.cpp; sourceTree = ""; };
+   E4A63A9020F55D27000D9548 /* LibCxxOptional.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxOptional.cpp; path = Language/CPlusPlus/LibCxxOptional.cpp; 
sourceTree = ""; };
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxQueue.cpp; path = Language/CPlusPlus/LibCxxQueue.cpp; sourceTree = 
""; };
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxTuple.cpp; path = Language/CPlusPlus/LibCxxTuple.cpp; sourceTree = 
""; };
945261BA1B9A11E800BF138D /* LibCxxUnorderedMap.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxUnorderedMap.cpp; path = Language/CPlusPlus/LibCxxUnorderedMap.cpp; 
sourceTree = ""; };
@@ -6351,6 +6353,7 @@
945261B71B9A11E800BF138D /* 
LibCxxInitializerList.cpp */,
945261B81B9A11E800BF138D /* LibCxxList.cpp */,
945261B91B9A11E800BF138D /* LibCxxMap.cpp */,
+   E4A63A9020F55D27000D9548 /* LibCxxOptional.cpp 
*/,
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */,
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */,
945261BA1B9

[Lldb-commits] [PATCH] D49685: LLDB does not respect platform sysroot when loading core on Linux

2018-07-27 Thread Eugene Birukov via Phabricator via lldb-commits
EugeneBi added a comment.

In https://reviews.llvm.org/D49685#1178553, @labath wrote:

> In https://reviews.llvm.org/D49685#1178528, @EugeneBi wrote:
>
> > Hmm... I never thought I can do that :)
> >  Anyway, with the change as it is now, LLDB would try to load executable in 
> > the sysroot, fail that, then open it without the sysroot.
>
>
> Does that mean it is possible to exercise this code path (by placing the 
> executable in the sysroot for lldb to find it)?


I looked at the tests - is it all in Python? Not sure I have time to learn a 
new language... Is there anything in C++?


https://reviews.llvm.org/D49685



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


[Lldb-commits] [lldb] r338162 - Revert "Recommit [DataFormatters] Add formatter for C++17 std::optional."

2018-07-27 Thread Davide Italiano via lldb-commits
Author: davide
Date: Fri Jul 27 13:38:01 2018
New Revision: 338162

URL: http://llvm.org/viewvc/llvm-project?rev=338162&view=rev
Log:
Revert "Recommit [DataFormatters] Add formatter for C++17 std::optional."

This broke a linux bot which doesn't support -std=c++17. The solution
is to add a decorator to skip these tests on machines with older compilers.

Removed:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.h

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=338162&r1=338161&r2=338162&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jul 27 13:38:01 2018
@@ -388,7 +388,6 @@
945261C11B9A11FC00BF138D /* LibCxxInitializerList.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 945261B71B9A11E800BF138D /* 
LibCxxInitializerList.cpp */; };
945261C21B9A11FC00BF138D /* LibCxxList.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 945261B81B9A11E800BF138D /* LibCxxList.cpp */; };
945261C31B9A11FC00BF138D /* LibCxxMap.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 945261B91B9A11E800BF138D /* LibCxxMap.cpp */; };
-   E4A63A9120F55D28000D9548 /* LibCxxOptional.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = E4A63A9020F55D27000D9548 /* LibCxxOptional.cpp 
*/; };
AF9FF1F71FAA79FE00474976 /* LibCxxQueue.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */; 
};
AF9FF1F51FAA79A400474976 /* LibCxxTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */; 
};
945261C41B9A11FC00BF138D /* LibCxxUnorderedMap.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 945261BA1B9A11E800BF138D /* 
LibCxxUnorderedMap.cpp */; };
@@ -2001,7 +2000,6 @@
945261B71B9A11E800BF138D /* LibCxxInitializerList.cpp */ = {isa 
= PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxInitializerList.cpp; path = Language/CPlusPlus/LibCxxInitializerList.cpp; 
sourceTree = ""; };
945261B81B9A11E800BF138D /* LibCxxList.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxList.cpp; path = Language/CPlusPlus/LibCxxList.cpp; sourceTree = 
""; };
945261B91B9A11E800BF138D /* LibCxxMap.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LibCxxMap.cpp; 
path = Language/CPlusPlus/LibCxxMap.cpp; sourceTree = ""; };
-   E4A63A9020F55D27000D9548 /* LibCxxOptional.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxOptional.cpp; path = Language/CPlusPlus/LibCxxOptional.cpp; 
sourceTree = ""; };
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxQueue.cpp; path = Language/CPlusPlus/LibCxxQueue.cpp; sourceTree = 
""; };
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxTuple.cpp; path = Language/CPlusPlus/LibCxxTuple.cpp; sourceTree = 
""; };
945261BA1B9A11E800BF138D /* LibCxxUnorderedMap.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxUnorderedMap.cpp; path = Language/CPlusPlus/LibCxxUnorderedMap.cpp; 
sourceTree = ""; };
@@ -6353,7 +6351,6 @@
945261B71B9A11E800BF138D /* 
LibCxxInitializerList.cpp */,
945261B81B9A11E800BF138D /* LibCxxList.cpp */,
945261B91B9A11E800BF138D /* LibCxxMap.cpp */,
-   E4A63A9020F55D27000D9548 /* LibCxxOptional.cpp 
*/,
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */,
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */,
945261BA1B9A11E800BF138D /* 
LibCxxUnorderedMap.cpp */,
@@ -8048,7 +8045,6 @@
AF26703B1852D01E00B6CC36 /* QueueList.cpp in 
Sources */,
267C012B136880DF006E963E /* 
OptionGroupValueObjectDisplay.cpp in Sources */,
49CA96FE1E6AACC900C03FEE /* DataEncoder.cpp in 
Sources */,
-   

[Lldb-commits] [PATCH] D49271: Adding libc++ formattors for std::optional

2018-07-27 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

I'm afraid I had to revert this again. It broke an ubuntu lldb-cmake bot which 
builds with clang-3.5 (which has no `-std=c++17` support flag, as 17 wasn't 
there yet).

I'd recommend to update this patch with another decorator to skip places where 
`-std=c++17` is not available doesn't work, and then we'll try again.


Repository:
  rL LLVM

https://reviews.llvm.org/D49271



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


[Lldb-commits] [PATCH] D49271: Adding libc++ formattors for std::optional

2018-07-27 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

Bot logs for completeness:

  Session logs for test failures/errors/unexpected successes will go into 
directory 'logs-clang-3.5-i386'
  Command invoked: 
/lldb-buildbot/lldbSlave/buildWorkingDir/scripts/../llvm/tools/lldb/test/dotest.py
 -A i386 -C clang-3.5 -v -s logs-clang-3.5-i386 -u CXXFLAGS -u CFLAGS --env 
ARCHIVER=ar --env OBJCOPY=objcopy --executable 
/lldb-buildbot/lldbSlave/buildWorkingDir/scripts/../build/bin/lldb --channel 
gdb-remote packets --channel lldb all --skip-category watchpoint 
--skip-category lldb-mi --results-port 43584 -S fnmac --inferior -p 
TestDataFormatterLibcxxOptional.py 
/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional
 --event-add-entries worker_index=4:int
  
  Configuration: arch=i386 compiler=/usr/bin/clang-3.5
  --
  Collected 4 tests
  
  1: test_with_run_command_dsym 
(TestDataFormatterLibcxxOptional.LibcxxOptionalDataFormatterTestCase)
 Test that that file and class static variables display correctly. ... 
skipped 'test case does not fall in any category of interest for this run'
  2: test_with_run_command_dwarf 
(TestDataFormatterLibcxxOptional.LibcxxOptionalDataFormatterTestCase)
 Test that that file and class static variables display correctly. ... 3: 
test_with_run_command_dwo 
(TestDataFormatterLibcxxOptional.LibcxxOptionalDataFormatterTestCase)
 Test that that file and class static variables display correctly. ... 4: 
test_with_run_command_gmodules 
(TestDataFormatterLibcxxOptional.LibcxxOptionalDataFormatterTestCase)
 Test that that file and class static variables display correctly. ... 
skipped 'test case does not fall in any category of interest for this run'
  
  ==
  ERROR: test_with_run_command_dwarf 
(TestDataFormatterLibcxxOptional.LibcxxOptionalDataFormatterTestCase)
 Test that that file and class static variables display correctly.
  --
  Error when building test subject.
  
  Build Command:
  make 
VPATH=/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional
 -C 
/lldb-buildbot/lldbSlave/buildWorkingDir/scripts/lldb-test-build.noindex/functionalities/data-formatter/data-formatter-stl/libcxx/optional/TestDataFormatterLibcxxOptional.test_with_run_command_dwarf
 -I 
/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional
 -f 
/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile
 MAKE_DSYM=NO ARCH=i386 CC="/usr/bin/clang-3.5" 
  
  Build Command Output:
  error: invalid value 'c++17' in '-std=c++17'
  error: invalid value 'c++17' in '-std=c++17'
  make: *** [main.o] Error 1


Repository:
  rL LLVM

https://reviews.llvm.org/D49271



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


[Lldb-commits] [PATCH] D49943: Fix whitespace in the python test suite.

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
Herald added subscribers: christof, JDevlieghere, ki.stfu.

The test suite has often unnecessary trailing whitespace, and sometimes
unnecessary trailing lines or a missing final new line. This patch just strips
trailing whitespace/lines and adds missing newlines at the end.


https://reviews.llvm.org/D49943

Files:
  packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py
  packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
  packages/Python/lldbsuite/test/decorators.py
  
packages/Python/lldbsuite/test/expression_command/call-function/TestCallStdStringFunction.py
  
packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py
  
packages/Python/lldbsuite/test/expression_command/call-throws/TestCallThatThrows.py
  packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
  packages/Python/lldbsuite/test/expression_command/fixits/TestFixIts.py
  packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py
  packages/Python/lldbsuite/test/expression_command/pr35310/TestExprsBug35310.py
  
packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py
  
packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py
  packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py
  
packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
  
packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py
  
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
  
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
  
packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
  
packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
  
packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
  packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
  packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
  
packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py
  packages/Python/lldbsuite/test/functionalities/frame_var/TestFrameVar.py
  
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
  
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
  packages/Python/lldbsuite/test/functionalities/history/TestHistoryRecall.py
  packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
  
packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py
  
packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/TestPreRunDylibs.py
  
packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py
  packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
  
packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py
  
packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
  
packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
  
packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
  
packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py
  packages/Python/lldbsuite/test/lang/c/find_struct_type/TestFindStructTypes.py
  
packages/Python/lldbsuite/test/lang/cpp/dynamic-value-same-basename/TestDynamicValueSameBase.py
  
packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
  packages/Python/lldbsuite/test/lang/cpp/llvm-style/TestLLVMStyle.py
  packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
  packages/Python/lldbsuite/test/lang/cpp/trivial_abi/TestTrivialABI.py
  packages/Python/lldbsuite/test/lldbdwarf.py
  packages/Python/lldbsuite/test/lldbtest.py
  packa

[Lldb-commits] [PATCH] D49943: Fix whitespace in the python test suite.

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338171: Fix whitespace in the python test suite. (authored 
by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49943?vs=157781&id=157788#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49943

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py
  
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
  lldb/trunk/packages/Python/lldbsuite/test/decorators.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStdStringFunction.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-throws/TestCallThatThrows.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/fixits/TestFixIts.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/pr35310/TestExprsBug35310.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
  lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var/TestFrameVar.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/history/TestHistoryRecall.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/TestPreRunDylibs.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Test

[Lldb-commits] [lldb] r338171 - Fix whitespace in the python test suite.

2018-07-27 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Jul 27 15:20:59 2018
New Revision: 338171

URL: http://llvm.org/viewvc/llvm-project?rev=338171&view=rev
Log:
Fix whitespace in the python test suite.

Summary:
The test suite has often unnecessary trailing whitespace, and sometimes
unnecessary trailing lines or a missing final new line. This patch just strips
trailing whitespace/lines and adds missing newlines at the end.

Subscribers: ki.stfu, JDevlieghere, christof, lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py

lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
lldb/trunk/packages/Python/lldbsuite/test/decorators.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStdStringFunction.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-throws/TestCallThatThrows.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/fixits/TestFixIts.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/pr35310/TestExprsBug35310.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var/TestFrameVar.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/history/TestHistoryRecall.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/TestPreRunDylibs.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/w

[Lldb-commits] [PATCH] D49947: Add the actually calculated completions to COMPLETION_MSG

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.

Otherwise this assertion message is not very useful to whoever is reading the 
log.


https://reviews.llvm.org/D49947

Files:
  packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  packages/Python/lldbsuite/test/lldbtest.py


Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -184,9 +184,9 @@
 return "Command '%s' returns successfully" % str
 
 
-def COMPLETION_MSG(str_before, str_after):
+def COMPLETION_MSG(str_before, str_after, completions):
 '''A generic message generator for the completion mechanism.'''
-return "'%s' successfully completes to '%s'" % (str_before, str_after)
+return "'%s' successfully completes to '%s', but completions were:\n%s" % 
(str_before, str_after, "\n".join(completions))
 
 
 def EXP_MSG(str, actual, exe):
Index: 
packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -273,8 +273,8 @@
 if turn_off_re_match:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, substrs=[p])
+str_input, p, match_strings), exe=False, substrs=[p])
 else:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, patterns=[p])
+str_input, p, match_strings), exe=False, patterns=[p])


Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -184,9 +184,9 @@
 return "Command '%s' returns successfully" % str
 
 
-def COMPLETION_MSG(str_before, str_after):
+def COMPLETION_MSG(str_before, str_after, completions):
 '''A generic message generator for the completion mechanism.'''
-return "'%s' successfully completes to '%s'" % (str_before, str_after)
+return "'%s' successfully completes to '%s', but completions were:\n%s" % (str_before, str_after, "\n".join(completions))
 
 
 def EXP_MSG(str, actual, exe):
Index: packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -273,8 +273,8 @@
 if turn_off_re_match:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, substrs=[p])
+str_input, p, match_strings), exe=False, substrs=[p])
 else:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, patterns=[p])
+str_input, p, match_strings), exe=False, patterns=[p])
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D49949: Add missing boundary checks to variable completion.

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.

Stopgap patch to at least stop all the crashes I get from this code.


https://reviews.llvm.org/D49949

Files:
  packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  packages/Python/lldbsuite/test/functionalities/completion/main.cpp
  source/Symbol/Variable.cpp


Index: source/Symbol/Variable.cpp
===
--- source/Symbol/Variable.cpp
+++ source/Symbol/Variable.cpp
@@ -644,11 +644,11 @@
   break;
 
 case '-':
-  if (partial_path[1] == '>' && !prefix_path.str().empty()) {
+  if (partial_path.size() > 1 && partial_path[1] == '>' && 
!prefix_path.str().empty()) {
 switch (type_class) {
 case lldb::eTypeClassPointer: {
   CompilerType pointee_type(compiler_type.GetPointeeType());
-  if (partial_path[2]) {
+  if (partial_path.size() > 2 && partial_path[2]) {
 // If there is more after the "->", then search deeper
 PrivateAutoComplete(
 frame, partial_path.substr(2), prefix_path + "->",
@@ -672,7 +672,7 @@
 case lldb::eTypeClassUnion:
 case lldb::eTypeClassStruct:
 case lldb::eTypeClassClass:
-  if (partial_path[1]) {
+  if (partial_path.size() > 1 && partial_path[1]) {
 // If there is more after the ".", then search deeper
 PrivateAutoComplete(frame, partial_path.substr(1),
 prefix_path + ".", compiler_type, matches,
Index: packages/Python/lldbsuite/test/functionalities/completion/main.cpp
===
--- packages/Python/lldbsuite/test/functionalities/completion/main.cpp
+++ packages/Python/lldbsuite/test/functionalities/completion/main.cpp
@@ -7,8 +7,15 @@
 }
 };
 
+struct Container { int MemberVar; };
+
 int main()
 {
-Foo f;
-f.Bar(1, 2);
+Foo fooo;
+Foo *ptr_fooo = &fooo;
+fooo.Bar(1, 2);
+
+Container container;
+Container *ptr_container = &container;
+return container.MemberVar = 3; // Break here
 }
Index: 
packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -38,6 +38,35 @@
 """Test that 'de' completes to 'detach '."""
 self.complete_from_to('de', 'detach ')
 
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_frame_variable(self):
+self.build()
+self.main_source = "main.cpp"
+self.main_source_spec = lldb.SBFileSpec(self.main_source)
+self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+
+(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
+  '// Break here', 
self.main_source_spec)
+self.assertEquals(process.GetState(), lldb.eStateStopped)
+# FIXME: This pulls in the debug information to make the completions 
work,
+# but the completions should also work without.
+self.runCmd("frame variable fooo")
+
+self.complete_from_to('frame variable fo', 'frame variable fooo')
+self.complete_from_to('frame variable fooo.', 'frame variable fooo.')
+self.complete_from_to('frame variable fooo.dd', 'frame variable 
fooo.dd')
+
+self.complete_from_to('frame variable ptr_fooo->', 'frame variable 
ptr_fooo->')
+self.complete_from_to('frame variable ptr_fooo->dd', 'frame variable 
ptr_fooo->dd')
+
+self.complete_from_to('frame variable cont', 'frame variable 
container')
+self.complete_from_to('frame variable container.', 'frame variable 
container.MemberVar')
+self.complete_from_to('frame variable container.Mem', 'frame variable 
container.MemberVar')
+
+self.complete_from_to('frame variable ptr_cont', 'frame variable 
ptr_container')
+self.complete_from_to('frame variable ptr_container->', 'frame 
variable ptr_container->MemberVar')
+self.complete_from_to('frame variable ptr_container->Mem', 'frame 
variable ptr_container->MemberVar')
+
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_process_attach_dash_dash_con(self):
 """Test that 'process attach --con' completes to 'process attach 
--continue '."""


Index: source/Symbol/Variable.cpp
===
--- source/Symbol/Variable.cpp
+++ source/Symbol/Variable.cpp
@@ -644,11 +644,11 @@
   break;
 
 case '-':
-  if (partial_path[1] == '>' && !prefix_path.str().empty()) {
+  if (partial_path.size() > 1 && partial_path[1] == '>' && !prefix_path.str().empty()) {
 switch (type_class) {
 case lldb::eTypeClassPointer: {
   CompilerType pointee_type(compile

[Lldb-commits] [PATCH] D49949: Add missing boundary checks to variable completion.

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 157803.
teemperor added a comment.

- Fixed formatting.


https://reviews.llvm.org/D49949

Files:
  packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  packages/Python/lldbsuite/test/functionalities/completion/main.cpp
  source/Symbol/Variable.cpp

Index: source/Symbol/Variable.cpp
===
--- source/Symbol/Variable.cpp
+++ source/Symbol/Variable.cpp
@@ -644,11 +644,12 @@
   break;
 
 case '-':
-  if (partial_path[1] == '>' && !prefix_path.str().empty()) {
+  if (partial_path.size() > 1 && partial_path[1] == '>' &&
+  !prefix_path.str().empty()) {
 switch (type_class) {
 case lldb::eTypeClassPointer: {
   CompilerType pointee_type(compiler_type.GetPointeeType());
-  if (partial_path[2]) {
+  if (partial_path.size() > 2 && partial_path[2]) {
 // If there is more after the "->", then search deeper
 PrivateAutoComplete(
 frame, partial_path.substr(2), prefix_path + "->",
@@ -672,7 +673,7 @@
 case lldb::eTypeClassUnion:
 case lldb::eTypeClassStruct:
 case lldb::eTypeClassClass:
-  if (partial_path[1]) {
+  if (partial_path.size() > 1 && partial_path[1]) {
 // If there is more after the ".", then search deeper
 PrivateAutoComplete(frame, partial_path.substr(1),
 prefix_path + ".", compiler_type, matches,
Index: packages/Python/lldbsuite/test/functionalities/completion/main.cpp
===
--- packages/Python/lldbsuite/test/functionalities/completion/main.cpp
+++ packages/Python/lldbsuite/test/functionalities/completion/main.cpp
@@ -7,8 +7,15 @@
 }
 };
 
+struct Container { int MemberVar; };
+
 int main()
 {
-Foo f;
-f.Bar(1, 2);
+Foo fooo;
+Foo *ptr_fooo = &fooo;
+fooo.Bar(1, 2);
+
+Container container;
+Container *ptr_container = &container;
+return container.MemberVar = 3; // Break here
 }
Index: packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -38,6 +38,46 @@
 """Test that 'de' completes to 'detach '."""
 self.complete_from_to('de', 'detach ')
 
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_frame_variable(self):
+self.build()
+self.main_source = "main.cpp"
+self.main_source_spec = lldb.SBFileSpec(self.main_source)
+self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+
+(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
+  '// Break here', self.main_source_spec)
+self.assertEquals(process.GetState(), lldb.eStateStopped)
+# FIXME: This pulls in the debug information to make the completions work,
+# but the completions should also work without.
+self.runCmd("frame variable fooo")
+
+self.complete_from_to('frame variable fo',
+  'frame variable fooo')
+self.complete_from_to('frame variable fooo.',
+  'frame variable fooo.')
+self.complete_from_to('frame variable fooo.dd',
+  'frame variable fooo.dd')
+
+self.complete_from_to('frame variable ptr_fooo->',
+  'frame variable ptr_fooo->')
+self.complete_from_to('frame variable ptr_fooo->dd',
+  'frame variable ptr_fooo->dd')
+
+self.complete_from_to('frame variable cont',
+  'frame variable container')
+self.complete_from_to('frame variable container.',
+  'frame variable container.MemberVar')
+self.complete_from_to('frame variable container.Mem',
+  'frame variable container.MemberVar')
+
+self.complete_from_to('frame variable ptr_cont',
+  'frame variable ptr_container')
+self.complete_from_to('frame variable ptr_container->',
+  'frame variable ptr_container->MemberVar')
+self.complete_from_to('frame variable ptr_container->Mem',
+  'frame variable ptr_container->MemberVar')
+
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_process_attach_dash_dash_con(self):
 """Test that 'process attach --con' completes to 'process attach --continue '."""
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r338177 - Add missing boundary checks to variable completion.

2018-07-27 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Jul 27 16:37:08 2018
New Revision: 338177

URL: http://llvm.org/viewvc/llvm-project?rev=338177&view=rev
Log:
Add missing boundary checks to variable completion.

Summary: Stopgap patch to at least stop all the crashes I get from this code.

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
lldb/trunk/source/Symbol/Variable.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py?rev=338177&r1=338176&r2=338177&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 Fri Jul 27 16:37:08 2018
@@ -39,6 +39,46 @@ class CommandLineCompletionTestCase(Test
 self.complete_from_to('de', 'detach ')
 
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_frame_variable(self):
+self.build()
+self.main_source = "main.cpp"
+self.main_source_spec = lldb.SBFileSpec(self.main_source)
+self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+
+(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
+  '// Break here', 
self.main_source_spec)
+self.assertEquals(process.GetState(), lldb.eStateStopped)
+# FIXME: This pulls in the debug information to make the completions 
work,
+# but the completions should also work without.
+self.runCmd("frame variable fooo")
+
+self.complete_from_to('frame variable fo',
+  'frame variable fooo')
+self.complete_from_to('frame variable fooo.',
+  'frame variable fooo.')
+self.complete_from_to('frame variable fooo.dd',
+  'frame variable fooo.dd')
+
+self.complete_from_to('frame variable ptr_fooo->',
+  'frame variable ptr_fooo->')
+self.complete_from_to('frame variable ptr_fooo->dd',
+  'frame variable ptr_fooo->dd')
+
+self.complete_from_to('frame variable cont',
+  'frame variable container')
+self.complete_from_to('frame variable container.',
+  'frame variable container.MemberVar')
+self.complete_from_to('frame variable container.Mem',
+  'frame variable container.MemberVar')
+
+self.complete_from_to('frame variable ptr_cont',
+  'frame variable ptr_container')
+self.complete_from_to('frame variable ptr_container->',
+  'frame variable ptr_container->MemberVar')
+self.complete_from_to('frame variable ptr_container->Mem',
+  'frame variable ptr_container->MemberVar')
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_process_attach_dash_dash_con(self):
 """Test that 'process attach --con' completes to 'process attach 
--continue '."""
 self.complete_from_to(

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/main.cpp?rev=338177&r1=338176&r2=338177&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/main.cpp 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/main.cpp 
Fri Jul 27 16:37:08 2018
@@ -7,8 +7,15 @@ public:
 }
 };
 
+struct Container { int MemberVar; };
+
 int main()
 {
-Foo f;
-f.Bar(1, 2);
+Foo fooo;
+Foo *ptr_fooo = &fooo;
+fooo.Bar(1, 2);
+
+Container container;
+Container *ptr_container = &container;
+return container.MemberVar = 3; // Break here
 }

Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=338177&r1=338176&r2=338177&view=diff
==
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Fri Jul 27 16:37:08 2018
@@ -644,11 +644,12 @@ static void PrivateAutoComplete(
   break;
 
 case '-':
-  if (partial_path[1] == '>' && !prefix_path.str().empty()) {
+  if (partial_path.size() > 1 && partial_path[1] == '>' &&
+  

[Lldb-commits] [PATCH] D49949: Add missing boundary checks to variable completion.

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338177: Add missing boundary checks to variable completion. 
(authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49949?vs=157803&id=157805#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49949

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
  lldb/trunk/source/Symbol/Variable.cpp

Index: lldb/trunk/source/Symbol/Variable.cpp
===
--- lldb/trunk/source/Symbol/Variable.cpp
+++ lldb/trunk/source/Symbol/Variable.cpp
@@ -644,11 +644,12 @@
   break;
 
 case '-':
-  if (partial_path[1] == '>' && !prefix_path.str().empty()) {
+  if (partial_path.size() > 1 && partial_path[1] == '>' &&
+  !prefix_path.str().empty()) {
 switch (type_class) {
 case lldb::eTypeClassPointer: {
   CompilerType pointee_type(compiler_type.GetPointeeType());
-  if (partial_path[2]) {
+  if (partial_path.size() > 2 && partial_path[2]) {
 // If there is more after the "->", then search deeper
 PrivateAutoComplete(
 frame, partial_path.substr(2), prefix_path + "->",
@@ -672,7 +673,7 @@
 case lldb::eTypeClassUnion:
 case lldb::eTypeClassStruct:
 case lldb::eTypeClassClass:
-  if (partial_path[1]) {
+  if (partial_path.size() > 1 && partial_path[1]) {
 // If there is more after the ".", then search deeper
 PrivateAutoComplete(frame, partial_path.substr(1),
 prefix_path + ".", compiler_type, matches,
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
@@ -7,8 +7,15 @@
 }
 };
 
+struct Container { int MemberVar; };
+
 int main()
 {
-Foo f;
-f.Bar(1, 2);
+Foo fooo;
+Foo *ptr_fooo = &fooo;
+fooo.Bar(1, 2);
+
+Container container;
+Container *ptr_container = &container;
+return container.MemberVar = 3; // Break here
 }
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -39,6 +39,46 @@
 self.complete_from_to('de', 'detach ')
 
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_frame_variable(self):
+self.build()
+self.main_source = "main.cpp"
+self.main_source_spec = lldb.SBFileSpec(self.main_source)
+self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+
+(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
+  '// Break here', self.main_source_spec)
+self.assertEquals(process.GetState(), lldb.eStateStopped)
+# FIXME: This pulls in the debug information to make the completions work,
+# but the completions should also work without.
+self.runCmd("frame variable fooo")
+
+self.complete_from_to('frame variable fo',
+  'frame variable fooo')
+self.complete_from_to('frame variable fooo.',
+  'frame variable fooo.')
+self.complete_from_to('frame variable fooo.dd',
+  'frame variable fooo.dd')
+
+self.complete_from_to('frame variable ptr_fooo->',
+  'frame variable ptr_fooo->')
+self.complete_from_to('frame variable ptr_fooo->dd',
+  'frame variable ptr_fooo->dd')
+
+self.complete_from_to('frame variable cont',
+  'frame variable container')
+self.complete_from_to('frame variable container.',
+  'frame variable container.MemberVar')
+self.complete_from_to('frame variable container.Mem',
+  'frame variable container.MemberVar')
+
+self.complete_from_to('frame variable ptr_cont',
+  'frame variable ptr_container')
+self.complete_from_to('frame variable ptr_container->',
+  'frame variable ptr_container->MemberVar')
+self.complete_from_to('frame variable ptr_container->Mem',
+  'fra

[Lldb-commits] [lldb] r338178 - Revert "Stop building liblldb with CMake's framework functionality"

2018-07-27 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Fri Jul 27 16:38:58 2018
New Revision: 338178

URL: http://llvm.org/viewvc/llvm-project?rev=338178&view=rev
Log:
Revert "Stop building liblldb with CMake's framework functionality"

This reverts r338154. This change is actually unnecessary, as the CMake
bug I referred to was actually not a bug but a misunderstanding of
CMake.

Original Differential Revision: https://reviews.llvm.org/D49888

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/cmake/modules/LLDBConfig.cmake
lldb/trunk/cmake/modules/LLDBFramework.cmake
lldb/trunk/scripts/CMakeLists.txt
lldb/trunk/source/API/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=338178&r1=338177&r2=338178&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Fri Jul 27 16:38:58 2018
@@ -51,16 +51,15 @@ if(LLDB_BUILD_FRAMEWORK)
 message(FATAL_ERROR "LLDB.framework can only be generated when targeting 
Apple platforms")
   endif()
 
-  add_custom_target(lldb-framework)
-  set(LLDB_SUITE_TARGET lldb-framework)
-  set(LLDB_FRAMEWORK_DIR
-
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework)
   # These are used to fill out LLDB-Info.plist. These are relevant when 
building
   # the framework, and must be defined before building liblldb.
   set(PRODUCT_NAME "LLDB")
   set(EXECUTABLE_NAME "LLDB")
   set(CURRENT_PROJECT_VERSION "360.99.0")
-  include(LLDBFramework)
+  set(LLDB_SUITE_TARGET lldb-framework)
+
+  set(LLDB_FRAMEWORK_DIR
+${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
 endif()
 
 add_subdirectory(docs)
@@ -72,7 +71,7 @@ if (NOT LLDB_DISABLE_PYTHON)
   set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts)
   set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
   if(LLDB_BUILD_FRAMEWORK)
-set(LLDB_PYTHON_TARGET_DIR "${LLDB_FRAMEWORK_DIR}/..")
+set(LLDB_PYTHON_TARGET_DIR ${LLDB_FRAMEWORK_DIR})
 set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp)
   else()
 # Don't set -m when building the framework.
@@ -163,6 +162,11 @@ if(LLDB_INCLUDE_TESTS)
   add_subdirectory(utils/lldb-dotest)
 endif()
 
+if (LLDB_BUILD_FRAMEWORK)
+  add_custom_target(lldb-framework)
+  include(LLDBFramework)
+endif()
+
 if (NOT LLDB_DISABLE_PYTHON)
 # Add a Post-Build Event to copy over Python files and create the symlink
 # to liblldb.so for the Python API(hardlink on Windows)

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=338178&r1=338177&r2=338178&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Fri Jul 27 16:38:58 2018
@@ -52,7 +52,7 @@ function(add_lldb_library name)
   if (PARAM_SHARED)
 set(out_dir lib${LLVM_LIBDIR_SUFFIX})
 if(${name} STREQUAL "liblldb" AND LLDB_BUILD_FRAMEWORK)
-  set(out_dir 
${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION})
+  set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
 endif()
 install(TARGETS ${name}
   COMPONENT ${name}
@@ -108,7 +108,7 @@ function(add_lldb_executable name)
   endif()
   string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR})
   set_target_properties(${name} PROPERTIES
-RUNTIME_OUTPUT_DIRECTORY 
${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}
+RUNTIME_OUTPUT_DIRECTORY $${resource_dir}
 BUILD_WITH_INSTALL_RPATH On
 INSTALL_RPATH 
"@loader_path/../../../${resource_dots}${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
 endif()
@@ -123,7 +123,7 @@ function(add_lldb_executable name)
   if(ARG_GENERATE_INSTALL)
 set(out_dir "bin")
 if (LLDB_BUILD_FRAMEWORK AND ARG_INCLUDE_IN_SUITE)
-  set(out_dir 
${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/${LLDB_FRAMEWORK_RESOURCE_DIR})
+  set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
 endif()
 install(TARGETS ${name}
   COMPONENT ${name}

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=338178&r1=338177&r2=338178&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Fri Jul 27 16:38:58 2018
@@ -326,9 +326,7 @@ if (APPLE)
   set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Output 
directory for LLDB.framework")
   set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default 
is A)")
   set(LLDB_FRAMEWORK_RESOURCE_DIR
-Versions/${LLDB_FRA

[Lldb-commits] [PATCH] D49947: Add the actually calculated completions to COMPLETION_MSG

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 157806.
teemperor added a comment.

- FIxed formatting.


https://reviews.llvm.org/D49947

Files:
  packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  packages/Python/lldbsuite/test/lldbtest.py


Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -184,9 +184,10 @@
 return "Command '%s' returns successfully" % str
 
 
-def COMPLETION_MSG(str_before, str_after):
+def COMPLETION_MSG(str_before, str_after, completions):
 '''A generic message generator for the completion mechanism.'''
-return "'%s' successfully completes to '%s'" % (str_before, str_after)
+return ("'%s' successfully completes to '%s', but completions were:\n%s"
+   % (str_before, str_after, "\n".join(completions)))
 
 
 def EXP_MSG(str, actual, exe):
Index: 
packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -273,8 +273,8 @@
 if turn_off_re_match:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, substrs=[p])
+str_input, p, match_strings), exe=False, substrs=[p])
 else:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, patterns=[p])
+str_input, p, match_strings), exe=False, patterns=[p])


Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -184,9 +184,10 @@
 return "Command '%s' returns successfully" % str
 
 
-def COMPLETION_MSG(str_before, str_after):
+def COMPLETION_MSG(str_before, str_after, completions):
 '''A generic message generator for the completion mechanism.'''
-return "'%s' successfully completes to '%s'" % (str_before, str_after)
+return ("'%s' successfully completes to '%s', but completions were:\n%s"
+   % (str_before, str_after, "\n".join(completions)))
 
 
 def EXP_MSG(str, actual, exe):
Index: packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -273,8 +273,8 @@
 if turn_off_re_match:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, substrs=[p])
+str_input, p, match_strings), exe=False, substrs=[p])
 else:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, patterns=[p])
+str_input, p, match_strings), exe=False, patterns=[p])
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r338179 - Add the actually calculated completions to COMPLETION_MSG

2018-07-27 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Jul 27 16:42:34 2018
New Revision: 338179

URL: http://llvm.org/viewvc/llvm-project?rev=338179&view=rev
Log:
Add the actually calculated completions to COMPLETION_MSG

Summary: Otherwise this assertion message is not very useful to whoever is 
reading the log.

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py?rev=338179&r1=338178&r2=338179&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 Fri Jul 27 16:42:34 2018
@@ -313,8 +313,8 @@ class CommandLineCompletionTestCase(Test
 if turn_off_re_match:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, substrs=[p])
+str_input, p, match_strings), exe=False, substrs=[p])
 else:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, patterns=[p])
+str_input, p, match_strings), exe=False, patterns=[p])

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=338179&r1=338178&r2=338179&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Jul 27 16:42:34 
2018
@@ -184,9 +184,10 @@ def CMD_MSG(str):
 return "Command '%s' returns successfully" % str
 
 
-def COMPLETION_MSG(str_before, str_after):
+def COMPLETION_MSG(str_before, str_after, completions):
 '''A generic message generator for the completion mechanism.'''
-return "'%s' successfully completes to '%s'" % (str_before, str_after)
+return ("'%s' successfully completes to '%s', but completions were:\n%s"
+   % (str_before, str_after, "\n".join(completions)))
 
 
 def EXP_MSG(str, actual, exe):


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


[Lldb-commits] [PATCH] D49947: Add the actually calculated completions to COMPLETION_MSG

2018-07-27 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338179: Add the actually calculated completions to 
COMPLETION_MSG (authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49947?vs=157806&id=157807#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49947

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py


Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -184,9 +184,10 @@
 return "Command '%s' returns successfully" % str
 
 
-def COMPLETION_MSG(str_before, str_after):
+def COMPLETION_MSG(str_before, str_after, completions):
 '''A generic message generator for the completion mechanism.'''
-return "'%s' successfully completes to '%s'" % (str_before, str_after)
+return ("'%s' successfully completes to '%s', but completions were:\n%s"
+   % (str_before, str_after, "\n".join(completions)))
 
 
 def EXP_MSG(str, actual, exe):
Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -313,8 +313,8 @@
 if turn_off_re_match:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, substrs=[p])
+str_input, p, match_strings), exe=False, substrs=[p])
 else:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, patterns=[p])
+str_input, p, match_strings), exe=False, patterns=[p])


Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -184,9 +184,10 @@
 return "Command '%s' returns successfully" % str
 
 
-def COMPLETION_MSG(str_before, str_after):
+def COMPLETION_MSG(str_before, str_after, completions):
 '''A generic message generator for the completion mechanism.'''
-return "'%s' successfully completes to '%s'" % (str_before, str_after)
+return ("'%s' successfully completes to '%s', but completions were:\n%s"
+   % (str_before, str_after, "\n".join(completions)))
 
 
 def EXP_MSG(str, actual, exe):
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -313,8 +313,8 @@
 if turn_off_re_match:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, substrs=[p])
+str_input, p, match_strings), exe=False, substrs=[p])
 else:
 self.expect(
 compare_string, msg=COMPLETION_MSG(
-str_input, p), exe=False, patterns=[p])
+str_input, p, match_strings), exe=False, patterns=[p])
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits