[Lldb-commits] [PATCH] D40470: Protect DWARFCompileUnit::m_die_array by a new mutex

2018-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I think we should expose the llvm::sys::RWMutex and lets clients like 
BuildAddressRangeTable and SymbolFileDWARF::Index use it and get rid of 
m_die_array_usecount all together.




Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.h:181
+  // ExtractDIEsIfNeeded() will keep m_die_array populated forever.
+  uint32_t m_die_array_usecount = 0;
   // GetUnitDIEPtrOnly() needs to return pointer to the first DIE.

Why don't we expose the llvm::sys::RWMutex for BuildAddressRangeTable and 
SymbolFileDWARF::Index? Then they can just grab the read lock?


https://reviews.llvm.org/D40470



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


[Lldb-commits] [PATCH] D40470: Protect DWARFCompileUnit::m_die_array by a new mutex

2018-05-29 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 149037.
jankratochvil edited the summary of this revision.

https://reviews.llvm.org/D40470

Files:
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -13,6 +13,7 @@
 #include "DWARFDIE.h"
 #include "DWARFDebugInfoEntry.h"
 #include "lldb/lldb-enumerations.h"
+#include "llvm/Support/RWMutex.h"
 
 class DWARFUnit;
 class DWARFCompileUnit;
@@ -172,10 +173,17 @@
   void *m_user_data = nullptr;
   // The compile unit debug information entry item
   DWARFDebugInfoEntry::collection m_die_array;
+  mutable llvm::sys::RWMutex m_die_array_mutex;
+  // It gets increased by ExtractDIEsIfNeeded() and decreased by ClearDIEs().
+  // BuildAddressRangeTable and SymbolFileDWARF::Index can populate m_die_array
+  // only temporarily while other functions calling only
+  // ExtractDIEsIfNeeded() will keep m_die_array populated forever.
+  uint32_t m_die_array_usecount = 0;
   // GetUnitDIEPtrOnly() needs to return pointer to the first DIE.
   // But the first element of m_die_array after ExtractUnitDIEIfNeeded()
   // would possibly move in memory after later ExtractDIEsIfNeeded().
   DWARFDebugInfoEntry m_first_die;
+  llvm::sys::RWMutex m_first_die_mutex;
   // A table similar to the .debug_aranges table, but this one points to the
   // exact DW_TAG_subprogram DIEs
   std::unique_ptr m_func_aranges_ap;
@@ -206,14 +214,17 @@
   // if needed.
   const DWARFDebugInfoEntry *GetUnitDIEPtrOnly() {
 ExtractUnitDIEIfNeeded();
+// m_first_die_mutex is not required as m_first_die is never cleared.
 if (!m_first_die)
   return NULL;
 return &m_first_die;
   }
 
   // Get all DWARF debug informration entries. Parse all DIEs if needed.
   const DWARFDebugInfoEntry *DIEPtr() {
 ExtractDIEsIfNeeded();
+// m_die_array_mutex is not required as ExtractDIEsIfNeeded() has not
+// been matched by ClearDIEs().
 if (m_die_array.empty())
   return NULL;
 return &m_die_array[0];
Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -39,6 +39,12 @@
 // Parses first DIE of a compile unit.
 //--
 void DWARFUnit::ExtractUnitDIEIfNeeded() {
+  {
+llvm::sys::ScopedReader lock(m_first_die_mutex);
+if (m_first_die)
+  return; // Already parsed
+  }
+  llvm::sys::ScopedWriter lock(m_first_die_mutex);
   if (m_first_die)
 return; // Already parsed
 
@@ -69,8 +75,19 @@
 // Parses a compile unit and indexes its DIEs if it hasn't already been done.
 //--
 bool DWARFUnit::ExtractDIEsIfNeeded() {
+  {
+llvm::sys::ScopedReader lock(m_die_array_mutex);
+if (!m_die_array.empty())
+  return 0; // Already parsed
+  }
+  llvm::sys::ScopedWriter lock(m_die_array_mutex);
   if (!m_die_array.empty())
 return 0; // Already parsed
+  // Protect against use count overflow.
+  if (m_die_array_usecount
+  < std::numeric_limits::max())
+++m_die_array_usecount;
+  llvm::sys::ScopedWriter first_die_lock(m_first_die_mutex);
 
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(
@@ -227,6 +244,7 @@
   }
 }
 
+// m_die_array_mutex must be already held as read/write.
 void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) {
   uint64_t base_addr = cu_die.GetAttributeValueAsAddress(
   m_dwarf, this, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
@@ -280,11 +298,14 @@
 DWARFDIECollection &dies,
 uint32_t depth) const {
   size_t old_size = dies.Size();
-  DWARFDebugInfoEntry::const_iterator pos;
-  DWARFDebugInfoEntry::const_iterator end = m_die_array.end();
-  for (pos = m_die_array.begin(); pos != end; ++pos) {
-if (pos->Tag() == tag)
-  dies.Append(DWARFDIE(this, &(*pos)));
+  {
+llvm::sys::ScopedReader lock(m_die_array_mutex);
+DWARFDebugInfoEntry::const_iterator pos;
+DWARFDebugInfoEntry::const_iterator end = m_die_array.end();
+for (pos = m_die_array.begin(); pos != end; ++pos) {
+  if (pos->Tag() == tag)
+dies.Append(DWARFDIE(this, &(*pos)));
+}
   }
 
   // Return the number of DIEs added to the collection
@@ -325,9 +346,18 @@
   m_base_obj_offset = base_obj_offset;
 }
 
+// It may be called only after: ExtractDIEsIfNeeded() == true
 void DWARFUnit::ClearDIEs() {
-  m_die_array.clear();
-  m_die_array.shrink_to_fit();
+  {
+llvm::sys::ScopedWriter lock(m_die_array_mutex);
+lldbassert(!m_die_array.empty());
+lldbassert(m_die_array_usecount > 0);
+if (--m_die_array_usecount > 0)
+  return;

[Lldb-commits] [PATCH] D47508: [lldb-test] Add a testing harness for the JIT's IRMemoryMap

2018-05-29 Thread Vedant Kumar via Phabricator via lldb-commits
vsk created this revision.
vsk added reviewers: jingham, davide, labath, zturner.

This teaches lldb-test how to launch a process, set up an IRMemoryMap,
and issue memory allocations in the target process through the map. This
makes it possible to test IRMemoryMap in a targeted way.

The main motivation for testing IRMemoryMap is to uncover bugs. I've
noticed two so far. The first bug is that IRMemoryMap::Malloc performs
an adjustment on the pointer returned from Process::AllocateMemory (for
alignment purposes) which ultimately allows overlapping memory regions
to be created. The second bug is that after most of the address space on
the host side is exhausted, Malloc may return the same address multiple
times. These bugs (and hopefully more!) can be uncovered and tested for
with targeted lldb-test commands.

At an even higher level, the motivation for addressing bugs in
IRMemoryMap::Malloc is that they can lead to strange user-visible
failures (e.g, variables assume the wrong value during expression
evaluation, or the debugger crashes). See my third comment on this
swift-lldb PR for an example:

  https://github.com/apple/swift-lldb/pull/652

I hope lldb-test is the right place to test IRMemoryMap. Setting up a
gtest-style unit test proved too cumbersome (you need to recreate or
mock way too much debugger state), as did writing end-to-end tests (it's
hard to write a test that actually hits a buggy path).

With lldb-test, it's easy to read/generate the test input and parse the
test output. I'll attach a simple "fuzz" tester which generates failing test
cases with ease.


https://reviews.llvm.org/D47508

Files:
  lit/Expr/TestIRMemoryMap.test
  source/Target/Process.cpp
  tools/lldb-test/lldb-test.cpp

Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -15,20 +15,25 @@
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Expression/IRMemoryMap.h"
 #include "lldb/Initialization/SystemLifetimeManager.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangASTImporter.h"
 #include "lldb/Symbol/SymbolVendor.h"
 #include "lldb/Symbol/TypeList.h"
 #include "lldb/Symbol/VariableList.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Utility/CleanUp.h"
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/StreamString.h"
 
+#include "llvm/ADT/IntervalMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/PrettyStackTrace.h"
@@ -41,11 +46,18 @@
 using namespace llvm;
 
 namespace opts {
+
+TargetSP createTarget(Debugger &Dbg, const std::string &Filename);
+std::unique_ptr openFile(const std::string &Filename);
+
 static cl::SubCommand BreakpointSubcommand("breakpoints",
"Test breakpoint resolution");
 cl::SubCommand ModuleSubcommand("module-sections",
 "Display LLDB Module Information");
 cl::SubCommand SymbolsSubcommand("symbols", "Dump symbols for an object file");
+cl::SubCommand IRMemoryMapSubcommand("ir-memory-map", "Test IRMemoryMap");
+cl::opt Log("log", cl::desc("Path to a log file"), cl::init(""),
+ cl::sub(IRMemoryMapSubcommand));
 
 namespace breakpoint {
 static cl::opt Target(cl::Positional, cl::desc(""),
@@ -135,8 +147,47 @@
 
 static int dumpSymbols(Debugger &Dbg);
 }
+
+namespace irmemorymap {
+static cl::opt Target(cl::Positional, cl::desc(""),
+   cl::Required,
+   cl::sub(IRMemoryMapSubcommand));
+static cl::opt CommandFile(cl::Positional,
+cl::desc(""),
+cl::init("-"),
+cl::sub(IRMemoryMapSubcommand));
+using AddrIntervalMap =
+  IntervalMap>;
+bool evalMalloc(IRMemoryMap &IRMemMap, StringRef Line,
+AddrIntervalMap &AllocatedIntervals);
+int evaluateMemoryMapCommands(Debugger &Dbg);
+} // namespace irmemorymap
+
 } // namespace opts
 
+TargetSP opts::createTarget(Debugger &Dbg, const std::string &Filename) {
+  TargetSP Target;
+  Status ST =
+  Dbg.GetTargetList().CreateTarget(Dbg, Filename, /*triple*/ "",
+   /*get_dependent_modules*/ false,
+   /*platform_options*/ nullptr, Target);
+  if (ST.Fail()) {
+errs() << formatv("Failed to create target '{0}: {1}\n", Filename, ST);
+exit(1);
+  }
+  return Target;
+}
+
+std::unique_ptr opts::openFile(const std::string &Filename) {
+  auto MB = MemoryBuffer::getFileOrSTDIN(Fi

Re: [Lldb-commits] [lldb] r333465 - [ObjC] Fix the formatter for NSOrderedSet.

2018-05-29 Thread Davide Italiano via lldb-commits
I would like to apologize, I forgot to `git add `the Makefile and this
broke the bots. It should be fixed now. I'll keep an eye to make sure
everything stays green.
Sorry for the disruption, folks!

--
Davide

On Tue, May 29, 2018 at 3:08 PM, Davide Italiano via lldb-commits
 wrote:
> Author: davide
> Date: Tue May 29 15:08:07 2018
> New Revision: 333465
>
> URL: http://llvm.org/viewvc/llvm-project?rev=333465&view=rev
> Log:
> [ObjC] Fix the formatter for NSOrderedSet.
>
> While I'm here, delete some dead code.
>
> 
>
> Added:
> lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/
> 
> lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py
> lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m
> Modified:
> lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
>
> Added: 
> lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py?rev=333465&view=auto
> ==
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py
>  (added)
> +++ 
> lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py
>  Tue May 29 15:08:07 2018
> @@ -0,0 +1,17 @@
> +import lldb
> +from lldbsuite.test.decorators import *
> +from lldbsuite.test.lldbtest import *
> +from lldbsuite.test import lldbutil
> +
> +class TestOrderedSet(TestBase):
> +  mydir = TestBase.compute_mydir(__file__)
> +
> +  def test_ordered_set(self):
> +self.build()
> +src_file = "main.m"
> +src_file_spec = lldb.SBFileSpec(src_file)
> +(target, process, thread, main_breakpoint) = 
> lldbutil.run_to_source_breakpoint(self,
> +  "break here", src_file_spec, exe_name = "a.out")
> +frame = thread.GetSelectedFrame()
> +self.expect("expr -d run -- orderedSet", substrs=["3 elements"])
> +self.expect("expr -d run -- *orderedSet", substrs=["(int)1", "(int)2", 
> "(int)3"])
>
> Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m?rev=333465&view=auto
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m 
> (added)
> +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m Tue 
> May 29 15:08:07 2018
> @@ -0,0 +1,8 @@
> +#import 
> +
> +int main() {
> +  NSOrderedSet *orderedSet =
> +  [NSOrderedSet orderedSetWithArray:@[@1,@2,@3,@1]];
> +  NSLog(@"%@",orderedSet);
> +  return 0; // break here
> +}
>
> Modified: lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp?rev=333465&r1=333464&r2=333465&view=diff
> ==
> --- lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp (original)
> +++ lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp Tue May 29 15:08:07 2018
> @@ -269,7 +269,8 @@ bool lldb_private::formatters::NSSetSumm
>if (!class_name || !*class_name)
>  return false;
>
> -  if (!strcmp(class_name, "__NSSetI")) {
> +  if (!strcmp(class_name, "__NSSetI") ||
> +  !strcmp(class_name, "__NSOrderedSetI")) {
>  Status error;
>  value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
>ptr_size, 0, error);
> @@ -289,32 +290,7 @@ bool lldb_private::formatters::NSSetSumm
>  }
>  if (error.Fail())
>return false;
> -  }
> -  /*else if (!strcmp(class_name,"__NSCFSet"))
> -   {
> -   Status error;
> -   value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit 
> ?
> -   20 : 12), 4, 0, error);
> -   if (error.Fail())
> -   return false;
> -   if (is_64bit)
> -   value &= ~0x1fffUL;
> -   }
> -   else if (!strcmp(class_name,"NSCountedSet"))
> -   {
> -   Status error;
> -   value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
> -   ptr_size, 0, error);
> -   if (error.Fail())
> -   return false;
> -   value = process_sp->ReadUnsignedIntegerFromMemory(value + (is_64bit ? 20 :
> -   12), 4, 0, error);
> -   if (error.Fail())
> -   return false;
> -   if (is_64bit)
> -   value &= ~0x1fffUL;
> -   }*/
> -  else {
> +  } else {
>  auto &map(NSSet_Additionals::GetAdditionalSummaries());
>  auto iter = map.find(class_name_cs), end = map.end();
>  if (iter != end)
> @@ -371,7 +347,8 @@ lldb_private::formatters::NSSetSynthetic
>if (!class_name || !*class_name)
>  return nullptr;
>
> -  if (!strcmp(class_name, "__NSSetI")) {
> +  if (!strcmp(class_name, "__NSSetI") ||
> +  !strcmp(class_name, "__NSOrderedSetI")

Re: [Lldb-commits] buildbot failure in LLVM on lldb-x86_64-ubuntu-14.04-cmake

2018-05-29 Thread Davide Italiano via lldb-commits
Pavel, this should be fixed now that I added a Makefile.
Don't hesitate to revert in case it stays red (or fix it yourself,
even better :)

--
Davide

On Tue, May 29, 2018 at 3:26 PM,   wrote:
> The Buildbot has detected a new failure on builder 
> lldb-x86_64-ubuntu-14.04-cmake while building lldb.
> Full details are available at:
>  http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/23928
>
> Buildbot URL: http://lab.llvm.org:8011/
>
> Buildslave for this Build: lldb-build1-ubuntu-1404
>
> Build Reason: scheduler
> Build Source Stamp: [branch trunk] 333465
> Blamelist: davide
>
> BUILD FAILED: failed test1 test2 test3 test4 test5 test6
>
> sincerely,
>  -The Buildbot
>
>
>



-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333466 - [ObjC] Add a Makefile for the test added in r333465.

2018-05-29 Thread Davide Italiano via lldb-commits
Author: davide
Date: Tue May 29 15:20:05 2018
New Revision: 333466

URL: http://llvm.org/viewvc/llvm-project?rev=333466&view=rev
Log:
[ObjC] Add a Makefile for the test added in r333465.

Not strictly necessary, but makes the test more robust in case
we end up changing the defaults.



Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/Makefile

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/Makefile?rev=333466&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/Makefile 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/Makefile Tue 
May 29 15:20:05 2018
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+OBJC_SOURCES := main.m
+LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
+
+include $(LEVEL)/Makefile.rules


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


[Lldb-commits] [lldb] r333465 - [ObjC] Fix the formatter for NSOrderedSet.

2018-05-29 Thread Davide Italiano via lldb-commits
Author: davide
Date: Tue May 29 15:08:07 2018
New Revision: 333465

URL: http://llvm.org/viewvc/llvm-project?rev=333465&view=rev
Log:
[ObjC] Fix the formatter for NSOrderedSet.

While I'm here, delete some dead code.



Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m
Modified:
lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py?rev=333465&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py
 Tue May 29 15:08:07 2018
@@ -0,0 +1,17 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestOrderedSet(TestBase):
+  mydir = TestBase.compute_mydir(__file__)
+
+  def test_ordered_set(self):
+self.build()
+src_file = "main.m"
+src_file_spec = lldb.SBFileSpec(src_file)
+(target, process, thread, main_breakpoint) = 
lldbutil.run_to_source_breakpoint(self,
+  "break here", src_file_spec, exe_name = "a.out")
+frame = thread.GetSelectedFrame()
+self.expect("expr -d run -- orderedSet", substrs=["3 elements"])
+self.expect("expr -d run -- *orderedSet", substrs=["(int)1", "(int)2", 
"(int)3"])

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m?rev=333465&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m Tue 
May 29 15:08:07 2018
@@ -0,0 +1,8 @@
+#import 
+
+int main() {
+  NSOrderedSet *orderedSet =
+  [NSOrderedSet orderedSetWithArray:@[@1,@2,@3,@1]];
+  NSLog(@"%@",orderedSet);
+  return 0; // break here
+}

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp?rev=333465&r1=333464&r2=333465&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp Tue May 29 15:08:07 2018
@@ -269,7 +269,8 @@ bool lldb_private::formatters::NSSetSumm
   if (!class_name || !*class_name)
 return false;
 
-  if (!strcmp(class_name, "__NSSetI")) {
+  if (!strcmp(class_name, "__NSSetI") ||
+  !strcmp(class_name, "__NSOrderedSetI")) {
 Status error;
 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
   ptr_size, 0, error);
@@ -289,32 +290,7 @@ bool lldb_private::formatters::NSSetSumm
 }
 if (error.Fail())
   return false;
-  }
-  /*else if (!strcmp(class_name,"__NSCFSet"))
-   {
-   Status error;
-   value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit ?
-   20 : 12), 4, 0, error);
-   if (error.Fail())
-   return false;
-   if (is_64bit)
-   value &= ~0x1fffUL;
-   }
-   else if (!strcmp(class_name,"NSCountedSet"))
-   {
-   Status error;
-   value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
-   ptr_size, 0, error);
-   if (error.Fail())
-   return false;
-   value = process_sp->ReadUnsignedIntegerFromMemory(value + (is_64bit ? 20 :
-   12), 4, 0, error);
-   if (error.Fail())
-   return false;
-   if (is_64bit)
-   value &= ~0x1fffUL;
-   }*/
-  else {
+  } else {
 auto &map(NSSet_Additionals::GetAdditionalSummaries());
 auto iter = map.find(class_name_cs), end = map.end();
 if (iter != end)
@@ -371,7 +347,8 @@ lldb_private::formatters::NSSetSynthetic
   if (!class_name || !*class_name)
 return nullptr;
 
-  if (!strcmp(class_name, "__NSSetI")) {
+  if (!strcmp(class_name, "__NSSetI") ||
+  !strcmp(class_name, "__NSOrderedSetI")) {
 return (new NSSetISyntheticFrontEnd(valobj_sp));
   } else if (!strcmp(class_name, "__NSSetM")) {
 AppleObjCRuntime *apple_runtime =


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


[Lldb-commits] [PATCH] D47495: Support relative paths with less than two components in DBGSourcePathRemapping

2018-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D47495



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


[Lldb-commits] [PATCH] D47495: Support relative paths with less than two components in DBGSourcePathRemapping

2018-05-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 148986.
JDevlieghere edited the summary of this revision.
JDevlieghere added a comment.

- Address Greg's feedback


https://reviews.llvm.org/D47495

Files:
  source/Utility/FileSpec.cpp


Index: source/Utility/FileSpec.cpp
===
--- source/Utility/FileSpec.cpp
+++ source/Utility/FileSpec.cpp
@@ -793,6 +793,8 @@
 SetFile("", resolve);
 return;
   }
+  if (*this == FileSpec(".", false))
+return;
   if (m_directory.IsEmpty()) {
 SetFile("", resolve);
 return;


Index: source/Utility/FileSpec.cpp
===
--- source/Utility/FileSpec.cpp
+++ source/Utility/FileSpec.cpp
@@ -793,6 +793,8 @@
 SetFile("", resolve);
 return;
   }
+  if (*this == FileSpec(".", false))
+return;
   if (m_directory.IsEmpty()) {
 SetFile("", resolve);
 return;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D47495: Support relative paths with less than two components in DBGSourcePathRemapping

2018-05-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: include/lldb/Utility/FileSpec.h:535
 
-  void RemoveLastPathComponent();
+  void RemoveLastPathComponent(bool keep_dot = false);
 

clayborg wrote:
> Why add this? If the path is just "." to begin with, there is nothing to do. 
> I would vote to not add this argument since we don't need it. Add it back if 
> we ever do.
The reason I opted for a flag rather than changing the behavior is that other 
(llvm & foundation) implementation of similar functions behave the same as the 
current implementation. However I think an argument can be made for this as 
well, so I'm happy to change it :-) 


https://reviews.llvm.org/D47495



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


[Lldb-commits] [PATCH] D47495: Support relative paths with less than two components in DBGSourcePathRemapping

2018-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Utility/FileSpec.cpp:821
 }
+
 //--

revert whitespace change.


https://reviews.llvm.org/D47495



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


[Lldb-commits] [PATCH] D47495: Support relative paths with less than two components in DBGSourcePathRemapping

2018-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Remove the argument since we don't need it. Just assume we keep ".".




Comment at: include/lldb/Utility/FileSpec.h:535
 
-  void RemoveLastPathComponent();
+  void RemoveLastPathComponent(bool keep_dot = false);
 

Why add this? If the path is just "." to begin with, there is nothing to do. I 
would vote to not add this argument since we don't need it. Add it back if we 
ever do.



Comment at: source/Host/macosx/Symbols.cpp:412-415
+  build_path.RemoveLastPathComponent(true);
+  build_path.RemoveLastPathComponent(true);
+  source_path.RemoveLastPathComponent(true);
+  source_path.RemoveLastPathComponent(true);

revert



Comment at: source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp:263-266
+  build_path.RemoveLastPathComponent(true);
+  build_path.RemoveLastPathComponent(true);
+  source_path.RemoveLastPathComponent(true);
+  source_path.RemoveLastPathComponent(true);

revert



Comment at: source/Utility/FileSpec.cpp:788
 
-void FileSpec::RemoveLastPathComponent() {
+void FileSpec::RemoveLastPathComponent(bool keep_dot) {
   // CLEANUP: Use StringRef for string handling.

Remove arg.


https://reviews.llvm.org/D47495



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


[Lldb-commits] [PATCH] D47495: Support relative paths with less than two components in DBGSourcePathRemapping

2018-05-29 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

This looks good.  My original change in r311622 to add this "remove the last 
two file path components" should have explicitly said that this is only done 
for DBGVersion == 2 to make it clearer for people reading the code.

At this point the parsing code behaves like:

DBGVersion 1 (or missing DBGVersion) - ignore the DBGSourcePathRemapping 
dictionary
DBGVersion 2 - Use DBGSourcePathRemapping, but chop off two components from 
both source and destination (assumption: the last two components are 
PROJECT-NAME/PROJECT-VERSION-NUMBER)
DBGVersion 3 - Use DBGSourcePathRemapping without any modifications

These interpretations of the DBGSourcePathRemapping / DBGVersion have been a 
little ad-hoc, as we've discovered issues in deployed plists that needed to be 
accommodated by lldb.


https://reviews.llvm.org/D47495



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


[Lldb-commits] [PATCH] D47495: Support relative paths with less than two components in DBGSourcePathRemapping

2018-05-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: jasonmolenda, clayborg, labath.

When reading DBGSourcePathRemapping from a dSYM, we remove the last two path 
components to make the source lookup more general. However, when dealing with a 
relative path that has less than 2 components, we ended up with an invalid 
(empty) FileSpec. The problem is the result of a combination of two thins:

1. How the relative path `.` or `./` is stored: both are considered to be an 
empty directory and just the dot as filename.
2. How removeLastPathComponent works: it makes sense that `/foo.bar` -> `/` and 
 `foo.bar` -> ``.

Because outside this context it doesn't really make sense to change either, 
I've added a flag to `removeLastPathComponent` to obtain the desired behavior.


https://reviews.llvm.org/D47495

Files:
  include/lldb/Utility/FileSpec.h
  source/Host/macosx/Symbols.cpp
  source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
  source/Utility/FileSpec.cpp


Index: source/Utility/FileSpec.cpp
===
--- source/Utility/FileSpec.cpp
+++ source/Utility/FileSpec.cpp
@@ -785,14 +785,16 @@
   return AppendPathComponent(new_path.GetPath(false));
 }
 
-void FileSpec::RemoveLastPathComponent() {
+void FileSpec::RemoveLastPathComponent(bool keep_dot) {
   // CLEANUP: Use StringRef for string handling.
 
   const bool resolve = false;
   if (m_filename.IsEmpty() && m_directory.IsEmpty()) {
 SetFile("", resolve);
 return;
   }
+  if (keep_dot && *this == FileSpec(".", false))
+return;
   if (m_directory.IsEmpty()) {
 SetFile("", resolve);
 return;
@@ -816,6 +818,7 @@
   } else
 SetFile(m_directory.GetCString(), resolve);
 }
+
 //--
 /// Returns true if the filespec represents an implementation source
 /// file (files with a ".c", ".cpp", ".m", ".mm" (many more)
Index: source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
===
--- source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -260,10 +260,10 @@
 if (do_truncate_remapping_names) {
   FileSpec build_path(key.AsCString(), false);
   FileSpec source_path(DBGSourcePath.c_str(), 
false);
-  build_path.RemoveLastPathComponent();
-  build_path.RemoveLastPathComponent();
-  source_path.RemoveLastPathComponent();
-  source_path.RemoveLastPathComponent();
+  build_path.RemoveLastPathComponent(true);
+  build_path.RemoveLastPathComponent(true);
+  source_path.RemoveLastPathComponent(true);
+  source_path.RemoveLastPathComponent(true);
   module_sp->GetSourceMappingList().Append(
   
ConstString(build_path.GetPath().c_str()),
   
ConstString(source_path.GetPath().c_str()), true);
Index: source/Host/macosx/Symbols.cpp
===
--- source/Host/macosx/Symbols.cpp
+++ source/Host/macosx/Symbols.cpp
@@ -409,10 +409,10 @@
 if (do_truncate_remapping_names) {
   FileSpec build_path(DBGBuildSourcePath.c_str(), false);
   FileSpec source_path(DBGSourcePath.c_str(), false);
-  build_path.RemoveLastPathComponent();
-  build_path.RemoveLastPathComponent();
-  source_path.RemoveLastPathComponent();
-  source_path.RemoveLastPathComponent();
+  build_path.RemoveLastPathComponent(true);
+  build_path.RemoveLastPathComponent(true);
+  source_path.RemoveLastPathComponent(true);
+  source_path.RemoveLastPathComponent(true);
   module_spec.GetSourceMappingList().Append(
 ConstString(build_path.GetPath().c_str()),
 ConstString(source_path.GetPath().c_str()), true);
Index: include/lldb/Utility/FileSpec.h
===
--- include/lldb/Utility/FileSpec.h
+++ include/lldb/Utility/FileSpec.h
@@ -532,7 +532,7 @@
   void AppendPathComponent(llvm::StringRef component);
   void AppendPathComponent(const FileSpec &new_path);
 
-  void RemoveLastPathComponent();
+  void RemoveLastPathComponent(bool keep_dot = false);
 
   ConstString GetLastPathComponent() const;
 


Index: source/Utility/FileSpec.cpp
===
--- source/Utility/FileSpec.cpp
+++ source/Utility/FileSpec.cpp
@@ -785,14 +785,16 @@
   return AppendPathCompo

[Lldb-commits] [PATCH] D47492: DWARFUnit::m_die_array swap()->shrink_to_fit()

2018-05-29 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil created this revision.
jankratochvil added a reviewer: clayborg.
Herald added a subscriber: JDevlieghere.

https://reviews.llvm.org/rL145086 introduced `m_die_array.shrink_to_fit()` 
implemented by `exact_size_die_array.swap`, it was before LLVM became written 
in C++11.

That is fine to use `shrink_to_fit()` now, right? Although I see no real 
performance gain by a simple `time` test.


https://reviews.llvm.org/D47492

Files:
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp


Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -180,15 +180,7 @@
 m_first_die = m_die_array.front();
   }
 
-  // Since std::vector objects will double their size, we really need to make a
-  // new array with the perfect size so we don't end up wasting space. So here
-  // we copy and swap to make sure we don't have any extra memory taken up.
-
-  if (m_die_array.size() < m_die_array.capacity()) {
-DWARFDebugInfoEntry::collection exact_size_die_array(m_die_array.begin(),
- m_die_array.end());
-exact_size_die_array.swap(m_die_array);
-  }
+  m_die_array.shrink_to_fit();
 
   ExtractDIEsEndCheck(offset);
 


Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -180,15 +180,7 @@
 m_first_die = m_die_array.front();
   }
 
-  // Since std::vector objects will double their size, we really need to make a
-  // new array with the perfect size so we don't end up wasting space. So here
-  // we copy and swap to make sure we don't have any extra memory taken up.
-
-  if (m_die_array.size() < m_die_array.capacity()) {
-DWARFDebugInfoEntry::collection exact_size_die_array(m_die_array.begin(),
- m_die_array.end());
-exact_size_die_array.swap(m_die_array);
-  }
+  m_die_array.shrink_to_fit();
 
   ExtractDIEsEndCheck(offset);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333452 - Remove unused DWARFUnit::HasDIEsParsed()

2018-05-29 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue May 29 12:14:46 2018
New Revision: 333452

URL: http://llvm.org/viewvc/llvm-project?rev=333452&view=rev
Log:
Remove unused DWARFUnit::HasDIEsParsed()

It was not implemented correctly after https://reviews.llvm.org/D46810 but then
it has not been used anywhere anyway.

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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333452&r1=333451&r2=333452&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue May 29 
12:14:46 2018
@@ -449,8 +449,6 @@ DWARFFormValue::FixedFormSizes DWARFUnit
 
 void DWARFUnit::SetBaseAddress(dw_addr_t base_addr) { m_base_addr = base_addr; 
}
 
-bool DWARFUnit::HasDIEsParsed() const { return m_die_array.size() > 1; }
-
 //--
 // Compare function DWARFDebugAranges::Range structures
 //--

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h?rev=333452&r1=333451&r2=333452&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Tue May 29 12:14:46 
2018
@@ -118,8 +118,6 @@ public:
 
   DWARFDIE DIE() { return DWARFDIE(this, DIEPtr()); }
 
-  bool HasDIEsParsed() const;
-
   DWARFDIE GetDIE(dw_offset_t die_offset);
 
   static uint8_t GetAddressByteSize(const DWARFUnit *cu);


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


[Lldb-commits] [PATCH] D46810: 3/3: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

2018-05-29 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil marked an inline comment as done.
jankratochvil added inline comments.



Comment at: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:208
+void DWARFUnit::ExtractDIEsEndCheck(lldb::offset_t offset) const {
+  lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
+

xiaobai wrote:
> This function introduces a warning because `next_cu_offset` is never used 
> within this function. Did you intend to use it in the if conditional below? 
> It looks like you call `GetNextCompileUnitOffset` there instead of using 
> `next_cu_offset`.
Fixed now in rL333449, sorry. Yes, you are right, it remained there from 
refactorizations.

GDB is using `-Werror` so I was not used to watch for compiler warnings.



Repository:
  rL LLVM

https://reviews.llvm.org/D46810



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


[Lldb-commits] [lldb] r333449 - Fix compiler unused variable warning in DWARFUnit

2018-05-29 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue May 29 11:53:25 2018
New Revision: 333449

URL: http://llvm.org/viewvc/llvm-project?rev=333449&view=rev
Log:
Fix compiler unused variable warning in DWARFUnit

Alex Langford has reported it from: https://reviews.llvm.org/D46810

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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333449&r1=333448&r2=333449&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue May 29 
11:53:25 2018
@@ -205,8 +205,6 @@ bool DWARFUnit::ExtractDIEsIfNeeded() {
 // Final checks for both ExtractUnitDIEIfNeeded() and ExtractDIEsIfNeeded().
 //--
 void DWARFUnit::ExtractDIEsEndCheck(lldb::offset_t offset) const {
-  lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
-
   // Give a little bit of info if we encounter corrupt DWARF (our offset should
   // always terminate at or before the start of the next compilation unit
   // header).


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


[Lldb-commits] [PATCH] D46810: 3/3: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

2018-05-29 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added inline comments.



Comment at: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:208
+void DWARFUnit::ExtractDIEsEndCheck(lldb::offset_t offset) const {
+  lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
+

This function introduces a warning because `next_cu_offset` is never used 
within this function. Did you intend to use it in the if conditional below? It 
looks like you call `GetNextCompileUnitOffset` there instead of using 
`next_cu_offset`.


Repository:
  rL LLVM

https://reviews.llvm.org/D46810



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


[Lldb-commits] [PATCH] D47278: Remove lldb-private headers when building LLDB.framework with CMake

2018-05-29 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333444: Remove lldb-private headers when building 
LLDB.framework with CMake (authored by xiaobai, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D47278

Files:
  lldb/trunk/source/API/CMakeLists.txt


Index: lldb/trunk/source/API/CMakeLists.txt
===
--- lldb/trunk/source/API/CMakeLists.txt
+++ lldb/trunk/source/API/CMakeLists.txt
@@ -162,8 +162,7 @@
 endif()
 
 if(LLDB_BUILD_FRAMEWORK)
-  file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h
-  ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
+  file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
   file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
   file(GLOB root_private_headers 
${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
   list(REMOVE_ITEM root_public_headers ${root_private_headers})


Index: lldb/trunk/source/API/CMakeLists.txt
===
--- lldb/trunk/source/API/CMakeLists.txt
+++ lldb/trunk/source/API/CMakeLists.txt
@@ -162,8 +162,7 @@
 endif()
 
 if(LLDB_BUILD_FRAMEWORK)
-  file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h
-  ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
+  file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
   file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
   file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
   list(REMOVE_ITEM root_public_headers ${root_private_headers})
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333444 - Remove lldb-private headers when building LLDB.framework with CMake

2018-05-29 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue May 29 11:09:09 2018
New Revision: 333444

URL: http://llvm.org/viewvc/llvm-project?rev=333444&view=rev
Log:
Remove lldb-private headers when building LLDB.framework with CMake

Summary:
Generating LLDB.framework when building with CMake+Ninja will copy the
lldb-private headers because public_headers contains them, even though we try
to make sure they don't get copied by removing root_private_headers from
root_public_headers.

This patch also removes SystemInitializerFull.h from the LLDB.framework headers 
when building with CMake.

Reviewers: compnerd, sas, labath, beanz, zturner

Reviewed By: labath

Subscribers: clayborg, mgorny, lldb-commits

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

Modified:
lldb/trunk/source/API/CMakeLists.txt

Modified: lldb/trunk/source/API/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=333444&r1=333443&r2=333444&view=diff
==
--- lldb/trunk/source/API/CMakeLists.txt (original)
+++ lldb/trunk/source/API/CMakeLists.txt Tue May 29 11:09:09 2018
@@ -162,8 +162,7 @@ if (LLDB_WRAP_PYTHON)
 endif()
 
 if(LLDB_BUILD_FRAMEWORK)
-  file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h
-  ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
+  file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
   file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
   file(GLOB root_private_headers 
${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
   list(REMOVE_ITEM root_public_headers ${root_private_headers})


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


[Lldb-commits] [PATCH] D47470: AppleDWARFIndex: Get function method-ness directly from debug info

2018-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

So my previous code suggestion might not work as we would want to recurse 
through the specification or abstract origin chain.


https://reviews.llvm.org/D47470



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


[Lldb-commits] [PATCH] D47470: AppleDWARFIndex: Get function method-ness directly from debug info

2018-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp:222
+return true;
+  return GetReferencedDIE(DW_AT_specification)
+  .GetParent()

labath wrote:
> clayborg wrote:
> > I can never remember when a DW_AT_abstract_origin might be used. Might be 
> > nice to have a DWARFDIE method:
> > 
> > ```
> > DWARFDIE DWARFDIE::GetAbstractOriginOrSpecification();
> > ```
> > this would return either the the DW_AT_specification or the 
> > DW_AT_abstract_origin. If we go that route the this coce would become:
> > 
> > ```
> > GetAbstractOriginOrSpecification().GetParent().IsStructUnionOrClass();
> > ```
> > 
> How would this method know which DIE to return? In case of inlined methods 
> you can have a chain of DIEs:
> `DIE1 --- DW_AT_abstract_origin --> DIE2 --- DW_AT_specification --> DIE3`
> Each of these dies will have a different parent.
> 
> The current function will check for the parent of DIE1 and DIE3 (this is what 
> the manual index does) though to be fully correct maybe we should check all 
> three of them (?) Or do you think checking the last DIE in that list should 
> be always enough? That would seem to be the case for the dwarf I've seen, but 
> I'm not sure if that is always correct..
Yeah, unfortunately I can't elaborate too much without seeing a bad example. If 
anything in the chain has a parent that is a struct/union or class might be 
enough, so we could ask each DIE in the specification or abstract origin chain 
if its parent is a struct/union/class and just return true if so?


https://reviews.llvm.org/D47470



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


[Lldb-commits] [PATCH] D46810: 3/3: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

2018-05-29 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
jankratochvil marked an inline comment as done.
Closed by commit rL333437: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer 
(authored by jankratochvil, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D46810?vs=148801&id=148938#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D46810

Files:
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.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

Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -39,7 +39,8 @@
 public:
   virtual ~DWARFUnit();
 
-  size_t ExtractDIEsIfNeeded(bool cu_die_only);
+  void ExtractUnitDIEIfNeeded();
+  bool ExtractDIEsIfNeeded();
   DWARFDIE LookupAddress(const dw_addr_t address);
   size_t AppendDIEsWithTag(const dw_tag_t tag,
DWARFDIECollection &matching_dies,
@@ -160,7 +161,7 @@
   dw_offset_t GetBaseObjOffset() const;
 
   die_iterator_range dies() {
-ExtractDIEsIfNeeded(false);
+ExtractDIEsIfNeeded();
 return die_iterator_range(m_die_array.begin(), m_die_array.end());
   }
 
@@ -173,6 +174,10 @@
   void *m_user_data = nullptr;
   // The compile unit debug information entry item
   DWARFDebugInfoEntry::collection m_die_array;
+  // GetUnitDIEPtrOnly() needs to return pointer to the first DIE.
+  // But the first element of m_die_array after ExtractUnitDIEIfNeeded()
+  // would possibly move in memory after later ExtractDIEsIfNeeded().
+  DWARFDebugInfoEntry m_first_die;
   // A table similar to the .debug_aranges table, but this one points to the
   // exact DW_TAG_subprogram DIEs
   std::unique_ptr m_func_aranges_ap;
@@ -202,21 +207,22 @@
   // Get the DWARF unit DWARF debug informration entry. Parse the single DIE
   // if needed.
   const DWARFDebugInfoEntry *GetUnitDIEPtrOnly() {
-ExtractDIEsIfNeeded(true);
-if (m_die_array.empty())
+ExtractUnitDIEIfNeeded();
+if (!m_first_die)
   return NULL;
-return &m_die_array[0];
+return &m_first_die;
   }
 
   // Get all DWARF debug informration entries. Parse all DIEs if needed.
   const DWARFDebugInfoEntry *DIEPtr() {
-ExtractDIEsIfNeeded(false);
+ExtractDIEsIfNeeded();
 if (m_die_array.empty())
   return NULL;
 return &m_die_array[0];
   }
 
-  void AddUnitDIE(DWARFDebugInfoEntry &die);
+  void AddUnitDIE(const DWARFDebugInfoEntry &cu_die);
+  void ExtractDIEsEndCheck(lldb::offset_t offset) const;
 
   DISALLOW_COPY_AND_ASSIGN(DWARFUnit);
 };
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -1825,3 +1825,15 @@
 die_ref.HasChildren() ? " *" : "");
   }
 }
+
+bool DWARFDebugInfoEntry::operator==(const DWARFDebugInfoEntry &rhs) const {
+  return m_offset == rhs.m_offset && m_parent_idx == rhs.m_parent_idx &&
+ m_sibling_idx == rhs.m_sibling_idx &&
+ m_empty_children == rhs.m_empty_children &&
+ m_abbr_idx == rhs.m_abbr_idx && m_has_children == rhs.m_has_children &&
+ m_tag == rhs.m_tag;
+}
+
+bool DWARFDebugInfoEntry::operator!=(const DWARFDebugInfoEntry &rhs) const {
+  return !(*this == rhs);
+}
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -60,6 +60,10 @@
 m_empty_children(false), m_abbr_idx(0), m_has_children(false),
 m_tag(0) {}
 
+  explicit operator bool() const { return m_offset != DW_INVALID_OFFSET; }
+  bool operator==(const DWARFDebugInfoEntry &rhs) const;
+  bool operator!=(const DWARFDebugInfoEntry &rhs) const;
+
   void BuildAddressRangeTable(SymbolFileDWARF *dwarf2Data,
   const DWARFUnit *cu,
   DWARFDebugAranges *debug_aranges) const;
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -14,6 +14,7 @@
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/LLDBAssert.h"
 #include 

[Lldb-commits] [lldb] r333437 - Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

2018-05-29 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue May 29 10:17:46 2018
New Revision: 333437

URL: http://llvm.org/viewvc/llvm-project?rev=333437&view=rev
Log:
Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

GetUnitDIEPtrOnly() needs to return pointer to the first DIE.
But the first element of m_die_array after ExtractDIEsIfNeeded(true)
may move in memory after later ExtractDIEsIfNeeded(false).

DWARFDebugInfoEntry::collection m_die_array is std::vector,
its data may move during its expansion.

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

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=333437&r1=333436&r2=333437&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Tue May 
29 10:17:46 2018
@@ -1825,3 +1825,15 @@ void DWARFDebugInfoEntry::DumpDIECollect
 die_ref.HasChildren() ? " *" : "");
   }
 }
+
+bool DWARFDebugInfoEntry::operator==(const DWARFDebugInfoEntry &rhs) const {
+  return m_offset == rhs.m_offset && m_parent_idx == rhs.m_parent_idx &&
+ m_sibling_idx == rhs.m_sibling_idx &&
+ m_empty_children == rhs.m_empty_children &&
+ m_abbr_idx == rhs.m_abbr_idx && m_has_children == rhs.m_has_children 
&&
+ m_tag == rhs.m_tag;
+}
+
+bool DWARFDebugInfoEntry::operator!=(const DWARFDebugInfoEntry &rhs) const {
+  return !(*this == rhs);
+}

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=333437&r1=333436&r2=333437&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Tue May 29 
10:17:46 2018
@@ -60,6 +60,10 @@ public:
 m_empty_children(false), m_abbr_idx(0), m_has_children(false),
 m_tag(0) {}
 
+  explicit operator bool() const { return m_offset != DW_INVALID_OFFSET; }
+  bool operator==(const DWARFDebugInfoEntry &rhs) const;
+  bool operator!=(const DWARFDebugInfoEntry &rhs) const;
+
   void BuildAddressRangeTable(SymbolFileDWARF *dwarf2Data,
   const DWARFUnit *cu,
   DWARFDebugAranges *debug_aranges) const;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333437&r1=333436&r2=333437&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue May 29 
10:17:46 2018
@@ -14,6 +14,7 @@
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/Timer.h"
 
@@ -35,19 +36,45 @@ DWARFUnit::DWARFUnit(SymbolFileDWARF *dw
 DWARFUnit::~DWARFUnit() {}
 
 //--
-// ParseCompileUnitDIEsIfNeeded
-//
+// Parses first DIE of a compile unit.
+//--
+void DWARFUnit::ExtractUnitDIEIfNeeded() {
+  if (m_first_die)
+return; // Already parsed
+
+  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+  Timer scoped_timer(
+  func_cat, "%8.8x: DWARFUnit::ExtractUnitDIEIfNeeded()", m_offset);
+
+  // Set the offset to that of the first DIE and calculate the start of the
+  // next compilation unit header.
+  lldb::offset_t offset = GetFirstDIEOffset();
+
+  // We are in our compile unit, parse starting at the offset we were told to
+  // parse
+  const DWARFDataExtractor &data = GetData();
+  DWARFFormValue::FixedFormSizes fixed_form_sizes =
+  DWARFFormValue::GetFixedFormSizesForAddressSize(GetAddressByteSize(),
+  IsDWARF64());
+  if (offset < GetNextCompileUnitOffset() &&
+  m_first_die.FastExtract(data, this, fixed_form_sizes, &offset)) {
+AddUnitDIE(m_first_die);
+return;
+  }
+
+  ExtractDIEsEndCheck(offset);
+}
+
+//--
 // Parses a c

[Lldb-commits] [PATCH] D47470: AppleDWARFIndex: Get function method-ness directly from debug info

2018-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp:222
+return true;
+  return GetReferencedDIE(DW_AT_specification)
+  .GetParent()

clayborg wrote:
> I can never remember when a DW_AT_abstract_origin might be used. Might be 
> nice to have a DWARFDIE method:
> 
> ```
> DWARFDIE DWARFDIE::GetAbstractOriginOrSpecification();
> ```
> this would return either the the DW_AT_specification or the 
> DW_AT_abstract_origin. If we go that route the this coce would become:
> 
> ```
> GetAbstractOriginOrSpecification().GetParent().IsStructUnionOrClass();
> ```
> 
How would this method know which DIE to return? In case of inlined methods you 
can have a chain of DIEs:
`DIE1 --- DW_AT_abstract_origin --> DIE2 --- DW_AT_specification --> DIE3`
Each of these dies will have a different parent.

The current function will check for the parent of DIE1 and DIE3 (this is what 
the manual index does) though to be fully correct maybe we should check all 
three of them (?) Or do you think checking the last DIE in that list should be 
always enough? That would seem to be the case for the dwarf I've seen, but I'm 
not sure if that is always correct..


https://reviews.llvm.org/D47470



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


[Lldb-commits] [lldb] r333432 - [lit] Add support for passing arguments to dotest.py via lit.

2018-05-29 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue May 29 09:49:07 2018
New Revision: 333432

URL: http://llvm.org/viewvc/llvm-project?rev=333432&view=rev
Log:
[lit] Add support for passing arguments to dotest.py via lit.

The lldb test suite is highly configurable. While part of this
configuration takes place at configure/build-time, a common scenario
involves running the test suite several times with different
configuration. For example, we might want to test the current lldb
against inferiors built with different compilers.

This configuration was already possible for lldb-dotest, but was lacking
for the lit counterpart. It is now possible to pass arguments to pass
  arguments like this:

  ./bin/llvm-lit ../llvm/tools/lldb/lit/Suite/ -Ddotest-args="-foo;-bar"

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

Modified: lldb/trunk/lit/Suite/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.site.cfg.in?rev=333432&r1=333431&r2=333432&view=diff
==
--- lldb/trunk/lit/Suite/lit.site.cfg.in (original)
+++ lldb/trunk/lit/Suite/lit.site.cfg.in Tue May 29 09:49:07 2018
@@ -14,6 +14,14 @@ config.python_executable = "@PYTHON_EXEC
 config.dotest_path = "@LLDB_SOURCE_DIR@/test/dotest.py"
 config.dotest_args_str = "@LLDB_DOTEST_ARGS@"
 
+
+# Additional dotest arguments can be passed to lit by providing a
+# semicolon-separates list: --param dotest-args="arg;arg".
+dotest_lit_args_str = lit_config.params.get('dotest-args', None)
+if dotest_lit_args_str:
+config.dotest_args_str += ';'
+config.dotest_args_str += dotest_lit_args_str
+
 # Support substitution of the tools and libs dirs with user parameters. This is
 # used when we can't determine the tool dir at configuration time.
 try:


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


[Lldb-commits] [PATCH] D46810: 3/3: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

2018-05-29 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil marked an inline comment as done.
jankratochvil added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:86
   // Keep a flat array of the DIE for binary lookup by DIE offset
-  if (!cu_die_only) {
+  {
 Log *log(

clayborg wrote:
> Do we need this empty scope? Remove?
There is now enclosed:
```Log *log(LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO | 
DWARF_LOG_LOOKUPS));
```
While lower (currently moved into `DWARFUnit::ExtractDIEsEndCheck()`) there was:
```Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
```
So those two did conflict while being a different variable. I am not sure which 
way is right but I have removed the empty scope as it is no longer required. 
Then also I am not sure the log in `DWARFUnit::ExtractDIEsEndCheck()` should 
not also have `| DWARF_LOG_LOOKUPS` but that would be out of the scope of this 
patch topic.



https://reviews.llvm.org/D46810



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


[Lldb-commits] [PATCH] D46810: 3/3: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

2018-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Only question is if we remove the extra empty scope as noted in inline 
comments. Looks good.




Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:86
   // Keep a flat array of the DIE for binary lookup by DIE offset
-  if (!cu_die_only) {
+  {
 Log *log(

Do we need this empty scope? Remove?


https://reviews.llvm.org/D46810



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


[Lldb-commits] [PATCH] D47415: [lldb, lldb-mi] Re-implement MI -exec-continue command.

2018-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

So nice to get rid of these HandleCommand hacks!


Repository:
  rL LLVM

https://reviews.llvm.org/D47415



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


[Lldb-commits] [PATCH] D47470: AppleDWARFIndex: Get function method-ness directly from debug info

2018-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp:153
+return true;
+  bool looking_for_methods = name_type_mask & eFunctionNameTypeMethod;
+  return looking_for_methods == die.IsMethod();

move up to line 150 and use this variable in the if statement instead of 
repeating "name_type_mask & eFunctionNameTypeMethod" twice?



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp:222
+return true;
+  return GetReferencedDIE(DW_AT_specification)
+  .GetParent()

I can never remember when a DW_AT_abstract_origin might be used. Might be nice 
to have a DWARFDIE method:

```
DWARFDIE DWARFDIE::GetAbstractOriginOrSpecification();
```
this would return either the the DW_AT_specification or the 
DW_AT_abstract_origin. If we go that route the this coce would become:

```
GetAbstractOriginOrSpecification().GetParent().IsStructUnionOrClass();
```



https://reviews.llvm.org/D47470



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


[Lldb-commits] [PATCH] D47470: AppleDWARFIndex: Get function method-ness directly from debug info

2018-05-29 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.

Thanks Pavel, LGTM.


https://reviews.llvm.org/D47470



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


[Lldb-commits] [lldb] r333412 - [test] Fix --framework argument passed to dotest.

2018-05-29 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue May 29 05:30:27 2018
New Revision: 333412

URL: http://llvm.org/viewvc/llvm-project?rev=333412&view=rev
Log:
[test] Fix --framework argument passed to dotest.

The framework argument was broken when I removed the generator
expressions upstream.  I replaced $ with
${LLVM_LIBRARY_OUTPUT_INTDIR}) which is not correct.

rdar://40534649

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=333412&r1=333411&r2=333412&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Tue May 29 05:30:27 2018
@@ -37,6 +37,11 @@ if(APPLE)
   add_definitions(-DLLDB_USE_OS_LOG)
 endif()
 
+if(LLDB_BUILD_FRAMEWORK)
+  set(LLDB_FRAMEWORK_DIR
+${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
+endif()
+
 # add_subdirectory(include)
 add_subdirectory(docs)
 if (NOT LLDB_DISABLE_PYTHON)
@@ -47,8 +52,7 @@ if (NOT LLDB_DISABLE_PYTHON)
   set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts)
   set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
   if(LLDB_BUILD_FRAMEWORK)
-set(LLDB_PYTHON_TARGET_DIR
-  ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
+set(LLDB_PYTHON_TARGET_DIR ${LLDB_FRAMEWORK_DIR})
 set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp)
   else()
 # Don't set -m when building the framework.

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=333412&r1=333411&r2=333412&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Tue May 29 05:30:27 2018
@@ -78,7 +78,7 @@ if(LLDB_CODESIGN_IDENTITY)
 endif()
 
 if(LLDB_BUILD_FRAMEWORK)
-  list(APPEND LLDB_TEST_COMMON_ARGS --framework ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  list(APPEND LLDB_TEST_COMMON_ARGS --framework 
${LLDB_FRAMEWORK_DIR}/LLDB.framework)
 endif()
 
 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")


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


[Lldb-commits] [PATCH] D47470: AppleDWARFIndex: Get function method-ness directly from debug info

2018-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, JDevlieghere.
Herald added a subscriber: aprantl.

When searching for methods only, we need to do extra work to make sure
the functions we get from the apple tables are indeed methods.
Previously we were resolving the DIE into a SymbolContext and then
checked whether the enclosing CompilerDeclContext is a
class (or struct, or union).

This patch changes that to operate on the debug info directly. This
should be:

- simpler
- faster
- more consistent with the ManualDWARFIndex (which does the same check, only at 
indexing time).

What we lose this ways is for the language plugin to have a say in what
it considers to be a "class", but that's probably more flexibility than
we need (and if we really wanted to do that in the future, we could
implement a more direct way to consult the plugin about this).

This also fixes the find-method-local-struct test, which was failing
because we were not able to construct a CompilerDeclContext for a local
struct correctly.

As a drive-by, I rename the DWARFDIE's IsStructClassOrUnion method to
match the name on the CompilerDeclContext class.


https://reviews.llvm.org/D47470

Files:
  lit/SymbolFile/DWARF/find-method-local-struct.cpp
  source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDIE.h
  source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

Index: source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
===
--- source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -292,14 +292,14 @@
   bool is_method = false;
   if (parent) {
 DWARFDIE parent_die(&unit, parent);
-if (parent_die.IsStructClassOrUnion())
+if (parent_die.IsStructUnionOrClass())
   is_method = true;
 else {
   if (specification_die_form.IsValid()) {
 DWARFDIE specification_die =
 unit.GetSymbolFileDWARF()->DebugInfo()->GetDIE(
 DIERef(specification_die_form));
-if (specification_die.GetParent().IsStructClassOrUnion())
+if (specification_die.GetParent().IsStructUnionOrClass())
   is_method = true;
   }
 }
Index: source/Plugins/SymbolFile/DWARF/DWARFDIE.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFDIE.h
+++ source/Plugins/SymbolFile/DWARF/DWARFDIE.h
@@ -19,7 +19,9 @@
   //--
   // Tests
   //--
-  bool IsStructClassOrUnion() const;
+  bool IsStructUnionOrClass() const;
+
+  bool IsMethod() const;
 
   //--
   // Accessors
Index: source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -209,12 +209,21 @@
 return DWARFDIE();
 }
 
-bool DWARFDIE::IsStructClassOrUnion() const {
+bool DWARFDIE::IsStructUnionOrClass() const {
   const dw_tag_t tag = Tag();
   return tag == DW_TAG_class_type || tag == DW_TAG_structure_type ||
  tag == DW_TAG_union_type;
 }
 
+bool DWARFDIE::IsMethod() const {
+  DWARFDIE parent = GetParent();
+  if (parent.IsStructUnionOrClass())
+return true;
+  return GetReferencedDIE(DW_AT_specification)
+  .GetParent()
+  .IsStructUnionOrClass();
+}
+
 DWARFDIE
 DWARFDIE::GetContainingDWOModuleDIE() const {
   if (IsValid()) {
Index: source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
===
--- source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -146,6 +146,14 @@
 m_apple_namespaces_up->FindByName(name.GetStringRef(), offsets);
 }
 
+static bool KeepFunctionDIE(DWARFDIE die, uint32_t name_type_mask) {
+  if (name_type_mask & eFunctionNameTypeMethod &&
+  name_type_mask & eFunctionNameTypeBase)
+return true;
+  bool looking_for_methods = name_type_mask & eFunctionNameTypeMethod;
+  return looking_for_methods == die.IsMethod();
+}
+
 void AppleDWARFIndex::GetFunctions(
 ConstString name, DWARFDebugInfo &info,
 llvm::function_refGetType();
-
-if (type) {
-  CompilerDeclContext decl_ctx =
-  get_decl_context_containing_uid(type->GetID());
-  if (decl_ctx.IsStructUnionOrClass()) {
-if (name_type_mask & eFunctionNameTypeBase) {
-  sc_list.RemoveContextAtIndex(sc_list.GetSize() - 1);
-  keep_die = false;
-   

[Lldb-commits] [lldb] r333401 - XFAIL TestMachCore for windows hosts

2018-05-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue May 29 02:22:58 2018
New Revision: 333401

URL: http://llvm.org/viewvc/llvm-project?rev=333401&view=rev
Log:
XFAIL TestMachCore for windows hosts

It's been failing since I enabled the test for non-darwin targets. I
made it reference the same bug as the linux core, as it's likely that
the root cause is the same.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py?rev=333401&r1=333400&r2=333401&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
 Tue May 29 02:22:58 2018
@@ -26,6 +26,7 @@ class MachCoreTestCase(TestBase):
 lldb.DBG.SetSelectedPlatform(self._initial_platform)
 super(MachCoreTestCase, self).tearDown()
 
+@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 def test_selected_thread(self):
 """Test that the right thread is selected after a core is loaded."""
 # Create core form YAML.


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


[Lldb-commits] [PATCH] D47420: Remove Linux-specific includes for posix/FileSystem.cpp

2018-05-29 Thread Bruce Mitchener via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333400: Remove Linux-specific includes for 
posix/FileSystem.cpp (authored by brucem, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D47420

Files:
  lldb/trunk/source/Host/posix/FileSystem.cpp


Index: lldb/trunk/source/Host/posix/FileSystem.cpp
===
--- lldb/trunk/source/Host/posix/FileSystem.cpp
+++ lldb/trunk/source/Host/posix/FileSystem.cpp
@@ -16,11 +16,6 @@
 #include 
 #include 
 #include 
-#ifdef __linux__
-#include 
-#include 
-#include 
-#endif
 #if defined(__NetBSD__)
 #include 
 #endif


Index: lldb/trunk/source/Host/posix/FileSystem.cpp
===
--- lldb/trunk/source/Host/posix/FileSystem.cpp
+++ lldb/trunk/source/Host/posix/FileSystem.cpp
@@ -16,11 +16,6 @@
 #include 
 #include 
 #include 
-#ifdef __linux__
-#include 
-#include 
-#include 
-#endif
 #if defined(__NetBSD__)
 #include 
 #endif
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333400 - Remove Linux-specific includes for posix/FileSystem.cpp

2018-05-29 Thread Bruce Mitchener via lldb-commits
Author: brucem
Date: Tue May 29 02:14:40 2018
New Revision: 333400

URL: http://llvm.org/viewvc/llvm-project?rev=333400&view=rev
Log:
Remove Linux-specific includes for posix/FileSystem.cpp

Summary:
This improves the process of cross-compiling from macOS to Linux
since these files aren't used / needed at all.

Reviewers: clayborg, labath

Subscribers: lldb-commits, krytarowski

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

Modified:
lldb/trunk/source/Host/posix/FileSystem.cpp

Modified: lldb/trunk/source/Host/posix/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/FileSystem.cpp?rev=333400&r1=99&r2=333400&view=diff
==
--- lldb/trunk/source/Host/posix/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/posix/FileSystem.cpp Tue May 29 02:14:40 2018
@@ -16,11 +16,6 @@
 #include 
 #include 
 #include 
-#ifdef __linux__
-#include 
-#include 
-#include 
-#endif
 #if defined(__NetBSD__)
 #include 
 #endif


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


[Lldb-commits] [PATCH] D47421: Typo fixes.

2018-05-29 Thread Bruce Mitchener via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL99: Typo fixes. (authored by brucem, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D47421

Files:
  lldb/trunk/include/lldb/Breakpoint/BreakpointID.h
  lldb/trunk/include/lldb/Core/Address.h
  lldb/trunk/include/lldb/Core/Broadcaster.h
  lldb/trunk/include/lldb/Target/ExecutionContext.h
  lldb/trunk/include/lldb/Target/Process.h
  lldb/trunk/include/lldb/Utility/ArchSpec.h
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
  
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/bitfield_ivars/TestBitfieldIvars.py
  lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/trunk/source/Core/Communication.cpp
  lldb/trunk/source/Core/ValueObjectVariable.cpp
  lldb/trunk/source/Expression/DWARFExpression.cpp
  lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
  lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h
  lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.h
  lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h
  lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
  
lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
  lldb/trunk/source/Target/TargetList.cpp
  lldb/trunk/source/Utility/Status.cpp
  lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
  lldb/trunk/tools/debugserver/source/RNBServices.cpp
  lldb/trunk/tools/lldb-mi/MICmnResources.cpp
  lldb/trunk/tools/lldb-mi/MIReadMe.txt
  lldb/trunk/www/remote.html
  lldb/trunk/www/tutorial.html

Index: lldb/trunk/www/tutorial.html
===
--- lldb/trunk/www/tutorial.html
+++ lldb/trunk/www/tutorial.html
@@ -94,7 +94,7 @@
 
 
You can use the --name option multiple times to make a breakpoint on a set of functions as well.  This is convenient
-  since it allows you to set commmon conditions or commands without having to specify them multiple times:
+  since it allows you to set common conditions or commands without having to specify them multiple times:
 
 
 (lldb) breakpoint set --name foo --name bar
Index: lldb/trunk/www/remote.html
===
--- lldb/trunk/www/remote.html
+++ lldb/trunk/www/remote.html
@@ -133,7 +133,7 @@
   "remote-". For example, to debug a remote Linux application:
 
 
-  (lldb) patform select remote-linux
+  (lldb) platform select remote-linux
 
 
 
@@ -215,7 +215,7 @@
 Install and run by specifying a remote install path
 
   If you want the "a.out" executable to be installed into
-  "/bin/a.out" instead of the platorm's current working directory,
+  "/bin/a.out" instead of the platform's current working directory,
   we can set the platform file specification using python:
 
 
@@ -225,7 +225,7 @@
 
 
   Now when you run your program, the program will be uploaded to
-  "/bin/a.out" instead of the the platform current working directory.
+  "/bin/a.out" instead of the platform current working directory.
   Only the main executable is uploaded to the remote system by
   default when launching the application. If you have shared
   libraries that should also be uploaded, then you can add the
Index: lldb/trunk/include/lldb/Utility/ArchSpec.h
===
--- lldb/trunk/include/lldb/Utility/ArchSpec.h
+++ lldb/trunk/include/lldb/Utility/ArchSpec.h
@@ -293,7 +293,7 @@
   //---

[Lldb-commits] [lldb] r333399 - Typo fixes.

2018-05-29 Thread Bruce Mitchener via lldb-commits
Author: brucem
Date: Tue May 29 02:10:46 2018
New Revision: 99

URL: http://llvm.org/viewvc/llvm-project?rev=99&view=rev
Log:
Typo fixes.

Reviewers: javed.absar

Subscribers: ki.stfu, JDevlieghere, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Breakpoint/BreakpointID.h
lldb/trunk/include/lldb/Core/Address.h
lldb/trunk/include/lldb/Core/Broadcaster.h
lldb/trunk/include/lldb/Target/ExecutionContext.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Utility/ArchSpec.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/bitfield_ivars/TestBitfieldIvars.py
lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/trunk/source/Core/Communication.cpp
lldb/trunk/source/Core/ValueObjectVariable.cpp
lldb/trunk/source/Expression/DWARFExpression.cpp
lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.h
lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp

lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
lldb/trunk/source/Target/TargetList.cpp
lldb/trunk/source/Utility/Status.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
lldb/trunk/tools/debugserver/source/RNBServices.cpp
lldb/trunk/tools/lldb-mi/MICmnResources.cpp
lldb/trunk/tools/lldb-mi/MIReadMe.txt
lldb/trunk/www/remote.html
lldb/trunk/www/tutorial.html

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointID.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointID.h?rev=99&r1=98&r2=99&view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointID.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointID.h Tue May 29 02:10:46 2018
@@ -57,7 +57,7 @@ public:
 
   //--
   /// Takes an input string containing the description of a breakpoint or
-  /// breakpoint and location and returns the a BreakpointID filled out with
+  /// breakpoint and location and returns a BreakpointID filled out with
   /// the proper id and location.
   ///
   /// @param[in] input

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=99&r1=98&r2=99&view=diff
==
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Tue May 29 02:10:46 2018
@@ -370,7 +370,7 @@ public:
   /// Check if the object state is valid.
   ///
   /// A valid Address object contains either a section pointer and
-  /// and offset (for section offset based addresses), or just a valid offset
+  /// offset (for section offset based addresses), or just a valid offset
   /// (for absolute addresses that have no section).
   ///
   /// @return
@@ -390,7 +390,7 @@ public:
   //--
   /// Resolve a file virtual address using a section list.
   ///
-  /// Given a list of sections, attempt to resolve \a addr as a an offset into
+  /// Given a list of sections, attempt to resolve \a addr as an offset into
   /// one of the file sections.
   ///
   /// @return

Modified: lldb/trunk/include/lldb/Core/Broadcaster.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Broadcaster.h?rev=99&r1=98&r2=99&view=diff
==
--- lldb/

[Lldb-commits] [PATCH] D47420: Remove Linux-specific includes for posix/FileSystem.cpp

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

I bet this stopped being necessary when most of the filesystem code was moved 
into llvm.


https://reviews.llvm.org/D47420



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


[Lldb-commits] [PATCH] D47368: ManualDWARFIndex: Treat DW_TAG_subprogram and DW_TAG_inlined_subroutine the same way

2018-05-29 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL98: ManualDWARFIndex: Treat DW_TAG_subprogram and 
DW_TAG_inlined_subroutine theā€¦ (authored by labath, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D47368

Files:
  lldb/trunk/lit/SymbolFile/DWARF/find-inline-method.s
  lldb/trunk/lit/SymbolFile/DWARF/lit.local.cfg
  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
@@ -256,6 +256,7 @@
 }
 
 switch (tag) {
+case DW_TAG_inlined_subroutine:
 case DW_TAG_subprogram:
   if (has_address) {
 if (name) {
@@ -330,28 +331,6 @@
   }
   break;
 
-case DW_TAG_inlined_subroutine:
-  if (has_address) {
-if (name)
-  set.function_basenames.Insert(ConstString(name),
-DIERef(cu_offset, die.GetOffset()));
-if (mangled_cstr) {
-  // Make sure our mangled name isn't the same string table entry as
-  // our name. If it starts with '_', then it is ok, else compare the
-  // string to make sure it isn't the same and we don't end up with
-  // duplicate entries
-  if (name && name != mangled_cstr &&
-  ((mangled_cstr[0] == '_') ||
-   (::strcmp(name, mangled_cstr) != 0))) {
-set.function_fullnames.Insert(ConstString(mangled_cstr),
-  DIERef(cu_offset, die.GetOffset()));
-  }
-} else
-  set.function_fullnames.Insert(ConstString(name),
-DIERef(cu_offset, die.GetOffset()));
-  }
-  break;
-
 case DW_TAG_array_type:
 case DW_TAG_base_type:
 case DW_TAG_class_type:
Index: lldb/trunk/lit/SymbolFile/DWARF/find-inline-method.s
===
--- lldb/trunk/lit/SymbolFile/DWARF/find-inline-method.s
+++ lldb/trunk/lit/SymbolFile/DWARF/find-inline-method.s
@@ -0,0 +1,152 @@
+# REQUIRES: lld
+
+# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: lldb-test symbols --find=function --name=inl --function-flags=method %t \
+# RUN:   | FileCheck %s
+
+# CHECK: Function: {{.*}} mangled = "_Z8externali"
+# CHECK: Blocks: {{.*}} range = [0x00201000-0x00201002)
+# CHECK-NEXT: range = [0x00201000-0x00201002), name = "inl", mangled = _ZN1S3inlEi
+
+
+# Generated via:
+#   clang -O2 -g -S
+
+# from file:
+#   int forward(int);
+#   struct S {
+# static int inl(int a) { return forward(a); }
+#   };
+#   int external(int a) { return S::inl(a); }
+
+# and then simplified.
+
+	.text
+_Z8externali:
+.Lfunc_begin0:
+	jmp	_Z7forwardi
+.Lfunc_end0:
+
+.globl _start
+_start:
+_Z7forwardi:
+ret
+
+	.section	.debug_str,"MS",@progbits,1
+.Linfo_string0:
+	.asciz	"clang version 7.0.0 (trunk 332830) (llvm/trunk 332835) with manual modifications"
+.Linfo_string3:
+	.asciz	"_ZN1S3inlEi"
+.Linfo_string4:
+	.asciz	"inl"
+.Linfo_string6:
+	.asciz	"S"
+.Linfo_string8:
+	.asciz	"_Z8externali"
+.Linfo_string9:
+	.asciz	"external"
+	.section	.debug_abbrev,"",@progbits
+	.byte	1   # Abbreviation Code
+	.byte	17  # DW_TAG_compile_unit
+	.byte	1   # DW_CHILDREN_yes
+	.byte	37  # DW_AT_producer
+	.byte	14  # DW_FORM_strp
+	.byte	19  # DW_AT_language
+	.byte	5   # DW_FORM_data2
+	.byte	17  # DW_AT_low_pc
+	.byte	1   # DW_FORM_addr
+	.byte	18  # DW_AT_high_pc
+	.byte	6   # DW_FORM_data4
+	.byte	0   # EOM(1)
+	.byte	0   # EOM(2)
+	.byte	2   # Abbreviation Code
+	.byte	19  # DW_TAG_structure_type
+	.byte	1   # DW_CHILDREN_yes
+	.byte	3   # DW_AT_name
+	.byte	14  # DW_FORM_strp
+	.byte	11  # DW_AT_byte_size
+	.byte	11  # DW_FORM_data1
+	.byte	0   # EOM(1)
+	.byte	0   # EOM(2)
+	.byte	3   # Abbreviation Code
+	.byte	46  # DW_TAG_subprogram
+	.byte	0   # DW_CHILDREN_no
+	.byte	110 # DW_AT_linkage_name
+	.byte	14  # DW_FORM_strp
+	.byte	3   # DW_AT_name
+	.byte	14  # DW_FORM_strp
+	.byte	0   # EOM(1)
+	.byte	0   # EOM(2)
+	.byte	6   # Abbreviation Code
+	.byte	4

[Lldb-commits] [lldb] r333398 - ManualDWARFIndex: Treat DW_TAG_subprogram and DW_TAG_inlined_subroutine the same way

2018-05-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue May 29 01:16:22 2018
New Revision: 98

URL: http://llvm.org/viewvc/llvm-project?rev=98&view=rev
Log:
ManualDWARFIndex: Treat DW_TAG_subprogram and DW_TAG_inlined_subroutine the 
same way

Summary:
We were treating subprograms and inlined subroutines differently when
building the index. The difference was in which indexes were individual
tags inserted (subprograms went to all indexes, where as inlined
subroutines only into the basename and full name indexes).

This seems like an error, because an inlined subroutine can still
represent an C++ or an ObjC method. I don't see anything in the
subprogram branch which should not apply to an inlined subroutine, so I
propose to just treat them identically. This makes searching for an
inlined method behave the same way as for the apple index.

I write an assembly-based test because I did not want to depend on
particular clang inlining behavior (and because I wanted to see how hard
would it be).

Reviewers: clayborg, JDevlieghere

Subscribers: eraman, lldb-commits

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

Added:
lldb/trunk/lit/SymbolFile/DWARF/find-inline-method.s
Modified:
lldb/trunk/lit/SymbolFile/DWARF/lit.local.cfg
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

Added: lldb/trunk/lit/SymbolFile/DWARF/find-inline-method.s
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/find-inline-method.s?rev=98&view=auto
==
--- lldb/trunk/lit/SymbolFile/DWARF/find-inline-method.s (added)
+++ lldb/trunk/lit/SymbolFile/DWARF/find-inline-method.s Tue May 29 01:16:22 
2018
@@ -0,0 +1,152 @@
+# REQUIRES: lld
+
+# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: lldb-test symbols --find=function --name=inl --function-flags=method %t 
\
+# RUN:   | FileCheck %s
+
+# CHECK: Function: {{.*}} mangled = "_Z8externali"
+# CHECK: Blocks: {{.*}} range = [0x00201000-0x00201002)
+# CHECK-NEXT: range = [0x00201000-0x00201002), name = "inl", mangled = 
_ZN1S3inlEi
+
+
+# Generated via:
+#   clang -O2 -g -S
+
+# from file:
+#   int forward(int);
+#   struct S {
+# static int inl(int a) { return forward(a); }
+#   };
+#   int external(int a) { return S::inl(a); }
+
+# and then simplified.
+
+   .text
+_Z8externali:
+.Lfunc_begin0:
+   jmp _Z7forwardi
+.Lfunc_end0:
+
+.globl _start
+_start:
+_Z7forwardi:
+ret
+
+   .section.debug_str,"MS",@progbits,1
+.Linfo_string0:
+   .asciz  "clang version 7.0.0 (trunk 332830) (llvm/trunk 332835) with 
manual modifications"
+.Linfo_string3:
+   .asciz  "_ZN1S3inlEi"
+.Linfo_string4:
+   .asciz  "inl"
+.Linfo_string6:
+   .asciz  "S"
+.Linfo_string8:
+   .asciz  "_Z8externali"
+.Linfo_string9:
+   .asciz  "external"
+   .section.debug_abbrev,"",@progbits
+   .byte   1   # Abbreviation Code
+   .byte   17  # DW_TAG_compile_unit
+   .byte   1   # DW_CHILDREN_yes
+   .byte   37  # DW_AT_producer
+   .byte   14  # DW_FORM_strp
+   .byte   19  # DW_AT_language
+   .byte   5   # DW_FORM_data2
+   .byte   17  # DW_AT_low_pc
+   .byte   1   # DW_FORM_addr
+   .byte   18  # DW_AT_high_pc
+   .byte   6   # DW_FORM_data4
+   .byte   0   # EOM(1)
+   .byte   0   # EOM(2)
+   .byte   2   # Abbreviation Code
+   .byte   19  # DW_TAG_structure_type
+   .byte   1   # DW_CHILDREN_yes
+   .byte   3   # DW_AT_name
+   .byte   14  # DW_FORM_strp
+   .byte   11  # DW_AT_byte_size
+   .byte   11  # DW_FORM_data1
+   .byte   0   # EOM(1)
+   .byte   0   # EOM(2)
+   .byte   3   # Abbreviation Code
+   .byte   46  # DW_TAG_subprogram
+   .byte   0   # DW_CHILDREN_no
+   .byte   110 # DW_AT_linkage_name
+   .byte   14  # DW_FORM_strp
+   .byte   3   # DW_AT_name
+   .byte   14  # DW_FORM_strp
+   .byte   0   # EOM(1)
+   .byte   0   # EOM(2)
+   .byte   6   # Abbreviation Code
+   .byte   46  # DW_TAG_subprogram
+   .byte   0   # DW_CHILDREN_no
+   .byte   71  # DW_AT_specification
+   .byte   19  # DW_FORM_ref4
+   .byte   32