[Lldb-commits] [PATCH] D63322: DWARF: Avoid storing DIERefs in long-lived containers

2019-06-14 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, JDevlieghere.
Herald added a subscriber: aprantl.

A user_id_t carries the same information as a DIERef, but it takes up
less space.

Furthermore, DIERef::operator<'s implementation is very
questionable, as it does not take the cu_offset and section fields into
account. Using just the die offset was correct it the days when all
debug info lived in a single section, but since we started supporting
DWO debug info, this was no longer true. The comparison operator could
be fixed, but it seems like using the user_id_t for these purposes is a
better idea overall.

I think this did not cause any bugs, because the only place the
comparison operator was used is in m_function_scope_qualified_name_map,
and this one is local to a dwo file, but I am not 100% sure of that.


https://reviews.llvm.org/D63322

Files:
  source/Plugins/SymbolFile/DWARF/DIERef.h
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -311,7 +311,8 @@
   typedef llvm::DenseMap
   DIEToClangType;
-  typedef llvm::DenseMap ClangTypeToDIE;
+  typedef llvm::DenseMap
+  ClangTypeToDIE;
 
   struct DWARFDataSegment {
 llvm::once_flag m_flag;
@@ -475,8 +476,8 @@
   bool m_fetched_external_modules : 1;
   lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type;
 
-  typedef std::shared_ptr> DIERefSetSP;
-  typedef std::unordered_map NameToOffsetMap;
+  typedef std::set DIERefSet;
+  typedef llvm::StringMap NameToOffsetMap;
   NameToOffsetMap m_function_scope_qualified_name_map;
   std::unique_ptr m_ranges;
   std::unique_ptr m_rnglists;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2341,15 +2341,9 @@
   dwo->GetMangledNamesForFunction(scope_qualified_name, mangled_names);
   }
 
-  NameToOffsetMap::iterator iter =
-  m_function_scope_qualified_name_map.find(scope_qualified_name);
-  if (iter == m_function_scope_qualified_name_map.end())
-return;
-
-  DIERefSetSP set_sp = (*iter).second;
-  std::set::iterator set_iter;
-  for (set_iter = set_sp->begin(); set_iter != set_sp->end(); set_iter++) {
-DWARFDIE die = DebugInfo()->GetDIE(*set_iter);
+  for (lldb::user_id_t uid :
+   m_function_scope_qualified_name_map.lookup(scope_qualified_name)) {
+DWARFDIE die = GetDIE(uid);
 mangled_names.push_back(ConstString(die.GetMangledName()));
   }
 }
@@ -2988,22 +2982,12 @@
 type_list->Insert(type_sp);
 
   if (die.Tag() == DW_TAG_subprogram) {
-DIERef die_ref = die.GetDIERef();
 std::string scope_qualified_name(GetDeclContextForUID(die.GetID())
  .GetScopeQualifiedName()
  .AsCString(""));
 if (scope_qualified_name.size()) {
-  NameToOffsetMap::iterator iter =
-  m_function_scope_qualified_name_map.find(
-  scope_qualified_name);
-  if (iter != m_function_scope_qualified_name_map.end())
-(*iter).second->insert(die_ref);
-  else {
-DIERefSetSP new_set(new std::set);
-new_set->insert(die_ref);
-m_function_scope_qualified_name_map.emplace(
-std::make_pair(scope_qualified_name, new_set));
-  }
+  m_function_scope_qualified_name_map[scope_qualified_name].insert(
+  die.GetID());
 }
   }
 }
Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -998,7 +998,7 @@
 clang_type.GetOpaqueQualType();
 dwarf->GetForwardDeclClangTypeToDie()
 [ClangUtil::RemoveFastQualifiers(clang_type).GetOpaqueQualType()] =
-die.GetDIERef();
+die.GetID();
 m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), true);
   }
 }
Index: source/Plugins/SymbolFile/DWARF/DIERef.h
===
--- source/Plugins/SymbolFile/DWARF/DIERef.h
+++ source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -25,10 +25,6 @@
 
   explicit DIERef(const DWARFFormValue &form_value);
 
-  bool operator<(const DIERef &ref) const {
-return die_offset < ref.die_offset;
-  }
-
   explicit operato

[Lldb-commits] [lldb] r363373 - DWARFIndex: s/ReportInvalidDIEOffset/ReportInvalidDIERef

2019-06-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Jun 14 05:01:18 2019
New Revision: 363373

URL: http://llvm.org/viewvc/llvm-project?rev=363373&view=rev
Log:
DWARFIndex: s/ReportInvalidDIEOffset/ReportInvalidDIERef

In a dwo/debug_types world, the die offset is not enough to uniquely
idendify a debug info entry. Pass the the entire DIERef object instead.

This is technically NFC, because only AppleIndex implemented this
method (and there, the die offset *is* enough for unique
identification). However, this makes the code simpler, and simplifies
some of the follow-up patches.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp?rev=363373&r1=363372&r2=363373&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp Fri Jun 14 
05:01:18 2019
@@ -155,12 +155,12 @@ void AppleDWARFIndex::GetFunctions(const
 DWARFMappedHash::ExtractDIEArray(hash_data, offsets);
 }
 
-void AppleDWARFIndex::ReportInvalidDIEOffset(dw_offset_t offset,
- llvm::StringRef name) {
+void AppleDWARFIndex::ReportInvalidDIERef(const DIERef &ref,
+  llvm::StringRef name) {
   m_module.ReportErrorIfModifyDetected(
   "the DWARF debug information has been modified (accelerator table had "
   "bad die 0x%8.8x for '%s')\n",
-  offset, name.str().c_str());
+  ref.die_offset, name.str().c_str());
 }
 
 void AppleDWARFIndex::Dump(Stream &s) {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h?rev=363373&r1=363372&r2=363373&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h Fri Jun 14 
05:01:18 2019
@@ -48,8 +48,7 @@ public:
 std::vector &dies) override;
   void GetFunctions(const RegularExpression ®ex, DIEArray &offsets) 
override;
 
-  void ReportInvalidDIEOffset(dw_offset_t offset,
-  llvm::StringRef name) override;
+  void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override;
   void Dump(Stream &s) override;
 
 private:

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp?rev=363373&r1=363372&r2=363373&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp Fri Jun 14 
05:01:18 2019
@@ -24,7 +24,7 @@ void DWARFIndex::ProcessFunctionDIE(llvm
 std::vector &dies) {
   DWARFDIE die = info.GetDIE(ref);
   if (!die) {
-ReportInvalidDIEOffset(ref.die_offset, name);
+ReportInvalidDIERef(ref, name);
 return;
   }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h?rev=363373&r1=363372&r2=363373&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h Fri Jun 14 05:01:18 
2019
@@ -47,8 +47,7 @@ public:
   virtual void GetFunctions(const RegularExpression ®ex,
 DIEArray &offsets) = 0;
 
-  virtual void ReportInvalidDIEOffset(dw_offset_t offset,
-  llvm::StringRef name) = 0;
+  virtual void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) = 
0;
   virtual void Dump(Stream &s) = 0;
 
 protected:

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h?rev=363373&r1=363372&r2=363373&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h (original)
+++ lldb/trunk/s

[Lldb-commits] [lldb] r363381 - Have DWARFUnit store a *reference* to SymbolFileDWARF

2019-06-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Jun 14 06:01:16 2019
New Revision: 363381

URL: http://llvm.org/viewvc/llvm-project?rev=363381&view=rev
Log:
Have DWARFUnit store a *reference* to SymbolFileDWARF

Previously it was storing a *pointer*, which left open the possibility
of this pointer being null. We never made use of that possibility (it
does not make sense), and most of the code was already assuming that.
However, there were a couple of null-checks scattered around the code.

This patch replaces the reference with a pointer, making the
non-null-ness explicit, and removes the remaining null-checks.

Modified:
lldb/trunk/source/Expression/DWARFExpression.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=363381&r1=363380&r2=363381&view=diff
==
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Fri Jun 14 06:01:16 2019
@@ -47,7 +47,7 @@ ReadAddressFromDebugAddrSection(const DW
   dw_offset_t addr_base = dwarf_cu->GetAddrBase();
   lldb::offset_t offset = addr_base + index * index_size;
   return dwarf_cu->GetSymbolFileDWARF()
-  ->GetDWARFContext()
+  .GetDWARFContext()
   .getOrLoadAddrData()
   .GetMaxU64(&offset, index_size);
 }
@@ -2750,7 +2750,7 @@ bool DWARFExpression::AddressRangeForLoc
 return false;
 
   DWARFExpression::LocationListFormat format =
-  dwarf_cu->GetSymbolFileDWARF()->GetLocationListFormat();
+  dwarf_cu->GetSymbolFileDWARF().GetLocationListFormat();
   switch (format) {
   case NonLocationList:
 return false;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=363381&r1=363380&r2=363381&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Fri Jun 
14 06:01:16 2019
@@ -155,8 +155,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
 
 // Since this this type is defined in one of the Clang modules imported by
 // this symbol file, search all of them.
-auto *sym_file = die.GetCU()->GetSymbolFileDWARF();
-for (const auto &name_module : sym_file->getExternalTypeModules()) {
+auto &sym_file = die.GetCU()->GetSymbolFileDWARF();
+for (const auto &name_module : sym_file.getExternalTypeModules()) {
   if (!name_module.second)
 continue;
   SymbolVendor *sym_vendor = name_module.second->GetSymbolVendor();

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp?rev=363381&r1=363380&r2=363381&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp Fri Jun 14 
06:01:16 2019
@@ -99,7 +99,7 @@ dw_offset_t DWARFBaseDIE::GetOffset() co
 
 SymbolFileDWARF *DWARFBaseDIE::GetDWARF() const {
   if (m_cu)
-return m_cu->GetSymbolFileDWARF();
+return &m_cu->GetSymbolFileDWARF();
   else
 return nullptr;
 }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=363381&r1=363380&r2=363381&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Fr

[Lldb-commits] [lldb] r363382 - DWARF: Remove unused includes from DWARFDebugAranges.h/cpp

2019-06-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Jun 14 06:21:57 2019
New Revision: 363382

URL: http://llvm.org/viewvc/llvm-project?rev=363382&view=rev
Log:
DWARF: Remove unused includes from DWARFDebugAranges.h/cpp

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp?rev=363382&r1=363381&r2=363382&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Fri Jun 14 
06:21:57 2019
@@ -7,20 +7,11 @@
 
//===--===//
 
 #include "DWARFDebugAranges.h"
-
-#include 
-#include 
-
-#include 
-
+#include "DWARFDebugArangeSet.h"
+#include "DWARFUnit.h"
 #include "lldb/Utility/Log.h"
-#include "lldb/Utility/Stream.h"
 #include "lldb/Utility/Timer.h"
 
-#include "DWARFUnit.h"
-#include "DWARFDebugInfo.h"
-#include "SymbolFileDWARF.h"
-
 using namespace lldb;
 using namespace lldb_private;
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h?rev=363382&r1=363381&r2=363382&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h Fri Jun 14 
06:21:57 2019
@@ -9,12 +9,9 @@
 #ifndef SymbolFileDWARF_DWARFDebugAranges_h_
 #define SymbolFileDWARF_DWARFDebugAranges_h_
 
-#include "DWARFDebugArangeSet.h"
+#include "lldb/Core/dwarf.h"
 #include "lldb/Utility/RangeMap.h"
 #include "llvm/Support/Error.h"
-#include 
-
-class SymbolFileDWARF;
 
 class DWARFDebugAranges {
 protected:


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


[Lldb-commits] [lldb] r363400 - DWARF: port debug_ranges/rnglists over to DWARFContext

2019-06-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Jun 14 07:12:25 2019
New Revision: 363400

URL: http://llvm.org/viewvc/llvm-project?rev=363400&view=rev
Log:
DWARF: port debug_ranges/rnglists over to DWARFContext

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp?rev=363400&r1=363399&r2=363400&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp Fri Jun 14 
07:12:25 2019
@@ -75,6 +75,16 @@ const DWARFDataExtractor &DWARFContext::
   m_data_debug_macro);
 }
 
+const DWARFDataExtractor &DWARFContext::getOrLoadRangesData() {
+  return LoadOrGetSection(eSectionTypeDWARFDebugRanges, llvm::None,
+  m_data_debug_ranges);
+}
+
+const DWARFDataExtractor &DWARFContext::getOrLoadRngListsData() {
+  return LoadOrGetSection(eSectionTypeDWARFDebugRngLists, llvm::None,
+  m_data_debug_rnglists);
+}
+
 const DWARFDataExtractor &DWARFContext::getOrLoadStrData() {
   return LoadOrGetSection(eSectionTypeDWARFDebugStr,
   eSectionTypeDWARFDebugStrDwo, m_data_debug_str);

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h?rev=363400&r1=363399&r2=363400&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h Fri Jun 14 
07:12:25 2019
@@ -33,6 +33,8 @@ private:
   SectionData m_data_debug_line;
   SectionData m_data_debug_line_str;
   SectionData m_data_debug_macro;
+  SectionData m_data_debug_ranges;
+  SectionData m_data_debug_rnglists;
   SectionData m_data_debug_str;
   SectionData m_data_debug_str_offsets;
   SectionData m_data_debug_types;
@@ -57,6 +59,8 @@ public:
   const DWARFDataExtractor &getOrLoadLineData();
   const DWARFDataExtractor &getOrLoadLineStrData();
   const DWARFDataExtractor &getOrLoadMacroData();
+  const DWARFDataExtractor &getOrLoadRangesData();
+  const DWARFDataExtractor &getOrLoadRngListsData();
   const DWARFDataExtractor &getOrLoadStrData();
   const DWARFDataExtractor &getOrLoadStrOffsetsData();
   const DWARFDataExtractor &getOrLoadDebugTypesData();

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp?rev=363400&r1=363399&r2=363400&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp Fri Jun 14 
07:12:25 2019
@@ -8,12 +8,9 @@
 
 #include "DWARFDebugRanges.h"
 #include "DWARFUnit.h"
-#include "SymbolFileDWARF.h"
 #include "lldb/Utility/Stream.h"
-#include 
 
 using namespace lldb_private;
-using namespace std;
 
 static dw_addr_t GetBaseAddressMarker(uint32_t addr_size) {
   switch(addr_size) {
@@ -29,25 +26,24 @@ static dw_addr_t GetBaseAddressMarker(ui
 
 DWARFDebugRanges::DWARFDebugRanges() : m_range_map() {}
 
-void DWARFDebugRanges::Extract(SymbolFileDWARF *dwarf2Data) {
+void DWARFDebugRanges::Extract(DWARFContext &context) {
   DWARFRangeList range_list;
   lldb::offset_t offset = 0;
   dw_offset_t debug_ranges_offset = offset;
-  while (Extract(dwarf2Data, &offset, range_list)) {
+  while (Extract(context, &offset, range_list)) {
 range_list.Sort();
 m_range_map[debug_ranges_offset] = range_list;
 debug_ranges_offset = offset;
   }
 }
 
-bool DWARFDebugRanges::Extract(SymbolFileDWARF *dwarf2Data,
+bool DWARFDebugRanges::Extract(DWARFContext &context,
lldb::offset_t *offset_ptr,
DWARFRangeList &range_list) {
   range_list.Clear();
 
   lldb::offset_t range_offset = *offset_ptr;
-  const DWARFDataExtractor &debug_ranges_data =
-  dwarf2Data->get_debug_ranges_data();
+  const DWARFDataExtractor &debug_ranges_data = context.getOrLoadRangesData();
   uint32_t addr_size = debug_ranges_data.GetAddressByteSize();
   dw_addr_t base_addr = 0;
   dw_addr_t base_addr_marker = GetBaseAddressMarker(addr_size);
@@ -257,8 +253,8 @@ bool DWARFDebugRngLists::FindRanges(cons
   return f

[Lldb-commits] [lldb] r363404 - EditlineTest: Improve error message

2019-06-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Jun 14 07:33:04 2019
New Revision: 363404

URL: http://llvm.org/viewvc/llvm-project?rev=363404&view=rev
Log:
EditlineTest: Improve error message

This test seems to occasionally fail because editline returns a
different number of lines. Rewrite the message in such a way that we
also see the actual lines when that happens (and not just their count).

Also, clean up the dependencies of the test while I'm in there.

Modified:
lldb/trunk/unittests/Editline/CMakeLists.txt
lldb/trunk/unittests/Editline/EditlineTest.cpp

Modified: lldb/trunk/unittests/Editline/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Editline/CMakeLists.txt?rev=363404&r1=363403&r2=363404&view=diff
==
--- lldb/trunk/unittests/Editline/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Editline/CMakeLists.txt Fri Jun 14 07:33:04 2019
@@ -2,7 +2,6 @@ add_lldb_unittest(EditlineTests
   EditlineTest.cpp
 
   LINK_LIBS
-lldbCore
 lldbHost
 lldbUtility
   )

Modified: lldb/trunk/unittests/Editline/EditlineTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Editline/EditlineTest.cpp?rev=363404&r1=363403&r2=363404&view=diff
==
--- lldb/trunk/unittests/Editline/EditlineTest.cpp (original)
+++ lldb/trunk/unittests/Editline/EditlineTest.cpp Fri Jun 14 07:33:04 2019
@@ -13,11 +13,11 @@
 #include 
 #include 
 
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
 #include 
 #include 
 
-#include "gtest/gtest.h"
-
 #include "lldb/Host/Editline.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Pipe.h"
@@ -311,11 +311,11 @@ TEST_F(EditlineTestFixture, EditlineRece
 
   // Without any auto indentation support, our output should directly match our
   // input.
-  EXPECT_EQ(input_lines.size(), el_reported_lines.GetSize());
-  if (input_lines.size() == el_reported_lines.GetSize()) {
-for (size_t i = 0; i < input_lines.size(); ++i)
-  EXPECT_EQ(input_lines[i], el_reported_lines[i]);
-  }
+  std::vector reported_lines;
+  for (size_t i = 0; i < el_reported_lines.GetSize(); ++i)
+reported_lines.push_back(el_reported_lines[i]);
+
+  EXPECT_THAT(reported_lines, testing::ContainerEq(input_lines));
 }
 
 #endif


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


[Lldb-commits] [PATCH] D63311: Python 3: decode string as utf-8 to avoid type mismatch.

2019-06-14 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 204772.
aprantl added a comment.

Address review feedback.


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

https://reviews.llvm.org/D63311

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -58,7 +58,7 @@
 platform_system = platform.system()
 if platform_system == 'Darwin':
 # On Darwin, try the currently selected Xcode directory
-xcode_dir = subprocess.check_output("xcode-select --print-path", 
shell=True)
+xcode_dir = subprocess.check_output("xcode-select --print-path", 
shell=True).decode("utf-8")
 if xcode_dir:
 lldb_python_dirs.append(
 os.path.realpath(
@@ -232,7 +232,7 @@
 if not os.path.exists(dsymForUUIDBinary):
 try:
 dsymForUUIDBinary = subprocess.check_output('which 
dsymForUUID',
-
shell=True).rstrip('\n')
+
shell=True).decode("utf-8").rstrip('\n')
 except:
 dsymForUUIDBinary = ""
 
@@ -300,7 +300,7 @@
 if os.path.exists(self.dsymForUUIDBinary):
 dsym_for_uuid_command = '%s %s' % (
 self.dsymForUUIDBinary, uuid_str)
-s = subprocess.check_output(dsym_for_uuid_command, shell=True)
+s = subprocess.check_output(dsym_for_uuid_command, 
shell=True).decode("utf-8")
 if s:
 try:
 plist_root = read_plist(s)
@@ -326,7 +326,7 @@
 try:
 dsym = subprocess.check_output(
 ["/usr/bin/mdfind",
- "com_apple_xcode_dsym_uuids == %s"%uuid_str])[:-1]
+ "com_apple_xcode_dsym_uuids == 
%s"%uuid_str]).decode("utf-8")[:-1]
 if dsym and os.path.exists(dsym):
 print(('falling back to binary inside "%s"'%dsym))
 self.symfile = dsym
@@ -764,7 +764,7 @@
(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
 out_file.write(
 'OS Version:  Mac OS X %s (%s)\n' %
-(platform.mac_ver()[0], subprocess.check_output('sysctl -n 
kern.osversion', shell=True)))
+(platform.mac_ver()[0], subprocess.check_output('sysctl -n 
kern.osversion', shell=True).decode("utf-8")))
 out_file.write('Report Version:  9\n')
 for thread_idx in range(process.num_threads):
 thread = process.thread[thread_idx]


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -58,7 +58,7 @@
 platform_system = platform.system()
 if platform_system == 'Darwin':
 # On Darwin, try the currently selected Xcode directory
-xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True)
+xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True).decode("utf-8")
 if xcode_dir:
 lldb_python_dirs.append(
 os.path.realpath(
@@ -232,7 +232,7 @@
 if not os.path.exists(dsymForUUIDBinary):
 try:
 dsymForUUIDBinary = subprocess.check_output('which dsymForUUID',
-shell=True).rstrip('\n')
+shell=True).decode("utf-8").rstrip('\n')
 except:
 dsymForUUIDBinary = ""
 
@@ -300,7 +300,7 @@
 if os.path.exists(self.dsymForUUIDBinary):
 dsym_for_uuid_command = '%s %s' % (
 self.dsymForUUIDBinary, uuid_str)
-s = subprocess.check_output(dsym_for_uuid_command, shell=True)
+s = subprocess.check_output(dsym_for_uuid_command, shell=True).decode("utf-8")
 if s:
 try:
 plist_root = read_plist(s)
@@ -326,7 +326,7 @@
 try:
 dsym = subprocess.check_output(
 ["/usr/bin/mdfind",
- "com_apple_xcode_dsym_uuids == %s"%uuid_str])[:-1]
+ "com_apple_xcode_dsym_uuids == %s"%uuid_str]).decode("utf-8")[:-1]
 if dsym and os.path.exists(dsym):
 print(('falling back to binary inside "%s"'%dsym))
 self.symfile = dsym
@@ -764,7 +764,7 @@
(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
 out_file.write(
 'OS Version:  Mac OS X %s (%s)\n' %
-(platform

[Lldb-commits] [PATCH] D63311: Python 3: decode string as utf-8 to avoid type mismatch.

2019-06-14 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!


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

https://reviews.llvm.org/D63311



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


[Lldb-commits] [lldb] r363412 - Make crashlog.py less noisy

2019-06-14 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Fri Jun 14 08:39:11 2019
New Revision: 363412

URL: http://llvm.org/viewvc/llvm-project?rev=363412&view=rev
Log:
Make crashlog.py less noisy

For end-users there is no point in printing dSYM load errors for
system frameworks, since they will all fail and there's nothing they
can do about it. This patch hides them by default and shows them when
--verbose is present.

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

Modified:
lldb/trunk/examples/python/crashlog.py

Modified: lldb/trunk/examples/python/crashlog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=363412&r1=363411&r2=363412&view=diff
==
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Fri Jun 14 08:39:11 2019
@@ -246,7 +246,8 @@ class CrashLog(symbolication.Symbolicato
 identifier,
 version,
 uuid,
-path):
+path,
+verbose):
 symbolication.Image.__init__(self, path, uuid)
 self.add_section(
 symbolication.Section(
@@ -255,6 +256,17 @@ class CrashLog(symbolication.Symbolicato
 "__TEXT"))
 self.identifier = identifier
 self.version = version
+self.verbose = verbose
+
+def show_symbol_progress(self):
+"""
+Hide progress output and errors from system frameworks as they are 
plentiful.
+"""
+if self.verbose:
+return True
+return not (self.path.startswith("/System/Library/") or
+self.path.startswith("/usr/lib/"))
+
 
 def find_matching_slice(self):
 dwarfdump_cmd_output = subprocess.check_output(
@@ -271,8 +283,9 @@ class CrashLog(symbolication.Symbolicato
 return True
 if not self.resolved_path:
 self.unavailable = True
-print(("error\nerror: unable to locate '%s' with UUID %s"
-  % (self.path, self.get_normalized_uuid_string(
+if self.show_symbol_progress():
+print(("error\nerror: unable to locate '%s' with UUID 
%s"
+   % (self.path, self.get_normalized_uuid_string(
 return False
 
 def locate_module_and_debug_symbols(self):
@@ -282,7 +295,8 @@ class CrashLog(symbolication.Symbolicato
 # Mark this as resolved so we don't keep trying
 self.resolved = True
 uuid_str = self.get_normalized_uuid_string()
-print('Getting symbols for %s %s...' % (uuid_str, self.path), 
end=' ')
+if self.show_symbol_progress():
+print('Getting symbols for %s %s...' % (uuid_str, self.path), 
end=' ')
 if os.path.exists(self.dsymForUUIDBinary):
 dsym_for_uuid_command = '%s %s' % (
 self.dsymForUUIDBinary, uuid_str)
@@ -332,7 +346,7 @@ class CrashLog(symbolication.Symbolicato
 self.unavailable = True
 return False
 
-def __init__(self, path):
+def __init__(self, path, verbose):
 """CrashLog constructor that take a path to a darwin crash log file"""
 symbolication.Symbolicator.__init__(self)
 self.path = os.path.expanduser(path)
@@ -345,6 +359,7 @@ class CrashLog(symbolication.Symbolicato
 self.version = -1
 self.error = None
 self.target = None
+self.verbose = verbose
 # With possible initial component of ~ or ~user replaced by that user's
 # home directory.
 try:
@@ -491,7 +506,8 @@ class CrashLog(symbolication.Symbolicato
  img_name.strip(),
  img_version.strip()
  if img_version else "",
- uuid.UUID(img_uuid), img_path)
+ uuid.UUID(img_uuid), img_path,
+ self.verbose)
 self.images.append(image)
 else:
 print("error: image regex failed for: %s" % line)
@@ -557,7 +573,9 @@ class CrashLog(symbolication.Symbolicato
 if self.target:
 return self.target  # success
 print('crashlog.create_target()...4')
-print('error: unable to locate any executables from the crash log')
+print('error: Unable to locate any executables from the crash 
log.')
+print('   Try loading the executable into lldb before running 
crashlog')
+print('   and/or make sure the .dSYM bundles can be found by 
Spotlight.')
 return self.target
 

[Lldb-commits] [lldb] r363413 - Python 3: decode string as utf-8 to avoid type mismatch.

2019-06-14 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Fri Jun 14 08:39:14 2019
New Revision: 363413

URL: http://llvm.org/viewvc/llvm-project?rev=363413&view=rev
Log:
Python 3: decode string as utf-8 to avoid type mismatch.

rdar://problem/51464644

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

Modified:
lldb/trunk/examples/python/crashlog.py

Modified: lldb/trunk/examples/python/crashlog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=363413&r1=363412&r2=363413&view=diff
==
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Fri Jun 14 08:39:14 2019
@@ -58,7 +58,7 @@ except ImportError:
 platform_system = platform.system()
 if platform_system == 'Darwin':
 # On Darwin, try the currently selected Xcode directory
-xcode_dir = subprocess.check_output("xcode-select --print-path", 
shell=True)
+xcode_dir = subprocess.check_output("xcode-select --print-path", 
shell=True).decode("utf-8")
 if xcode_dir:
 lldb_python_dirs.append(
 os.path.realpath(
@@ -232,7 +232,7 @@ class CrashLog(symbolication.Symbolicato
 if not os.path.exists(dsymForUUIDBinary):
 try:
 dsymForUUIDBinary = subprocess.check_output('which 
dsymForUUID',
-
shell=True).rstrip('\n')
+
shell=True).decode("utf-8").rstrip('\n')
 except:
 dsymForUUIDBinary = ""
 
@@ -300,7 +300,7 @@ class CrashLog(symbolication.Symbolicato
 if os.path.exists(self.dsymForUUIDBinary):
 dsym_for_uuid_command = '%s %s' % (
 self.dsymForUUIDBinary, uuid_str)
-s = subprocess.check_output(dsym_for_uuid_command, shell=True)
+s = subprocess.check_output(dsym_for_uuid_command, 
shell=True).decode("utf-8")
 if s:
 try:
 plist_root = read_plist(s)
@@ -326,7 +326,7 @@ class CrashLog(symbolication.Symbolicato
 try:
 dsym = subprocess.check_output(
 ["/usr/bin/mdfind",
- "com_apple_xcode_dsym_uuids == %s"%uuid_str])[:-1]
+ "com_apple_xcode_dsym_uuids == 
%s"%uuid_str]).decode("utf-8")[:-1]
 if dsym and os.path.exists(dsym):
 print(('falling back to binary inside "%s"'%dsym))
 self.symfile = dsym
@@ -764,7 +764,7 @@ def save_crashlog(debugger, command, exe
(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
 out_file.write(
 'OS Version:  Mac OS X %s (%s)\n' %
-(platform.mac_ver()[0], subprocess.check_output('sysctl -n 
kern.osversion', shell=True)))
+(platform.mac_ver()[0], subprocess.check_output('sysctl -n 
kern.osversion', shell=True).decode("utf-8")))
 out_file.write('Report Version:  9\n')
 for thread_idx in range(process.num_threads):
 thread = process.thread[thread_idx]


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


[Lldb-commits] [PATCH] D63310: Make crashlog.py less noisy

2019-06-14 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363412: Make crashlog.py less noisy (authored by adrian, 
committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D63310?vs=204675&id=204774#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63310

Files:
  lldb/trunk/examples/python/crashlog.py

Index: lldb/trunk/examples/python/crashlog.py
===
--- lldb/trunk/examples/python/crashlog.py
+++ lldb/trunk/examples/python/crashlog.py
@@ -246,7 +246,8 @@
 identifier,
 version,
 uuid,
-path):
+path,
+verbose):
 symbolication.Image.__init__(self, path, uuid)
 self.add_section(
 symbolication.Section(
@@ -255,6 +256,17 @@
 "__TEXT"))
 self.identifier = identifier
 self.version = version
+self.verbose = verbose
+
+def show_symbol_progress(self):
+"""
+Hide progress output and errors from system frameworks as they are plentiful.
+"""
+if self.verbose:
+return True
+return not (self.path.startswith("/System/Library/") or
+self.path.startswith("/usr/lib/"))
+
 
 def find_matching_slice(self):
 dwarfdump_cmd_output = subprocess.check_output(
@@ -271,8 +283,9 @@
 return True
 if not self.resolved_path:
 self.unavailable = True
-print(("error\nerror: unable to locate '%s' with UUID %s"
-  % (self.path, self.get_normalized_uuid_string(
+if self.show_symbol_progress():
+print(("error\nerror: unable to locate '%s' with UUID %s"
+   % (self.path, self.get_normalized_uuid_string(
 return False
 
 def locate_module_and_debug_symbols(self):
@@ -282,7 +295,8 @@
 # Mark this as resolved so we don't keep trying
 self.resolved = True
 uuid_str = self.get_normalized_uuid_string()
-print('Getting symbols for %s %s...' % (uuid_str, self.path), end=' ')
+if self.show_symbol_progress():
+print('Getting symbols for %s %s...' % (uuid_str, self.path), end=' ')
 if os.path.exists(self.dsymForUUIDBinary):
 dsym_for_uuid_command = '%s %s' % (
 self.dsymForUUIDBinary, uuid_str)
@@ -332,7 +346,7 @@
 self.unavailable = True
 return False
 
-def __init__(self, path):
+def __init__(self, path, verbose):
 """CrashLog constructor that take a path to a darwin crash log file"""
 symbolication.Symbolicator.__init__(self)
 self.path = os.path.expanduser(path)
@@ -345,6 +359,7 @@
 self.version = -1
 self.error = None
 self.target = None
+self.verbose = verbose
 # With possible initial component of ~ or ~user replaced by that user's
 # home directory.
 try:
@@ -491,7 +506,8 @@
  img_name.strip(),
  img_version.strip()
  if img_version else "",
- uuid.UUID(img_uuid), img_path)
+ uuid.UUID(img_uuid), img_path,
+ self.verbose)
 self.images.append(image)
 else:
 print("error: image regex failed for: %s" % line)
@@ -557,7 +573,9 @@
 if self.target:
 return self.target  # success
 print('crashlog.create_target()...4')
-print('error: unable to locate any executables from the crash log')
+print('error: Unable to locate any executables from the crash log.')
+print('   Try loading the executable into lldb before running crashlog')
+print('   and/or make sure the .dSYM bundles can be found by Spotlight.')
 return self.target
 
 def get_target(self):
@@ -683,7 +701,7 @@
 crash_logs = list()
 for crash_log_file in crash_log_files:
 # print 'crash_log_file = "%s"' % crash_log_file
-crash_log = CrashLog(crash_log_file)
+crash_log = CrashLog(crash_log_file, options.verbose)
 if crash_log.error:
 print(crash_log.error)
 continue
@@ -1022,7 +1040,7 @@
 interactive_crashlogs(options, args)
 else:
 for crash_log_file in args:
-  

[Lldb-commits] [PATCH] D63311: Python 3: decode string as utf-8 to avoid type mismatch.

2019-06-14 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363413: Python 3: decode string as utf-8 to avoid type 
mismatch. (authored by adrian, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D63311?vs=204772&id=204775#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63311

Files:
  lldb/trunk/examples/python/crashlog.py


Index: lldb/trunk/examples/python/crashlog.py
===
--- lldb/trunk/examples/python/crashlog.py
+++ lldb/trunk/examples/python/crashlog.py
@@ -58,7 +58,7 @@
 platform_system = platform.system()
 if platform_system == 'Darwin':
 # On Darwin, try the currently selected Xcode directory
-xcode_dir = subprocess.check_output("xcode-select --print-path", 
shell=True)
+xcode_dir = subprocess.check_output("xcode-select --print-path", 
shell=True).decode("utf-8")
 if xcode_dir:
 lldb_python_dirs.append(
 os.path.realpath(
@@ -232,7 +232,7 @@
 if not os.path.exists(dsymForUUIDBinary):
 try:
 dsymForUUIDBinary = subprocess.check_output('which 
dsymForUUID',
-
shell=True).rstrip('\n')
+
shell=True).decode("utf-8").rstrip('\n')
 except:
 dsymForUUIDBinary = ""
 
@@ -300,7 +300,7 @@
 if os.path.exists(self.dsymForUUIDBinary):
 dsym_for_uuid_command = '%s %s' % (
 self.dsymForUUIDBinary, uuid_str)
-s = subprocess.check_output(dsym_for_uuid_command, shell=True)
+s = subprocess.check_output(dsym_for_uuid_command, 
shell=True).decode("utf-8")
 if s:
 try:
 plist_root = read_plist(s)
@@ -326,7 +326,7 @@
 try:
 dsym = subprocess.check_output(
 ["/usr/bin/mdfind",
- "com_apple_xcode_dsym_uuids == %s"%uuid_str])[:-1]
+ "com_apple_xcode_dsym_uuids == 
%s"%uuid_str]).decode("utf-8")[:-1]
 if dsym and os.path.exists(dsym):
 print(('falling back to binary inside "%s"'%dsym))
 self.symfile = dsym
@@ -764,7 +764,7 @@
(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
 out_file.write(
 'OS Version:  Mac OS X %s (%s)\n' %
-(platform.mac_ver()[0], subprocess.check_output('sysctl -n 
kern.osversion', shell=True)))
+(platform.mac_ver()[0], subprocess.check_output('sysctl -n 
kern.osversion', shell=True).decode("utf-8")))
 out_file.write('Report Version:  9\n')
 for thread_idx in range(process.num_threads):
 thread = process.thread[thread_idx]


Index: lldb/trunk/examples/python/crashlog.py
===
--- lldb/trunk/examples/python/crashlog.py
+++ lldb/trunk/examples/python/crashlog.py
@@ -58,7 +58,7 @@
 platform_system = platform.system()
 if platform_system == 'Darwin':
 # On Darwin, try the currently selected Xcode directory
-xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True)
+xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True).decode("utf-8")
 if xcode_dir:
 lldb_python_dirs.append(
 os.path.realpath(
@@ -232,7 +232,7 @@
 if not os.path.exists(dsymForUUIDBinary):
 try:
 dsymForUUIDBinary = subprocess.check_output('which dsymForUUID',
-shell=True).rstrip('\n')
+shell=True).decode("utf-8").rstrip('\n')
 except:
 dsymForUUIDBinary = ""
 
@@ -300,7 +300,7 @@
 if os.path.exists(self.dsymForUUIDBinary):
 dsym_for_uuid_command = '%s %s' % (
 self.dsymForUUIDBinary, uuid_str)
-s = subprocess.check_output(dsym_for_uuid_command, shell=True)
+s = subprocess.check_output(dsym_for_uuid_command, shell=True).decode("utf-8")
 if s:
 try:
 plist_root = read_plist(s)
@@ -326,7 +326,7 @@
 try:
 dsym = subprocess.check_output(
 ["/usr/bin/mdfind",
- "com_apple_xcode_dsym_uuids == %s"%uuid_str])[:-1]
+ "com_apple_xcode_dsym_uuids == %s"%uuid_str]).decode("utf-8")[:-1]
 if dsym and os.path.exists(dsym):

[Lldb-commits] [PATCH] D63339: Extend D55859 symbols.enable-external-lookup=false for more testcases

2019-06-14 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil created this revision.
jankratochvil added reviewers: labath, clayborg.
jankratochvil added a project: LLDB.
Herald added subscribers: abidh, aprantl, ki.stfu.

D55859  has no effect for some of the 
testcases so this patch extends it even for (all?) other testcases known to me. 
 LLDB was failing when LLDB prints errors reading system debug infos 
(`*-debuginfo.rpm`, DWZ-optimized) which should never happen as LLDB testcases 
should not be affected by system debug infos.

`lldb/packages/Python/lldbsuite/test/api/multithreaded/driver.cpp.template` is 
using only SB API which does not expose `ModuleList` so I had to call 
`HandleCommand()` there.

`lldb-test.cpp` could also use `HandleCommand` and then there would be no need 
for `ModuleListProperties::SetEnableExternalLookup()` but I think it is cleaner 
with API and not on based on text commands.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D63339

Files:
  lldb/include/lldb/Core/ModuleList.h
  lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test
  lldb/lit/tools/lldb-mi/breakpoint/break-insert.test
  lldb/lit/tools/lldb-mi/data/data-info-line.test
  lldb/lit/tools/lldb-mi/exec/exec-continue.test
  lldb/lit/tools/lldb-mi/exec/exec-finish.test
  lldb/lit/tools/lldb-mi/exec/exec-interrupt.test
  lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test
  lldb/lit/tools/lldb-mi/exec/exec-next.test
  lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test
  lldb/lit/tools/lldb-mi/exec/exec-step.test
  lldb/packages/Python/lldbsuite/test/api/multithreaded/driver.cpp.template
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/source/Core/ModuleList.cpp
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -975,6 +975,7 @@
   CleanUp TerminateDebugger([&] { DebuggerLifetime.Terminate(); });
 
   auto Dbg = lldb_private::Debugger::CreateInstance();
+  ModuleList::GetGlobalModuleListProperties().SetEnableExternalLookup(false);
 
   if (!opts::Log.empty())
 Dbg->EnableLog("lldb", {"all"}, opts::Log, 0, errs());
Index: lldb/source/Core/ModuleList.cpp
===
--- lldb/source/Core/ModuleList.cpp
+++ lldb/source/Core/ModuleList.cpp
@@ -102,6 +102,11 @@
   nullptr, idx, g_properties[idx].default_uint_value != 0);
 }
 
+bool ModuleListProperties::SetEnableExternalLookup(bool new_value) {
+  return m_collection_sp->SetPropertyAtIndexAsBoolean(
+  nullptr, ePropertyEnableExternalLookup, new_value);
+}
+
 FileSpec ModuleListProperties::GetClangModulesCachePath() const {
   return m_collection_sp
   ->GetPropertyAtIndexAsOptionValueFileSpec(nullptr, false,
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -447,8 +447,10 @@
 args_dict['waitFor'] = waitFor
 if trace:
 args_dict['trace'] = trace
+args_dict['initCommands'] = [
+'settings set symbols.enable-external-lookup false']
 if initCommands:
-args_dict['initCommands'] = initCommands
+args_dict['initCommands'].extend(initCommands)
 if preRunCommands:
 args_dict['preRunCommands'] = preRunCommands
 if stopCommands:
@@ -582,8 +584,10 @@
 args_dict['shellExpandArguments'] = shellExpandArguments
 if trace:
 args_dict['trace'] = trace
+args_dict['initCommands'] = [
+'settings set symbols.enable-external-lookup false']
 if initCommands:
-args_dict['initCommands'] = initCommands
+args_dict['initCommands'].extend(initCommands)
 if preRunCommands:
 args_dict['preRunCommands'] = preRunCommands
 if stopCommands:
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -729,12 +729,12 @@
 else:
 self.lldbVSCodeExec = None
 
+self.lldbOption = "-o 'settings set symbols.enable-external-lookup false'"
+
 # If we spawn an lldb process for test (via pexpect), do not load the
 # init file unless told otherwise.
-if "NO_LLDBINIT" in os.environ and "NO" == os.environ["NO_LLDBINIT"]:
-self.lldbOption = ""
-else:
-self.lldbOption = "--no-lldbinit"
+if "NO_LLDBINIT" not in os.environ or "NO" != os.environ["NO_LLDBINIT"]:
+self.lldbOption += " --no-lldb

[Lldb-commits] [PATCH] D63322: DWARF: Avoid storing DIERefs in long-lived containers

2019-06-14 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


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

https://reviews.llvm.org/D63322



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


[Lldb-commits] [PATCH] D63166: Move common functionality from processwindows into processdebugger

2019-06-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I would rather see this stuff just moved into NativeProcessWindows (or some 
class in the windows lldb-server plug-in) and have all code in 
ProcessWindow.cpp and ProcessDebugger.cpp go away once lldb-server works on 
windows? The goal is to get rid of the ProcessWindows.cpp once lldb-server is 
running. Better to not maintain two different plug-ins (one for native and one 
for remote). The remote version will always work less well in that case.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D63166



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


[Lldb-commits] [lldb] r363438 - Remove stale comment and disabled code (NFC)

2019-06-14 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Jun 14 11:12:55 2019
New Revision: 363438

URL: http://llvm.org/viewvc/llvm-project?rev=363438&view=rev
Log:
Remove stale comment and disabled code (NFC)

Modified:
lldb/trunk/source/Symbol/Symtab.cpp

Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=363438&r1=363437&r2=363438&view=diff
==
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Fri Jun 14 11:12:55 2019
@@ -216,7 +216,6 @@ const Symbol *Symtab::SymbolAtIndex(size
   return nullptr;
 }
 
-// InitNameIndexes
 static bool lldb_skip_name(llvm::StringRef mangled,
Mangled::ManglingScheme scheme) {
   switch (scheme) {
@@ -259,25 +258,7 @@ void Symtab::InitNameIndexes() {
 Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
 // Create the name index vector to be able to quickly search by name
 const size_t num_symbols = m_symbols.size();
-#if 1
 m_name_to_index.Reserve(num_symbols);
-#else
-// TODO: benchmark this to see if we save any memory. Otherwise we
-// will always keep the memory reserved in the vector unless we pull some
-// STL swap magic and then recopy...
-uint32_t actual_count = 0;
-for (const_iterator pos = m_symbols.begin(), end = m_symbols.end();
- pos != end; ++pos) {
-  const Mangled &mangled = pos->GetMangled();
-  if (mangled.GetMangledName())
-++actual_count;
-
-  if (mangled.GetDemangledName())
-++actual_count;
-}
-
-m_name_to_index.Reserve(actual_count);
-#endif
 
 // The "const char *" in "class_contexts" and backlog::value_type::second
 // must come from a ConstString::GetCString()


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


[Lldb-commits] [PATCH] D63166: Move common functionality from processwindows into processdebugger

2019-06-14 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

I'm OK with moving common stuff out for now, and I like the separation of 
ProcessWindows and ProcessDebugger.

I agree that we don't want to live too long in a state with a regular plugin 
and a remote plugin, I still think there's advantage to having common Windows 
stuff grouped together (though, perhaps, not exactly this grouping in the long 
run).  I'm trying to think through the implications on cross-platform 
post-mortem debugging, e.g., debugging a Windows minidump on a Linux host 
without spinning up a remote on an actual Windows machine.

This LGTM as an incremental step if you address some of the naming slips and 
others' feedback.




Comment at: source/Plugins/Process/Windows/Common/ProcessDebugger.cpp:125
+StreamString stream;
+stream.Printf("ProcessWindows unable to launch '%s'.  ProcessWindows can "
+  "only be used for debug launches.",

s/ProcessWindows/ProcessDebugger/  (2x)



Comment at: source/Plugins/Process/Windows/Common/ProcessDebugger.cpp:215
+// DebuggerThread. StopDebugging() will trigger a call back into
+// ProcessWindows which will acquire the lock again, so we need to not
+// deadlock.

s/ProcessWindows/ProcessDebugger/ ?




Comment at: source/Plugins/Process/Windows/Common/ProcessDebugger.h:1
+//===-- NativeProcessWindows.h --*- C++ 
-*-===//
+//

Please fix file title.



Comment at: source/Plugins/Process/Windows/Common/ProcessDebugger.h:30
+
+class ProcessWindowsData {
+public:

Arguably, this should be renamed to ProcessDebuggerData, but that's not a 
sticking point right now.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D63166



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


[Lldb-commits] [lldb] r363441 - Don't try to parse ObjC method if CU isn't ObjC

2019-06-14 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Fri Jun 14 12:18:10 2019
New Revision: 363441

URL: http://llvm.org/viewvc/llvm-project?rev=363441&view=rev
Log:
Don't try to parse ObjC method if CU isn't ObjC

Improve manual indexing performance when indexing non objective C code. 

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


Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp?rev=363441&r1=363440&r2=363441&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp Fri Jun 14 
12:18:10 2019
@@ -249,26 +249,30 @@ void ManualDWARFIndex::IndexUnitImpl(
 case DW_TAG_subprogram:
   if (has_address) {
 if (name) {
-  ObjCLanguage::MethodName objc_method(name, true);
-  if (objc_method.IsValid(true)) {
-ConstString objc_class_name_with_category(
-objc_method.GetClassNameWithCategory());
-ConstString objc_selector_name(objc_method.GetSelector());
-ConstString objc_fullname_no_category_name(
-objc_method.GetFullNameWithoutCategory(true));
-ConstString 
objc_class_name_no_category(objc_method.GetClassName());
-set.function_fullnames.Insert(ConstString(name), ref);
-if (objc_class_name_with_category)
-  set.objc_class_selectors.Insert(objc_class_name_with_category,
+  bool is_objc_method = false;
+  if (cu_language == eLanguageTypeObjC ||
+  cu_language == eLanguageTypeObjC_plus_plus) {
+ObjCLanguage::MethodName objc_method(name, true);
+if (objc_method.IsValid(true)) {
+  is_objc_method = true;
+  ConstString class_name_with_category(
+  objc_method.GetClassNameWithCategory());
+  ConstString objc_selector_name(objc_method.GetSelector());
+  ConstString objc_fullname_no_category_name(
+  objc_method.GetFullNameWithoutCategory(true));
+  ConstString class_name_no_category(objc_method.GetClassName());
+  set.function_fullnames.Insert(ConstString(name), ref);
+  if (class_name_with_category)
+set.objc_class_selectors.Insert(class_name_with_category, ref);
+  if (class_name_no_category &&
+  class_name_no_category != class_name_with_category)
+set.objc_class_selectors.Insert(class_name_no_category, ref);
+  if (objc_selector_name)
+set.function_selectors.Insert(objc_selector_name, ref);
+  if (objc_fullname_no_category_name)
+set.function_fullnames.Insert(objc_fullname_no_category_name,
   ref);
-if (objc_class_name_no_category &&
-objc_class_name_no_category != objc_class_name_with_category)
-  set.objc_class_selectors.Insert(objc_class_name_no_category, 
ref);
-if (objc_selector_name)
-  set.function_selectors.Insert(objc_selector_name, ref);
-if (objc_fullname_no_category_name)
-  set.function_fullnames.Insert(objc_fullname_no_category_name,
-ref);
+}
   }
   // If we have a mangled name, then the DW_AT_name attribute is
   // usually the method name without the class or any parameters
@@ -279,7 +283,7 @@ void ManualDWARFIndex::IndexUnitImpl(
   else
 set.function_basenames.Insert(ConstString(name), ref);
 
-  if (!is_method && !mangled_cstr && !objc_method.IsValid(true))
+  if (!is_method && !mangled_cstr && !is_objc_method)
 set.function_fullnames.Insert(ConstString(name), ref);
 }
 if (mangled_cstr) {


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


[Lldb-commits] [PATCH] D63171: Don't try to parse ObjC method if CU isn't ObjC

2019-06-14 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363441: Don't try to parse ObjC method if CU isn't 
ObjC (authored by gclayton, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D63171?vs=204553&id=204829#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63171

Files:
  lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp


Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -249,26 +249,30 @@
 case DW_TAG_subprogram:
   if (has_address) {
 if (name) {
-  ObjCLanguage::MethodName objc_method(name, true);
-  if (objc_method.IsValid(true)) {
-ConstString objc_class_name_with_category(
-objc_method.GetClassNameWithCategory());
-ConstString objc_selector_name(objc_method.GetSelector());
-ConstString objc_fullname_no_category_name(
-objc_method.GetFullNameWithoutCategory(true));
-ConstString 
objc_class_name_no_category(objc_method.GetClassName());
-set.function_fullnames.Insert(ConstString(name), ref);
-if (objc_class_name_with_category)
-  set.objc_class_selectors.Insert(objc_class_name_with_category,
+  bool is_objc_method = false;
+  if (cu_language == eLanguageTypeObjC ||
+  cu_language == eLanguageTypeObjC_plus_plus) {
+ObjCLanguage::MethodName objc_method(name, true);
+if (objc_method.IsValid(true)) {
+  is_objc_method = true;
+  ConstString class_name_with_category(
+  objc_method.GetClassNameWithCategory());
+  ConstString objc_selector_name(objc_method.GetSelector());
+  ConstString objc_fullname_no_category_name(
+  objc_method.GetFullNameWithoutCategory(true));
+  ConstString class_name_no_category(objc_method.GetClassName());
+  set.function_fullnames.Insert(ConstString(name), ref);
+  if (class_name_with_category)
+set.objc_class_selectors.Insert(class_name_with_category, ref);
+  if (class_name_no_category &&
+  class_name_no_category != class_name_with_category)
+set.objc_class_selectors.Insert(class_name_no_category, ref);
+  if (objc_selector_name)
+set.function_selectors.Insert(objc_selector_name, ref);
+  if (objc_fullname_no_category_name)
+set.function_fullnames.Insert(objc_fullname_no_category_name,
   ref);
-if (objc_class_name_no_category &&
-objc_class_name_no_category != objc_class_name_with_category)
-  set.objc_class_selectors.Insert(objc_class_name_no_category, 
ref);
-if (objc_selector_name)
-  set.function_selectors.Insert(objc_selector_name, ref);
-if (objc_fullname_no_category_name)
-  set.function_fullnames.Insert(objc_fullname_no_category_name,
-ref);
+}
   }
   // If we have a mangled name, then the DW_AT_name attribute is
   // usually the method name without the class or any parameters
@@ -279,7 +283,7 @@
   else
 set.function_basenames.Insert(ConstString(name), ref);
 
-  if (!is_method && !mangled_cstr && !objc_method.IsValid(true))
+  if (!is_method && !mangled_cstr && !is_objc_method)
 set.function_fullnames.Insert(ConstString(name), ref);
 }
 if (mangled_cstr) {


Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -249,26 +249,30 @@
 case DW_TAG_subprogram:
   if (has_address) {
 if (name) {
-  ObjCLanguage::MethodName objc_method(name, true);
-  if (objc_method.IsValid(true)) {
-ConstString objc_class_name_with_category(
-objc_method.GetClassNameWithCategory());
-ConstString objc_selector_name(objc_method.GetSelector());
-ConstString objc_fullname_no_category_name(
-objc_method.GetFullNameWithoutCategory(true));
-ConstString objc_class_name_no_category(objc_method.GetClassName());
-set.function_fullnames.Insert(ConstString(name), ref);
-if (objc_class_name_with_category)
-   

[Lldb-commits] [PATCH] D63166: Move common functionality from processwindows into processdebugger

2019-06-14 Thread Hui Huang via Phabricator via lldb-commits
Hui added inline comments.



Comment at: source/Plugins/Process/Windows/Common/ProcessDebugger.cpp:169-170
+
+Status ProcessDebugger::AttachProcess(lldb::pid_t pid,
+  const ProcessAttachInfo &attach_info,
+  DebugDelegateSP delegate) {

labath wrote:
> BTW, looking at the other patch, I just realized that this api is extremely 
> redundant:
> a) `ProcessAttachInfo` already contains a `pid` field so passing it 
> separately makes no sense
> b) `DebuggerThread` does not seem to be doing anything with the 
> ProcessAttachInfo struct anyway.
I once checked the pid shipped in attach_info. It was LLDB_INVALID_PROCESS_ID.  
Maybe it is an issue to fix.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D63166



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


[Lldb-commits] [PATCH] D63322: DWARF: Avoid storing DIERefs in long-lived containers

2019-06-14 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2970
 
   if (die) {
 TypeSystem *type_system =

If you find the time:

```
if (!die)
  return {};
auto *type_system = GetTypeSystemForLanguage(die.GetCU()->GetLanguageType());
if (!type_system)
  return {};
 DWARFASTParser *dwarf_ast = type_system->GetDWARFParser();
if (!dwarf_ast)
  return {};
```


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

https://reviews.llvm.org/D63322



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


[Lldb-commits] [PATCH] D63357: [Process] Remove unused field from HistoryThread

2019-06-14 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: compnerd, JDevlieghere, davide, labath.
Herald added a subscriber: kubamracek.

These fields are unused and have been since their inception, from what
I can tell.


https://reviews.llvm.org/D63357

Files:
  
source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp
  source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
  source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
  source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
  source/Plugins/Process/Utility/HistoryThread.cpp
  source/Plugins/Process/Utility/HistoryThread.h
  source/Plugins/Process/Utility/HistoryUnwind.cpp
  source/Plugins/Process/Utility/HistoryUnwind.h
  source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp

Index: source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
===
--- source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
+++ source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
@@ -485,12 +485,8 @@
   m_process->GetByteOrder(),
   m_process->GetAddressByteSize());
   ItemInfo item = ExtractItemInfoFromBuffer(extractor);
-  bool stop_id_is_valid = true;
-  if (item.stop_id == 0)
-stop_id_is_valid = false;
   originating_thread_sp = std::make_shared(
-  *m_process, item.enqueuing_thread_id, item.enqueuing_callstack,
-  item.stop_id, stop_id_is_valid);
+  *m_process, item.enqueuing_thread_id, item.enqueuing_callstack);
   originating_thread_sp->SetExtendedBacktraceToken(
   item.item_that_enqueued_this);
   originating_thread_sp->SetQueueName(
@@ -530,12 +526,8 @@
   m_process->GetByteOrder(),
   m_process->GetAddressByteSize());
   ItemInfo item = ExtractItemInfoFromBuffer(extractor);
-  bool stop_id_is_valid = true;
-  if (item.stop_id == 0)
-stop_id_is_valid = false;
   return_thread_sp = std::make_shared(
-  *m_process, item.enqueuing_thread_id, item.enqueuing_callstack,
-  item.stop_id, stop_id_is_valid);
+  *m_process, item.enqueuing_thread_id, item.enqueuing_callstack);
   return_thread_sp->SetExtendedBacktraceToken(item.item_that_enqueued_this);
   return_thread_sp->SetQueueName(item.enqueuing_queue_label.c_str());
   return_thread_sp->SetQueueID(item.enqueuing_queue_serialnum);
@@ -556,14 +548,9 @@
   if (type != "libdispatch")
 return extended_thread_sp;
 
-  bool stop_id_is_valid = true;
-  if (queue_item_sp->GetStopID() == 0)
-stop_id_is_valid = false;
-
   extended_thread_sp = std::make_shared(
   *m_process, queue_item_sp->GetEnqueueingThreadID(),
-  queue_item_sp->GetEnqueueingBacktrace(), queue_item_sp->GetStopID(),
-  stop_id_is_valid);
+  queue_item_sp->GetEnqueueingBacktrace());
   extended_thread_sp->SetExtendedBacktraceToken(
   queue_item_sp->GetItemThatEnqueuedThis());
   extended_thread_sp->SetQueueName(queue_item_sp->GetQueueLabel().c_str());
Index: source/Plugins/Process/Utility/HistoryUnwind.h
===
--- source/Plugins/Process/Utility/HistoryUnwind.h
+++ source/Plugins/Process/Utility/HistoryUnwind.h
@@ -18,8 +18,7 @@
 
 class HistoryUnwind : public lldb_private::Unwind {
 public:
-  HistoryUnwind(Thread &thread, std::vector pcs,
-bool stop_id_is_valid);
+  HistoryUnwind(Thread &thread, std::vector pcs);
 
   ~HistoryUnwind() override;
 
@@ -35,7 +34,6 @@
 
 private:
   std::vector m_pcs;
-  bool m_stop_id_is_valid;
 };
 
 } // namespace lldb_private
Index: source/Plugins/Process/Utility/HistoryUnwind.cpp
===
--- source/Plugins/Process/Utility/HistoryUnwind.cpp
+++ source/Plugins/Process/Utility/HistoryUnwind.cpp
@@ -23,9 +23,8 @@
 
 // Constructor
 
-HistoryUnwind::HistoryUnwind(Thread &thread, std::vector pcs,
- bool stop_id_is_valid)
-: Unwind(thread), m_pcs(pcs), m_stop_id_is_valid(stop_id_is_valid) {}
+HistoryUnwind::HistoryUnwind(Thread &thread, std::vector pcs)
+: Unwind(thread), m_pcs(pcs) {}
 
 // Destructor
 
@@ -34,7 +33,6 @@
 void HistoryUnwind::DoClear() {
   std::lock_guard guard(m_unwind_mutex);
   m_pcs.clear();
-  m_stop_id_is_valid = false;
 }
 
 lldb::RegisterContextSP
Index: source/Plugins/Process/Utility/HistoryThread.h
===
--- source/Plugins/Process/Utility/HistoryThread.h
+++ source/Plugins/Process/Utility/HistoryThread.h
@@ -27,15 +27,13 @@
 /// process execution
 ///
 /// This subclass of Thread is used to provide a backtrace from earlier in
-/// process execution.  It is gi

[Lldb-commits] [PATCH] D62743: Add color to the default thread and frame format.

2019-06-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked 4 inline comments as done.
JDevlieghere added inline comments.



Comment at: lldb/source/Core/Debugger.cpp:124
+#define FILE_COLOR "${ansi.fg.yellow}"
+#define STOP_COLOR "${ansi.fg.red}$"
+

aprantl wrote:
> Thanks, but I was thinking more about something that could be replaced 
> dynamically to support dark and light terminals in the same LLDB binary. Int 
> hits form, this probably doesn't add much because ...
As discussed offline, I think it's better to have fixed colors (but not things 
like black and white) and let the user's color scheme deal with their 
interpretation. 


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

https://reviews.llvm.org/D62743



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


[Lldb-commits] [PATCH] D62743: Add color to the default thread and frame format.

2019-06-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 204842.
JDevlieghere added a comment.

Match dwarfdump color scheme


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

https://reviews.llvm.org/D62743

Files:
  lldb/source/Core/Debugger.cpp

Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -101,14 +101,14 @@
  "Show disassembly when there is no source information, or the source file "
  "is missing when displaying a stop context."},
 {Debugger::eStopDisassemblyTypeAlways, "always",
- "Always show disassembly when displaying a stop context."} };
+ "Always show disassembly when displaying a stop context."}};
 
 static constexpr OptionEnumValueElement g_language_enumerators[] = {
 {eScriptLanguageNone, "none", "Disable scripting languages."},
 {eScriptLanguagePython, "python",
  "Select python as the default scripting language."},
 {eScriptLanguageDefault, "default",
- "Select the lldb default as the default scripting language."} };
+ "Select the lldb default as the default scripting language."}};
 
 #define MODULE_WITH_FUNC   \
   "{ " \
@@ -121,7 +121,9 @@
   "{${frame.no-debug}${function.pc-offset"
 
 #define FILE_AND_LINE  \
-  "{ at ${line.file.basename}:${line.number}{:${line.column}}}"
+  "{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}"\
+  ":${line.number}{:${line.column}}}"
+
 #define IS_OPTIMIZED "{${function.is-optimized} [opt]}"
 
 #define IS_ARTIFICIAL "{${frame.is-artificial} [artificial]}"
@@ -129,32 +131,36 @@
 #define DEFAULT_THREAD_FORMAT  \
   "thread #${thread.index}: tid = ${thread.id%tid}"\
   "{, ${frame.pc}}" MODULE_WITH_FUNC FILE_AND_LINE \
-  "{, name = '${thread.name}'}"\
-  "{, queue = '${thread.queue}'}"  \
-  "{, activity = '${thread.info.activity.name}'}"  \
+  "{, name = ${ansi.fg.green}'${thread.name}'${ansi.normal}}"  \
+  "{, queue = ${ansi.fg.green}'${thread.queue}'${ansi.normal}}"\
+  "{, activity = " \
+  "${ansi.fg.green}'${thread.info.activity.name}'${ansi.normal}}"  \
   "{, ${thread.info.trace_messages} messages}" \
-  "{, stop reason = ${thread.stop-reason}}"\
+  "{, stop reason = ${ansi.fg.red}${thread.stop-reason}${ansi.normal}}"\
   "{\\nReturn value: ${thread.return-value}}"  \
   "{\\nCompleted expression: ${thread.completed-expression}}"  \
   "\\n"
 
 #define DEFAULT_THREAD_STOP_FORMAT \
   "thread #${thread.index}{, name = '${thread.name}'}" \
-  "{, queue = '${thread.queue}'}"  \
-  "{, activity = '${thread.info.activity.name}'}"  \
+  "{, queue = ${ansi.fg.green}'${thread.queue}'${ansi.normal}}"\
+  "{, activity = " \
+  "${ansi.fg.green}'${thread.info.activity.name}'${ansi.normal}}"  \
   "{, ${thread.info.trace_messages} messages}" \
-  "{, stop reason = ${thread.stop-reason}}"\
+  "{, stop reason = ${ansi.fg.red}${thread.stop-reason}${ansi.normal}}"\
   "{\\nReturn value: ${thread.return-value}}"  \
   "{\\nCompleted expression: ${thread.completed-expression}}"  \
   "\\n"
 
 #define DEFAULT_FRAME_FORMAT   \
-  "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC FILE_AND_LINE  \
+  "frame #${frame.index}: "\
+  "${ansi.fg.yellow}${frame.pc}${ansi.normal}" MODULE_WITH_FUNC FILE_AND_LINE  \
   IS_OPTIMIZED IS_ARTIFICIAL "\\n"
 
 #define DEFAULT_FRAME_FORMAT_NO_ARGS   \
-  "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC_NO_ARGS FILE_AND_LINE  \
-  IS_OPTIMIZED IS_ARTIFICIAL "\\n"
+  "frame #${frame.index}: "\
+  "${ansi.fg.yellow}${frame.pc}${ansi.normal}" MODULE_WITH_FUNC_NO_ARGS\
+  FILE_AND_LINE IS_OPTIMIZED IS_ARTIFICIAL "\\n"
 
 // Three parts to this disassembly format specification:
 //   1. If this is a new function/symbol (no previous symbol/function

[Lldb-commits] [PATCH] D63166: Move common functionality from processwindows into processdebugger

2019-06-14 Thread Hui Huang via Phabricator via lldb-commits
Hui added inline comments.



Comment at: source/Plugins/Process/Windows/Common/ProcessDebugger.cpp:169-170
+
+Status ProcessDebugger::AttachProcess(lldb::pid_t pid,
+  const ProcessAttachInfo &attach_info,
+  DebugDelegateSP delegate) {

Hui wrote:
> labath wrote:
> > BTW, looking at the other patch, I just realized that this api is extremely 
> > redundant:
> > a) `ProcessAttachInfo` already contains a `pid` field so passing it 
> > separately makes no sense
> > b) `DebuggerThread` does not seem to be doing anything with the 
> > ProcessAttachInfo struct anyway.
> I once checked the pid shipped in attach_info. It was 
> LLDB_INVALID_PROCESS_ID.  Maybe it is an issue to fix.
Just double checked. The pid shipped in attach_info is correct. So the pid 
field can be removed. 
However the Process class does have a virtual method DoAttachToProcessWithID 
that requires pid as an input.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D63166



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


[Lldb-commits] [PATCH] D62501: Implement GetSharedLibraryInfoAddress

2019-06-14 Thread António Afonso via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363458: Implement GetSharedLibraryInfoAddress (authored by 
aadsm, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62501?vs=204422&id=204847#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62501

Files:
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
  lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt
  lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.cpp
  lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.h
  lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp
  lldb/trunk/unittests/Process/CMakeLists.txt
  lldb/trunk/unittests/Process/POSIX/CMakeLists.txt
  lldb/trunk/unittests/Process/POSIX/NativeProcessELFTest.cpp
  lldb/trunk/unittests/TestingSupport/Host/NativeProcessTestUtils.h

Index: lldb/trunk/unittests/Process/POSIX/NativeProcessELFTest.cpp
===
--- lldb/trunk/unittests/Process/POSIX/NativeProcessELFTest.cpp
+++ lldb/trunk/unittests/Process/POSIX/NativeProcessELFTest.cpp
@@ -0,0 +1,155 @@
+//===-- NativeProcessELFTest.cpp *- 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
+//
+//===--===//
+
+#include "TestingSupport/Host/NativeProcessTestUtils.h"
+
+#include "Plugins/Process/POSIX/NativeProcessELF.h"
+#include "Plugins/Process/Utility/AuxVector.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataEncoder.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "llvm/BinaryFormat/ELF.h"
+#include "llvm/Support/MemoryBuffer.h"
+
+#include "gmock/gmock.h"
+
+using namespace lldb_private;
+using namespace lldb;
+using namespace testing;
+
+namespace {
+class MockProcessELF : public MockProcess {
+public:
+  using MockProcess::MockProcess;
+  using NativeProcessELF::GetAuxValue;
+  using NativeProcessELF::GetELFImageInfoAddress;
+};
+
+std::unique_ptr CreateAuxvData(
+MockProcessELF &process,
+llvm::ArrayRef> auxv_data) {
+  auto addr_size = process.GetAddressByteSize();
+  DataBufferSP buffer_sp(
+  new DataBufferHeap(auxv_data.size() * addr_size * 2, 0));
+  DataEncoder encoder(buffer_sp, process.GetByteOrder(), addr_size);
+  uint32_t offset = 0;
+  for (auto &pair : auxv_data) {
+offset = encoder.PutAddress(offset, pair.first);
+offset = encoder.PutAddress(offset, pair.second);
+  }
+  return llvm::MemoryBuffer::getMemBufferCopy(
+  llvm::toStringRef(buffer_sp->GetData()), "");
+}
+
+} // namespace
+
+TEST(NativeProcessELFTest, GetAuxValue) {
+  NiceMock DummyDelegate;
+  MockProcessELF process(DummyDelegate, ArchSpec("i386-pc-linux"));
+
+  uint64_t phdr_addr = 0x42;
+  auto auxv_buffer = CreateAuxvData(
+  process, {std::make_pair(AuxVector::AUXV_AT_PHDR, phdr_addr)});
+  EXPECT_CALL(process, GetAuxvData())
+  .WillOnce(Return(ByMove(std::move(auxv_buffer;
+
+  ASSERT_EQ(phdr_addr, process.GetAuxValue(AuxVector::AUXV_AT_PHDR));
+}
+
+TEST(NativeProcessELFTest, GetELFImageInfoAddress) {
+  NiceMock DummyDelegate;
+  MockProcessELF process(DummyDelegate, ArchSpec("i386-pc-linux"));
+
+  uint32_t load_base = 0x1000;
+  uint32_t info_addr = 0x3741;
+  uint32_t phdr_addr = load_base + sizeof(llvm::ELF::Elf32_Ehdr);
+
+  auto auxv_buffer = CreateAuxvData(
+  process,
+  {std::make_pair(AuxVector::AUXV_AT_PHDR, phdr_addr),
+   std::make_pair(AuxVector::AUXV_AT_PHENT, sizeof(llvm::ELF::Elf32_Phdr)),
+   std::make_pair(AuxVector::AUXV_AT_PHNUM, 2)});
+  EXPECT_CALL(process, GetAuxvData())
+  .WillOnce(Return(ByMove(std::move(auxv_buffer;
+
+  // We're going to set up a fake memory with 2 program headers and 1 entry in
+  // the dynamic section. For simplicity sake they will be contiguous in memory.
+  struct MemoryContents {
+llvm::ELF::Elf32_Phdr phdr_load;
+llvm::ELF::Elf32_Phdr phdr_dynamic;
+llvm::ELF::Elf32_Dyn dyn_debug;
+  } MC;
+  // Setup the 2 program header entries
+  MC.phdr_load.p_type = llvm::ELF::PT_PHDR;
+  MC.phdr_load.p_vaddr = phdr_addr - load_base;
+
+  MC.phdr_dynamic.p_type = llvm::ELF::PT_DYNAMIC;
+  MC.phdr_dynamic.p_vaddr =
+  (phdr_addr + 2 * sizeof(llvm::ELF::Elf32_Phdr)) - load_base;
+  MC.phdr_dynamic.p_memsz = sizeof(llvm::ELF::Elf32_Dyn);
+
+  // Setup the single entry in the .dynamic section
+  MC.dyn_debug.d_tag = llvm::ELF::DT_DEBUG;
+  MC.dyn_debug.d_un.d_ptr = info_addr;
+
+  FakeMemory M(&MC, sizeof(MC), phdr_addr);
+  EXPECT_CALL(process, ReadMemory(_, _))
+  .WillRepeatedly(Invoke(&M,

[Lldb-commits] [PATCH] D62502: Implement xfer:libraries-svr4:read packet

2019-06-14 Thread António Afonso via Phabricator via lldb-commits
aadsm updated this revision to Diff 204850.
aadsm added a comment.

Only extend support to NetBSD


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62502

Files:
  lldb/include/lldb/Host/common/NativeProcessProtocol.h
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/Makefile
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/main.cpp
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_a.cpp
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_a.mk
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_b_quote.cpp
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_b_quote.mk
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
  lldb/source/Plugins/Process/POSIX/NativeProcessELF.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h

Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -196,6 +196,8 @@
   llvm::Expected>
   ReadXferObject(llvm::StringRef object, llvm::StringRef annex);
 
+  static std::string XMLEncodeAttributeValue(llvm::StringRef value);
+
 private:
   void HandleInferiorState_Exited(NativeProcessProtocol *process);
 
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -2765,6 +2765,24 @@
 return std::move(*buffer_or_error);
   }
 
+  if (object == "libraries-svr4") {
+auto library_list = m_debugged_process_up->GetLoadedSVR4Libraries();
+if (!library_list)
+  return library_list.takeError();
+
+StreamString response;
+response.Printf("");
+for (auto const &library : *library_list) {
+  response.Printf("", library.ld_addr);
+}
+response.Printf("");
+return MemoryBuffer::getMemBufferCopy(response.GetString(), __FUNCTION__);
+  }
+
   return llvm::make_error(
   "Xfer object not supported");
 }
@@ -3283,3 +3301,28 @@
 
   return GDBRemoteCommunicationServerCommon::FindModuleFile(module_path, arch);
 }
+
+std::string GDBRemoteCommunicationServerLLGS::XMLEncodeAttributeValue(
+llvm::StringRef value) {
+  std::string result;
+  for (const char &c : value) {
+switch (c) {
+case '\'':
+  result += "'";
+  break;
+case '"':
+  result += """;
+  break;
+case '<':
+  result += "<";
+  break;
+case '>':
+  result += ">";
+  break;
+default:
+  result += c;
+  break;
+}
+  }
+  return result;
+}
\ No newline at end of file
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -825,6 +825,7 @@
 #if defined(__linux__) || defined(__NetBSD__)
   response.PutCString(";QPassSignals+");
   response.PutCString(";qXfer:auxv:read+");
+  response.PutCString(";qXfer:libraries-svr4:read+");
 #endif
 
   return SendPacketNoLock(response.GetString());
Index: lldb/source/Plugins/Process/POSIX/NativeProcessELF.h
===
--- lldb/source/Plugins/Process/POSIX/NativeProcessELF.h
+++ lldb/source/Plugins/Process/POSIX/NativeProcessELF.h
@@ -37,6 +37,13 @@
   template 
   lldb::addr_t GetELFImageInfoAddress();
 
+  llvm::Expected>
+  GetLoadedSVR4Libraries() override;
+
+  template 
+  llvm::Expected
+  ReadSVR4LibraryInfo(lldb::addr_t link_map_addr);
+
   std::unique_ptr m_aux_vector;
   llvm::Optional m_shared_library_info_addr;
 };
Index: lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
===
--- lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
+++ lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
@@ -107,4 +107,73 @@
   return LLDB_INVALID_ADDRESS;
 }
 
+template 
+llvm::Expected
+NativeP

[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes

2019-06-14 Thread Hui Huang via Phabricator via lldb-commits
Hui added inline comments.



Comment at: 
source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.h:31
+protected:
+  Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp,
+   const size_t data_size);

labath wrote:
> Is this overriding something? Can you please use `override` to indicate that 
> (throughout this patch)?
No, it doesn't override anything. It has different signature from  the pure 
virtual method with the same name.


```
NativeRegisterContext::virtual Status ReadAllRegisterValues(lldb::DataBufferSP 
&data_sp) = 0;
```

It would be better to change the name to be ReadAllRegisterValuesWithSize or 
something else.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D63165



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


[Lldb-commits] [PATCH] D62743: Add color to the default thread and frame format.

2019-06-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 204855.
JDevlieghere marked an inline comment as done.
JDevlieghere added a comment.

Highlight line and column in different color


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

https://reviews.llvm.org/D62743

Files:
  lldb/source/Core/Debugger.cpp


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -121,7 +121,10 @@
   "{${frame.no-debug}${function.pc-offset"
 
 #define FILE_AND_LINE  
\
-  "{ at ${line.file.basename}:${line.number}{:${line.column}}}"
+  "{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}"
\
+  ":${ansi.fg.yellow}${line.number}${ansi.normal}" 
\
+  "{:${ansi.fg.yellow}${line.column}${ansi.normal}}}"
+
 #define IS_OPTIMIZED "{${function.is-optimized} [opt]}"
 
 #define IS_ARTIFICIAL "{${frame.is-artificial} [artificial]}"
@@ -129,32 +132,36 @@
 #define DEFAULT_THREAD_FORMAT  
\
   "thread #${thread.index}: tid = ${thread.id%tid}"
\
   "{, ${frame.pc}}" MODULE_WITH_FUNC FILE_AND_LINE 
\
-  "{, name = '${thread.name}'}"
\
-  "{, queue = '${thread.queue}'}"  
\
-  "{, activity = '${thread.info.activity.name}'}"  
\
+  "{, name = ${ansi.fg.green}'${thread.name}'${ansi.normal}}"  
\
+  "{, queue = ${ansi.fg.green}'${thread.queue}'${ansi.normal}}"
\
+  "{, activity = " 
\
+  "${ansi.fg.green}'${thread.info.activity.name}'${ansi.normal}}"  
\
   "{, ${thread.info.trace_messages} messages}" 
\
-  "{, stop reason = ${thread.stop-reason}}"
\
+  "{, stop reason = ${ansi.fg.red}${thread.stop-reason}${ansi.normal}}"
\
   "{\\nReturn value: ${thread.return-value}}"  
\
   "{\\nCompleted expression: ${thread.completed-expression}}"  
\
   "\\n"
 
 #define DEFAULT_THREAD_STOP_FORMAT 
\
   "thread #${thread.index}{, name = '${thread.name}'}" 
\
-  "{, queue = '${thread.queue}'}"  
\
-  "{, activity = '${thread.info.activity.name}'}"  
\
+  "{, queue = ${ansi.fg.green}'${thread.queue}'${ansi.normal}}"
\
+  "{, activity = " 
\
+  "${ansi.fg.green}'${thread.info.activity.name}'${ansi.normal}}"  
\
   "{, ${thread.info.trace_messages} messages}" 
\
-  "{, stop reason = ${thread.stop-reason}}"
\
+  "{, stop reason = ${ansi.fg.red}${thread.stop-reason}${ansi.normal}}"
\
   "{\\nReturn value: ${thread.return-value}}"  
\
   "{\\nCompleted expression: ${thread.completed-expression}}"  
\
   "\\n"
 
 #define DEFAULT_FRAME_FORMAT   
\
-  "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC FILE_AND_LINE  
\
+  "frame #${frame.index}: "
\
+  "${ansi.fg.yellow}${frame.pc}${ansi.normal}" MODULE_WITH_FUNC FILE_AND_LINE  
\
   IS_OPTIMIZED IS_ARTIFICIAL "\\n"
 
 #define DEFAULT_FRAME_FORMAT_NO_ARGS   
\
-  "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC_NO_ARGS FILE_AND_LINE  
\
-  IS_OPTIMIZED IS_ARTIFICIAL "\\n"
+  "frame #${frame.index}: "
\
+  "${ansi.fg.yellow}${frame.pc}${ansi.normal}" MODULE_WITH_FUNC_NO_ARGS
\
+  FILE_AND_LINE IS_OPTIMIZED IS_ARTIFICIAL "\\n"
 
 // Three parts to this disassembly format specification:
 //   1. If this is a new function/symbol (no previous symbol/function), print


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -121,7 +121,10 @@
   "{${frame.no-debug}${function.pc-offset"
 
 #define FILE_AND_LINE  \
-  "{ at ${line.file.basename}:${line.number}{:${line.column}}}"
+  "{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}"\
+  ":${ansi.fg.yellow}${line.number}${ansi.normal}" \
+  "{:${ansi.fg.yellow}${line.column}${ansi.normal}}}"
+
 #define IS_OPTIMIZED "{${function.is-optimized} [opt]}"
 
 #define IS_ARTIFICIAL "{${frame.is-artificial} [

[Lldb-commits] [PATCH] D63357: [Process] Remove unused field from HistoryThread

2019-06-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Added Jason and Jim. Not sure if all libdispatch stuff is in llvm.org? Either 
Jim or Jason should ok this just in case they still use this in Apple specific 
repos.


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

https://reviews.llvm.org/D63357



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


[Lldb-commits] [PATCH] D62743: Add color to the default thread and frame format.

2019-06-14 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

Can you add a screenshot of the final result for everybody?


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

https://reviews.llvm.org/D62743



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


[Lldb-commits] [PATCH] D62743: Add color to the default thread and frame format.

2019-06-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D62743#1544371 , @davide wrote:

> Can you add a screenshot of the final result for everybody?


Of course! https://i.imgur.com/1cvIbjB.png


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

https://reviews.llvm.org/D62743



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


[Lldb-commits] [PATCH] D62743: Add color to the default thread and frame format.

2019-06-14 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!


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

https://reviews.llvm.org/D62743



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


[Lldb-commits] [PATCH] D63363: [Signals] Create a plugin directory just for signals

2019-06-14 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: compnerd, JDevlieghere, labath, clayborg, davide.
Herald added subscribers: atanasyan, mgorny, sdardis, emaste.
Herald added a reviewer: jfb.

I plan on setting up a plugin architecture for UnixSignals since I
don't think it makes sense for UnixSignals to know about all the
platform-specific signal classes. The first step is to organize the directories
in a way that makes this easier to do.


https://reviews.llvm.org/D63363

Files:
  source/Plugins/CMakeLists.txt
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  source/Plugins/Process/Utility/CMakeLists.txt
  source/Plugins/Process/Utility/FreeBSDSignals.cpp
  source/Plugins/Process/Utility/FreeBSDSignals.h
  source/Plugins/Process/Utility/GDBRemoteSignals.cpp
  source/Plugins/Process/Utility/GDBRemoteSignals.h
  source/Plugins/Process/Utility/LinuxSignals.cpp
  source/Plugins/Process/Utility/LinuxSignals.h
  source/Plugins/Process/Utility/MipsLinuxSignals.cpp
  source/Plugins/Process/Utility/MipsLinuxSignals.h
  source/Plugins/Process/Utility/NetBSDSignals.cpp
  source/Plugins/Process/Utility/NetBSDSignals.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Signals/CMakeLists.txt
  source/Plugins/Signals/FreeBSD/CMakeLists.txt
  source/Plugins/Signals/FreeBSD/FreeBSDSignals.cpp
  source/Plugins/Signals/FreeBSD/FreeBSDSignals.h
  source/Plugins/Signals/GDBRemote/CMakeLists.txt
  source/Plugins/Signals/GDBRemote/GDBRemoteSignals.cpp
  source/Plugins/Signals/GDBRemote/GDBRemoteSignals.h
  source/Plugins/Signals/Linux/CMakeLists.txt
  source/Plugins/Signals/Linux/LinuxSignals.cpp
  source/Plugins/Signals/Linux/LinuxSignals.h
  source/Plugins/Signals/Linux/MipsLinuxSignals.cpp
  source/Plugins/Signals/Linux/MipsLinuxSignals.h
  source/Plugins/Signals/NetBSD/CMakeLists.txt
  source/Plugins/Signals/NetBSD/NetBSDSignals.cpp
  source/Plugins/Signals/NetBSD/NetBSDSignals.h
  source/Target/CMakeLists.txt
  source/Target/UnixSignals.cpp

Index: source/Target/UnixSignals.cpp
===
--- source/Target/UnixSignals.cpp
+++ source/Target/UnixSignals.cpp
@@ -7,10 +7,10 @@
 //===--===//
 
 #include "lldb/Target/UnixSignals.h"
-#include "Plugins/Process/Utility/FreeBSDSignals.h"
-#include "Plugins/Process/Utility/LinuxSignals.h"
-#include "Plugins/Process/Utility/MipsLinuxSignals.h"
-#include "Plugins/Process/Utility/NetBSDSignals.h"
+#include "Plugins/Signals/FreeBSD/FreeBSDSignals.h"
+#include "Plugins/Signals/Linux/LinuxSignals.h"
+#include "Plugins/Signals/Linux/MipsLinuxSignals.h"
+#include "Plugins/Signals/NetBSD/NetBSDSignals.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Utility/ArchSpec.h"
Index: source/Target/CMakeLists.txt
===
--- source/Target/CMakeLists.txt
+++ source/Target/CMakeLists.txt
@@ -68,6 +68,9 @@
 lldbUtility
 lldbPluginExpressionParserClang
 lldbPluginProcessUtility
+lldbPluginSignalsFreeBSD
+lldbPluginSignalsLinux
+lldbPluginSignalsNetBSD
 
   LINK_COMPONENTS
 Support
Index: source/Plugins/Process/Utility/NetBSDSignals.h
===
--- /dev/null
+++ source/Plugins/Process/Utility/NetBSDSignals.h
@@ -1,27 +0,0 @@
-//===-- NetBSDSignals.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_NetBSDSignals_H_
-#define liblldb_NetBSDSignals_H_
-
-#include "lldb/Target/UnixSignals.h"
-
-namespace lldb_private {
-
-/// NetBSD specific set of Unix signals.
-class NetBSDSignals : public UnixSignals {
-public:
-  NetBSDSignals();
-
-private:
-  void Reset() override;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_NetBSDSignals_H_
Index: source/Plugins/Process/Utility/NetBSDSignals.cpp
===
--- /dev/null
+++ source/Plugins/Process/Utility/NetBSDSignals.cpp
@@ -1,53 +0,0 @@
-//===-- NetBSDSignals.cpp --*- 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
-//
-//===--===//
-
-#include "NetBSDSignals.h"
-
-using namespace lldb_private;
-
-NetBSDSignals::NetBSDSignals() : UnixSignals() { Reset(); }
-
-void NetBSDSignals::Reset() {
-  UnixSigna

[Lldb-commits] [PATCH] D63363: [Signals] Create a plugin directory just for signals

2019-06-14 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 204862.
xiaobai added a comment.

Fix up include in gtest


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

https://reviews.llvm.org/D63363

Files:
  source/Plugins/CMakeLists.txt
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  source/Plugins/Process/Utility/CMakeLists.txt
  source/Plugins/Process/Utility/FreeBSDSignals.cpp
  source/Plugins/Process/Utility/FreeBSDSignals.h
  source/Plugins/Process/Utility/GDBRemoteSignals.cpp
  source/Plugins/Process/Utility/GDBRemoteSignals.h
  source/Plugins/Process/Utility/LinuxSignals.cpp
  source/Plugins/Process/Utility/LinuxSignals.h
  source/Plugins/Process/Utility/MipsLinuxSignals.cpp
  source/Plugins/Process/Utility/MipsLinuxSignals.h
  source/Plugins/Process/Utility/NetBSDSignals.cpp
  source/Plugins/Process/Utility/NetBSDSignals.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Signals/CMakeLists.txt
  source/Plugins/Signals/FreeBSD/CMakeLists.txt
  source/Plugins/Signals/FreeBSD/FreeBSDSignals.cpp
  source/Plugins/Signals/FreeBSD/FreeBSDSignals.h
  source/Plugins/Signals/GDBRemote/CMakeLists.txt
  source/Plugins/Signals/GDBRemote/GDBRemoteSignals.cpp
  source/Plugins/Signals/GDBRemote/GDBRemoteSignals.h
  source/Plugins/Signals/Linux/CMakeLists.txt
  source/Plugins/Signals/Linux/LinuxSignals.cpp
  source/Plugins/Signals/Linux/LinuxSignals.h
  source/Plugins/Signals/Linux/MipsLinuxSignals.cpp
  source/Plugins/Signals/Linux/MipsLinuxSignals.h
  source/Plugins/Signals/NetBSD/CMakeLists.txt
  source/Plugins/Signals/NetBSD/NetBSDSignals.cpp
  source/Plugins/Signals/NetBSD/NetBSDSignals.h
  source/Target/CMakeLists.txt
  source/Target/UnixSignals.cpp
  unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp

Index: unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
===
--- unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
+++ unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
@@ -9,7 +9,7 @@
 
 #include "GDBRemoteTestUtils.h"
 
-#include "Plugins/Process/Utility/LinuxSignals.h"
+#include "Plugins/Signals/Linux/LinuxSignals.h"
 #include "Plugins/Process/gdb-remote/GDBRemoteClientBase.h"
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h"
 #include "lldb/Utility/StreamGDBRemote.h"
Index: source/Target/UnixSignals.cpp
===
--- source/Target/UnixSignals.cpp
+++ source/Target/UnixSignals.cpp
@@ -7,10 +7,10 @@
 //===--===//
 
 #include "lldb/Target/UnixSignals.h"
-#include "Plugins/Process/Utility/FreeBSDSignals.h"
-#include "Plugins/Process/Utility/LinuxSignals.h"
-#include "Plugins/Process/Utility/MipsLinuxSignals.h"
-#include "Plugins/Process/Utility/NetBSDSignals.h"
+#include "Plugins/Signals/FreeBSD/FreeBSDSignals.h"
+#include "Plugins/Signals/Linux/LinuxSignals.h"
+#include "Plugins/Signals/Linux/MipsLinuxSignals.h"
+#include "Plugins/Signals/NetBSD/NetBSDSignals.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Utility/ArchSpec.h"
Index: source/Target/CMakeLists.txt
===
--- source/Target/CMakeLists.txt
+++ source/Target/CMakeLists.txt
@@ -68,6 +68,9 @@
 lldbUtility
 lldbPluginExpressionParserClang
 lldbPluginProcessUtility
+lldbPluginSignalsFreeBSD
+lldbPluginSignalsLinux
+lldbPluginSignalsNetBSD
 
   LINK_COMPONENTS
 Support
Index: source/Plugins/Process/Utility/NetBSDSignals.h
===
--- /dev/null
+++ source/Plugins/Process/Utility/NetBSDSignals.h
@@ -1,27 +0,0 @@
-//===-- NetBSDSignals.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_NetBSDSignals_H_
-#define liblldb_NetBSDSignals_H_
-
-#include "lldb/Target/UnixSignals.h"
-
-namespace lldb_private {
-
-/// NetBSD specific set of Unix signals.
-class NetBSDSignals : public UnixSignals {
-public:
-  NetBSDSignals();
-
-private:
-  void Reset() override;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_NetBSDSignals_H_
Index: source/Plugins/Process/Utility/NetBSDSignals.cpp
===
--- /dev/null
+++ source/Plugins/Process/Utility/NetBSDSignals.cpp
@@ -1,53 +0,0 @@
-//===-- NetBSDSignals.cpp --*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LI

[Lldb-commits] [PATCH] D63370: Specify log level for CMake messages (less stderr)

2019-06-14 Thread Christoph Siedentop via Phabricator via lldb-commits
siedentop created this revision.
siedentop added reviewers: zturner, beanz, xiaobai, kbobyrev.
Herald added subscribers: llvm-commits, lldb-commits, Sanitizers, lebedev.ri, 
mgorny.
Herald added a reviewer: lebedev.ri.
Herald added projects: Sanitizers, LLDB, LLVM.

Specify message levels in CMake. Prefer STATUS (stdout).

  

As the default message mode (i.e. level) is NOTICE in CMake, more then 
necessary messages get printed to stderr. Some tools,  noticably ccmake treat 
this as an error and require additional confirmation and re-running CMake's 
configuration step.

  

This commit specifies a mode (either STATUS or WARNING or FATAL_ERROR)  instead 
of the default.

- I used `csearch -f 'llvm-project/.+(CMakeLists\.txt|cmake)' -l 'message\("'` 
to find all locations.
- Reviewers were chosen by the most common authors of specific files. If there 
are more suitable reviewers for these CMake changes, please let me know.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63370

Files:
  compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/cmake/modules/LLDBStandalone.cmake
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  llvm/utils/benchmark/CMakeLists.txt
  llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
  llvm/utils/benchmark/cmake/GetGitVersion.cmake

Index: llvm/utils/benchmark/cmake/GetGitVersion.cmake
===
--- llvm/utils/benchmark/cmake/GetGitVersion.cmake
+++ llvm/utils/benchmark/cmake/GetGitVersion.cmake
@@ -49,6 +49,6 @@
   set(GIT_VERSION "v0.0.0")
   endif()
 
-  message("-- git Version: ${GIT_VERSION}")
+  message(STATUS "-- git Version: ${GIT_VERSION}")
   set(${var} ${GIT_VERSION} PARENT_SCOPE)
 endfunction()
Index: llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
===
--- llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
+++ llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
@@ -28,7 +28,7 @@
   endif()
 
   if (NOT DEFINED COMPILE_${FEATURE})
-message("-- Performing Test ${FEATURE}")
+message(STATUS "-- Performing Test ${FEATURE}")
 if(CMAKE_CROSSCOMPILING)
   try_compile(COMPILE_${FEATURE}
   ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
@@ -42,7 +42,7 @@
 set(RUN_${FEATURE} 1)
   endif()
 else()
-  message("-- Performing Test ${FEATURE}")
+  message(STATUS "-- Performing Test ${FEATURE}")
   try_run(RUN_${FEATURE} COMPILE_${FEATURE}
   ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
   CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS}
@@ -51,14 +51,14 @@
   endif()
 
   if(RUN_${FEATURE} EQUAL 0)
-message("-- Performing Test ${FEATURE} -- success")
+message(STATUS "-- Performing Test ${FEATURE} -- success")
 set(HAVE_${VAR} 1 PARENT_SCOPE)
 add_definitions(-DHAVE_${VAR})
   else()
 if(NOT COMPILE_${FEATURE})
-  message("-- Performing Test ${FEATURE} -- failed to compile")
+  message(WARNING "-- Performing Test ${FEATURE} -- failed to compile")
 else()
-  message("-- Performing Test ${FEATURE} -- compiled but failed to run")
+  message(STATUS "-- Performing Test ${FEATURE} -- compiled but failed to run")
 endif()
   endif()
 endfunction()
Index: llvm/utils/benchmark/CMakeLists.txt
===
--- llvm/utils/benchmark/CMakeLists.txt
+++ llvm/utils/benchmark/CMakeLists.txt
@@ -81,7 +81,7 @@
 
 # Tell the user what versions we are using
 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION ${GIT_VERSION})
-message("-- Version: ${VERSION}")
+message(STATUS "-- Version: ${VERSION}")
 
 # The version of the libraries
 set(GENERIC_LIB_VERSION ${VERSION})
@@ -216,7 +216,7 @@
   elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
   "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
 add_cxx_compiler_flag(-nostdinc++)
-message("libc++ header path must be manually specified using CMAKE_CXX_FLAGS")
+message(WARNING "libc++ header path must be manually specified using CMAKE_CXX_FLAGS")
 # Adding -nodefaultlibs directly to CMAKE__LINKER_FLAGS will break
 # configuration checks such as 'find_package(Threads)'
 list(APPEND BENCHMARK_CXX_LINKER_FLAGS -nodefaultlibs)
Index: llvm/cmake/modules/LLVMInstallSymlink.cmake
===
--- llvm/cmake/modules/LLVMInstallSymlink.cmake
+++ llvm/cmake/modules/LLVMInstallSymlink.cmake
@@ -12,7 +12,7 @@
 
   set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
 
-  message("Creating ${name}")
+  message(STATUS "Creating ${name}")
 
   execute_process(
 COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}" "${name}"
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+

[Lldb-commits] [PATCH] D63370: Specify log level for CMake messages (less stderr)

2019-06-14 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a reviewer: sgraenitz.
xiaobai added a comment.

Seems alright to me. I'd like to see 1 message changed from a STATUS to a 
WARNING though.




Comment at: lldb/cmake/modules/LLDBConfig.cmake:131
   if ("${PYTHON_HOME}" STREQUAL "")
-message("LLDB embedded Python on Windows requires specifying a value for 
PYTHON_HOME.  Python support disabled.")
+message(STATUS "LLDB embedded Python on Windows requires specifying a 
value for PYTHON_HOME.  Python support disabled.")
 set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)

Please make this a warning.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63370



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


[Lldb-commits] [PATCH] D62213: [ABI] Implement Windows ABI for x86_64

2019-06-14 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour updated this revision to Diff 204885.
kusmour added a comment.

complete the code for floating point registers and cleaned up
the support for floating point registers fixed `TestRegistersIterator` update 
the testcased


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62213

Files:
  
lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/ABI/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
  lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
  lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h
  lldb/source/Plugins/ABI/Windows-x86_64/CMakeLists.txt
  lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
  lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp

Index: lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
===
--- lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
+++ lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
@@ -24,6 +24,11 @@
 
 #define DEFINE_GPR(reg, alt) #reg, alt, 8, 0, eEncodingUint, eFormatHexUppercase
 #define DEFINE_GPR_BIN(reg, alt) #reg, alt, 8, 0, eEncodingUint, eFormatBinary
+#define DEFINE_FPU_XMM(reg)\
+  #reg, NULL, 16, 0, eEncodingUint, eFormatVectorOfUInt64, \
+  {dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, LLDB_INVALID_REGNUM,\
+   LLDB_INVALID_REGNUM, lldb_##reg##_x86_64},  \
+  nullptr, nullptr, nullptr, 0
 
 namespace {
 
@@ -51,7 +56,24 @@
   eRegisterIndexR14,
   eRegisterIndexR15,
   eRegisterIndexRip,
-  eRegisterIndexRflags
+  eRegisterIndexRflags,
+
+  eRegisterIndexXmm0,
+  eRegisterIndexXmm1,
+  eRegisterIndexXmm2,
+  eRegisterIndexXmm3,
+  eRegisterIndexXmm4,
+  eRegisterIndexXmm5,
+  eRegisterIndexXmm6,
+  eRegisterIndexXmm7,
+  eRegisterIndexXmm8,
+  eRegisterIndexXmm9,
+  eRegisterIndexXmm10,
+  eRegisterIndexXmm11,
+  eRegisterIndexXmm12,
+  eRegisterIndexXmm13,
+  eRegisterIndexXmm14,
+  eRegisterIndexXmm15
 };
 
 // Array of all register information supported by Windows x86
@@ -133,14 +155,14 @@
  nullptr,
  0},
 {DEFINE_GPR(r10, nullptr),
- {dwarf_r10_x86_64, dwarf_r10_x86_64, LLDB_REGNUM_GENERIC_ARG5,
+ {dwarf_r10_x86_64, dwarf_r10_x86_64, LLDB_INVALID_REGNUM,
   LLDB_INVALID_REGNUM, lldb_r10_x86_64},
  nullptr,
  nullptr,
  nullptr,
  0},
 {DEFINE_GPR(r11, nullptr),
- {dwarf_r11_x86_64, dwarf_r11_x86_64, LLDB_REGNUM_GENERIC_ARG6,
+ {dwarf_r11_x86_64, dwarf_r11_x86_64, LLDB_INVALID_REGNUM,
   LLDB_INVALID_REGNUM, lldb_r11_x86_64},
  nullptr,
  nullptr,
@@ -188,6 +210,22 @@
  nullptr,
  nullptr,
  0},
+{DEFINE_FPU_XMM(xmm0)},
+{DEFINE_FPU_XMM(xmm1)},
+{DEFINE_FPU_XMM(xmm2)},
+{DEFINE_FPU_XMM(xmm3)},
+{DEFINE_FPU_XMM(xmm4)},
+{DEFINE_FPU_XMM(xmm5)},
+{DEFINE_FPU_XMM(xmm6)},
+{DEFINE_FPU_XMM(xmm7)},
+{DEFINE_FPU_XMM(xmm8)},
+{DEFINE_FPU_XMM(xmm9)},
+{DEFINE_FPU_XMM(xmm10)},
+{DEFINE_FPU_XMM(xmm11)},
+{DEFINE_FPU_XMM(xmm12)},
+{DEFINE_FPU_XMM(xmm13)},
+{DEFINE_FPU_XMM(xmm14)},
+{DEFINE_FPU_XMM(xmm15)}
 };
 
 static size_t k_num_register_infos = llvm::array_lengthof(g_register_infos);
@@ -202,10 +240,20 @@
 eRegisterIndexR12, eRegisterIndexR13, eRegisterIndexR14,
 eRegisterIndexR15, eRegisterIndexRip, eRegisterIndexRflags};
 
+uint32_t g_fpu_reg_indices[] = {
+eRegisterIndexXmm0,  eRegisterIndexXmm1,  eRegisterIndexXmm2,
+eRegisterIndexXmm3,  eRegisterIndexXmm4,  eRegisterIndexXmm5,
+eRegisterIndexXmm6,  eRegisterIndexXmm7,  eRegisterIndexXmm8,
+eRegisterIndexXmm9,  eRegisterIndexXmm10, eRegisterIndexXmm11,
+eRegisterIndexXmm12, eRegisterIndexXmm13, eRegisterIndexXmm14,
+eRegisterIndexXmm15
+};
+
 RegisterSet g_register_sets[] = {
 {"General Purpose Registers", "gpr",
  llvm::array_lengthof(g_gpr_reg_indices), g_gpr_reg_indices},
-};
+{"Floating Point Registers", "fpu",
+ llvm::array_lengthof(g_fpu_reg_indices), g_fpu_reg_indices}};
 }
 
 // Constructors and Destructors
@@ -242,7 +290,9 @@
   if (reg_info == nullptr)
 return false;
 
-  switch (reg_info->kinds[eRegisterKindLLDB]) {
+  const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
+
+  switch (reg) {
   case lldb_rax_x86_64:
 reg_value.SetUInt64(m_context.Rax);
 break;
@@ -297,6 +347,70 @@
   case lldb_rflags_x86_64:
 reg_value.SetUInt64(m_context.EFlags);
 break;
+  case lldb_xmm0_x86_64:
+reg_value.SetBytes(&m_context.Xmm0,
+   reg_info->byte_size, endian::InlHostByteOrder());
+break;
+  case lldb_xmm1_x86_64:
+reg_value.SetBytes(&m_context.Xmm1,
+

[Lldb-commits] [PATCH] D63370: Specify log level for CMake messages (less stderr)

2019-06-14 Thread Christoph Siedentop via Phabricator via lldb-commits
siedentop marked an inline comment as done.
siedentop added a comment.

Thank you for the review, @xiaobai. I've made the requested change.


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

https://reviews.llvm.org/D63370



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


[Lldb-commits] [PATCH] D63370: Specify log level for CMake messages (less stderr)

2019-06-14 Thread Christoph Siedentop via Phabricator via lldb-commits
siedentop updated this revision to Diff 204886.
siedentop added a comment.

Modified STATUS to WARNING as requested by @xiaobai


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

https://reviews.llvm.org/D63370

Files:
  compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/cmake/modules/LLDBStandalone.cmake
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  llvm/utils/benchmark/CMakeLists.txt
  llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
  llvm/utils/benchmark/cmake/GetGitVersion.cmake

Index: llvm/utils/benchmark/cmake/GetGitVersion.cmake
===
--- llvm/utils/benchmark/cmake/GetGitVersion.cmake
+++ llvm/utils/benchmark/cmake/GetGitVersion.cmake
@@ -49,6 +49,6 @@
   set(GIT_VERSION "v0.0.0")
   endif()
 
-  message("-- git Version: ${GIT_VERSION}")
+  message(STATUS "-- git Version: ${GIT_VERSION}")
   set(${var} ${GIT_VERSION} PARENT_SCOPE)
 endfunction()
Index: llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
===
--- llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
+++ llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
@@ -28,7 +28,7 @@
   endif()
 
   if (NOT DEFINED COMPILE_${FEATURE})
-message("-- Performing Test ${FEATURE}")
+message(STATUS "-- Performing Test ${FEATURE}")
 if(CMAKE_CROSSCOMPILING)
   try_compile(COMPILE_${FEATURE}
   ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
@@ -42,7 +42,7 @@
 set(RUN_${FEATURE} 1)
   endif()
 else()
-  message("-- Performing Test ${FEATURE}")
+  message(STATUS "-- Performing Test ${FEATURE}")
   try_run(RUN_${FEATURE} COMPILE_${FEATURE}
   ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
   CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS}
@@ -51,14 +51,14 @@
   endif()
 
   if(RUN_${FEATURE} EQUAL 0)
-message("-- Performing Test ${FEATURE} -- success")
+message(STATUS "-- Performing Test ${FEATURE} -- success")
 set(HAVE_${VAR} 1 PARENT_SCOPE)
 add_definitions(-DHAVE_${VAR})
   else()
 if(NOT COMPILE_${FEATURE})
-  message("-- Performing Test ${FEATURE} -- failed to compile")
+  message(WARNING "-- Performing Test ${FEATURE} -- failed to compile")
 else()
-  message("-- Performing Test ${FEATURE} -- compiled but failed to run")
+  message(STATUS "-- Performing Test ${FEATURE} -- compiled but failed to run")
 endif()
   endif()
 endfunction()
Index: llvm/utils/benchmark/CMakeLists.txt
===
--- llvm/utils/benchmark/CMakeLists.txt
+++ llvm/utils/benchmark/CMakeLists.txt
@@ -81,7 +81,7 @@
 
 # Tell the user what versions we are using
 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION ${GIT_VERSION})
-message("-- Version: ${VERSION}")
+message(STATUS "-- Version: ${VERSION}")
 
 # The version of the libraries
 set(GENERIC_LIB_VERSION ${VERSION})
@@ -216,7 +216,7 @@
   elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
   "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
 add_cxx_compiler_flag(-nostdinc++)
-message("libc++ header path must be manually specified using CMAKE_CXX_FLAGS")
+message(WARNING "libc++ header path must be manually specified using CMAKE_CXX_FLAGS")
 # Adding -nodefaultlibs directly to CMAKE__LINKER_FLAGS will break
 # configuration checks such as 'find_package(Threads)'
 list(APPEND BENCHMARK_CXX_LINKER_FLAGS -nodefaultlibs)
Index: llvm/cmake/modules/LLVMInstallSymlink.cmake
===
--- llvm/cmake/modules/LLVMInstallSymlink.cmake
+++ llvm/cmake/modules/LLVMInstallSymlink.cmake
@@ -12,7 +12,7 @@
 
   set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
 
-  message("Creating ${name}")
+  message(STATUS "Creating ${name}")
 
   execute_process(
 COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}" "${name}"
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -95,7 +95,7 @@
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
 endif()
   else()
-message("-- Found PythonInterp: ${PYTHON_EXECUTABLE}")
+message(STATUS "-- Found PythonInterp: ${PYTHON_EXECUTABLE}")
   endif()
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -128,7 +128,7 @@
 # addresses them, but it can be improved and extended on an as-needed basis.
 function(find_python_libs_windows)
   if ("${PYTHON_HOME}" STREQUAL "")
-message("LLDB embedded Python on Windows requires specifyin