[Lldb-commits] [PATCH] D70979: [lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTriple

2019-12-03 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2f1e7b3d01e1: [lldb][NFC] Migrate to raw_ostream in 
ArchSpec::DumpTriple (authored by teemperor).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70979

Files:
  lldb/include/lldb/Core/ModuleSpec.h
  lldb/include/lldb/Utility/ArchSpec.h
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/TargetList.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/source/Utility/ProcessInfo.cpp

Index: lldb/source/Utility/ProcessInfo.cpp
===
--- lldb/source/Utility/ProcessInfo.cpp
+++ lldb/source/Utility/ProcessInfo.cpp
@@ -49,7 +49,7 @@
 void ProcessInfo::Dump(Stream , Platform *platform) const {
   s << "Executable: " << GetName() << "\n";
   s << "Triple: ";
-  m_arch.DumpTriple(s);
+  m_arch.DumpTriple(s.AsRawOstream());
   s << "\n";
 
   s << "Arguments:\n";
@@ -137,7 +137,7 @@
 
   if (m_arch.IsValid()) {
 s.Printf("   arch = ");
-m_arch.DumpTriple(s);
+m_arch.DumpTriple(s.AsRawOstream());
 s.EOL();
   }
 
@@ -189,7 +189,7 @@
 
 StreamString arch_strm;
 if (m_arch.IsValid())
-  m_arch.DumpTriple(arch_strm);
+  m_arch.DumpTriple(arch_strm.AsRawOstream());
 
 auto print = [&](bool (ProcessInstanceInfo::*isValid)() const,
  uint32_t (ProcessInstanceInfo::*getID)() const,
Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -1450,17 +1450,17 @@
   return false;
 }
 
-void ArchSpec::DumpTriple(Stream ) const {
+void ArchSpec::DumpTriple(llvm::raw_ostream ) const {
   const llvm::Triple  = GetTriple();
   llvm::StringRef arch_str = triple.getArchName();
   llvm::StringRef vendor_str = triple.getVendorName();
   llvm::StringRef os_str = triple.getOSName();
   llvm::StringRef environ_str = triple.getEnvironmentName();
 
-  s.Printf("%s-%s-%s", arch_str.empty() ? "*" : arch_str.str().c_str(),
-   vendor_str.empty() ? "*" : vendor_str.str().c_str(),
-   os_str.empty() ? "*" : os_str.str().c_str());
+  s << llvm::formatv("{0}-{1}-{2}", arch_str.empty() ? "*" : arch_str,
+ vendor_str.empty() ? "*" : vendor_str,
+ os_str.empty() ? "*" : os_str);
 
   if (!environ_str.empty())
-s.Printf("-%s", environ_str.str().c_str());
+s << "-" << environ_str;
 }
Index: lldb/source/Target/TargetList.cpp
===
--- lldb/source/Target/TargetList.cpp
+++ lldb/source/Target/TargetList.cpp
@@ -144,9 +144,9 @@
   StreamString platform_arch_strm;
   StreamString module_arch_strm;
 
-  platform_arch.DumpTriple(platform_arch_strm);
+  platform_arch.DumpTriple(platform_arch_strm.AsRawOstream());
   matching_module_spec.GetArchitecture().DumpTriple(
-  module_arch_strm);
+  module_arch_strm.AsRawOstream());
   error.SetErrorStringWithFormat(
   "the specified architecture '%s' is not compatible with '%s' "
   "in '%s'",
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -406,7 +406,7 @@
   if (arch.IsValid()) {
 if (!arch.GetTriple().str().empty()) {
   strm.Printf("Triple: ");
-  arch.DumpTriple(strm);
+  arch.DumpTriple(strm.AsRawOstream());
   strm.EOL();
 }
   }
Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -78,7 +78,7 @@
   uint32_t properties = 0;
   if (target_arch.IsValid()) {
 strm.Printf("%sarch=", properties++ > 0 ? ", " : " ( ");
-target_arch.DumpTriple(strm);
+target_arch.DumpTriple(strm.AsRawOstream());
 properties++;
   }
   PlatformSP platform_sp(target->GetPlatform());
@@ -1291,7 +1291,7 @@
 StreamString arch_strm;
 
 if (full_triple)
-  module->GetArchitecture().DumpTriple(arch_strm);
+  module->GetArchitecture().DumpTriple(arch_strm.AsRawOstream());
 else
   arch_strm.PutCString(module->GetArchitecture().GetArchitectureName());
 std::string arch_str = arch_strm.GetString();
Index: lldb/include/lldb/Utility/ArchSpec.h
===
--- lldb/include/lldb/Utility/ArchSpec.h
+++ lldb/include/lldb/Utility/ArchSpec.h
@@ -433,7 +433,7 @@
   /// \return A triple describing this ArchSpec.
   const llvm::Triple () const { return m_triple; }
 
-  void DumpTriple(Stream ) const;
+  void 

[Lldb-commits] [lldb] 2f1e7b3 - [lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTriple

2019-12-03 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-12-04T08:28:52+01:00
New Revision: 2f1e7b3d01e176e912477d52847c19d3847a43a0

URL: 
https://github.com/llvm/llvm-project/commit/2f1e7b3d01e176e912477d52847c19d3847a43a0
DIFF: 
https://github.com/llvm/llvm-project/commit/2f1e7b3d01e176e912477d52847c19d3847a43a0.diff

LOG: [lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTriple

Reviewers: labath, davide

Reviewed By: davide

Subscribers: clayborg, JDevlieghere, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/include/lldb/Core/ModuleSpec.h
lldb/include/lldb/Utility/ArchSpec.h
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Target/Platform.cpp
lldb/source/Target/TargetList.cpp
lldb/source/Utility/ArchSpec.cpp
lldb/source/Utility/ProcessInfo.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/ModuleSpec.h 
b/lldb/include/lldb/Core/ModuleSpec.h
index 651d0dc869bc..26be59e3f4ae 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -207,7 +207,7 @@ class ModuleSpec {
   if (dumped_something)
 strm.PutCString(", ");
   strm.Printf("arch = ");
-  m_arch.DumpTriple(strm);
+  m_arch.DumpTriple(strm.AsRawOstream());
   dumped_something = true;
 }
 if (m_uuid.IsValid()) {

diff  --git a/lldb/include/lldb/Utility/ArchSpec.h 
b/lldb/include/lldb/Utility/ArchSpec.h
index ae7958376832..15e2fdb10c32 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -433,7 +433,7 @@ class ArchSpec {
   /// \return A triple describing this ArchSpec.
   const llvm::Triple () const { return m_triple; }
 
-  void DumpTriple(Stream ) const;
+  void DumpTriple(llvm::raw_ostream ) const;
 
   /// Architecture triple setter.
   ///

diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 9f4e58e55e5d..ac3188740234 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -78,7 +78,7 @@ static void DumpTargetInfo(uint32_t target_idx, Target 
*target,
   uint32_t properties = 0;
   if (target_arch.IsValid()) {
 strm.Printf("%sarch=", properties++ > 0 ? ", " : " ( ");
-target_arch.DumpTriple(strm);
+target_arch.DumpTriple(strm.AsRawOstream());
 properties++;
   }
   PlatformSP platform_sp(target->GetPlatform());
@@ -1291,7 +1291,7 @@ static void DumpModuleArchitecture(Stream , Module 
*module,
 StreamString arch_strm;
 
 if (full_triple)
-  module->GetArchitecture().DumpTriple(arch_strm);
+  module->GetArchitecture().DumpTriple(arch_strm.AsRawOstream());
 else
   arch_strm.PutCString(module->GetArchitecture().GetArchitectureName());
 std::string arch_str = arch_strm.GetString();

diff  --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index c9849a9e5f09..aaf48f35f921 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -406,7 +406,7 @@ void Platform::GetStatus(Stream ) {
   if (arch.IsValid()) {
 if (!arch.GetTriple().str().empty()) {
   strm.Printf("Triple: ");
-  arch.DumpTriple(strm);
+  arch.DumpTriple(strm.AsRawOstream());
   strm.EOL();
 }
   }

diff  --git a/lldb/source/Target/TargetList.cpp 
b/lldb/source/Target/TargetList.cpp
index 7c7a36e97bbf..ebd02a504d09 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -144,9 +144,9 @@ Status TargetList::CreateTargetInternal(
   StreamString platform_arch_strm;
   StreamString module_arch_strm;
 
-  platform_arch.DumpTriple(platform_arch_strm);
+  platform_arch.DumpTriple(platform_arch_strm.AsRawOstream());
   matching_module_spec.GetArchitecture().DumpTriple(
-  module_arch_strm);
+  module_arch_strm.AsRawOstream());
   error.SetErrorStringWithFormat(
   "the specified architecture '%s' is not compatible with '%s' 
"
   "in '%s'",

diff  --git a/lldb/source/Utility/ArchSpec.cpp 
b/lldb/source/Utility/ArchSpec.cpp
index 38f6752b0348..2bebecb2c677 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -1450,17 +1450,17 @@ bool ArchSpec::IsAlwaysThumbInstructions() const {
   return false;
 }
 
-void ArchSpec::DumpTriple(Stream ) const {
+void ArchSpec::DumpTriple(llvm::raw_ostream ) const {
   const llvm::Triple  = GetTriple();
   llvm::StringRef arch_str = triple.getArchName();
   llvm::StringRef vendor_str = triple.getVendorName();
   llvm::StringRef os_str = triple.getOSName();
   llvm::StringRef environ_str = triple.getEnvironmentName();
 
-  s.Printf("%s-%s-%s", arch_str.empty() ? "*" : arch_str.str().c_str(),
-   vendor_str.empty() ? "*" : 

[Lldb-commits] [PATCH] D70992: Replacing to use of ul suffix in GetMaxU64Bitfield since it not guarenteed to be 64 bit

2019-12-03 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik created this revision.
shafik added reviewers: aprantl, teemperor, JDevlieghere.

`GetMaxU64Bitfield(...)` uses the `ul` suffix but we require a 64 bit unsigned 
integer and `ul` could be 32 bit. So this replacing it with a explicit cast and 
refactors the code around it to use an early exit.

This bug came up in [[lldb-dev] Possible bug in 
DataExtractor::GetMaxU64Bitfield](http://lists.llvm.org/pipermail/lldb-dev/2019-November/015780.html).


https://reviews.llvm.org/D70992

Files:
  lldb/source/Utility/DataExtractor.cpp
  lldb/unittests/Utility/DataExtractorTest.cpp


Index: lldb/unittests/Utility/DataExtractorTest.cpp
===
--- lldb/unittests/Utility/DataExtractorTest.cpp
+++ lldb/unittests/Utility/DataExtractorTest.cpp
@@ -13,7 +13,7 @@
 using namespace lldb_private;
 
 TEST(DataExtractorTest, GetBitfield) {
-  uint8_t buffer[] = {0x01, 0x23, 0x45, 0x67};
+  uint8_t buffer[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
   DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle,
sizeof(void *));
   DataExtractor BE(buffer, sizeof(buffer), lldb::eByteOrderBig, sizeof(void 
*));
@@ -24,6 +24,15 @@
   ASSERT_EQ(buffer[1], LE.GetMaxU64Bitfield(, sizeof(buffer), 8, 8));
   offset = 0;
   ASSERT_EQ(buffer[1], BE.GetMaxU64Bitfield(, sizeof(buffer), 8, 8));
+  offset = 0;
+  ASSERT_EQ(static_cast(0x0123456789ABCDEF),
+BE.GetMaxU64Bitfield(, sizeof(buffer), 64, 0));
+  offset = 0;
+  ASSERT_EQ(static_cast(0x01234567),
+BE.GetMaxU64Bitfield(, sizeof(buffer), 32, 0));
+  offset = 0;
+  ASSERT_EQ(static_cast(0x012345678),
+BE.GetMaxU64Bitfield(, sizeof(buffer), 36, 0));
 
   offset = 0;
   ASSERT_EQ(int8_t(buffer[1]),
Index: lldb/source/Utility/DataExtractor.cpp
===
--- lldb/source/Utility/DataExtractor.cpp
+++ lldb/source/Utility/DataExtractor.cpp
@@ -577,18 +577,28 @@
 uint64_t DataExtractor::GetMaxU64Bitfield(offset_t *offset_ptr, size_t size,
   uint32_t bitfield_bit_size,
   uint32_t bitfield_bit_offset) const {
+  assert(bitfield_bit_size <= 64);
   uint64_t uval64 = GetMaxU64(offset_ptr, size);
-  if (bitfield_bit_size > 0) {
-int32_t lsbcount = bitfield_bit_offset;
-if (m_byte_order == eByteOrderBig)
-  lsbcount = size * 8 - bitfield_bit_offset - bitfield_bit_size;
-if (lsbcount > 0)
-  uval64 >>= lsbcount;
-uint64_t bitfield_mask = ((1ul << bitfield_bit_size) - 1);
-if (!bitfield_mask && bitfield_bit_offset == 0 && bitfield_bit_size == 64)
-  return uval64;
-uval64 &= bitfield_mask;
-  }
+
+  if (bitfield_bit_size == 0)
+return uval64;
+
+  int32_t lsbcount = bitfield_bit_offset;
+  if (m_byte_order == eByteOrderBig)
+lsbcount = size * 8 - bitfield_bit_offset - bitfield_bit_size;
+
+  if (lsbcount > 0)
+uval64 >>= lsbcount;
+
+  uint64_t bitfield_mask =
+  (bitfield_bit_size == 64
+   ? -static_cast(1)
+   : ((static_cast(1) << bitfield_bit_size) - 1));
+  if (!bitfield_mask && bitfield_bit_offset == 0 && bitfield_bit_size == 64)
+return uval64;
+
+  uval64 &= bitfield_mask;
+
   return uval64;
 }
 


Index: lldb/unittests/Utility/DataExtractorTest.cpp
===
--- lldb/unittests/Utility/DataExtractorTest.cpp
+++ lldb/unittests/Utility/DataExtractorTest.cpp
@@ -13,7 +13,7 @@
 using namespace lldb_private;
 
 TEST(DataExtractorTest, GetBitfield) {
-  uint8_t buffer[] = {0x01, 0x23, 0x45, 0x67};
+  uint8_t buffer[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
   DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle,
sizeof(void *));
   DataExtractor BE(buffer, sizeof(buffer), lldb::eByteOrderBig, sizeof(void *));
@@ -24,6 +24,15 @@
   ASSERT_EQ(buffer[1], LE.GetMaxU64Bitfield(, sizeof(buffer), 8, 8));
   offset = 0;
   ASSERT_EQ(buffer[1], BE.GetMaxU64Bitfield(, sizeof(buffer), 8, 8));
+  offset = 0;
+  ASSERT_EQ(static_cast(0x0123456789ABCDEF),
+BE.GetMaxU64Bitfield(, sizeof(buffer), 64, 0));
+  offset = 0;
+  ASSERT_EQ(static_cast(0x01234567),
+BE.GetMaxU64Bitfield(, sizeof(buffer), 32, 0));
+  offset = 0;
+  ASSERT_EQ(static_cast(0x012345678),
+BE.GetMaxU64Bitfield(, sizeof(buffer), 36, 0));
 
   offset = 0;
   ASSERT_EQ(int8_t(buffer[1]),
Index: lldb/source/Utility/DataExtractor.cpp
===
--- lldb/source/Utility/DataExtractor.cpp
+++ lldb/source/Utility/DataExtractor.cpp
@@ -577,18 +577,28 @@
 uint64_t DataExtractor::GetMaxU64Bitfield(offset_t *offset_ptr, size_t size,
   uint32_t bitfield_bit_size,
   uint32_t bitfield_bit_offset) const {
+  assert(bitfield_bit_size <= 64);
   

[Lldb-commits] [lldb] cec8263 - [Process] GetLanguageRuntimes() takes an argument that's always constant.

2019-12-03 Thread Davide Italiano via lldb-commits

Author: Davide Italiano
Date: 2019-12-03T16:54:55-08:00
New Revision: cec82634a4034b1528940487349be14b0c405d2d

URL: 
https://github.com/llvm/llvm-project/commit/cec82634a4034b1528940487349be14b0c405d2d
DIFF: 
https://github.com/llvm/llvm-project/commit/cec82634a4034b1528940487349be14b0c405d2d.diff

LOG: [Process] GetLanguageRuntimes() takes an argument that's always constant.

And arguably `retry_if_null` isn't really descriptive of what
the flag did anyway.

Added: 


Modified: 
lldb/include/lldb/Target/Process.h
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index 81181a831a49..47c5c7870405 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -2185,11 +2185,9 @@ class Process : public 
std::enable_shared_from_this,
 
   OperatingSystem *GetOperatingSystem() { return m_os_up.get(); }
 
-  std::vector
-  GetLanguageRuntimes(bool retry_if_null = true);
+  std::vector GetLanguageRuntimes();
 
-  LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language,
-  bool retry_if_null = true);
+  LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language);
 
   bool IsPossibleDynamicValue(ValueObject _value);
 

diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index ed0b951fbce1..a731a353c1bc 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1486,8 +1486,7 @@ const lldb::ABISP ::GetABI() {
   return m_abi_sp;
 }
 
-std::vector
-Process::GetLanguageRuntimes(bool retry_if_null) {
+std::vector Process::GetLanguageRuntimes() {
   std::vector language_runtimes;
 
   if (m_finalizing)
@@ -1500,15 +1499,14 @@ Process::GetLanguageRuntimes(bool retry_if_null) {
   // yet or the proper condition for loading wasn't yet met (e.g. libc++.so
   // hadn't been loaded).
   for (const lldb::LanguageType lang_type : Language::GetSupportedLanguages()) 
{
-if (LanguageRuntime *runtime = GetLanguageRuntime(lang_type, 
retry_if_null))
+if (LanguageRuntime *runtime = GetLanguageRuntime(lang_type))
   language_runtimes.emplace_back(runtime);
   }
 
   return language_runtimes;
 }
 
-LanguageRuntime *Process::GetLanguageRuntime(lldb::LanguageType language,
- bool retry_if_null) {
+LanguageRuntime *Process::GetLanguageRuntime(lldb::LanguageType language) {
   if (m_finalizing)
 return nullptr;
 
@@ -1517,7 +1515,7 @@ LanguageRuntime 
*Process::GetLanguageRuntime(lldb::LanguageType language,
   std::lock_guard guard(m_language_runtimes_mutex);
   LanguageRuntimeCollection::iterator pos;
   pos = m_language_runtimes.find(language);
-  if (pos == m_language_runtimes.end() || (retry_if_null && !pos->second)) {
+  if (pos == m_language_runtimes.end() || !pos->second) {
 lldb::LanguageRuntimeSP runtime_sp(
 LanguageRuntime::FindPlugin(this, language));
 



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


[Lldb-commits] [PATCH] D70663: [lldb] Remove lldb's own ASTDumper

2019-12-03 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

Yeah, there was indeed some ugly code there, nice work!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70663



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


[Lldb-commits] [lldb] 11ae9dd - [ClangASTContext] Remove a very old hack.

2019-12-03 Thread Davide Italiano via lldb-commits

Author: Davide Italiano
Date: 2019-12-03T16:32:21-08:00
New Revision: 11ae9dd6576e02223e6eb10568af9e5cb45b7bc6

URL: 
https://github.com/llvm/llvm-project/commit/11ae9dd6576e02223e6eb10568af9e5cb45b7bc6
DIFF: 
https://github.com/llvm/llvm-project/commit/11ae9dd6576e02223e6eb10568af9e5cb45b7bc6.diff

LOG: [ClangASTContext] Remove a very old hack.

This was fixed in clang a while ago, and the rdar associated
is now closed.

Added: 


Modified: 
lldb/source/Symbol/ClangASTContext.cpp

Removed: 




diff  --git a/lldb/source/Symbol/ClangASTContext.cpp 
b/lldb/source/Symbol/ClangASTContext.cpp
index e683a0a9f4be..e6435a261174 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -15,24 +15,6 @@
 #include 
 #include 
 
-
-// Clang headers like to use NDEBUG inside of them to enable/disable debug
-// related features using "#ifndef NDEBUG" preprocessor blocks to do one thing
-// or another. This is bad because it means that if clang was built in release
-// mode, it assumes that you are building in release mode which is not always
-// the case. You can end up with functions that are defined as empty in header
-// files when NDEBUG is not defined, and this can cause link errors with the
-// clang .a files that you have since you might be missing functions in the .a
-// file. So we have to define NDEBUG when including clang headers to avoid any
-// mismatches. This is covered by rdar://problem/8691220
-
-#if !defined(NDEBUG) && !defined(LLVM_NDEBUG_OFF)
-#define LLDB_DEFINED_NDEBUG_FOR_CLANG
-#define NDEBUG
-// Need to include assert.h so it is as clang would expect it to be (disabled)
-#include 
-#endif
-
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTImporter.h"
 #include "clang/AST/Attr.h"
@@ -54,13 +36,6 @@
 #include "clang/Frontend/FrontendOptions.h"
 #include "clang/Sema/Sema.h"
 
-#ifdef LLDB_DEFINED_NDEBUG_FOR_CLANG
-#undef NDEBUG
-#undef LLDB_DEFINED_NDEBUG_FOR_CLANG
-// Need to re-include assert.h so it is as _we_ would expect it to be (enabled)
-#include 
-#endif
-
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/Threading.h"
 



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


[Lldb-commits] [PATCH] D70989: [TypeCategory] IsApplicable doesn't seem to apply.

2019-12-03 Thread Davide Italiano via Phabricator via lldb-commits
davide abandoned this revision.
davide added a comment.

Nevermind, I found a better way.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70989



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


[Lldb-commits] [PATCH] D70886: [lldb-vscode] capture the debuggers file handles before lldbinit runs

2019-12-03 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

We could just add a new flag to lldb-vscode like "--no-lldb-init" and always 
pass that when we run our test suite?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70886



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


[Lldb-commits] [PATCH] D70979: [lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTriple

2019-12-03 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/include/lldb/Utility/ArchSpec.h:436
 
-  void DumpTriple(Stream ) const;
+  void DumpTriple(llvm::raw_ostream ) const;
 

Should we just make a static operator << function for this instead so we can 
use in formats?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70979



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


[Lldb-commits] [PATCH] D70883: [vscode.py] Make read_packet only return None when EOF

2019-12-03 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Although I am ok with this patch, it will only work if the unexpected output 
comes before we expect any packets or perfectly in between packets. Not sure we 
should do this. For example this would work:

  random outut
  Content Length:2
  
  {}

And this would work:

  Content Length:2
  
  {}
  random outut
  Content Length:2
  
  {}

But this wouldn't:

  Content Length:2
  
  random outut
  {}

We could also end up with:

  Content Length:2
  
  
  {random outut}

where "random outut" was written to STDOUT and magically appeared between the 
two braces.

So the main question is:

- do we try and deal with random output being able to be mixed in and have our 
solution only work some of the time
- or just never allow it (current state of things)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70883



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


[Lldb-commits] [lldb] 2bb19f9 - [TypeCategory] HasLanguage() is now unused.

2019-12-03 Thread Davide Italiano via lldb-commits

Author: Davide Italiano
Date: 2019-12-03T15:45:23-08:00
New Revision: 2bb19f93f6a8d0c7ceaa41df744803480c95fe9a

URL: 
https://github.com/llvm/llvm-project/commit/2bb19f93f6a8d0c7ceaa41df744803480c95fe9a
DIFF: 
https://github.com/llvm/llvm-project/commit/2bb19f93f6a8d0c7ceaa41df744803480c95fe9a.diff

LOG: [TypeCategory] HasLanguage() is now unused.

Added: 


Modified: 
lldb/include/lldb/DataFormatters/TypeCategory.h
lldb/source/DataFormatters/TypeCategory.cpp

Removed: 




diff  --git a/lldb/include/lldb/DataFormatters/TypeCategory.h 
b/lldb/include/lldb/DataFormatters/TypeCategory.h
index 90c8a3da6005..dc5edb654940 100644
--- a/lldb/include/lldb/DataFormatters/TypeCategory.h
+++ b/lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -358,8 +358,6 @@ class TypeCategoryImpl {
 
   void AddLanguage(lldb::LanguageType lang);
 
-  bool HasLanguage(lldb::LanguageType lang);
-
   std::string GetDescription();
 
   bool AnyMatches(ConstString type_name,

diff  --git a/lldb/source/DataFormatters/TypeCategory.cpp 
b/lldb/source/DataFormatters/TypeCategory.cpp
index 9159de169f04..be3b31603eac 100644
--- a/lldb/source/DataFormatters/TypeCategory.cpp
+++ b/lldb/source/DataFormatters/TypeCategory.cpp
@@ -86,12 +86,6 @@ void TypeCategoryImpl::AddLanguage(lldb::LanguageType lang) {
   m_languages.push_back(lang);
 }
 
-bool TypeCategoryImpl::HasLanguage(lldb::LanguageType lang) {
-  const auto iter = std::find(m_languages.begin(), m_languages.end(), lang),
- end = m_languages.end();
-  return (iter != end);
-}
-
 bool TypeCategoryImpl::Get(ValueObject ,
const FormattersMatchVector ,
lldb::TypeFormatImplSP , uint32_t *reason) {



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


[Lldb-commits] [PATCH] D70989: [TypeCategory] IsApplicable doesn't seem to apply.

2019-12-03 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

This seems like it will make a lot more work happen. Many C++ formatters are 
regex based and are quite expensive to compare against type names. Seems 
worthwhile to skip if the language doesn't match?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70989



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


[Lldb-commits] [PATCH] D70989: [TypeCategory] IsApplicable doesn't seem to apply.

2019-12-03 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

Please don't merge this yet. I'm mostly trying to understand if this is dead 
code or not.

@jingham , this is one of the places in generic code where we hardcode 
knowledge about the languages. Needless to say, it causes conflicts downstream 
and feels wrong anyway.
After some amount of yak shaving I realized this is not quite used. What do you 
think about it? I thought this might be needed for some sort of filtering on 
language but I really can't seem to be able to trigger it on a testcase [or 
reading the code].


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70989



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


[Lldb-commits] [PATCH] D70989: [TypeCategory] IsApplicable doesn't seem to apply.

2019-12-03 Thread Davide Italiano via Phabricator via lldb-commits
davide created this revision.
davide added reviewers: teemperor, friss, jingham.
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70989

Files:
  lldb/include/lldb/DataFormatters/TypeCategory.h
  lldb/source/DataFormatters/TypeCategory.cpp

Index: lldb/source/DataFormatters/TypeCategory.cpp
===
--- lldb/source/DataFormatters/TypeCategory.cpp
+++ lldb/source/DataFormatters/TypeCategory.cpp
@@ -22,54 +22,6 @@
   m_validator_cont("validator", "regex-validator", clist), m_enabled(false),
   m_change_listener(clist), m_mutex(), m_name(name), m_languages() {}
 
-static bool IsApplicable(lldb::LanguageType category_lang,
- lldb::LanguageType valobj_lang) {
-  switch (category_lang) {
-  // Unless we know better, allow only exact equality.
-  default:
-return category_lang == valobj_lang;
-
-  // the C family, we consider it as one
-  case eLanguageTypeC89:
-  case eLanguageTypeC:
-  case eLanguageTypeC99:
-return valobj_lang == eLanguageTypeC89 || valobj_lang == eLanguageTypeC ||
-   valobj_lang == eLanguageTypeC99;
-
-  // ObjC knows about C and itself
-  case eLanguageTypeObjC:
-return valobj_lang == eLanguageTypeC89 || valobj_lang == eLanguageTypeC ||
-   valobj_lang == eLanguageTypeC99 || valobj_lang == eLanguageTypeObjC;
-
-  // C++ knows about C and C++
-  case eLanguageTypeC_plus_plus:
-return valobj_lang == eLanguageTypeC89 || valobj_lang == eLanguageTypeC ||
-   valobj_lang == eLanguageTypeC99 ||
-   valobj_lang == eLanguageTypeC_plus_plus;
-
-  // ObjC++ knows about C,C++,ObjC and ObjC++
-  case eLanguageTypeObjC_plus_plus:
-return valobj_lang == eLanguageTypeC89 || valobj_lang == eLanguageTypeC ||
-   valobj_lang == eLanguageTypeC99 ||
-   valobj_lang == eLanguageTypeC_plus_plus ||
-   valobj_lang == eLanguageTypeObjC;
-
-  // Categories with unspecified language match everything.
-  case eLanguageTypeUnknown:
-return true;
-  }
-}
-
-bool TypeCategoryImpl::IsApplicable(ValueObject ) {
-  lldb::LanguageType valobj_lang = valobj.GetObjectRuntimeLanguage();
-  for (size_t idx = 0; idx < GetNumLanguages(); idx++) {
-const lldb::LanguageType category_lang = GetLanguageAtIndex(idx);
-if (::IsApplicable(category_lang, valobj_lang))
-  return true;
-  }
-  return false;
-}
-
 size_t TypeCategoryImpl::GetNumLanguages() {
   if (m_languages.empty())
 return 1;
@@ -86,16 +38,10 @@
   m_languages.push_back(lang);
 }
 
-bool TypeCategoryImpl::HasLanguage(lldb::LanguageType lang) {
-  const auto iter = std::find(m_languages.begin(), m_languages.end(), lang),
- end = m_languages.end();
-  return (iter != end);
-}
-
 bool TypeCategoryImpl::Get(ValueObject ,
const FormattersMatchVector ,
lldb::TypeFormatImplSP , uint32_t *reason) {
-  if (!IsEnabled() || !IsApplicable(valobj))
+  if (!IsEnabled())
 return false;
   if (GetTypeFormatsContainer()->Get(candidates, entry, reason))
 return true;
@@ -108,7 +54,7 @@
 bool TypeCategoryImpl::Get(ValueObject ,
const FormattersMatchVector ,
lldb::TypeSummaryImplSP , uint32_t *reason) {
-  if (!IsEnabled() || !IsApplicable(valobj))
+  if (!IsEnabled())
 return false;
   if (GetTypeSummariesContainer()->Get(candidates, entry, reason))
 return true;
@@ -121,7 +67,7 @@
 bool TypeCategoryImpl::Get(ValueObject ,
const FormattersMatchVector ,
lldb::SyntheticChildrenSP , uint32_t *reason) {
-  if (!IsEnabled() || !IsApplicable(valobj))
+  if (!IsEnabled())
 return false;
   TypeFilterImpl::SharedPointer filter_sp;
   uint32_t reason_filter = 0;
Index: lldb/include/lldb/DataFormatters/TypeCategory.h
===
--- lldb/include/lldb/DataFormatters/TypeCategory.h
+++ lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -358,8 +358,6 @@
 
   void AddLanguage(lldb::LanguageType lang);
 
-  bool HasLanguage(lldb::LanguageType lang);
-
   std::string GetDescription();
 
   bool AnyMatches(ConstString type_name,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 0cfb4a6 - [FormatManager] Provide only one variant of EnableCategory.

2019-12-03 Thread Davide Italiano via lldb-commits

Author: Davide Italiano
Date: 2019-12-03T15:03:25-08:00
New Revision: 0cfb4a6b3d9556c8fc55766bce47cbb433ff19fe

URL: 
https://github.com/llvm/llvm-project/commit/0cfb4a6b3d9556c8fc55766bce47cbb433ff19fe
DIFF: 
https://github.com/llvm/llvm-project/commit/0cfb4a6b3d9556c8fc55766bce47cbb433ff19fe.diff

LOG: [FormatManager] Provide only one variant of EnableCategory.

All the callers pass a single language anyway.

Added: 


Modified: 
lldb/include/lldb/DataFormatters/FormatManager.h

Removed: 




diff  --git a/lldb/include/lldb/DataFormatters/FormatManager.h 
b/lldb/include/lldb/DataFormatters/FormatManager.h
index afaafda47e76..66df8397dfee 100644
--- a/lldb/include/lldb/DataFormatters/FormatManager.h
+++ b/lldb/include/lldb/DataFormatters/FormatManager.h
@@ -52,24 +52,15 @@ class FormatManager : public IFormatChangeListener {
   void
   EnableCategory(ConstString category_name,
  TypeCategoryMap::Position pos = TypeCategoryMap::Default) {
-EnableCategory(category_name, pos,
-   std::initializer_list());
+EnableCategory(category_name, pos, {});
   }
 
   void EnableCategory(ConstString category_name,
   TypeCategoryMap::Position pos, lldb::LanguageType lang) {
-std::initializer_list langs = {lang};
-EnableCategory(category_name, pos, langs);
-  }
-
-  void EnableCategory(ConstString category_name,
-  TypeCategoryMap::Position pos = TypeCategoryMap::Default,
-  std::initializer_list langs = {}) {
 TypeCategoryMap::ValueSP category_sp;
 if (m_categories_map.Get(category_name, category_sp) && category_sp) {
   m_categories_map.Enable(category_sp, pos);
-  for (const lldb::LanguageType lang : langs)
-category_sp->AddLanguage(lang);
+  category_sp->AddLanguage(lang);
 }
   }
 



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


[Lldb-commits] [lldb] 89618a7 - [DataVisualization] Simplify. NFCI.

2019-12-03 Thread Davide Italiano via lldb-commits

Author: Davide Italiano
Date: 2019-12-03T15:03:25-08:00
New Revision: 89618a7ce1c13dcb540d925626638c93cc85a553

URL: 
https://github.com/llvm/llvm-project/commit/89618a7ce1c13dcb540d925626638c93cc85a553
DIFF: 
https://github.com/llvm/llvm-project/commit/89618a7ce1c13dcb540d925626638c93cc85a553.diff

LOG: [DataVisualization] Simplify. NFCI.

Added: 


Modified: 
lldb/source/DataFormatters/DataVisualization.cpp

Removed: 




diff  --git a/lldb/source/DataFormatters/DataVisualization.cpp 
b/lldb/source/DataFormatters/DataVisualization.cpp
index 08b3b34447bb..e73d44f60f03 100644
--- a/lldb/source/DataFormatters/DataVisualization.cpp
+++ b/lldb/source/DataFormatters/DataVisualization.cpp
@@ -122,8 +122,7 @@ void DataVisualization::Categories::Enable(ConstString 
category,
TypeCategoryMap::Position pos) {
   if (GetFormatManager().GetCategory(category)->IsEnabled())
 GetFormatManager().DisableCategory(category);
-  GetFormatManager().EnableCategory(
-  category, pos, std::initializer_list());
+  GetFormatManager().EnableCategory(category, pos, {});
 }
 
 void DataVisualization::Categories::Enable(lldb::LanguageType lang_type) {



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


[Lldb-commits] [PATCH] D70979: [lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTriple

2019-12-03 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.

LGTM.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70979



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


[Lldb-commits] [PATCH] D70983: [TypeCategory] Nothing passes down a list of languages.

2019-12-03 Thread Davide Italiano via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG15a172bebbc5: [TypeCategory] Nothing passes down a list of 
languages. (authored by davide).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70983

Files:
  lldb/include/lldb/DataFormatters/TypeCategory.h
  lldb/source/DataFormatters/TypeCategory.cpp


Index: lldb/source/DataFormatters/TypeCategory.cpp
===
--- lldb/source/DataFormatters/TypeCategory.cpp
+++ lldb/source/DataFormatters/TypeCategory.cpp
@@ -13,18 +13,14 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeCategoryImpl::TypeCategoryImpl(
-IFormatChangeListener *clist, ConstString name,
-std::initializer_list langs)
+TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener *clist,
+   ConstString name)
 : m_format_cont("format", "regex-format", clist),
   m_summary_cont("summary", "regex-summary", clist),
   m_filter_cont("filter", "regex-filter", clist),
   m_synth_cont("synth", "regex-synth", clist),
   m_validator_cont("validator", "regex-validator", clist), 
m_enabled(false),
-  m_change_listener(clist), m_mutex(), m_name(name), m_languages() {
-  for (const lldb::LanguageType lang : langs)
-AddLanguage(lang);
-}
+  m_change_listener(clist), m_mutex(), m_name(name), m_languages() {}
 
 static bool IsApplicable(lldb::LanguageType category_lang,
  lldb::LanguageType valobj_lang) {
Index: lldb/include/lldb/DataFormatters/TypeCategory.h
===
--- lldb/include/lldb/DataFormatters/TypeCategory.h
+++ lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -214,8 +214,7 @@
 ValidatorContainer::RegexMatchForEachCallback m_validator_regex;
   };
 
-  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
-   std::initializer_list langs = {});
+  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name);
 
   template  void ForEach(const ForEachCallbacks ) {
 GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());


Index: lldb/source/DataFormatters/TypeCategory.cpp
===
--- lldb/source/DataFormatters/TypeCategory.cpp
+++ lldb/source/DataFormatters/TypeCategory.cpp
@@ -13,18 +13,14 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeCategoryImpl::TypeCategoryImpl(
-IFormatChangeListener *clist, ConstString name,
-std::initializer_list langs)
+TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener *clist,
+   ConstString name)
 : m_format_cont("format", "regex-format", clist),
   m_summary_cont("summary", "regex-summary", clist),
   m_filter_cont("filter", "regex-filter", clist),
   m_synth_cont("synth", "regex-synth", clist),
   m_validator_cont("validator", "regex-validator", clist), m_enabled(false),
-  m_change_listener(clist), m_mutex(), m_name(name), m_languages() {
-  for (const lldb::LanguageType lang : langs)
-AddLanguage(lang);
-}
+  m_change_listener(clist), m_mutex(), m_name(name), m_languages() {}
 
 static bool IsApplicable(lldb::LanguageType category_lang,
  lldb::LanguageType valobj_lang) {
Index: lldb/include/lldb/DataFormatters/TypeCategory.h
===
--- lldb/include/lldb/DataFormatters/TypeCategory.h
+++ lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -214,8 +214,7 @@
 ValidatorContainer::RegexMatchForEachCallback m_validator_regex;
   };
 
-  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
-   std::initializer_list langs = {});
+  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name);
 
   template  void ForEach(const ForEachCallbacks ) {
 GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 15a172b - [TypeCategory] Nothing passes down a list of languages.

2019-12-03 Thread Davide Italiano via lldb-commits

Author: Davide Italiano
Date: 2019-12-03T13:57:58-08:00
New Revision: 15a172bebbc5b95d05733ef842fcdbd14e9d441d

URL: 
https://github.com/llvm/llvm-project/commit/15a172bebbc5b95d05733ef842fcdbd14e9d441d
DIFF: 
https://github.com/llvm/llvm-project/commit/15a172bebbc5b95d05733ef842fcdbd14e9d441d.diff

LOG: [TypeCategory] Nothing passes down a list of languages.

Summary: This should allow further simplifications, but it's a first step.

Reviewers: teemperor, jingham, friss

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/include/lldb/DataFormatters/TypeCategory.h
lldb/source/DataFormatters/TypeCategory.cpp

Removed: 




diff  --git a/lldb/include/lldb/DataFormatters/TypeCategory.h 
b/lldb/include/lldb/DataFormatters/TypeCategory.h
index a5438226..90c8a3da6005 100644
--- a/lldb/include/lldb/DataFormatters/TypeCategory.h
+++ b/lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -214,8 +214,7 @@ class TypeCategoryImpl {
 ValidatorContainer::RegexMatchForEachCallback m_validator_regex;
   };
 
-  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
-   std::initializer_list langs = {});
+  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name);
 
   template  void ForEach(const ForEachCallbacks ) {
 GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());

diff  --git a/lldb/source/DataFormatters/TypeCategory.cpp 
b/lldb/source/DataFormatters/TypeCategory.cpp
index fed2dfb3c7c5..9159de169f04 100644
--- a/lldb/source/DataFormatters/TypeCategory.cpp
+++ b/lldb/source/DataFormatters/TypeCategory.cpp
@@ -13,18 +13,14 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeCategoryImpl::TypeCategoryImpl(
-IFormatChangeListener *clist, ConstString name,
-std::initializer_list langs)
+TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener *clist,
+   ConstString name)
 : m_format_cont("format", "regex-format", clist),
   m_summary_cont("summary", "regex-summary", clist),
   m_filter_cont("filter", "regex-filter", clist),
   m_synth_cont("synth", "regex-synth", clist),
   m_validator_cont("validator", "regex-validator", clist), 
m_enabled(false),
-  m_change_listener(clist), m_mutex(), m_name(name), m_languages() {
-  for (const lldb::LanguageType lang : langs)
-AddLanguage(lang);
-}
+  m_change_listener(clist), m_mutex(), m_name(name), m_languages() {}
 
 static bool IsApplicable(lldb::LanguageType category_lang,
  lldb::LanguageType valobj_lang) {



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


[Lldb-commits] [PATCH] D70983: [TypeCategory] Nothing passes down a list of languages.

2019-12-03 Thread Davide Italiano via Phabricator via lldb-commits
davide created this revision.
davide added reviewers: teemperor, jingham, friss.
Herald added a project: LLDB.

This should allow further simplifications, but it's a first step.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70983

Files:
  lldb/include/lldb/DataFormatters/TypeCategory.h
  lldb/source/DataFormatters/TypeCategory.cpp


Index: lldb/source/DataFormatters/TypeCategory.cpp
===
--- lldb/source/DataFormatters/TypeCategory.cpp
+++ lldb/source/DataFormatters/TypeCategory.cpp
@@ -13,18 +13,14 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeCategoryImpl::TypeCategoryImpl(
-IFormatChangeListener *clist, ConstString name,
-std::initializer_list langs)
+TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener *clist,
+   ConstString name)
 : m_format_cont("format", "regex-format", clist),
   m_summary_cont("summary", "regex-summary", clist),
   m_filter_cont("filter", "regex-filter", clist),
   m_synth_cont("synth", "regex-synth", clist),
   m_validator_cont("validator", "regex-validator", clist), 
m_enabled(false),
-  m_change_listener(clist), m_mutex(), m_name(name), m_languages() {
-  for (const lldb::LanguageType lang : langs)
-AddLanguage(lang);
-}
+  m_change_listener(clist), m_mutex(), m_name(name), m_languages() {}
 
 static bool IsApplicable(lldb::LanguageType category_lang,
  lldb::LanguageType valobj_lang) {
Index: lldb/include/lldb/DataFormatters/TypeCategory.h
===
--- lldb/include/lldb/DataFormatters/TypeCategory.h
+++ lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -214,8 +214,7 @@
 ValidatorContainer::RegexMatchForEachCallback m_validator_regex;
   };
 
-  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
-   std::initializer_list langs = {});
+  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name);
 
   template  void ForEach(const ForEachCallbacks ) {
 GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());


Index: lldb/source/DataFormatters/TypeCategory.cpp
===
--- lldb/source/DataFormatters/TypeCategory.cpp
+++ lldb/source/DataFormatters/TypeCategory.cpp
@@ -13,18 +13,14 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeCategoryImpl::TypeCategoryImpl(
-IFormatChangeListener *clist, ConstString name,
-std::initializer_list langs)
+TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener *clist,
+   ConstString name)
 : m_format_cont("format", "regex-format", clist),
   m_summary_cont("summary", "regex-summary", clist),
   m_filter_cont("filter", "regex-filter", clist),
   m_synth_cont("synth", "regex-synth", clist),
   m_validator_cont("validator", "regex-validator", clist), m_enabled(false),
-  m_change_listener(clist), m_mutex(), m_name(name), m_languages() {
-  for (const lldb::LanguageType lang : langs)
-AddLanguage(lang);
-}
+  m_change_listener(clist), m_mutex(), m_name(name), m_languages() {}
 
 static bool IsApplicable(lldb::LanguageType category_lang,
  lldb::LanguageType valobj_lang) {
Index: lldb/include/lldb/DataFormatters/TypeCategory.h
===
--- lldb/include/lldb/DataFormatters/TypeCategory.h
+++ lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -214,8 +214,7 @@
 ValidatorContainer::RegexMatchForEachCallback m_validator_regex;
   };
 
-  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
-   std::initializer_list langs = {});
+  TypeCategoryImpl(IFormatChangeListener *clist, ConstString name);
 
   template  void ForEach(const ForEachCallbacks ) {
 GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70979: [lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTriple

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

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D70979

Files:
  lldb/include/lldb/Core/ModuleSpec.h
  lldb/include/lldb/Utility/ArchSpec.h
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/TargetList.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/source/Utility/ProcessInfo.cpp

Index: lldb/source/Utility/ProcessInfo.cpp
===
--- lldb/source/Utility/ProcessInfo.cpp
+++ lldb/source/Utility/ProcessInfo.cpp
@@ -49,7 +49,7 @@
 void ProcessInfo::Dump(Stream , Platform *platform) const {
   s << "Executable: " << GetName() << "\n";
   s << "Triple: ";
-  m_arch.DumpTriple(s);
+  m_arch.DumpTriple(s.AsRawOstream());
   s << "\n";
 
   s << "Arguments:\n";
@@ -137,7 +137,7 @@
 
   if (m_arch.IsValid()) {
 s.Printf("   arch = ");
-m_arch.DumpTriple(s);
+m_arch.DumpTriple(s.AsRawOstream());
 s.EOL();
   }
 
@@ -189,7 +189,7 @@
 
 StreamString arch_strm;
 if (m_arch.IsValid())
-  m_arch.DumpTriple(arch_strm);
+  m_arch.DumpTriple(arch_strm.AsRawOstream());
 
 auto print = [&](bool (ProcessInstanceInfo::*isValid)() const,
  uint32_t (ProcessInstanceInfo::*getID)() const,
Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -1450,17 +1450,17 @@
   return false;
 }
 
-void ArchSpec::DumpTriple(Stream ) const {
+void ArchSpec::DumpTriple(llvm::raw_ostream ) const {
   const llvm::Triple  = GetTriple();
   llvm::StringRef arch_str = triple.getArchName();
   llvm::StringRef vendor_str = triple.getVendorName();
   llvm::StringRef os_str = triple.getOSName();
   llvm::StringRef environ_str = triple.getEnvironmentName();
 
-  s.Printf("%s-%s-%s", arch_str.empty() ? "*" : arch_str.str().c_str(),
-   vendor_str.empty() ? "*" : vendor_str.str().c_str(),
-   os_str.empty() ? "*" : os_str.str().c_str());
+  s << llvm::formatv("{0}-{1}-{2}", arch_str.empty() ? "*" : arch_str,
+ vendor_str.empty() ? "*" : vendor_str,
+ os_str.empty() ? "*" : os_str);
 
   if (!environ_str.empty())
-s.Printf("-%s", environ_str.str().c_str());
+s << "-" << environ_str;
 }
Index: lldb/source/Target/TargetList.cpp
===
--- lldb/source/Target/TargetList.cpp
+++ lldb/source/Target/TargetList.cpp
@@ -144,9 +144,9 @@
   StreamString platform_arch_strm;
   StreamString module_arch_strm;
 
-  platform_arch.DumpTriple(platform_arch_strm);
+  platform_arch.DumpTriple(platform_arch_strm.AsRawOstream());
   matching_module_spec.GetArchitecture().DumpTriple(
-  module_arch_strm);
+  module_arch_strm.AsRawOstream());
   error.SetErrorStringWithFormat(
   "the specified architecture '%s' is not compatible with '%s' "
   "in '%s'",
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -406,7 +406,7 @@
   if (arch.IsValid()) {
 if (!arch.GetTriple().str().empty()) {
   strm.Printf("Triple: ");
-  arch.DumpTriple(strm);
+  arch.DumpTriple(strm.AsRawOstream());
   strm.EOL();
 }
   }
Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -78,7 +78,7 @@
   uint32_t properties = 0;
   if (target_arch.IsValid()) {
 strm.Printf("%sarch=", properties++ > 0 ? ", " : " ( ");
-target_arch.DumpTriple(strm);
+target_arch.DumpTriple(strm.AsRawOstream());
 properties++;
   }
   PlatformSP platform_sp(target->GetPlatform());
@@ -1291,7 +1291,7 @@
 StreamString arch_strm;
 
 if (full_triple)
-  module->GetArchitecture().DumpTriple(arch_strm);
+  module->GetArchitecture().DumpTriple(arch_strm.AsRawOstream());
 else
   arch_strm.PutCString(module->GetArchitecture().GetArchitectureName());
 std::string arch_str = arch_strm.GetString();
Index: lldb/include/lldb/Utility/ArchSpec.h
===
--- lldb/include/lldb/Utility/ArchSpec.h
+++ lldb/include/lldb/Utility/ArchSpec.h
@@ -433,7 +433,7 @@
   /// \return A triple describing this ArchSpec.
   const llvm::Triple () const { return m_triple; }
 
-  void DumpTriple(Stream ) const;
+  void DumpTriple(llvm::raw_ostream ) const;
 
   /// Architecture triple setter.
   ///
Index: lldb/include/lldb/Core/ModuleSpec.h

[Lldb-commits] [PATCH] D70883: [vscode.py] Make read_packet only return None when EOF

2019-12-03 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py:58
+while True:
+line = f.readline().decode("utf-8")
+if len(line) == 0:

Prefer single quotes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70883



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


[Lldb-commits] [PATCH] D70886: [lldb-vscode] capture the debuggers file handles before lldbinit runs

2019-12-03 Thread António Afonso via Phabricator via lldb-commits
aadsm added a comment.

> Maybe you could do something similar to LocalLLDBInit.test ?

That test uses the `lldb` `-S` (and others) flags that `lldb-vscode` doesn't 
support :(. These flags should really be added to the initialize packet but 
they're very specific to lldb and the DAP doesn't support it.. We could 
implement something like what `Driver::ProcessArgs` does and pass options 
through envs but, the logic in ProcessArgs itself is sketchy (just like the 
comment mentions) and I l also find it odd to pass options through env vars...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70886



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


[Lldb-commits] [PATCH] D63540: Fix lookup of symbols at the same address with no size vs. size

2019-12-03 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

FYI I am investigating it.  I have found 2019-09-26-raspbian-buster.zip 
 really can run in chroot on 
Fedora 31 armv7hl so I should be able to reproduce it. It is building LLDB now, 
that takes about 6 hours.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63540



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


[Lldb-commits] [PATCH] D70840: [LLDB] [DWARF] Strip out the thumb bit from addresses on ARM

2019-12-03 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D70840#1767049 , @labath wrote:

> In D70840#1767028 , @mstorsjo wrote:
>
> > In D70840#1765373 , @clayborg 
> > wrote:
> >
> > > So some background on how address masks are handled in LLDB:
> > >
> > > Typically the way we have tried to take care of the extra Thumb bit for 
> > > ARM using:
> > >
> > >   lldb::addr_t Address::GetCallableLoadAddress(Target *target, bool 
> > > is_indirect = false) const;
> > >   lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass 
> > > addr_class = AddressClass::eInvalid) const;
> > >   
> > >
> > > The first will add the extra bit to an address if needed. The latter will 
> > > strip the bit if needed. This does require a target though and the target 
> > > uses the "Architecture" class for ARM to do the work of using the mask. 
> > > Not sure if we want to try to get an architecture class and use that here 
> > > for stripping the bit instead of using an address mask?
> >
> >
> > So, where do I get hold of an Architecture* object instance from within the 
> > relevant contexts (within SymbolFileDWARF, where we have a reference to the 
> > object file)? Also within source/Symbol/DWARFCallFrameInfo.cpp where we 
> > have existing code that does the same.
>
>
> Well... that's the tricky part (which I've tried to allude to in  
> D70840#1763639 . Currently the only 
> thing holding an architecture object is the target class, but since one of 
> the goals of the SymbolFile stuff is to be independent of any particular 
> target, you cannot easily get hold of that. That is why I tried to steer this 
> towards having this in the ArchSpec class. If we don't want that, we'll 
> probably have to create one new Architecture instance local to each Module 
> object...


Ah, sorry for overlooking those parts of your comment. @clayborg - what do you 
think of @labath's suggestions here?


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

https://reviews.llvm.org/D70840



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


[Lldb-commits] [PATCH] D70764: build: reduce CMake handling for zlib

2019-12-03 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd added a comment.

In D70764#1767395 , @JDevlieghere 
wrote:

> Having one canonical variable controlling zlib support seems indeed desirable.
>
> In D70519#1754618 , @labath wrote:
>
> > With this patch, what is the output of `llvm-config --system-libs` ?
>
>
> @compnerd What's the answer to this for this patch?


Sorry, didn't see the question.  From my local build:

   $ ./bin/llvm-config --system-libs
  /usr/lib/x86_64-linux-gnu/libz.so -lrt -ldl -ltinfo -lpthread -lm 
/usr/lib/x86_64-linux-gnu/libxml2.so


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70764



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


[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-03 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp:159
   // FUNC11-BT: func11_tailcalled{{.*}}
   // FUNC11-BT-NEXT: func12{{.*}} [artificial]
   use(x);

The failure was:
```
main.cpp:159:21: error: FUNC11-BT-NEXT: expected string not found in input
 // FUNC11-BT-NEXT: func12{{.*}} [artificial]
^
:3:2: note: scanning from here
 frame #1: 0x0001079eae69 a.out`func12(sink=0x7ffee8215cb4, x=123) at 
main.cpp:179:3 [opt]
```

The added `DESTROY_RBX` asm might confuse TailRecursionElimination into 
believing that the callee accesses the caller's stack. Could you double-check 
that a tail call is actually emitted in `func12` (something like `jmp *%rax`)? 
If it //is//, this is a pre-existing lldb bug, so the func12 test should be 
disabled.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68209



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


[Lldb-commits] [PATCH] D70764: build: reduce CMake handling for zlib

2019-12-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Having one canonical variable controlling zlib support seems indeed desirable.

In D70519#1754618 , @labath wrote:

> With this patch, what is the output of `llvm-config --system-libs` ?


@compnerd What's the answer to this for this patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70764



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


[Lldb-commits] [PATCH] D63540: Fix lookup of symbols at the same address with no size vs. size

2019-12-03 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

In D63540#1766693 , @omjavaid wrote:

> Hi Jan,
>
> I have done further investigation on this with new ampere arm server. This 
> problem manifests itself on all kind of Debian flavors and is not related to 
> underlying libraries. I have tested LLDB on Arm 32bit host with Ubuntu 
> Xenial, Bionic and Debian Buster all show same problem.
>
> Moreover this problem seems to be emerging from clang expression parser 
> generating symbols while evaluating certain types of expressions. These 
> symbols are rejected by expression interpreter. LLDB symtab classes are 
> utilized for expressions as well so it is a highly likely problem so I would 
> suggest you to investigate further on these lines
>
> For example: 
>  ./bin/lldb-dotest -p TestVirtual.py -v -t
>
> test_virtual_madness_dwarf (TestVirtual.CppVirtualMadness) fails with 
> following error
>
> runCmd: expression a_as_A->a()
>  runCmd failed!
>  error: Can't run the expression locally: Interpreter doesn't handle one of 
> the expression's opcodes


Hi Omair, is it possible that Process::CanJIT() is false?  I'm not super 
experienced with the expression engine in lldb, but this sounds like the llvm 
IR interpretation can't handle the expression (expected, in this case) and lldb 
isn't able to JIT the IR into code and run it.

The one thing that IR interpreter can't do is call external functions.  When 
I'm trying to debug something like this, I'll go as basic as possible -- 
something like "p (int)isdigit('1')" which requires that the expression be 
jitted, and debug from there.  Maybe this is specific to this C++ test case, 
but is it possible that all function calls are failing?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63540



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


[Lldb-commits] [PATCH] D70721: [lldb/cpluspluslanguage] Add constructor substitutor

2019-12-03 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:327
 
+  bool trySubstitute(llvm::StringRef From, llvm::StringRef To) {
+if (!llvm::StringRef(this->First, this->numLeft()).startswith(From))

`trySubstitute` has a return value but it is not used in the code below.



Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:352
+  void appendUnchangedInput() {
+Result += llvm::StringRef(Written, this->First - Written);
+Written = this->First;

`this->First - Written` feels awkward, I feel like given the names they should 
be reversed :-(


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70721



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


[Lldb-commits] [PATCH] D70846: Expression eval lookup speedup by not returning methods in ManualDWARFIndex::GetFunctions

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I guess you were building darwin binaries, right? If that's the case, then you 
weren't using this code at all, as apple uses AppleIndex by default. The test 
in question uses all three indexes (it forces their generation by altering 
compile flags) and the failures you were seeing were most likely coming the 
"manual" case...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70846



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


[Lldb-commits] [PATCH] D70846: Expression eval lookup speedup by not returning methods in ManualDWARFIndex::GetFunctions

2019-12-03 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

In D70846#1766598 , @labath wrote:

> In D70846#1766204 , @shafik wrote:
>
> > In D70846#1763731 , @labath wrote:
> >
> > > There's `lldb-shell :: SymbolFile/DWARF/find-basic-function.cpp`, which 
> > > probably didn't get run for you as you didn't have lld enabled (cmake 
> > > -DLLVM_ENABLE_PROJECTS=...;lld). You'll need to update that test to match 
> > > the new behavior, but other than that, I think this is a good change.
> >
> >
> > So with this change for the `find-basic-function.cpp` test I no longer see 
> > any results for the `full` case so we should at least generate a case that 
> > has results for the `full` case.
>
>
> There's an additional check in that test which does a search by a mangled 
> name (search for FULL-MANGLED), and this one does return some result. If this 
> patch lands, I'm not sure if there's any other kind of a "full" lookup that 
> we could perform. `eFunctionNameTypeFull` is documented as: `... For C this 
> is the same as just the name of the function For C++ this is the mangled or 
> demangled version of the mangled name...`, which appears like we should 
> support searching by *de*mangled names. However, I'm not sure if that is 
> actually a good idea. Implementing that for the manual index would be simple 
> enough, but that is something that the apple index could never support (in 
> fact, I think I remember that the manual index once supported searching by 
> demangled names, but then I removed this ability for consistency when adding 
> debug_names support).
>
> That said, I think it may be interesting to add a test searching for an 
> `extern "C"` symbol (which has no "mangled" name), as right now it's not 
> clear if it will show up because of `function_fullnames.Find` or 
> `function_basenames.Find`...


I did see that and I was just a little confused by the mixed results I was 
seeing.

I had put together a few test programs to better understand how it works e.g.:

  namespace A {
int foo() {
return 2;
}
  }
  
  int main() {
   return A::foo() ;
  }

and when I run `lldb-test symbols --name=foo --find=function 
--function-flags=full function_full.o` I see:

  Module: function_full.o
  Found 1 functions:
  0x7ffee5ad3438: SymbolContextList
 Module: file = "function_full.o", arch = "x86_64"
CompileUnit: id = {0x}, file = 
"/Users/shafik/code/function_full.cpp", language = "c++"
   Function: id = {0x002f}, name = "A::foo()", mangled = 
"_ZN1A3fooEv", range = function_full.o[0x-0x000b)
   FuncType: id = {0x002f}, byte-size = 0, decl = 
/Users/shafik/code/function_full.cpp:2, compiler_type = "int (void)"

which seems inconsistent with what I am seeing with `find-basic-function.cpp` 
or at least it is not obvious to me what the difference is.

I think at least adding a test case for the `extern "C"` case would be good as 
well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70846



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


[Lldb-commits] [PATCH] D70851: [lldb] s/FileSpec::Equal/FileSpec::Match

2019-12-03 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

lgtm


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70851



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


[Lldb-commits] [PATCH] D70907: Change Target::FindBreakpointsByName to return Expected

2019-12-03 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet marked 2 inline comments as done.
JosephTremoulet added inline comments.



Comment at: lldb/source/Breakpoint/BreakpointList.cpp:136
+"FindBreakpointsByName requires a name",
+llvm::inconvertibleErrorCode());
 

JDevlieghere wrote:
> I think `llvm::errc::invalid_argument` would fit. 
SGTM; updated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70907



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


[Lldb-commits] [PATCH] D70907: Change Target::FindBreakpointsByName to return Expected

2019-12-03 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet updated this revision to Diff 231931.
JosephTremoulet added a comment.

- Use invalid_argument error code


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70907

Files:
  lldb/include/lldb/Breakpoint/BreakpointList.h
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
  lldb/source/API/SBTarget.cpp
  lldb/source/Breakpoint/BreakpointList.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -728,11 +728,17 @@
 }
 
 void Target::ApplyNameToBreakpoints(BreakpointName _name) {
-  BreakpointList bkpts_with_name(false);
-  m_breakpoint_list.FindBreakpointsByName(bp_name.GetName().AsCString(),
-  bkpts_with_name);
+  llvm::Expected> expected_vector =
+  m_breakpoint_list.FindBreakpointsByName(bp_name.GetName().AsCString());
 
-  for (auto bp_sp : bkpts_with_name.Breakpoints())
+  if (!expected_vector) {
+LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS),
+ "invalid breakpoint name: {}",
+ llvm::toString(expected_vector.takeError()));
+return;
+  }
+
+  for (auto bp_sp : *expected_vector)
 bp_name.ConfigureBreakpoint(bp_sp);
 }
 
Index: lldb/source/Breakpoint/BreakpointList.cpp
===
--- lldb/source/Breakpoint/BreakpointList.cpp
+++ lldb/source/Breakpoint/BreakpointList.cpp
@@ -10,6 +10,8 @@
 
 #include "lldb/Target/Target.h"
 
+#include "llvm/Support/Errc.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -128,22 +130,24 @@
   return {};
 }
 
-bool BreakpointList::FindBreakpointsByName(const char *name,
-   BreakpointList _bps) {
-  Status error;
+llvm::Expected>
+BreakpointList::FindBreakpointsByName(const char *name) {
   if (!name)
-return false;
+return llvm::createStringError(llvm::errc::invalid_argument,
+   "FindBreakpointsByName requires a name");
 
+  Status error;
   if (!BreakpointID::StringIsBreakpointName(llvm::StringRef(name), error))
-return false;
+return error.ToError();
 
+  std::vector matching_bps;
   for (BreakpointSP bkpt_sp : Breakpoints()) {
 if (bkpt_sp->MatchesName(name)) {
-  matching_bps.Add(bkpt_sp, false);
+  matching_bps.push_back(bkpt_sp);
 }
   }
 
-  return true;
+  return matching_bps;
 }
 
 void BreakpointList::Dump(Stream *s) const {
Index: lldb/source/API/SBTarget.cpp
===
--- lldb/source/API/SBTarget.cpp
+++ lldb/source/API/SBTarget.cpp
@@ -1176,12 +1176,15 @@
   TargetSP target_sp(GetSP());
   if (target_sp) {
 std::lock_guard guard(target_sp->GetAPIMutex());
-BreakpointList bkpt_list(false);
-bool is_valid =
-target_sp->GetBreakpointList().FindBreakpointsByName(name, bkpt_list);
-if (!is_valid)
+llvm::Expected> expected_vector =
+target_sp->GetBreakpointList().FindBreakpointsByName(name);
+if (!expected_vector) {
+  LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS),
+   "invalid breakpoint name: {}",
+   llvm::toString(expected_vector.takeError()));
   return false;
-for (BreakpointSP bkpt_sp : bkpt_list.Breakpoints()) {
+}
+for (BreakpointSP bkpt_sp : *expected_vector) {
   bkpts.AppendByID(bkpt_sp->GetID());
 }
   }
Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
@@ -155,8 +155,13 @@
 def do_check_using_names(self):
 """Use Python APIs to check names work in place of breakpoint ID's."""
 
+# Create a dummy breakpoint to use up ID 1
+_ = self.target.BreakpointCreateByLocation(self.main_file_spec, 30)
+
+# Create a breakpiont to test with
 bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
 bkpt_name = "ABreakpoint"
+bkpt_id = bkpt.GetID()
 other_bkpt_name= "_AnotherBreakpoint"
 
 # Add a name and make sure we match it:
@@ -169,6 +174,7 @@
 self.assertTrue(bkpts.GetSize() == 1, "One breakpoint matched.")
 found_bkpt = bkpts.GetBreakpointAtIndex(0)
 self.assertTrue(bkpt.GetID() == found_bkpt.GetID(),"The right breakpoint.")
+self.assertTrue(bkpt.GetID() == bkpt_id,"With the same ID as before.")
 
 retval = lldb.SBCommandReturnObject()
 

[Lldb-commits] [PATCH] D70907: Change Target::FindBreakpointsByName to return Expected

2019-12-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: lldb/source/Breakpoint/BreakpointList.cpp:136
+"FindBreakpointsByName requires a name",
+llvm::inconvertibleErrorCode());
 

I think `llvm::errc::invalid_argument` would fit. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70907



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


[Lldb-commits] [PATCH] D70851: [lldb] s/FileSpec::Equal/FileSpec::Match

2019-12-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Okay, sound sensible. LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70851



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


[Lldb-commits] [PATCH] D70932: [EditLine] Fix RecallHistory that makes it move in the opposite direction.

2019-12-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0e9b0b6d11e8: [EditLine] Fix RecallHistory to make it go in 
the right direction. (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70932

Files:
  lldb/include/lldb/Host/Editline.h
  lldb/source/Host/common/Editline.cpp

Index: lldb/source/Host/common/Editline.cpp
===
--- lldb/source/Host/common/Editline.cpp
+++ lldb/source/Host/common/Editline.cpp
@@ -97,6 +97,32 @@
   return true;
 }
 
+static int GetOperation(HistoryOperation op) {
+  // The naming used by editline for the history operations is counter
+  // intuitive to how it's used here.
+  //
+  //  - The H_PREV operation returns the previous element in the history, which
+  //is newer than the current one.
+  //
+  //  - The H_NEXT operation returns the next element in the history, which is
+  //older than the current one.
+  //
+  // The naming of the enum entries match the semantic meaning.
+  switch(op) {
+case HistoryOperation::Oldest:
+  return H_FIRST;
+case HistoryOperation::Older:
+  return H_NEXT;
+case HistoryOperation::Current:
+  return H_CURR;
+case HistoryOperation::Newer:
+  return H_PREV;
+case HistoryOperation::Newest:
+  return H_LAST;
+  }
+}
+
+
 EditLineStringType CombineLines(const std::vector ) {
   EditLineStringStreamType combined_stream;
   for (EditLineStringType line : lines) {
@@ -423,7 +449,8 @@
   return lines;
 }
 
-unsigned char Editline::RecallHistory(bool earlier) {
+unsigned char Editline::RecallHistory(HistoryOperation op) {
+  assert(op == HistoryOperation::Older || op == HistoryOperation::Newer);
   if (!m_history_sp || !m_history_sp->IsValid())
 return CC_ERROR;
 
@@ -433,27 +460,38 @@
 
   // Treat moving from the "live" entry differently
   if (!m_in_history) {
-if (!earlier)
+switch (op) {
+case HistoryOperation::Newer:
   return CC_ERROR; // Can't go newer than the "live" entry
-if (history_w(pHistory, _event, H_FIRST) == -1)
-  return CC_ERROR;
-
-// Save any edits to the "live" entry in case we return by moving forward
-// in history (it would be more bash-like to save over any current entry,
-// but libedit doesn't offer the ability to add entries anywhere except the
-// end.)
-SaveEditedLine();
-m_live_history_lines = m_input_lines;
-m_in_history = true;
+case HistoryOperation::Older: {
+  if (history_w(pHistory, _event,
+GetOperation(HistoryOperation::Newest)) == -1)
+return CC_ERROR;
+  // Save any edits to the "live" entry in case we return by moving forward
+  // in history (it would be more bash-like to save over any current entry,
+  // but libedit doesn't offer the ability to add entries anywhere except
+  // the end.)
+  SaveEditedLine();
+  m_live_history_lines = m_input_lines;
+  m_in_history = true;
+} break;
+default:
+  llvm_unreachable("unsupported history direction");
+}
   } else {
-if (history_w(pHistory, _event, earlier ? H_PREV : H_NEXT) == -1) {
-  // Can't move earlier than the earliest entry
-  if (earlier)
+if (history_w(pHistory, _event, GetOperation(op)) == -1) {
+  switch (op) {
+  case HistoryOperation::Older:
+// Can't move earlier than the earliest entry.
 return CC_ERROR;
-
-  // ... but moving to newer than the newest yields the "live" entry
-  new_input_lines = m_live_history_lines;
-  m_in_history = false;
+  case HistoryOperation::Newer:
+// Moving to newer-than-the-newest entry yields the "live" entry.
+new_input_lines = m_live_history_lines;
+m_in_history = false;
+break;
+  default:
+llvm_unreachable("unsupported history direction");
+  }
 }
   }
 
@@ -468,8 +506,17 @@
 
   // Prepare to edit the last line when moving to previous entry, or the first
   // line when moving to next entry
-  SetCurrentLine(m_current_line_index =
- earlier ? (int)m_input_lines.size() - 1 : 0);
+  switch (op) {
+  case HistoryOperation::Older:
+m_current_line_index = (int)m_input_lines.size() - 1;
+break;
+  case HistoryOperation::Newer:
+m_current_line_index = 0;
+break;
+  default:
+llvm_unreachable("unsupported history direction");
+  }
+  SetCurrentLine(m_current_line_index);
   MoveCursor(CursorLocation::BlockEnd, CursorLocation::EditingPrompt);
   return CC_NEWLINE;
 }
@@ -721,7 +768,7 @@
   SaveEditedLine();
 
   if (m_current_line_index == 0) {
-return RecallHistory(true);
+return RecallHistory(HistoryOperation::Older);
   }
 
   // Start from a known location
@@ -747,7 +794,7 @@
 // Don't add an extra line if the existing last line is blank, move through
 // history 

[Lldb-commits] [lldb] 0e9b0b6 - [EditLine] Fix RecallHistory to make it go in the right direction.

2019-12-03 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-12-03T08:12:10-08:00
New Revision: 0e9b0b6d11e882efec8505d97c4b65e1562e6715

URL: 
https://github.com/llvm/llvm-project/commit/0e9b0b6d11e882efec8505d97c4b65e1562e6715
DIFF: 
https://github.com/llvm/llvm-project/commit/0e9b0b6d11e882efec8505d97c4b65e1562e6715.diff

LOG: [EditLine] Fix RecallHistory to make it go in the right direction.

The naming used by editline for the history operations is counter
intuitive to how it's used in lldb for the REPL.

 - The H_PREV operation returns the previous element in the history,
   which is newer than the current one.
 - The H_NEXT operation returns the next element in the history, which
   is older than the current one.

This exposed itself as a bug in the REPL where the behavior of up- and
down-arrow was inverted. This wasn't immediately obvious because of how
we save the current "live" entry.

This patch fixes the bug and introduces and enum to wrap the editline
operations that match the semantics of lldb.

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

Added: 


Modified: 
lldb/include/lldb/Host/Editline.h
lldb/source/Host/common/Editline.cpp

Removed: 




diff  --git a/lldb/include/lldb/Host/Editline.h 
b/lldb/include/lldb/Host/Editline.h
index 65bf15531bc4..0cb2c6c5b6a1 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -133,6 +133,15 @@ enum class CursorLocation {
   /// session
   BlockEnd
 };
+
+/// Operation for the history.
+enum class HistoryOperation {
+  Oldest,
+  Older,
+  Current,
+  Newer,
+  Newest
+};
 }
 
 using namespace line_editor;
@@ -258,11 +267,7 @@ class Editline {
   StringList GetInputAsStringList(int line_count = UINT32_MAX);
 
   /// Replaces the current multi-line session with the next entry from history.
-  /// When the parameter is
-  /// true it will take the next earlier entry from history, when it is false 
it
-  /// takes the next most
-  /// recent.
-  unsigned char RecallHistory(bool earlier);
+  unsigned char RecallHistory(HistoryOperation op);
 
   /// Character reading implementation for EditLine that supports our 
multi-line
   /// editing trickery.

diff  --git a/lldb/source/Host/common/Editline.cpp 
b/lldb/source/Host/common/Editline.cpp
index 3ae837866faf..45d3db24bbc6 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -97,6 +97,32 @@ bool IsOnlySpaces(const EditLineStringType ) {
   return true;
 }
 
+static int GetOperation(HistoryOperation op) {
+  // The naming used by editline for the history operations is counter
+  // intuitive to how it's used here.
+  //
+  //  - The H_PREV operation returns the previous element in the history, which
+  //is newer than the current one.
+  //
+  //  - The H_NEXT operation returns the next element in the history, which is
+  //older than the current one.
+  //
+  // The naming of the enum entries match the semantic meaning.
+  switch(op) {
+case HistoryOperation::Oldest:
+  return H_FIRST;
+case HistoryOperation::Older:
+  return H_NEXT;
+case HistoryOperation::Current:
+  return H_CURR;
+case HistoryOperation::Newer:
+  return H_PREV;
+case HistoryOperation::Newest:
+  return H_LAST;
+  }
+}
+
+
 EditLineStringType CombineLines(const std::vector ) {
   EditLineStringStreamType combined_stream;
   for (EditLineStringType line : lines) {
@@ -423,7 +449,8 @@ StringList Editline::GetInputAsStringList(int line_count) {
   return lines;
 }
 
-unsigned char Editline::RecallHistory(bool earlier) {
+unsigned char Editline::RecallHistory(HistoryOperation op) {
+  assert(op == HistoryOperation::Older || op == HistoryOperation::Newer);
   if (!m_history_sp || !m_history_sp->IsValid())
 return CC_ERROR;
 
@@ -433,27 +460,38 @@ unsigned char Editline::RecallHistory(bool earlier) {
 
   // Treat moving from the "live" entry 
diff erently
   if (!m_in_history) {
-if (!earlier)
+switch (op) {
+case HistoryOperation::Newer:
   return CC_ERROR; // Can't go newer than the "live" entry
-if (history_w(pHistory, _event, H_FIRST) == -1)
-  return CC_ERROR;
-
-// Save any edits to the "live" entry in case we return by moving forward
-// in history (it would be more bash-like to save over any current entry,
-// but libedit doesn't offer the ability to add entries anywhere except the
-// end.)
-SaveEditedLine();
-m_live_history_lines = m_input_lines;
-m_in_history = true;
+case HistoryOperation::Older: {
+  if (history_w(pHistory, _event,
+GetOperation(HistoryOperation::Newest)) == -1)
+return CC_ERROR;
+  // Save any edits to the "live" entry in case we return by moving forward
+  // in history (it would be more bash-like to save over any current entry,
+  // but libedit doesn't offer the ability to add entries anywhere except
+   

[Lldb-commits] [PATCH] D70907: Change Target::FindBreakpointsByName to use a vector

2019-12-03 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet updated this revision to Diff 231914.
JosephTremoulet added a comment.

- Change signature to return Expected>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70907

Files:
  lldb/include/lldb/Breakpoint/BreakpointList.h
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
  lldb/source/API/SBTarget.cpp
  lldb/source/Breakpoint/BreakpointList.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -728,11 +728,17 @@
 }
 
 void Target::ApplyNameToBreakpoints(BreakpointName _name) {
-  BreakpointList bkpts_with_name(false);
-  m_breakpoint_list.FindBreakpointsByName(bp_name.GetName().AsCString(),
-  bkpts_with_name);
+  llvm::Expected> expected_vector =
+  m_breakpoint_list.FindBreakpointsByName(bp_name.GetName().AsCString());
 
-  for (auto bp_sp : bkpts_with_name.Breakpoints())
+  if (!expected_vector) {
+LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS),
+ "invalid breakpoint name: {}",
+ llvm::toString(expected_vector.takeError()));
+return;
+  }
+
+  for (auto bp_sp : *expected_vector)
 bp_name.ConfigureBreakpoint(bp_sp);
 }
 
Index: lldb/source/Breakpoint/BreakpointList.cpp
===
--- lldb/source/Breakpoint/BreakpointList.cpp
+++ lldb/source/Breakpoint/BreakpointList.cpp
@@ -128,22 +128,25 @@
   return {};
 }
 
-bool BreakpointList::FindBreakpointsByName(const char *name,
-   BreakpointList _bps) {
-  Status error;
+llvm::Expected>
+BreakpointList::FindBreakpointsByName(const char *name) {
   if (!name)
-return false;
+return llvm::make_error(
+"FindBreakpointsByName requires a name",
+llvm::inconvertibleErrorCode());
 
+  Status error;
   if (!BreakpointID::StringIsBreakpointName(llvm::StringRef(name), error))
-return false;
+return error.ToError();
 
+  std::vector matching_bps;
   for (BreakpointSP bkpt_sp : Breakpoints()) {
 if (bkpt_sp->MatchesName(name)) {
-  matching_bps.Add(bkpt_sp, false);
+  matching_bps.push_back(bkpt_sp);
 }
   }
 
-  return true;
+  return matching_bps;
 }
 
 void BreakpointList::Dump(Stream *s) const {
Index: lldb/source/API/SBTarget.cpp
===
--- lldb/source/API/SBTarget.cpp
+++ lldb/source/API/SBTarget.cpp
@@ -1176,12 +1176,15 @@
   TargetSP target_sp(GetSP());
   if (target_sp) {
 std::lock_guard guard(target_sp->GetAPIMutex());
-BreakpointList bkpt_list(false);
-bool is_valid =
-target_sp->GetBreakpointList().FindBreakpointsByName(name, bkpt_list);
-if (!is_valid)
+llvm::Expected> expected_vector =
+target_sp->GetBreakpointList().FindBreakpointsByName(name);
+if (!expected_vector) {
+  LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS),
+   "invalid breakpoint name: {}",
+   llvm::toString(expected_vector.takeError()));
   return false;
-for (BreakpointSP bkpt_sp : bkpt_list.Breakpoints()) {
+}
+for (BreakpointSP bkpt_sp : *expected_vector) {
   bkpts.AppendByID(bkpt_sp->GetID());
 }
   }
Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
@@ -155,8 +155,13 @@
 def do_check_using_names(self):
 """Use Python APIs to check names work in place of breakpoint ID's."""
 
+# Create a dummy breakpoint to use up ID 1
+_ = self.target.BreakpointCreateByLocation(self.main_file_spec, 30)
+
+# Create a breakpiont to test with
 bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
 bkpt_name = "ABreakpoint"
+bkpt_id = bkpt.GetID()
 other_bkpt_name= "_AnotherBreakpoint"
 
 # Add a name and make sure we match it:
@@ -169,6 +174,7 @@
 self.assertTrue(bkpts.GetSize() == 1, "One breakpoint matched.")
 found_bkpt = bkpts.GetBreakpointAtIndex(0)
 self.assertTrue(bkpt.GetID() == found_bkpt.GetID(),"The right breakpoint.")
+self.assertTrue(bkpt.GetID() == bkpt_id,"With the same ID as before.")
 
 retval = lldb.SBCommandReturnObject()
 self.dbg.GetCommandInterpreter().HandleCommand("break disable %s"%(bkpt_name), retval)
Index: lldb/include/lldb/Breakpoint/BreakpointList.h

[Lldb-commits] [PATCH] D70851: [lldb] s/FileSpec::Equal/FileSpec::Match

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 5 inline comments as done.
labath added inline comments.



Comment at: lldb/include/lldb/Utility/FileSpec.h:196
 
   static bool Equal(const FileSpec , const FileSpec , bool full);
 

clayborg wrote:
> JDevlieghere wrote:
> > Why do we still need the `Equal` method? Are there cases where `full` is 
> > only decided at runtime? Would it be worth to update the call sites to use 
> > `==` or `::Match` directly? I think having both `Match` and `Equal` with 
> > these semantics is confusing and will likely reintroduce the things you 
> > just cleaned up. 
> I agree with JDev here.
I also wanted to delete it completely, but then I ran into 
FileSpecList::FindFirstFile, which forwards the `full` parameter to this 
function. I believe the calls to *that* function all have "static" values of 
the `full` argument, but the way this argument is used in this function is so 
convoluted, I thought I'd be best to leave that for a separate patch. (I'm 
pretty sure the convolutedness is not intentional, but also a result of the 
misunderstanding of how FileSpec::Equal works, but that means that fixing 
*that* will not be NFC.



Comment at: lldb/include/lldb/Utility/FileSpec.h:202
+  /// pattern matches everything.
+  static bool Match(const FileSpec , const FileSpec );
+

clayborg wrote:
> Maybe rename to "Matches"?
`Match` seems to be the prevalent choice in other match-like apis (`re.match`, 
`pcre_match`, etc.).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70851



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


[Lldb-commits] [PATCH] D70934: [Reproducer] Add version check

2019-12-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG62827737acd8: [lldb/Reproducer] Add version check (authored 
by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70934

Files:
  lldb/include/lldb/API/SBReproducer.h
  lldb/source/API/SBReproducer.cpp
  lldb/test/Shell/Reproducer/TestVersionCheck.test
  lldb/tools/driver/Driver.cpp
  lldb/tools/driver/Options.td

Index: lldb/tools/driver/Options.td
===
--- lldb/tools/driver/Options.td
+++ lldb/tools/driver/Options.td
@@ -232,5 +232,7 @@
 def replay: Separate<["--", "-"], "replay">,
   MetaVarName<"">,
   HelpText<"Tells the debugger to replay a reproducer from .">;
+def skip_version_check: F<"reproducer-skip-version-check">,
+  HelpText<"Skip the reproducer version check.">;
 
 def REM : R<["--"], "">;
Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -797,7 +797,9 @@
 
 llvm::Optional InitializeReproducer(opt::InputArgList _args) {
   if (auto *replay_path = input_args.getLastArg(OPT_replay)) {
-if (const char *error = SBReproducer::Replay(replay_path->getValue())) {
+const bool skip_version_check = input_args.hasArg(OPT_skip_version_check);
+if (const char *error =
+SBReproducer::Replay(replay_path->getValue(), skip_version_check)) {
   WithColor::error() << "reproducer replay failed: " << error << '\n';
   return 1;
 }
Index: lldb/test/Shell/Reproducer/TestVersionCheck.test
===
--- /dev/null
+++ lldb/test/Shell/Reproducer/TestVersionCheck.test
@@ -0,0 +1,29 @@
+# REQUIRES: system-darwin
+
+# This tests the reproducer version check.
+
+# RUN: rm -rf %t.repro
+# RUN: %clang_host %S/Inputs/simple.c -g -o %t.out
+# RUN: %lldb -x -b -s %S/Inputs/FileCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
+
+# Make sure that replay works.
+# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
+
+# Change the reproducer version.
+# RUN: echo "bogus" >> %t.repro/version.txt
+
+# Make sure that replay works.
+# RUN: not %lldb --replay %t.repro 2>&1 | FileCheck %s --check-prefix ERROR
+
+# Make sure that we can circumvent the version check with -reproducer-skip-version-check.
+# RUN: %lldb --replay %t.repro -reproducer-skip-version-check | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
+
+# CAPTURE: testing
+# REPLAY-NOT: testing
+
+# CHECK: Process {{.*}} exited
+
+# CAPTURE: Reproducer is in capture mode.
+# CAPTURE: Reproducer written
+
+# ERROR: error: reproducer replay failed: reproducer capture and replay version don't match
Index: lldb/source/API/SBReproducer.cpp
===
--- lldb/source/API/SBReproducer.cpp
+++ lldb/source/API/SBReproducer.cpp
@@ -22,8 +22,8 @@
 #include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBHostOS.h"
 #include "lldb/API/SBReproducer.h"
-
 #include "lldb/Host/FileSystem.h"
+#include "lldb/lldb-private.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -124,7 +124,7 @@
   return nullptr;
 }
 
-const char *SBReproducer::Replay(const char *path) {
+const char *SBReproducer::Replay(const char *path, bool skip_version_check) {
   static std::string error;
   if (auto e = Reproducer::Initialize(ReproducerMode::Replay, FileSpec(path))) {
 error = llvm::toString(std::move(e));
@@ -137,6 +137,22 @@
 return error.c_str();
   }
 
+  if (!skip_version_check) {
+llvm::Expected version = loader->LoadBuffer();
+if (!version) {
+  error = llvm::toString(version.takeError());
+  return error.c_str();
+}
+if (lldb_private::GetVersion() != llvm::StringRef(*version).rtrim()) {
+  error = "reproducer capture and replay version don't match:\n";
+  error.append("reproducer captured with:\n");
+  error.append(*version);
+  error.append("reproducer replayed with:\n");
+  error.append(lldb_private::GetVersion());
+  return error.c_str();
+}
+  }
+
   FileSpec file = loader->GetFile();
   if (!file) {
 error = "unable to get replay data from reproducer.";
Index: lldb/include/lldb/API/SBReproducer.h
===
--- lldb/include/lldb/API/SBReproducer.h
+++ lldb/include/lldb/API/SBReproducer.h
@@ -20,7 +20,7 @@
 public:
   static const char *Capture();
   static const char *Capture(const char *path);
-  static const char *Replay(const char *path);
+  static const char *Replay(const char *path, bool skip_version_check = false);
   static const char *GetPath();
   static bool Generate();
 };
___
lldb-commits mailing 

[Lldb-commits] [lldb] 6282773 - [lldb/Reproducer] Add version check

2019-12-03 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-12-03T07:54:42-08:00
New Revision: 62827737acd878af6cd8930758b0d6f297173f40

URL: 
https://github.com/llvm/llvm-project/commit/62827737acd878af6cd8930758b0d6f297173f40
DIFF: 
https://github.com/llvm/llvm-project/commit/62827737acd878af6cd8930758b0d6f297173f40.diff

LOG: [lldb/Reproducer] Add version check

To ensure a reproducer works correctly, the version of LLDB used for
capture and replay must match. Right now the reproducer already contains
the LLDB version. However, this is purely informative. LLDB will happily
replay a reproducer generated with a different version of LLDB, which
can cause subtle differences.

This patch adds a version check which compares the current LLDB version
with the one in the reproducer. If the version doesn't match, LLDB will
refuse to replay. It also adds an escape hatch to make it possible to
still replay the reproducer without having to mess with the recorded
version. This might prove useful when you know two versions of LLDB
match, even though the version string doesn't. This behavior is
triggered by passing a new flag -reproducer-skip-version-check to the
lldb driver.

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

Added: 
lldb/test/Shell/Reproducer/TestVersionCheck.test

Modified: 
lldb/include/lldb/API/SBReproducer.h
lldb/source/API/SBReproducer.cpp
lldb/tools/driver/Driver.cpp
lldb/tools/driver/Options.td

Removed: 




diff  --git a/lldb/include/lldb/API/SBReproducer.h 
b/lldb/include/lldb/API/SBReproducer.h
index 93e567607aa8..8bb530a0fe42 100644
--- a/lldb/include/lldb/API/SBReproducer.h
+++ b/lldb/include/lldb/API/SBReproducer.h
@@ -20,7 +20,7 @@ class LLDB_API SBReproducer {
 public:
   static const char *Capture();
   static const char *Capture(const char *path);
-  static const char *Replay(const char *path);
+  static const char *Replay(const char *path, bool skip_version_check = false);
   static const char *GetPath();
   static bool Generate();
 };

diff  --git a/lldb/source/API/SBReproducer.cpp 
b/lldb/source/API/SBReproducer.cpp
index d50d95ebb547..1107161a419f 100644
--- a/lldb/source/API/SBReproducer.cpp
+++ b/lldb/source/API/SBReproducer.cpp
@@ -22,8 +22,8 @@
 #include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBHostOS.h"
 #include "lldb/API/SBReproducer.h"
-
 #include "lldb/Host/FileSystem.h"
+#include "lldb/lldb-private.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -124,7 +124,7 @@ const char *SBReproducer::Capture(const char *path) {
   return nullptr;
 }
 
-const char *SBReproducer::Replay(const char *path) {
+const char *SBReproducer::Replay(const char *path, bool skip_version_check) {
   static std::string error;
   if (auto e = Reproducer::Initialize(ReproducerMode::Replay, FileSpec(path))) 
{
 error = llvm::toString(std::move(e));
@@ -137,6 +137,22 @@ const char *SBReproducer::Replay(const char *path) {
 return error.c_str();
   }
 
+  if (!skip_version_check) {
+llvm::Expected version = 
loader->LoadBuffer();
+if (!version) {
+  error = llvm::toString(version.takeError());
+  return error.c_str();
+}
+if (lldb_private::GetVersion() != llvm::StringRef(*version).rtrim()) {
+  error = "reproducer capture and replay version don't match:\n";
+  error.append("reproducer captured with:\n");
+  error.append(*version);
+  error.append("reproducer replayed with:\n");
+  error.append(lldb_private::GetVersion());
+  return error.c_str();
+}
+  }
+
   FileSpec file = loader->GetFile();
   if (!file) {
 error = "unable to get replay data from reproducer.";

diff  --git a/lldb/test/Shell/Reproducer/TestVersionCheck.test 
b/lldb/test/Shell/Reproducer/TestVersionCheck.test
new file mode 100644
index ..e3fb60367cec
--- /dev/null
+++ b/lldb/test/Shell/Reproducer/TestVersionCheck.test
@@ -0,0 +1,29 @@
+# REQUIRES: system-darwin
+
+# This tests the reproducer version check.
+
+# RUN: rm -rf %t.repro
+# RUN: %clang_host %S/Inputs/simple.c -g -o %t.out
+# RUN: %lldb -x -b -s %S/Inputs/FileCapture.in --capture --capture-path 
%t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
+
+# Make sure that replay works.
+# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK 
--check-prefix REPLAY
+
+# Change the reproducer version.
+# RUN: echo "bogus" >> %t.repro/version.txt
+
+# Make sure that replay works.
+# RUN: not %lldb --replay %t.repro 2>&1 | FileCheck %s --check-prefix ERROR
+
+# Make sure that we can circumvent the version check with 
-reproducer-skip-version-check.
+# RUN: %lldb --replay %t.repro -reproducer-skip-version-check | FileCheck %s 
--check-prefix CHECK --check-prefix REPLAY
+
+# CAPTURE: testing
+# REPLAY-NOT: testing
+
+# CHECK: Process {{.*}} exited
+
+# CAPTURE: Reproducer is in capture mode.
+# CAPTURE: Reproducer written
+
+# ERROR: error: reproducer replay failed: 

[Lldb-commits] [lldb] ad5bb05 - [lldb] Remove unneeded semicolon in IOHandlerCursesGUI

2019-12-03 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2019-12-03T16:22:52+01:00
New Revision: ad5bb05405c0ea8fc82fae240e2006d241799cf6

URL: 
https://github.com/llvm/llvm-project/commit/ad5bb05405c0ea8fc82fae240e2006d241799cf6
DIFF: 
https://github.com/llvm/llvm-project/commit/ad5bb05405c0ea8fc82fae240e2006d241799cf6.diff

LOG: [lldb] Remove unneeded semicolon in IOHandlerCursesGUI

Added: 


Modified: 
lldb/include/lldb/Core/IOHandlerCursesGUI.h

Removed: 




diff  --git a/lldb/include/lldb/Core/IOHandlerCursesGUI.h 
b/lldb/include/lldb/Core/IOHandlerCursesGUI.h
index d67f37d8f598..afa435269725 100644
--- a/lldb/include/lldb/Core/IOHandlerCursesGUI.h
+++ b/lldb/include/lldb/Core/IOHandlerCursesGUI.h
@@ -35,6 +35,6 @@ class IOHandlerCursesGUI : public IOHandler {
   curses::ApplicationAP m_app_ap;
 };
 
-}; // namespace lldb_private
+} // namespace lldb_private
 
 #endif // liblldb_IOHandlerCursesGUI_h_



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


[Lldb-commits] [lldb] 159641d - [lldb] Use llvm range functions in LineTable.cpp

2019-12-03 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2019-12-03T16:22:52+01:00
New Revision: 159641d710b074b6d89e3aced179f9a2229e4eb0

URL: 
https://github.com/llvm/llvm-project/commit/159641d710b074b6d89e3aced179f9a2229e4eb0
DIFF: 
https://github.com/llvm/llvm-project/commit/159641d710b074b6d89e3aced179f9a2229e4eb0.diff

LOG: [lldb] Use llvm range functions in LineTable.cpp

to avoid needing to declare iterators everywhere.

Added: 


Modified: 
lldb/source/Symbol/LineTable.cpp

Removed: 




diff  --git a/lldb/source/Symbol/LineTable.cpp 
b/lldb/source/Symbol/LineTable.cpp
index 1433dc156d91..fecc90c409f2 100644
--- a/lldb/source/Symbol/LineTable.cpp
+++ b/lldb/source/Symbol/LineTable.cpp
@@ -34,11 +34,9 @@ void LineTable::InsertLineEntry(lldb::addr_t file_addr, 
uint32_t line,
   is_start_of_basic_block, is_prologue_end, is_epilogue_begin,
   is_terminal_entry);
 
-  entry_collection::iterator begin_pos = m_entries.begin();
-  entry_collection::iterator end_pos = m_entries.end();
   LineTable::Entry::LessThanBinaryPredicate less_than_bp(this);
   entry_collection::iterator pos =
-  upper_bound(begin_pos, end_pos, entry, less_than_bp);
+  llvm::upper_bound(m_entries, entry, less_than_bp);
 
   //  Stream s(stdout);
   //  s << "\n\nBefore:\n";
@@ -289,8 +287,6 @@ uint32_t LineTable::FindLineEntryIndexByFileIndex(
 uint32_t line, bool exact, LineEntry *line_entry_ptr) {
 
   const size_t count = m_entries.size();
-  std::vector::const_iterator begin_pos = file_indexes.begin();
-  std::vector::const_iterator end_pos = file_indexes.end();
   size_t best_match = UINT32_MAX;
 
   for (size_t idx = start_idx; idx < count; ++idx) {
@@ -299,7 +295,7 @@ uint32_t LineTable::FindLineEntryIndexByFileIndex(
 if (m_entries[idx].is_terminal_entry)
   continue;
 
-if (find(begin_pos, end_pos, m_entries[idx].file_idx) == end_pos)
+if (llvm::find(file_indexes, m_entries[idx].file_idx) == 
file_indexes.end())
   continue;
 
 // Exact match always wins.  Otherwise try to find the closest line > the



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


[Lldb-commits] [PATCH] D70954: [lldb] Don't put compile unit name into the support file list

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 231904.
labath added a comment.

Add the dwarf5 part + a test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70954

Files:
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Symbol/CompileUnit.cpp
  lldb/test/Shell/SymbolFile/DWARF/dwarf5-debug_line.s

Index: lldb/test/Shell/SymbolFile/DWARF/dwarf5-debug_line.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/dwarf5-debug_line.s
@@ -0,0 +1,129 @@
+# Test handling of DWARF5 line tables. In particular, test that we handle files
+# which are present in the line table more than once.
+
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -o %t -triple x86_64-pc-linux %s
+# RUN: %lldb %t -o "source info -f file0.c" -o "source info -f file1.c" \
+# RUN:   -o "breakpoint set -f file0.c -l 42" \
+# RUN:   -o "breakpoint set -f file0.c -l 47" \
+# RUN:   -o exit | FileCheck %s
+
+# CHECK-LABEL: source info -f file0.c
+# CHECK: [0x-0x0001): /file0.c:42
+# CHECK-LABEL: source info -f file1.c
+# CHECK: [0x0001-0x0002): /file1.c:47
+# CHECK-LABEL: breakpoint set -f file0.c -l 42
+# CHECK: Breakpoint 1: {{.*}}`foo,
+# CHECK-LABEL: breakpoint set -f file0.c -l 47
+# CHECK: Breakpoint 2: {{.*}}`foo + 2,
+
+.text
+.globl  foo
+foo:
+nop
+nop
+nop
+.Lfoo_end:
+
+.section.debug_abbrev,"",@progbits
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   0   # DW_CHILDREN_no
+.byte   37  # DW_AT_producer
+.byte   8   # DW_FORM_string
+.byte   19  # DW_AT_language
+.byte   5   # DW_FORM_data2
+.byte   3   # DW_AT_name
+.byte   8   # DW_FORM_string
+.byte   16  # DW_AT_stmt_list
+.byte   23  # DW_FORM_sec_offset
+.byte   27  # DW_AT_comp_dir
+.byte   8   # DW_FORM_string
+.byte   17  # DW_AT_low_pc
+.byte   1   # DW_FORM_addr
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   0   # EOM(3)
+
+.section.debug_info,"",@progbits
+.Lcu_begin0:
+.long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+.short  5   # DWARF version number
+.byte   1   # DWARF Unit Type
+.byte   8   # Address Size (in bytes)
+.long   .debug_abbrev   # Offset Into Abbrev. Section
+.byte   1   # Abbrev [1] 0xc:0x23 DW_TAG_compile_unit
+.asciz  "Hand-written DWARF"# DW_AT_producer
+.short  12  # DW_AT_language
+.asciz  "file0.c"   # DW_AT_name
+.long   .Lline_table_begin  # DW_AT_stmt_list
+.asciz  "/" # DW_AT_comp_dir
+.quad   foo # DW_AT_low_pc
+.long   .Lfoo_end-foo   # DW_AT_high_pc
+.Ldebug_info_end0:
+
+.section.debug_line,"",@progbits
+.Lline_table_begin:
+.long .Lline_end-.Lline_start
+.Lline_start:
+.short  5   # DWARF version number
+.byte   8   # Address Size (in bytes)
+.byte   0   # Segment Selector Size
+.long   .Lheader_end-.Lheader_start
+.Lheader_start:
+.byte   1   # Minimum Instruction Length
+.byte   1   # Maximum Operations per Instruction
+.byte   1   # Default is_stmt
+.byte   0   # Line Base
+.byte   0   # Line Range
+.byte   5   # Opcode Base
+.byte   0, 1, 1, 1  # Standard Opcode Lengths
+
+# Directory table format
+.byte   1   # One element per directory entry
+.byte   1   # DW_LNCT_path
+.byte   0x08# DW_FORM_string
+
+# Directory table entries
+.byte   1   # 1 directory
+.asciz  "/"
+
+# File table format
+.byte   2   # 2 elements 

[Lldb-commits] [PATCH] D70830: [LLDB] Disable MSVC warning C4190

2019-12-03 Thread Alexandre Ganea via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1cc0ba4cbdc5: [LLDB] Disable MSVC warning C4190: 
LLDBSwigPythonBreakpointCallbackFunction… (authored by aganea).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70830

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp


Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -62,6 +62,14 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP _frame,
@@ -70,6 +78,10 @@
   return false;
 }
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -77,11 +77,23 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP _frame,
 const lldb::BreakpointLocationSP _bp_loc, StructuredDataImpl 
*args_impl);
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(


Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -62,6 +62,14 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP _frame,
@@ -70,6 +78,10 @@
   return false;
 }
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -77,11 +77,23 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP _frame,
 const lldb::BreakpointLocationSP _bp_loc, StructuredDataImpl *args_impl);
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 1cc0ba4 - [LLDB] Disable MSVC warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has C-linkage specified, but returns UDT 'llvm::Expected' which is incompatible with

2019-12-03 Thread Alexandre Ganea via lldb-commits

Author: Alexandre Ganea
Date: 2019-12-03T09:53:26-05:00
New Revision: 1cc0ba4cbdc54200e1b3c65e83e51a5368a819ea

URL: 
https://github.com/llvm/llvm-project/commit/1cc0ba4cbdc54200e1b3c65e83e51a5368a819ea
DIFF: 
https://github.com/llvm/llvm-project/commit/1cc0ba4cbdc54200e1b3c65e83e51a5368a819ea.diff

LOG: [LLDB] Disable MSVC warning C4190: 
'LLDBSwigPythonBreakpointCallbackFunction' has C-linkage specified, but returns 
UDT 'llvm::Expected' which is incompatible with C

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

Added: 


Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 5ed01cf47934..f6b918399cdc 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -77,11 +77,23 @@ extern "C" void init_lldb(void);
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP _frame,
 const lldb::BreakpointLocationSP _bp_loc, StructuredDataImpl 
*args_impl);
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(

diff  --git a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp 
b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
index 12ffdfe79ec3..8bc510bd989a 100644
--- a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -62,6 +62,14 @@ extern "C" void init_lldb(void) {}
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP _frame,
@@ -70,6 +78,10 @@ extern "C" llvm::Expected 
LLDBSwigPythonBreakpointCallbackFunction(
   return false;
 }
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(



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


[Lldb-commits] [PATCH] D70840: [LLDB] [DWARF] Strip out the thumb bit from addresses on ARM

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D70840#1767028 , @mstorsjo wrote:

> In D70840#1765373 , @clayborg wrote:
>
> > So some background on how address masks are handled in LLDB:
> >
> > Typically the way we have tried to take care of the extra Thumb bit for ARM 
> > using:
> >
> >   lldb::addr_t Address::GetCallableLoadAddress(Target *target, bool 
> > is_indirect = false) const;
> >   lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class 
> > = AddressClass::eInvalid) const;
> >   
> >
> > The first will add the extra bit to an address if needed. The latter will 
> > strip the bit if needed. This does require a target though and the target 
> > uses the "Architecture" class for ARM to do the work of using the mask. Not 
> > sure if we want to try to get an architecture class and use that here for 
> > stripping the bit instead of using an address mask?
>
>
> So, where do I get hold of an Architecture* object instance from within the 
> relevant contexts (within SymbolFileDWARF, where we have a reference to the 
> object file)? Also within source/Symbol/DWARFCallFrameInfo.cpp where we have 
> existing code that does the same.


Well... that's the tricky part (which I've tried to allude to in  
D70840#1763639 . Currently the only 
thing holding an architecture object is the target class, but since one of the 
goals of the SymbolFile stuff is to be independent of any particular target, 
you cannot easily get hold of that. That is why I tried to steer this towards 
having this in the ArchSpec class. If we don't want that, we'll probably have 
to create one new Architecture instance local to each Module object...


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

https://reviews.llvm.org/D70840



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


[Lldb-commits] [PATCH] D70840: [LLDB] [DWARF] Strip out the thumb bit from addresses on ARM

2019-12-03 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D70840#1765373 , @clayborg wrote:

> So some background on how address masks are handled in LLDB:
>
> Typically the way we have tried to take care of the extra Thumb bit for ARM 
> using:
>
>   lldb::addr_t Address::GetCallableLoadAddress(Target *target, bool 
> is_indirect = false) const;
>   lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class = 
> AddressClass::eInvalid) const;
>   
>
> The first will add the extra bit to an address if needed. The latter will 
> strip the bit if needed. This does require a target though and the target 
> uses the "Architecture" class for ARM to do the work of using the mask. Not 
> sure if we want to try to get an architecture class and use that here for 
> stripping the bit instead of using an address mask?


So, where do I get hold of an Architecture* object instance from within the 
relevant contexts (within SymbolFileDWARF, where we have a reference to the 
object file)? Also within source/Symbol/DWARFCallFrameInfo.cpp where we have 
existing code that does the same.


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

https://reviews.llvm.org/D70840



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


[Lldb-commits] [PATCH] D70954: [lldb] Don't put compile unit name into the support file list

2019-12-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

This seems to break `Shell/SymbolFile/DWARF/debug-types-address-ranges.s` on my 
machine: https://teemperor.de/pub/D70954.log


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70954



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


[Lldb-commits] [PATCH] D70954: [lldb] Don't put compile unit name into the support file list

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath planned changes to this revision.
labath added a comment.

It seems one dwarf5 test is failing with this change (or rather, it was 
accidentally passing before as it picked up the fake line 0 entry). Since this 
patch is not that big, I'll just fold the dwarf5 followup into it. Planning 
changes == I need to come up with a test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70954



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


[Lldb-commits] [PATCH] D70932: [EditLine] Fix RecallHistory that makes it move in the opposite direction.

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D70932#1766846 , @teemperor wrote:

> Yes, multiline expressions use this code, but I don't see any functional 
> change in this patch that could be tested? It seems to only change the bool 
> to an enum so that we can pass in Swift `Newer`/`Older` instead of cryptic 
> `true`/`false` (and the actual fix is swapping this in swift-lldb).
>
> Anyway, I added a test for going up/down in multiline expressions in 
> rG4821d2a014e02b14223676c98b2ef5244eb91da8 
> . As 
> this seems NFC and the changed  code is now tested, this can land.


Yes, that makes sense. And thank you for adding the test!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70932



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


[Lldb-commits] [PATCH] D70932: [EditLine] Fix RecallHistory that makes it move in the opposite direction.

2019-12-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

Yes, multiline expressions use this code, but I don't see any functional change 
in this patch that could be tested? It seems to only change the bool to an enum 
so that we can pass in Swift `Newer`/`Older` instead of cryptic `true`/`false` 
(and the actual fix is swapping this in swift-lldb).

Anyway, I added a test for going up/down in multiline expressions in 
rG4821d2a014e02b14223676c98b2ef5244eb91da8 
. As this 
seems NFC and the changed  code is now tested, this can land.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70932



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


[Lldb-commits] [PATCH] D70954: [lldb] Don't put compile unit name into the support file list

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, JDevlieghere.
Herald added a subscriber: aprantl.
Herald added a reviewer: jdoerfert.
Herald added a project: LLDB.

Lldb's "format-independent" debug info made use of the fact that DWARF
(<=4) did not use the file index zero, and reused the support file index
zero for storing the compile unit name.

While this provided some convenience for DWARF<=4, it meant that the PDB
plugin needed to artificially remap file indices in order to free up
index 0. Furthermore, DWARF v5 make file index 0 legal, which meant that
similar remapping would be needed in the dwarf plugin too.

What this patch does instead is remove the requirement of having the
compile unit name in the index 0. It is not that useful since the name
can always be fetched from the CompileUnit object. Remapping code in the
pdb plugin(s) has been removed or simplified.

DWARF plugin has started inserting an empty FileSpec at index 0 to
ensure the indices keep matching up. In a follow-up patch, I'll start
adding the file zero in case of DWARF v5.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70954

Files:
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Symbol/CompileUnit.cpp

Index: lldb/source/Symbol/CompileUnit.cpp
===
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -210,23 +210,12 @@
 uint32_t CompileUnit::FindLineEntry(uint32_t start_idx, uint32_t line,
 const FileSpec *file_spec_ptr, bool exact,
 LineEntry *line_entry_ptr) {
-  uint32_t file_idx = 0;
+  if (!file_spec_ptr)
+file_spec_ptr = ();
+  uint32_t file_idx = GetSupportFiles().FindFileIndex(0, *file_spec_ptr, true);
+  if (file_idx == UINT32_MAX)
+return UINT32_MAX;
 
-  if (file_spec_ptr) {
-file_idx = GetSupportFiles().FindFileIndex(1, *file_spec_ptr, true);
-if (file_idx == UINT32_MAX)
-  return UINT32_MAX;
-  } else {
-// All the line table entries actually point to the version of the Compile
-// Unit that is in the support files (the one at 0 was artificially added.)
-// So prefer the one further on in the support files if it exists...
-const FileSpecList _files = GetSupportFiles();
-const bool full = true;
-file_idx = support_files.FindFileIndex(
-1, support_files.GetFileSpecAtIndex(0), full);
-if (file_idx == UINT32_MAX)
-  file_idx = 0;
-  }
   LineTable *line_table = GetLineTable();
   if (line_table)
 return line_table->FindLineEntryIndexByFileIndex(start_idx, file_idx, line,
@@ -253,7 +242,7 @@
 return;
 
   uint32_t file_idx =
-  GetSupportFiles().FindFileIndex(1, file_spec, true);
+  GetSupportFiles().FindFileIndex(0, file_spec, true);
   while (file_idx != UINT32_MAX) {
 file_indexes.push_back(file_idx);
 file_idx = GetSupportFiles().FindFileIndex(file_idx + 1, file_spec, true);
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -371,10 +371,6 @@
 support_files.AppendIfUnique(spec);
   }
 
-  // LLDB uses the DWARF-like file numeration (one based),
-  // the zeroth file is the compile unit itself
-  support_files.Insert(0, comp_unit.GetPrimaryFile());
-
   return true;
 }
 
@@ -1881,9 +1877,7 @@
   if (!source_files)
 return;
 
-  // LLDB uses the DWARF-like file numeration (one based)
-  int index = 1;
-
+  int index = 0;
   while (auto file = source_files->getNext()) {
 uint32_t source_id = file->getUniqueId();
 index_map[source_id] = index++;
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1110,9 +1110,7 @@
   // LLDB wants the index of the file in the list of support files.
   auto fn_iter = llvm::find(cci->m_file_list, *efn);
   lldbassert(fn_iter != cci->m_file_list.end());
-  // LLDB support file indices are 1-based.
-  uint32_t file_index =
-  1 + std::distance(cci->m_file_list.begin(), fn_iter);
+  uint32_t file_index = std::distance(cci->m_file_list.begin(), fn_iter);
 
   std::unique_ptr sequence(
   line_table->CreateLineSequenceContainer());
@@ -1155,14 +1153,6 @@
 FileSpec spec(f, style);
 support_files.Append(spec);
   }
-
-  llvm::SmallString<64> main_source_file =
-  m_index->compilands().GetMainSourceFile(*cci);
-  FileSpec::Style style = main_source_file.startswith("/")
- 

[Lldb-commits] [PATCH] D70722: [lldb/IRExecutionUnit] Stop searching based on demangled names

2019-12-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM, thanks for fixing this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70722



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


[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Hi,

I'm not sure if you've noticed but the re-enabled TestBasicEntryValuesX86_64.py 
is failing both on linux and mac. An example of breakage can be found here: 
http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/4338/testReport/ (you 
can ignore the TestReturnValue.py failure -- that's an unrelated concurrent 
breakage which has been since fixed).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68209



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


[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-03 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro added a comment.

Reverted while investigating. I am not sure what happened, since the test 
passed on my machine. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68209



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


[Lldb-commits] [lldb] 409350d - Revert "[LiveDebugValues] Introduce entry values of unmodified params"

2019-12-03 Thread Djordje Todorovic via lldb-commits

Author: Djordje Todorovic
Date: 2019-12-03T13:13:27+01:00
New Revision: 409350deeaf27ab767018b4c4834cfb82919e338

URL: 
https://github.com/llvm/llvm-project/commit/409350deeaf27ab767018b4c4834cfb82919e338
DIFF: 
https://github.com/llvm/llvm-project/commit/409350deeaf27ab767018b4c4834cfb82919e338.diff

LOG: Revert "[LiveDebugValues] Introduce entry values of unmodified params"

This reverts commit rG4cfceb910692 due to LLDB test failing.

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py

lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
llvm/lib/CodeGen/LiveDebugValues.cpp
llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir

Removed: 
llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir



diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
index e0285e6d626d..1192c2b672f6 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
@@ -6,7 +6,8 @@
 supported_platforms.extend(lldbplatformutil.getDarwinOSTriples())
 
 lldbinline.MakeInlineTest(__file__, globals(),
-[decorators.skipUnlessPlatform(supported_platforms),
+[decorators.skipIf(bugnumber="llvm.org/pr44059"),
+ decorators.skipUnlessPlatform(supported_platforms),
  decorators.skipIf(compiler="clang", compiler_version=['<', '10.0']),
  decorators.skipUnlessArch('x86_64'),
  decorators.skipUnlessHasCallSiteInfo,

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
 
b/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
index 9aac6e947838..ff72a81c6b29 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
@@ -18,14 +18,6 @@ template __attribute__((noinline)) void use(T x) 
{
   /* Clobbers */ : "rsi" \
   );
 
-// Destroy %rbx in the current frame.
-#define DESTROY_RBX \
-  asm volatile ("xorq %%rbx, %%rbx" \
-  /* Outputs */  : \
-  /* Inputs */   : \
-  /* Clobbers */ : "rbx" \
-  );
-
 struct S1 {
   int field1 = 123;
   int *field2 = 
@@ -38,17 +30,10 @@ void func1(int , int x) {
   // Destroy 'x' in the current frame.
   DESTROY_RSI;
 
-  // NOTE: Currently, we do not generate DW_OP_entry_value for the 'x',
-  // since it gets copied into a register that is not callee saved,
-  // and we can not guarantee that its value has not changed.
+  //% self.filecheck("image lookup -va $pc", "main.cpp", 
"-check-prefix=FUNC1-DESC")
+  // FUNC1-DESC: name = "x", type = "int", location = 
DW_OP_entry_value(DW_OP_reg4 RSI)
 
   ++sink;
-
-  // Destroy 'sink' in the current frame.
-  DESTROY_RBX;
-
-  //% self.filecheck("image lookup -va $pc", "main.cpp", 
"-check-prefix=FUNC1-DESC")
-  // FUNC1-DESC: name = "sink", type = "int &", location = 
DW_OP_entry_value(DW_OP_reg5 RDI)
 }
 
 __attribute__((noinline))
@@ -58,16 +43,10 @@ void func2(int , int x) {
   // Destroy 'x' in the current frame.
   DESTROY_RSI;
 
-  //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC2-EXPR-FAIL", 
expect_cmd_failure=True)
-  // FUNC2-EXPR-FAIL: couldn't get the value of variable x: variable not 
available
+  //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC2-EXPR")
+  // FUNC2-EXPR: (int) ${{.*}} = 123
 
   ++sink;
-
-  // Destroy 'sink' in the current frame.
-  DESTROY_RBX;
-
-  //% self.filecheck("expr sink", "main.cpp", "-check-prefix=FUNC2-EXPR")
-  // FUNC2-EXPR: ${{.*}} = 2
 }
 
 __attribute__((noinline))
@@ -90,16 +69,10 @@ void func4_amb(int , int x) {
   // Destroy 'x' in the current frame.
   DESTROY_RSI;
 
-  //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC4-EXPR-FAIL", 
expect_cmd_failure=True)
-  // FUNC4-EXPR-FAIL: couldn't get the value of variable x: variable not 
available
+  //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC4-EXPR", 
expect_cmd_failure=True)
+  // FUNC4-EXPR: couldn't get the value of variable x: Could not evaluate 
DW_OP_entry_value.
 
   ++sink;
-
-  // Destroy 'sink' 

[Lldb-commits] [PATCH] D70532: [lldb] Improve/fix base address selection in location lists

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Greg, what do you make of this version?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70532



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


[Lldb-commits] [lldb] 16c0653 - [lldb][NFC] Extract searching for function SymbolContexts out of ClangExpressionDeclMap::LookupFunction

2019-12-03 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-12-03T12:33:24+01:00
New Revision: 16c0653db1150c849bb25f0547abb64349234394

URL: 
https://github.com/llvm/llvm-project/commit/16c0653db1150c849bb25f0547abb64349234394
DIFF: 
https://github.com/llvm/llvm-project/commit/16c0653db1150c849bb25f0547abb64349234394.diff

LOG: [lldb][NFC] Extract searching for function SymbolContexts out of 
ClangExpressionDeclMap::LookupFunction

This code was just creating a new SymbolContextList with any found functions
in the front and orders them by how close they are to the current frame.
This refactors this code into its own function to make this more obvious.

Doesn't do any other changes to the code, so this is NFC.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 22966e8023d6..fc25a2e72e3b 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1177,6 +1177,104 @@ bool ClangExpressionDeclMap::LookupLocalVariable(
   return variable_found;
 }
 
+/// Structure to hold the info needed when comparing function
+/// declarations.
+namespace {
+struct FuncDeclInfo {
+  ConstString m_name;
+  CompilerType m_copied_type;
+  uint32_t m_decl_lvl;
+  SymbolContext m_sym_ctx;
+};
+} // namespace
+
+SymbolContextList ClangExpressionDeclMap::SearchFunctionsInSymbolContexts(
+const SymbolContextList _list,
+const CompilerDeclContext _decl_context) {
+  // First, symplify things by looping through the symbol contexts to
+  // remove unwanted functions and separate out the functions we want to
+  // compare and prune into a separate list. Cache the info needed about
+  // the function declarations in a vector for efficiency.
+  uint32_t num_indices = sc_list.GetSize();
+  SymbolContextList sc_sym_list;
+  std::vector decl_infos;
+  decl_infos.reserve(num_indices);
+  clang::DeclContext *frame_decl_ctx =
+  (clang::DeclContext *)frame_decl_context.GetOpaqueDeclContext();
+  ClangASTContext *ast = llvm::dyn_cast_or_null(
+  frame_decl_context.GetTypeSystem());
+
+  for (uint32_t index = 0; index < num_indices; ++index) {
+FuncDeclInfo fdi;
+SymbolContext sym_ctx;
+sc_list.GetContextAtIndex(index, sym_ctx);
+
+// We don't know enough about symbols to compare them, but we should
+// keep them in the list.
+Function *function = sym_ctx.function;
+if (!function) {
+  sc_sym_list.Append(sym_ctx);
+  continue;
+}
+// Filter out functions without declaration contexts, as well as
+// class/instance methods, since they'll be skipped in the code that
+// follows anyway.
+CompilerDeclContext func_decl_context = function->GetDeclContext();
+if (!func_decl_context ||
+func_decl_context.IsClassMethod(nullptr, nullptr, nullptr))
+  continue;
+// We can only prune functions for which we can copy the type.
+CompilerType func_clang_type = function->GetType()->GetFullCompilerType();
+CompilerType copied_func_type = GuardedCopyType(func_clang_type);
+if (!copied_func_type) {
+  sc_sym_list.Append(sym_ctx);
+  continue;
+}
+
+fdi.m_sym_ctx = sym_ctx;
+fdi.m_name = function->GetName();
+fdi.m_copied_type = copied_func_type;
+fdi.m_decl_lvl = LLDB_INVALID_DECL_LEVEL;
+if (fdi.m_copied_type && func_decl_context) {
+  // Call CountDeclLevels to get the number of parent scopes we have
+  // to look through before we find the function declaration. When
+  // comparing functions of the same type, the one with a lower count
+  // will be closer to us in the lookup scope and shadows the other.
+  clang::DeclContext *func_decl_ctx =
+  (clang::DeclContext *)func_decl_context.GetOpaqueDeclContext();
+  fdi.m_decl_lvl = ast->CountDeclLevels(frame_decl_ctx, func_decl_ctx,
+_name, _copied_type);
+}
+decl_infos.emplace_back(fdi);
+  }
+
+  // Loop through the functions in our cache looking for matching types,
+  // then compare their scope levels to see which is closer.
+  std::multimap matches;
+  for (const FuncDeclInfo  : decl_infos) {
+const CompilerType t = fdi.m_copied_type;
+auto q = matches.find(t);
+if (q != matches.end()) {
+  if (q->second->m_decl_lvl > fdi.m_decl_lvl)
+// This function is closer; remove the old set.
+matches.erase(t);
+  else if (q->second->m_decl_lvl < fdi.m_decl_lvl)
+// The functions in our set are closer - skip this one.
+continue;
+}
+matches.insert(std::make_pair(t, ));
+  }
+
+  // Loop through 

[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-03 Thread Djordje Todorovic via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4cfceb910692: [LiveDebugValues] Introduce entry values of 
unmodified params (authored by djtodoro).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68209

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
  
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
  llvm/lib/CodeGen/LiveDebugValues.cpp
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
  llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir

Index: llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
===
--- /dev/null
+++ llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
@@ -0,0 +1,184 @@
+# RUN: llc -debug-entry-values -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
+#
+#extern void fn1 (int, int, int);
+#__attribute__((noinline))
+#int
+#fn2 (int a, int b, int c) {
+#  int q = 2 + a;
+#  fn1 (5, 6, q);
+#  if (b < 17) {
+#b = b + 7;
+# fn1 (5, b, q);
+#  } else {
+#b = b + 1;
+#fn1 (1, b, q);
+#  }
+#  return b;
+#}
+# CHECK: ![[ARG_C:.*]] = !DILocalVariable(name: "c"
+# CHECK: bb.0.entry:
+# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
+# CHECK: bb.1.if.then:
+# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
+# CHECK: bb.2.if.else:
+# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
+# CHECK: bb.3.if.end:
+# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
+#
+--- |
+  ; ModuleID = 'test.c'
+  source_filename = "test.c"
+  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+  target triple = "x86_64-unknown-linux-gnu"
+
+  ; Function Attrs: noinline nounwind uwtable
+  define dso_local i32 @fn2(i32 %a, i32 %b, i32 %c) local_unnamed_addr !dbg !12 {
+  entry:
+call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !20
+call void @llvm.dbg.value(metadata i32 %b, metadata !17, metadata !DIExpression()), !dbg !20
+call void @llvm.dbg.value(metadata i32 %c, metadata !18, metadata !DIExpression()), !dbg !20
+%add = add nsw i32 %a, 2, !dbg !21
+call void @llvm.dbg.value(metadata i32 %add, metadata !19, metadata !DIExpression()), !dbg !20
+tail call void @fn1(i32 5, i32 6, i32 %add), !dbg !22
+%cmp = icmp slt i32 %b, 17, !dbg !23
+br i1 %cmp, label %if.then, label %if.else, !dbg !25
+
+  if.then:  ; preds = %entry
+%add1 = add nsw i32 %b, 7, !dbg !26
+call void @llvm.dbg.value(metadata i32 %add1, metadata !17, metadata !DIExpression()), !dbg !20
+tail call void @fn1(i32 5, i32 %add1, i32 %add), !dbg !28
+br label %if.end, !dbg !29
+
+  if.else:  ; preds = %entry
+%add2 = add nuw nsw i32 %b, 1, !dbg !30
+call void @llvm.dbg.value(metadata i32 %add2, metadata !17, metadata !DIExpression()), !dbg !20
+tail call void @fn1(i32 1, i32 %add2, i32 %add), !dbg !32
+br label %if.end
+
+  if.end:   ; preds = %if.else, %if.then
+%b.addr.0 = phi i32 [ %add1, %if.then ], [ %add2, %if.else ], !dbg !33
+call void @llvm.dbg.value(metadata i32 %b.addr.0, metadata !17, metadata !DIExpression()), !dbg !20
+ret i32 %b.addr.0, !dbg !34
+  }
+
+  declare !dbg !4 dso_local void @fn1(i32, i32, i32) local_unnamed_addr
+
+  ; Function Attrs: nounwind readnone speculatable willreturn
+  declare void @llvm.dbg.value(metadata, metadata, metadata)
+
+  !llvm.dbg.cu = !{!0}
+  !llvm.module.flags = !{!8, !9, !10}
+  !llvm.ident = !{!11}
+
+  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
+  !1 = !DIFile(filename: "test.c", directory: "/")
+  !2 = !{}
+  !3 = !{!4}
+  !4 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
+  !5 = !DISubroutineType(types: !6)
+  !6 = !{null, !7, !7, !7}
+  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+  !8 = !{i32 2, !"Dwarf Version", i32 4}
+  !9 = !{i32 2, !"Debug Info Version", i32 3}
+  !10 = !{i32 1, !"wchar_size", i32 4}
+  !11 = !{!"clang version 10.0.0"}
+  

[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-03 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro added a comment.

Thanks for the reviews!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68209



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


[Lldb-commits] [lldb] b37a43d - [lldb] Remove all remaining tabs from TestReturnValue.py

2019-12-03 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-12-03T12:14:40+01:00
New Revision: b37a43d93db8c5afb3b95d803638f0536608779d

URL: 
https://github.com/llvm/llvm-project/commit/b37a43d93db8c5afb3b95d803638f0536608779d
DIFF: 
https://github.com/llvm/llvm-project/commit/b37a43d93db8c5afb3b95d803638f0536608779d.diff

LOG: [lldb] Remove all remaining tabs from TestReturnValue.py

I assumed this was just a single typo, but it seems we actually have
a whole bunch of tabs in this file which cause Python to complain
about mixing tabs and spaces.

Added: 


Modified: 

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

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
index a0f434aad654..e84bbc3c245d 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
@@ -127,7 +127,7 @@ def test_with_python(self):
 #self.assertTrue(in_float == return_float)
 
 if not self.affected_by_radar_34562999() and not 
self.affected_by_pr44132():
-   self.return_and_test_struct_value("return_one_int")
+self.return_and_test_struct_value("return_one_int")
 self.return_and_test_struct_value("return_two_int")
 self.return_and_test_struct_value("return_three_int")
 self.return_and_test_struct_value("return_four_int")
@@ -185,12 +185,12 @@ def test_vector_values(self):
 
 self.return_and_test_struct_value("return_vector_size_float32_8")
 self.return_and_test_struct_value("return_vector_size_float32_16")
-   if not self.affected_by_pr44132():
-   
self.return_and_test_struct_value("return_vector_size_float32_32")
+if not self.affected_by_pr44132():
+self.return_and_test_struct_value("return_vector_size_float32_32")
 self.return_and_test_struct_value("return_ext_vector_size_float32_2")
 self.return_and_test_struct_value("return_ext_vector_size_float32_4")
-   if not self.affected_by_pr44132():
-   
self.return_and_test_struct_value("return_ext_vector_size_float32_8")
+if not self.affected_by_pr44132():
+
self.return_and_test_struct_value("return_ext_vector_size_float32_8")
 
 # limit the nested struct and class tests to only x86_64
 @skipIf(archs=no_match(['x86_64']))



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


[Lldb-commits] [lldb] 4821d2a - [lldb][NFC] Test going up/down one line in the multiline expression editor

2019-12-03 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-12-03T12:06:40+01:00
New Revision: 4821d2a014e02b14223676c98b2ef5244eb91da8

URL: 
https://github.com/llvm/llvm-project/commit/4821d2a014e02b14223676c98b2ef5244eb91da8
DIFF: 
https://github.com/llvm/llvm-project/commit/4821d2a014e02b14223676c98b2ef5244eb91da8.diff

LOG: [lldb][NFC] Test going up/down one line in the multiline expression editor

Added: 

lldb/packages/Python/lldbsuite/test/commands/expression/multiline-navigation/TestMultilineNavigation.py

Modified: 


Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/multiline-navigation/TestMultilineNavigation.py
 
b/lldb/packages/Python/lldbsuite/test/commands/expression/multiline-navigation/TestMultilineNavigation.py
new file mode 100644
index ..712111209215
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/commands/expression/multiline-navigation/TestMultilineNavigation.py
@@ -0,0 +1,67 @@
+"""
+Tests navigating in the multiline expression editor.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class TestCase(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+arrow_up = "\033[A"
+arrow_down = "\033[B"
+
+# PExpect uses many timeouts internally and doesn't play well
+# under ASAN on a loaded machine..
+@skipIfAsan
+def test_nav_arrow_up(self):
+"""Tests that we can navigate back to the previous line with the up 
arrow"""
+self.launch()
+
+# Start multiline expression mode by just running 'expr'
+self.child.sendline("expr")
+self.child.expect_exact("terminate with an empty line to evaluate")
+# Create a simple integer expression '123' and press enter.
+self.child.send("123\n")
+# We should see the prompt for the second line of our expression.
+self.child.expect_exact("2: ")
+# Go back to the first line and change 123 to 124.
+# Then press enter twice to evaluate our expression.
+self.child.send(self.arrow_up + "\b4\n\n")
+# The result of our expression should be 124 (our edited expression)
+# and not 123 (the one we initially typed).
+self.child.expect_exact("(int) $0 = 124")
+
+self.quit()
+
+@skipIfAsan
+def test_nav_arrow_down(self):
+"""Tests that we can navigate to the next line with the down arrow"""
+self.launch()
+
+# Start multiline expression mode by just running 'expr'
+self.child.sendline("expr")
+self.child.expect_exact("terminate with an empty line to evaluate")
+# Create a simple integer expression '111' and press enter.
+self.child.send("111\n")
+# We should see the prompt for the second line of our expression.
+self.child.expect_exact("2: ")
+# Create another simple integer expression '222'.
+self.child.send("222")
+# Go back to the first line and change '111' to '111+' to make
+# an addition operation that spans two lines. We need to go up to
+# test that we can go back down again.
+self.child.send(self.arrow_up + "+")
+# Go back down to our second line and change '222' to '223'
+# so that the full expression is now '111+\n223'.
+# Then press enter twice to evaluate the expression.
+self.child.send(self.arrow_down + "\b3\n\n")
+# The result of our expression '111 + 223' should be '334'.
+# If the expression is '333' then arrow down failed to get
+# us back to the second line.
+self.child.expect_exact("(int) $0 = 334")
+
+self.quit()



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


[Lldb-commits] [lldb] 057626b - Fixup 6d18e53: xfail TestShowLocationDwarf5.py properly

2019-12-03 Thread Diana Picus via lldb-commits

Author: Diana Picus
Date: 2019-12-03T11:53:28+01:00
New Revision: 057626b4393836e11712bd694afda121d8309973

URL: 
https://github.com/llvm/llvm-project/commit/057626b4393836e11712bd694afda121d8309973
DIFF: 
https://github.com/llvm/llvm-project/commit/057626b4393836e11712bd694afda121d8309973.diff

LOG: Fixup 6d18e53: xfail TestShowLocationDwarf5.py properly

Forgot to squash this...

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py
index 2ceeed6a8f15..1d4bc6f13450 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py
@@ -9,7 +9,7 @@ class TestTargetSourceMap(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
-@skipIf(archs="aarch64", oslist="linux", debug_info="dwo",
+@skipIf(archs="aarch64", oslist="linux",
 bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44180;)
 def test_source_map(self):
 # Set the target soure map to map "./" to the current test directory.



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


[Lldb-commits] [PATCH] D63540: Fix lookup of symbols at the same address with no size vs. size

2019-12-03 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

Hi Jan,

I have done further investigation on this with new ampere arm server. This 
problem manifests itself on all kind of Debian flavors and is not related to 
underlying libraries. I have tested LLDB on Arm 32bit host with Ubuntu Xenial, 
Bionic and Debian Buster all show same problem.

Moreover this problem seems to be emerging from clang expression parser 
generating symbols while evaluating certain types of expressions. These symbols 
are rejected by expression interpreter. LLDB symtab classes are utilized for 
expressions as well so it is a highly likely problem so I would suggest you to 
investigate further on these lines

For example: 
./bin/lldb-dotest -p TestVirtual.py -v -t

test_virtual_madness_dwarf (TestVirtual.CppVirtualMadness) fails with following 
error

runCmd: expression a_as_A->a()
runCmd failed!
error: Can't run the expression locally: Interpreter doesn't handle one of the 
expression's opcodes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63540



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


[Lldb-commits] [lldb] 46d0ec3 - [lldb] Remove tab from TestReturnValue.py

2019-12-03 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-12-03T11:44:24+01:00
New Revision: 46d0ec3a803021281c8d868b1487d2d5cd06f274

URL: 
https://github.com/llvm/llvm-project/commit/46d0ec3a803021281c8d868b1487d2d5cd06f274
DIFF: 
https://github.com/llvm/llvm-project/commit/46d0ec3a803021281c8d868b1487d2d5cd06f274.diff

LOG: [lldb] Remove tab from TestReturnValue.py

Mixing tabs and spaces makes Python exit with this error:

  File 
"llvm/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py",
 line 23
return (self.getArchitecture() == "aarch64" and self.getPlatform() == 
"linux")

 ^
TabError: inconsistent use of tabs and spaces in indentation

Added: 


Modified: 

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

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
index b326c96325fa..a0f434aad654 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
@@ -20,7 +20,7 @@ def affected_by_pr33042(self):
 "aarch64" and self.getPlatform() == "linux")
 
 def affected_by_pr44132(self):
-   return (self.getArchitecture() == "aarch64" and self.getPlatform() == 
"linux")
+return (self.getArchitecture() == "aarch64" and self.getPlatform() == 
"linux")
 
 # ABIMacOSX_arm can't fetch simple values inside a structure
 def affected_by_radar_34562999(self):



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


[Lldb-commits] [PATCH] D70906: [lldb] Move register info "augmentation" from gdb-remote into ABI

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2b8db387f2a6: [lldb] Move register info 
augmentation from gdb-remote into ABI (authored by labath).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70906

Files:
  lldb/include/lldb/Target/ABI.h
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/basic_eh_frame.yaml
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Target/ABI.cpp

Index: lldb/source/Target/ABI.cpp
===
--- lldb/source/Target/ABI.cpp
+++ lldb/source/Target/ABI.cpp
@@ -63,24 +63,6 @@
   return false;
 }
 
-bool ABI::GetRegisterInfoByKind(RegisterKind reg_kind, uint32_t reg_num,
-RegisterInfo ) {
-  if (reg_kind < eRegisterKindEHFrame || reg_kind >= kNumRegisterKinds)
-return false;
-
-  uint32_t count = 0;
-  const RegisterInfo *register_info_array = GetRegisterInfoArray(count);
-  if (register_info_array) {
-for (uint32_t i = 0; i < count; ++i) {
-  if (register_info_array[i].kinds[reg_kind] == reg_num) {
-info = register_info_array[i];
-return true;
-  }
-}
-  }
-  return false;
-}
-
 ValueObjectSP ABI::GetReturnValueObject(Thread , CompilerType _type,
 bool persistent) const {
   if (!ast_type.IsValid())
@@ -229,3 +211,20 @@
   assert(info_up);
   return info_up;
 }
+
+void ABI::AugmentRegisterInfo(RegisterInfo ) {
+  if (info.kinds[eRegisterKindEHFrame] != LLDB_INVALID_REGNUM &&
+  info.kinds[eRegisterKindDWARF] != LLDB_INVALID_REGNUM)
+return;
+
+  RegisterInfo abi_info;
+  if (!GetRegisterInfoByName(ConstString(info.name), abi_info))
+return;
+
+  if (info.kinds[eRegisterKindEHFrame] == LLDB_INVALID_REGNUM)
+info.kinds[eRegisterKindEHFrame] = abi_info.kinds[eRegisterKindEHFrame];
+  if (info.kinds[eRegisterKindDWARF] == LLDB_INVALID_REGNUM)
+info.kinds[eRegisterKindDWARF] = abi_info.kinds[eRegisterKindDWARF];
+  if (info.kinds[eRegisterKindGeneric] == LLDB_INVALID_REGNUM)
+info.kinds[eRegisterKindGeneric] = abi_info.kinds[eRegisterKindGeneric];
+}
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -388,36 +388,6 @@
   return false;
 }
 
-// If the remote stub didn't give us eh_frame or DWARF register numbers for a
-// register, see if the ABI can provide them.
-// DWARF and eh_frame register numbers are defined as a part of the ABI.
-static void AugmentRegisterInfoViaABI(RegisterInfo _info,
-  ConstString reg_name, ABISP abi_sp) {
-  if (reg_info.kinds[eRegisterKindEHFrame] == LLDB_INVALID_REGNUM ||
-  reg_info.kinds[eRegisterKindDWARF] == LLDB_INVALID_REGNUM) {
-if (abi_sp) {
-  RegisterInfo abi_reg_info;
-  if (abi_sp->GetRegisterInfoByName(reg_name, abi_reg_info)) {
-if (reg_info.kinds[eRegisterKindEHFrame] == LLDB_INVALID_REGNUM &&
-abi_reg_info.kinds[eRegisterKindEHFrame] != LLDB_INVALID_REGNUM) {
-  reg_info.kinds[eRegisterKindEHFrame] =
-  abi_reg_info.kinds[eRegisterKindEHFrame];
-}
-if (reg_info.kinds[eRegisterKindDWARF] == LLDB_INVALID_REGNUM &&
-abi_reg_info.kinds[eRegisterKindDWARF] != LLDB_INVALID_REGNUM) {
-  reg_info.kinds[eRegisterKindDWARF] =
-  abi_reg_info.kinds[eRegisterKindDWARF];
-}
-if (reg_info.kinds[eRegisterKindGeneric] == LLDB_INVALID_REGNUM &&
-abi_reg_info.kinds[eRegisterKindGeneric] != LLDB_INVALID_REGNUM) {
-  reg_info.kinds[eRegisterKindGeneric] =
-  abi_reg_info.kinds[eRegisterKindGeneric];
-}
-  }
-}
-  }
-}
-
 static size_t SplitCommaSeparatedRegisterNumberString(
 const llvm::StringRef _separated_regiter_numbers,
 std::vector , int base) {
@@ -615,12 +585,12 @@
   reg_info.invalidate_regs = invalidate_regs.data();
 }
 
+reg_info.name = reg_name.AsCString();
 // We have to make a temporary ABI here, and not use the GetABI because
 // this code gets called in DidAttach, when the target architecture
 // (and consequently the ABI we'll get from the process) may be wrong.
-ABISP abi_to_use = ABI::FindPlugin(shared_from_this(), arch_to_use);
-
-AugmentRegisterInfoViaABI(reg_info, reg_name, abi_to_use);
+if (ABISP abi_sp = ABI::FindPlugin(shared_from_this(), arch_to_use))
+  abi_sp->AugmentRegisterInfo(reg_info);
 
 m_register_info.AddRegister(reg_info, reg_name, alt_name, set_name);
   } else 

[Lldb-commits] [lldb] 2b8db38 - [lldb] Move register info "augmentation" from gdb-remote into ABI

2019-12-03 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2019-12-03T11:39:20+01:00
New Revision: 2b8db387f2a616f39a077ede18c6366f2ea9f203

URL: 
https://github.com/llvm/llvm-project/commit/2b8db387f2a616f39a077ede18c6366f2ea9f203
DIFF: 
https://github.com/llvm/llvm-project/commit/2b8db387f2a616f39a077ede18c6366f2ea9f203.diff

LOG: [lldb] Move register info "augmentation" from gdb-remote into ABI

Summary:
Previously the ABI plugin exposed some "register infos" and the
gdb-remote code used those to fill in the missing bits. Now, the
"filling in" code is in the ABI plugin itself, and the gdb-remote code
just invokes that.

The motivation for this is two-fold:
a) the "augmentation" logic is useful outside of process gdb-remote. For
  instance, it would allow us to avoid repeating the register number
  definitions in minidump code.
b) It gives more implementation freedom to the ABI classes. Now that
  these "register infos" are essentially implementation details, classes
  can use other methods to obtain dwarf/eh_frame register numbers -- for
  instance they can consult llvm MC layer.

Since the augmentation code was not currently tested anywhere, I took
the opportunity to create a simple test for it.

Reviewers: jasonmolenda, clayborg, tatyana-krasnukha

Subscribers: aprantl, lldb-commits

Tags: #lldb

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

Added: 

lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/basic_eh_frame.yaml

Modified: 
lldb/include/lldb/Target/ABI.h

lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Target/ABI.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/ABI.h b/lldb/include/lldb/Target/ABI.h
index 93378abc2ac2..1aff1e2f7817 100644
--- a/lldb/include/lldb/Target/ABI.h
+++ b/lldb/include/lldb/Target/ABI.h
@@ -126,12 +126,7 @@ class ABI : public PluginInterface {
 
   llvm::MCRegisterInfo () { return *m_mc_register_info_up; }
 
-  virtual const RegisterInfo *GetRegisterInfoArray(uint32_t ) = 0;
-
-  bool GetRegisterInfoByName(ConstString name, RegisterInfo );
-
-  bool GetRegisterInfoByKind(lldb::RegisterKind reg_kind, uint32_t reg_num,
- RegisterInfo );
+  virtual void AugmentRegisterInfo(RegisterInfo );
 
   virtual bool GetPointerReturnRegister(const char *) { return false; }
 
@@ -143,6 +138,10 @@ class ABI : public PluginInterface {
 assert(m_mc_register_info_up && "ABI must have MCRegisterInfo");
   }
 
+  bool GetRegisterInfoByName(ConstString name, RegisterInfo );
+
+  virtual const RegisterInfo *GetRegisterInfoArray(uint32_t ) = 0;
+
   /// Utility function to construct a MCRegisterInfo using the ArchSpec triple.
   /// Plugins wishing to customize the construction can construct the
   /// MCRegisterInfo themselves.

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
index 9ea7cc8a4c7e..20e575ae978b 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
@@ -4,6 +4,101 @@
 from lldbsuite.test.decorators import *
 from gdbclientutils import *
 
+class MyResponder(MockGDBServerResponder):
+def qXferRead(self, obj, annex, offset, length):
+if annex == "target.xml":
+return """
+
+  i386:x86-64
+  
+
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+""", 

[Lldb-commits] [PATCH] D70946: [lldb][NFC] Move Curses interface implementation to own file

2019-12-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor marked 2 inline comments as done.
teemperor added inline comments.



Comment at: lldb/include/lldb/Core/CursesInterface.h:38-51
+class IOHandlerCursesValueObjectList : public IOHandler {
+public:
+  IOHandlerCursesValueObjectList(Debugger ,
+ ValueObjectList _list);
+
+  ~IOHandlerCursesValueObjectList() override;
+

labath wrote:
> Is this class actually used anywhere? Can we delete it and rename this file 
> to a plain `IOHandlerCursesGUI.h` ?
Interesting, this is indeed not referenced anywhere. Will remove it and then 
rename the file. Thanks!



Comment at: lldb/source/Commands/CommandObjectGUI.cpp:14
 #include "lldb/lldb-private.h"
 
+#include "lldb/Core/CursesInterface.h"

labath wrote:
> What's up with these random blank lines? It seems everyone is adding them 
> based on some different key... llvm does not use blank lines at all and just 
> relies on clang-format to produce a "reasonable" include block.
I'm getting paid by LOC


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70946



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


[Lldb-commits] [PATCH] D70946: [lldb][NFC] Move Curses interface implementation to own file

2019-12-03 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.

Yes, this was long overdue.




Comment at: lldb/include/lldb/Core/CursesInterface.h:38-51
+class IOHandlerCursesValueObjectList : public IOHandler {
+public:
+  IOHandlerCursesValueObjectList(Debugger ,
+ ValueObjectList _list);
+
+  ~IOHandlerCursesValueObjectList() override;
+

Is this class actually used anywhere? Can we delete it and rename this file to 
a plain `IOHandlerCursesGUI.h` ?



Comment at: lldb/source/Commands/CommandObjectGUI.cpp:14
 #include "lldb/lldb-private.h"
 
+#include "lldb/Core/CursesInterface.h"

What's up with these random blank lines? It seems everyone is adding them based 
on some different key... llvm does not use blank lines at all and just relies 
on clang-format to produce a "reasonable" include block.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70946



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


[Lldb-commits] [lldb] 6d18e53 - Mark some tests as xfail on AArch64 Linux

2019-12-03 Thread Diana Picus via lldb-commits

Author: Diana Picus
Date: 2019-12-03T10:57:42+01:00
New Revision: 6d18e5366c9a0bffe45b179a830483b3f2ec9fa9

URL: 
https://github.com/llvm/llvm-project/commit/6d18e5366c9a0bffe45b179a830483b3f2ec9fa9
DIFF: 
https://github.com/llvm/llvm-project/commit/6d18e5366c9a0bffe45b179a830483b3f2ec9fa9.diff

LOG: Mark some tests as xfail on AArch64 Linux

I have either opened new bug reports for these tests, or added links to
existing bugs.

This should help make the lldb-aarch64-ubuntu buildbot green (there will
still be some unexpected passes that someone should look into, but those
can be handled later).

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py

lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py

lldb/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py

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

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

lldb/packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py

lldb/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py

lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py
lldb/packages/Python/lldbsuite/test/lang/cpp/trivial_abi/TestTrivialABI.py
lldb/packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
 
b/lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
index e350e6ef930f..61107077f9cf 100644
--- 
a/lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
+++ 
b/lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
@@ -7,6 +7,8 @@ class StaticInitializers(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
+@expectedFailureAll(archs="aarch64", oslist="linux",
+
bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44053;)
 def test(self):
 """ Test a static initializer. """
 self.build()

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
index 020974ee469a..4a571787f011 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
@@ -26,6 +26,8 @@ def test_breakpoint(self):
 self.assertTrue(breakpoint.IsHardware())
 
 @skipIfWindows
+@expectedFailureAll(archs="aarch64", oslist="linux",
+
bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44055;)
 def test_step_range(self):
 """Test stepping when hardware breakpoints are required."""
 self.build()
@@ -47,6 +49,8 @@ def test_step_range(self):
 in error.GetCString())
 
 @skipIfWindows
+@expectedFailureAll(archs="aarch64", oslist="linux",
+
bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44055;)
 def test_step_out(self):
 """Test stepping out when hardware breakpoints are required."""
 self.build()
@@ -67,6 +71,8 @@ def test_step_out(self):
 in error.GetCString())
 
 @skipIfWindows
+@expectedFailureAll(archs="aarch64", oslist="linux",
+
bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44055;)
 def test_step_over(self):
 """Test stepping over when hardware breakpoints are required."""
 self.build()
@@ -85,6 +91,8 @@ def test_step_over(self):
 ])
 
 @skipIfWindows
+@expectedFailureAll(archs="aarch64", oslist="linux",
+
bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44055;)
 def test_step_until(self):
 """Test stepping until when hardware breakpoints are required."""
 self.build()

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
index a52cd4dd6865..ce4572361d93 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
@@ -18,6 

[Lldb-commits] [PATCH] D70934: [Reproducer] Add version check

2019-12-03 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.

Seems legit.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70934



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


[Lldb-commits] [PATCH] D70846: Expression eval lookup speedup by not returning methods in ManualDWARFIndex::GetFunctions

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D70846#1766204 , @shafik wrote:

> In D70846#1763731 , @labath wrote:
>
> > There's `lldb-shell :: SymbolFile/DWARF/find-basic-function.cpp`, which 
> > probably didn't get run for you as you didn't have lld enabled (cmake 
> > -DLLVM_ENABLE_PROJECTS=...;lld). You'll need to update that test to match 
> > the new behavior, but other than that, I think this is a good change.
>
>
> So with this change for the `find-basic-function.cpp` test I no longer see 
> any results for the `full` case so we should at least generate a case that 
> has results for the `full` case.


There's an additional check in that test which does a search by a mangled name 
(search for FULL-MANGLED), and this one does return some result. If this patch 
lands, I'm not sure if there's any other kind of a "full" lookup that we could 
perform. `eFunctionNameTypeFull` is documented as: `... For C this is the same 
as just the name of the function For C++ this is the mangled or demangled 
version of the mangled name...`, which appears like we should support searching 
by *de*mangled names. However, I'm not sure if that is actually a good idea. 
Implementing that for the manual index would be simple enough, but that is 
something that the apple index could never support (in fact, I think I remember 
that the manual index once supported searching by demangled names, but then I 
removed this ability for consistency when adding debug_names support).

That said, I think it may be interesting to add a test searching for an `extern 
"C"` symbol (which has no "mangled" name), as right now it's not clear if it 
will show up because of `function_fullnames.Find` or 
`function_basenames.Find`...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70846



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


[Lldb-commits] [PATCH] D70847: [lldb-vscode] Ensure that target matches the executable file

2019-12-03 Thread Anton Kolesov via Phabricator via lldb-commits
anton.kolesov added a comment.

In D70847#1763797 , @labath wrote:

> This needs a test case, though judging by your description it looks like 
> pretty much every test case on affected platforms (I guess, windows) should 
> hit this. Can you check if any of the existing vscode tests which are marked 
> @skipIfWindows start passing now?


Yes, that should be tested by existing launch tests already. My case is a 
proprietary Process plugin, not a Windows target and because my target is an 
embedded system with no ability to pass environemnt variables, command line 
arguments or an implementation of process exit I can't really run the existing 
tests for my target. I will try to build lldb for Windows and see if 
lldb-vscode tests will start working on it - as far as I can see all 
lldb-vscode tests are currently skipped for Windows.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70847



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


[Lldb-commits] [PATCH] D70932: [EditLine] Fix RecallHistory that makes it move in the opposite direction.

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D70932#1766190 , @JDevlieghere 
wrote:

> ... this code is only used by the REPL)


Are you sure about that? I think I was able to trigger something like this by 
entering the multiline expression mode (`expr`) , and then pressing 
alt+up/down. I'm not 100% sure of that's the thing you're fixing here, because 
i've never used this feature (though it is pretty cool), but my impression is 
that this is it.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70932



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


[Lldb-commits] [PATCH] D70886: [lldb-vscode] capture the debuggers file handles before lldbinit runs

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D70886#1765629 , @aadsm wrote:

> The way phabricator shows the diff is tricky, this change has nothing to do 
> with D70882  and stands by itself. The 
> important part here is making the `g_vsc.debugger.SetOutputFileHandle(out, 
> true); g_vsc.debugger.SetErrorFileHandle(out, false);` happen before the 
> debugger creation. Not sure how to create a test for this though since 
> there's no mechanism to give lldb-vscode an initial file to load...


Maybe you could do something similar to LocalLLDBInit.test 

 ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70886



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


[Lldb-commits] [PATCH] D70845: [lldb][NFC] Remove ThreadSafeSTLVector and ThreadSafeSTLMap and their use in ValueObjectSynthetic

2019-12-03 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG315600f48005: [lldb][NFC] Remove ThreadSafeSTLVector and 
ThreadSafeSTLMap and their use in… (authored by teemperor).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70845

Files:
  lldb/include/lldb/Core/ThreadSafeSTLMap.h
  lldb/include/lldb/Core/ThreadSafeSTLVector.h
  lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
  lldb/source/Core/ValueObjectSyntheticFilter.cpp

Index: lldb/source/Core/ValueObjectSyntheticFilter.cpp
===
--- lldb/source/Core/ValueObjectSyntheticFilter.cpp
+++ lldb/source/Core/ValueObjectSyntheticFilter.cpp
@@ -48,8 +48,9 @@
 ValueObjectSynthetic::ValueObjectSynthetic(ValueObject ,
lldb::SyntheticChildrenSP filter)
 : ValueObject(parent), m_synth_sp(filter), m_children_byindex(),
-  m_name_toindex(), m_synthetic_children_count(UINT32_MAX),
-  m_synthetic_children_cache(), m_parent_type_name(parent.GetTypeName()),
+  m_name_toindex(), m_synthetic_children_cache(),
+  m_synthetic_children_count(UINT32_MAX),
+  m_parent_type_name(parent.GetTypeName()),
   m_might_have_children(eLazyBoolCalculate),
   m_provides_value(eLazyBoolCalculate) {
   SetName(parent.GetName());
@@ -177,14 +178,20 @@
   "filter said caches are stale - clearing",
   GetName().AsCString());
 // filter said that cached values are stale
-m_children_byindex.Clear();
-m_name_toindex.Clear();
+{
+  std::lock_guard guard(m_child_mutex);
+  m_children_byindex.clear();
+  m_name_toindex.clear();
+}
 // usually, an object's value can change but this does not alter its
 // children count for a synthetic VO that might indeed happen, so we need
 // to tell the upper echelons that they need to come back to us asking for
 // children
 m_children_count_valid = false;
-m_synthetic_children_cache.Clear();
+{
+  std::lock_guard guard(m_child_mutex);
+  m_synthetic_children_cache.clear();
+}
 m_synthetic_children_count = UINT32_MAX;
 m_might_have_children = eLazyBoolCalculate;
   } else {
@@ -232,7 +239,16 @@
   UpdateValueIfNeeded();
 
   ValueObject *valobj;
-  if (!m_children_byindex.GetValueForKey(idx, valobj)) {
+  bool child_is_cached;
+  {
+std::lock_guard guard(m_child_mutex);
+auto cached_child_it = m_children_byindex.find(idx);
+child_is_cached = cached_child_it != m_children_byindex.end();
+if (child_is_cached)
+  valobj = cached_child_it->second;
+  }
+
+  if (!child_is_cached) {
 if (can_create && m_synth_filter_up != nullptr) {
   LLDB_LOGF(log,
 "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
@@ -254,9 +270,12 @@
   if (!synth_guy)
 return synth_guy;
 
-  if (synth_guy->IsSyntheticChildrenGenerated())
-m_synthetic_children_cache.AppendObject(synth_guy);
-  m_children_byindex.SetValueForKey(idx, synth_guy.get());
+  {
+std::lock_guard guard(m_child_mutex);
+if (synth_guy->IsSyntheticChildrenGenerated())
+  m_synthetic_children_cache.push_back(synth_guy);
+m_children_byindex[idx] = synth_guy.get();
+  }
   synth_guy->SetPreferredDisplayLanguageIfNeeded(
   GetPreferredDisplayLanguage());
   return synth_guy;
@@ -297,13 +316,21 @@
   UpdateValueIfNeeded();
 
   uint32_t found_index = UINT32_MAX;
-  bool did_find = m_name_toindex.GetValueForKey(name.GetCString(), found_index);
+  bool did_find;
+  {
+std::lock_guard guard(m_child_mutex);
+auto name_to_index = m_name_toindex.find(name.GetCString());
+did_find = name_to_index != m_name_toindex.end();
+if (did_find)
+  found_index = name_to_index->second;
+  }
 
   if (!did_find && m_synth_filter_up != nullptr) {
 uint32_t index = m_synth_filter_up->GetIndexOfChildWithName(name);
 if (index == UINT32_MAX)
   return index;
-m_name_toindex.SetValueForKey(name.GetCString(), index);
+std::lock_guard guard(m_child_mutex);
+m_name_toindex[name.GetCString()] = index;
 return index;
   } else if (!did_find && m_synth_filter_up == nullptr)
 return UINT32_MAX;
Index: lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
===
--- lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -9,8 +9,6 @@
 #ifndef liblldb_ValueObjectSyntheticFilter_h_
 #define liblldb_ValueObjectSyntheticFilter_h_
 
-#include "lldb/Core/ThreadSafeSTLMap.h"
-#include "lldb/Core/ThreadSafeSTLVector.h"
 #include "lldb/Core/ValueObject.h"
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Utility/ConstString.h"
@@ -135,19 +133,24 @@
   lldb::SyntheticChildrenSP m_synth_sp;
   std::unique_ptr 

[Lldb-commits] [lldb] 315600f - [lldb][NFC] Remove ThreadSafeSTLVector and ThreadSafeSTLMap and their use in ValueObjectSynthetic

2019-12-03 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-12-03T09:18:44+01:00
New Revision: 315600f480055f5143aaa245f25bd25221edfa91

URL: 
https://github.com/llvm/llvm-project/commit/315600f480055f5143aaa245f25bd25221edfa91
DIFF: 
https://github.com/llvm/llvm-project/commit/315600f480055f5143aaa245f25bd25221edfa91.diff

LOG: [lldb][NFC] Remove ThreadSafeSTLVector and ThreadSafeSTLMap and their use 
in ValueObjectSynthetic

Summary:
ThreadSafeSTLVector and ThreadSafeSTLMap are not useful for achieving any 
degree of thread safety in LLDB
and should be removed before they are used in more places. They are only used 
(unsurprisingly incorrectly) in
`ValueObjectSynthetic::GetChildAtIndex`, so this patch replaces their use there 
with a simple mutex with which
we guard the related data structures. This doesn't make 
ValueObjectSynthetic::GetChildAtIndex
any more thread-safe, but on the other hand it at least allows us to get rid of 
the ThreadSafeSTL* data structures
without changing the observable behaviour of ValueObjectSynthetic (beside that 
it is now a few bytes smaller).

Reviewers: labath, JDevlieghere, jingham

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/source/Core/ValueObjectSyntheticFilter.cpp

Removed: 
lldb/include/lldb/Core/ThreadSafeSTLMap.h
lldb/include/lldb/Core/ThreadSafeSTLVector.h



diff  --git a/lldb/include/lldb/Core/ThreadSafeSTLMap.h 
b/lldb/include/lldb/Core/ThreadSafeSTLMap.h
deleted file mode 100644
index df0208cd49b3..
--- a/lldb/include/lldb/Core/ThreadSafeSTLMap.h
+++ /dev/null
@@ -1,128 +0,0 @@
-//===-- ThreadSafeSTLMap.h --*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef liblldb_ThreadSafeSTLMap_h_
-#define liblldb_ThreadSafeSTLMap_h_
-
-#include 
-#include 
-
-#include "lldb/lldb-defines.h"
-
-namespace lldb_private {
-
-template  class ThreadSafeSTLMap {
-public:
-  typedef std::map<_Key, _Tp> collection;
-  typedef typename collection::iterator iterator;
-  typedef typename collection::const_iterator const_iterator;
-  // Constructors and Destructors
-  ThreadSafeSTLMap() : m_collection(), m_mutex() {}
-
-  ~ThreadSafeSTLMap() {}
-
-  bool IsEmpty() const {
-std::lock_guard guard(m_mutex);
-return m_collection.empty();
-  }
-
-  void Clear() {
-std::lock_guard guard(m_mutex);
-return m_collection.clear();
-  }
-
-  size_t Erase(const _Key ) {
-std::lock_guard guard(m_mutex);
-return EraseNoLock(key);
-  }
-
-  size_t EraseNoLock(const _Key ) { return m_collection.erase(key); }
-
-  bool GetValueForKey(const _Key , _Tp ) const {
-std::lock_guard guard(m_mutex);
-return GetValueForKeyNoLock(key, value);
-  }
-
-  // Call this if you have already manually locked the mutex using the
-  // GetMutex() accessor
-  bool GetValueForKeyNoLock(const _Key , _Tp ) const {
-const_iterator pos = m_collection.find(key);
-if (pos != m_collection.end()) {
-  value = pos->second;
-  return true;
-}
-return false;
-  }
-
-  bool GetFirstKeyForValue(const _Tp , _Key ) const {
-std::lock_guard guard(m_mutex);
-return GetFirstKeyForValueNoLock(value, key);
-  }
-
-  bool GetFirstKeyForValueNoLock(const _Tp , _Key ) const {
-const_iterator pos, end = m_collection.end();
-for (pos = m_collection.begin(); pos != end; ++pos) {
-  if (pos->second == value) {
-key = pos->first;
-return true;
-  }
-}
-return false;
-  }
-
-  bool LowerBound(const _Key , _Key _key, _Tp _value,
-  bool decrement_if_not_equal) const {
-std::lock_guard guard(m_mutex);
-return LowerBoundNoLock(key, match_key, match_value,
-decrement_if_not_equal);
-  }
-
-  bool LowerBoundNoLock(const _Key , _Key _key, _Tp _value,
-bool decrement_if_not_equal) const {
-const_iterator pos = m_collection.lower_bound(key);
-if (pos != m_collection.end()) {
-  match_key = pos->first;
-  if (decrement_if_not_equal && key != match_key &&
-  pos != m_collection.begin()) {
---pos;
-match_key = pos->first;
-  }
-  match_value = pos->second;
-  return true;
-}
-return false;
-  }
-
-  iterator lower_bound_unsafe(const _Key ) {
-return m_collection.lower_bound(key);
-  }
-
-  void SetValueForKey(const _Key , const _Tp ) {
-std::lock_guard guard(m_mutex);
-SetValueForKeyNoLock(key, value);
-  }
-
-  // Call this if you have already manually locked the mutex using