[Lldb-commits] [PATCH] D47625: [cmake] Detect presence of wide-char libedit at build time

2018-06-04 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: include/lldb/Host/Editline.h:72-76
 #ifdef EL_CLIENTDATA   /* editline with wide support + wide char read function 
*/
 using EditLineGetCharType = wchar_t;
 #else
 using EditLineGetCharType = char;
 #endif

christos wrote:
> labath wrote:
> > It's not fully clear to me whether this part is still correct. My 
> > understanding is that if we use `el_wset` to set the getchar callback, we 
> > should always use wchar_t, regardless of libedit version. This is only true 
> > if all wide-char capable libedit versions also define EL_CLIENTDATA.
> > 
> > Is this the case?
> I believe that you are correct: If you use el_wset, you should use wchar_t. 
> The problem is that for libedit versions prior to 2016-04-19 the getchar 
> function used char * for narrow and wchar_t * for wide. Versions after that 
> use wchar_t * for both. This was an accident due to some code refactoring. If 
> you are checking if that's the case or not, perhaps you can determine this if 
> el_rfunc_t is defined in histedit.h or not. Unfortunately there is no compile 
> time way to determine if that's the case or not.
Thank, I can do that. Just to double-check, the condition you say here should 
be is:
```
#if LLDB_EDITLINE_USE_WCHAR || defined(EL_CLIENTDATA) || 
LLDB_LIBEDIT_HAVE_EL_RFUNC_T
using EditLineGetCharType = wchar_t;
#else
using EditLineGetCharType = char;
#endif
```
Is that right ?


https://reviews.llvm.org/D47625



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


[Lldb-commits] [PATCH] D47646: [IRMemoryMap] Use labels in the "malloc" and "free" lldb-test commands

2018-06-04 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.

Looks great, thanks for doing this.

As far as windows goes, I believe that there we simply don't have the memory 
allocation part implemented, so it's not surprising that these tests fail. It 
may be possible that the host-only tests would work (if you remove the `CanJIT` 
check in lldb-test), but I can't say that for sure.




Comment at: tools/lldb-test/lldb-test.cpp:606
+  // ::= free 
+  if (!Line.startswith("free"))
 return false;

`s/startswith/consumeFront`. Then, you don't need to do the `.find(' ')` below.


https://reviews.llvm.org/D47646



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


[Lldb-commits] [lldb] r333878 - AppleDWARFIndex: Get function method-ness directly from debug info

2018-06-04 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Jun  4 02:05:27 2018
New Revision: 333878

URL: http://llvm.org/viewvc/llvm-project?rev=333878&view=rev
Log:
AppleDWARFIndex: Get function method-ness directly from debug info

Summary:
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.

Reviewers: clayborg, JDevlieghere

Subscribers: aprantl, lldb-commits

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

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

Modified: lldb/trunk/lit/SymbolFile/DWARF/find-method-local-struct.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/find-method-local-struct.cpp?rev=333878&r1=333877&r2=333878&view=diff
==
--- lldb/trunk/lit/SymbolFile/DWARF/find-method-local-struct.cpp (original)
+++ lldb/trunk/lit/SymbolFile/DWARF/find-method-local-struct.cpp Mon Jun  4 
02:05:27 2018
@@ -1,6 +1,3 @@
-// llvm.org/pr37537
-// XFAIL: *
-
 // RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=method 
%t | \
 // RUN:   FileCheck %s

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=333878&r1=333877&r2=333878&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp Mon Jun  4 
02:05:27 2018
@@ -146,6 +146,14 @@ void AppleDWARFIndex::GetNamespaces(Cons
 m_apple_namespaces_up->FindByName(name.GetStringRef(), offsets);
 }
 
+static bool KeepFunctionDIE(DWARFDIE die, uint32_t name_type_mask) {
+  bool looking_for_methods = name_type_mask & eFunctionNameTypeMethod;
+  bool looking_for_functions = name_type_mask & eFunctionNameTypeBase;
+  if (looking_for_methods && looking_for_functions)
+return true;
+  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;
-}
-  } else {
-if (name_type_mask & eFunctionNameTypeMethod) {
-  sc_list.RemoveContextAtIndex(sc_list.GetSize() - 1);
-  keep_die = false;
-}
-  }
-} else {
-  m_module.ReportWarning(
-  "function at die offset 0x%8.8x had no function type",
-  die_ref.die_offset);
-}
-  }
-}
-  }
-  if (keep_die)
-resolved_dies.insert(die.GetDIE());
-}
+if (resolve_function(die, include_inlines, sc_list))
+  resolved_dies.insert(die.GetDIE());
   } else
 ReportInvalidDIEOffset(die_ref.die_offset, name.GetStringRef());
 }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp?rev=333878&r1=333877&r2=333878&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWAR

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

2018-06-04 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333878: AppleDWARFIndex: Get function method-ness directly 
from debug info (authored by labath, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D47470

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

Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -10,15 +10,29 @@
 #include "DWARFDIE.h"
 
 #include "DWARFASTParser.h"
-#include "DWARFUnit.h"
 #include "DWARFDIECollection.h"
 #include "DWARFDebugInfo.h"
-#include "DWARFDeclContext.h"
-
 #include "DWARFDebugInfoEntry.h"
+#include "DWARFDeclContext.h"
+#include "DWARFUnit.h"
 
 using namespace lldb_private;
 
+void DWARFDIE::ElaboratingDIEIterator::Next() {
+  assert(!m_worklist.empty() && "Incrementing end iterator?");
+
+  // Pop the current item from the list.
+  DWARFDIE die = m_worklist.back();
+  m_worklist.pop_back();
+
+  // And add back any items that elaborate it.
+  for (dw_attr_t attr : {DW_AT_specification, DW_AT_abstract_origin}) {
+if (DWARFDIE d = die.GetReferencedDIE(attr))
+  if (m_seen.insert(die.GetID()).second)
+m_worklist.push_back(d);
+  }
+}
+
 DWARFDIE
 DWARFDIE::GetParent() const {
   if (IsValid())
@@ -209,12 +223,19 @@
 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 {
+  for (DWARFDIE d: elaborating_dies())
+if (d.GetParent().IsStructUnionOrClass())
+  return true;
+  return false;
+}
+
 DWARFDIE
 DWARFDIE::GetContainingDWOModuleDIE() const {
   if (IsValid()) {
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
@@ -11,15 +11,20 @@
 #define SymbolFileDWARF_DWARFDIE_h_
 
 #include "DWARFBaseDIE.h"
+#include "llvm/ADT/SmallSet.h"
 
 class DWARFDIE : public DWARFBaseDIE {
 public:
+  class ElaboratingDIEIterator;
+
   using DWARFBaseDIE::DWARFBaseDIE;
 
   //--
   // Tests
   //--
-  bool IsStructClassOrUnion() const;
+  bool IsStructUnionOrClass() const;
+
+  bool IsMethod() const;
 
   //--
   // Accessors
@@ -29,6 +34,8 @@
   DWARFDIE
   GetContainingDWOModuleDIE() const;
 
+  inline llvm::iterator_range elaborating_dies() const;
+
   //--
   // Accessing information about a DIE
   //--
@@ -112,4 +119,58 @@
   lldb_private::CompilerDeclContext GetContainingDeclContext() const;
 };
 
+/// Iterate through all DIEs elaborating (i.e. reachable by a chain of
+/// DW_AT_specification and DW_AT_abstract_origin attributes) a given DIE. For
+/// convenience, the starting die is included in the sequence as the first
+/// item.
+class DWARFDIE::ElaboratingDIEIterator
+: public std::iterator {
+
+  // The operating invariant is: top of m_worklist contains the "current" item
+  // and the rest of the list are items yet to be visited. An empty worklist
+  // means we've reached the end.
+  // Infinite recursion is prevented by maintaining a list of seen DIEs.
+  // Container sizes are optimized for the case of following DW_AT_specification
+  // and DW_AT_abstract_origin just once.
+  llvm::SmallVector m_worklist;
+  llvm::SmallSet m_seen;
+
+  void Next();
+
+public:
+  /// An iterator starting at die d.
+  explicit ElaboratingDIEIterator(DWARFDIE d) : m_worklist(1, d) {}
+
+  /// End marker
+  ElaboratingDIEIterator() {}
+
+  const DWARFDIE &operator*() const { return m_worklist.back(); }
+  ElaboratingDIEIterator &operator++() {
+Next();
+return *this;
+  }
+  ElaboratingDIEIterator operator++(int) {
+ElaboratingDIEIterator I = *this;
+Next();
+return I;
+  }
+
+  friend bool operator==(const ElaboratingDIEIterator &a,
+ const ElaboratingDIEIterator &b) {
+if (a.m_worklist.empty() || b.m_worklist.empty())
+  return a.m_worklist.empty() == b.m_worklist.empty();
+return a.m_workli

[Lldb-commits] [PATCH] D47147: DWARFIndex: Reduce duplication in the GetFunctions methods

2018-06-04 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 149702.
labath added a comment.

This is a rewrite of the original patch with the same idea but different
approach. Now that Apple index determines method-ness straight from the debug
info, we don't need to resolve the functions into SymbolContexts. This removes
the need for the bunch of callback arguments and allows us to pull the common
part out of the two implementations of these functions back into the
SymbolFileDWARF class.


https://reviews.llvm.org/D47147

Files:
  source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
  source/Plugins/SymbolFile/DWARF/DWARFIndex.h
  source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2223,16 +2223,18 @@
   if (info == NULL)
 return 0;
 
-  m_index->GetFunctions(name, *info,
-[this](const DWARFDIE &die, bool include_inlines,
-   lldb_private::SymbolContextList &sc_list) {
-  return ResolveFunction(die, include_inlines, sc_list);
-},
-[this](lldb::user_id_t type_uid) {
-  return GetDeclContextContainingUID(type_uid);
-},
-parent_decl_ctx, name_type_mask, include_inlines,
-sc_list);
+  llvm::DenseSet resolved_dies;
+  DIEArray offsets;
+  CompilerDeclContext empty_decl_ctx;
+  if (!parent_decl_ctx)
+parent_decl_ctx = &empty_decl_ctx;
+
+  std::vector dies;
+  m_index->GetFunctions(name, *info, *parent_decl_ctx, name_type_mask, dies);
+  for (const DWARFDIE &die: dies) {
+if (resolved_dies.insert(die.GetDIE()).second)
+  ResolveFunction(die, include_inlines, sc_list);
+  }
 
   // Return the number of variable that were appended to the list
   const uint32_t num_matches = sc_list.GetSize() - original_size;
Index: source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
===
--- source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
+++ source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
@@ -31,15 +31,10 @@
   void GetTypes(ConstString name, DIEArray &offsets) override;
   void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override;
   void GetNamespaces(ConstString name, DIEArray &offsets) override;
-  void GetFunctions(
-  ConstString name, DWARFDebugInfo &info,
-  llvm::function_ref
-  resolve_function,
-  llvm::function_ref
-  get_decl_context_containing_uid,
-  const CompilerDeclContext *parent_decl_ctx, uint32_t name_type_mask,
-  bool include_inlines, SymbolContextList &sc_list) override;
+  void GetFunctions(ConstString name, DWARFDebugInfo &info,
+const CompilerDeclContext &parent_decl_ctx,
+uint32_t name_type_mask,
+std::vector &dies) override;
   void GetFunctions(
   const RegularExpression ®ex, DWARFDebugInfo &info,
   llvm::function_ref
-resolve_function,
-llvm::function_ref
-get_decl_context_containing_uid,
-const CompilerDeclContext *parent_decl_ctx, uint32_t name_type_mask,
-bool include_inlines, SymbolContextList &sc_list) {
-
+void ManualDWARFIndex::GetFunctions(ConstString name, DWARFDebugInfo &info,
+const CompilerDeclContext &parent_decl_ctx,
+uint32_t name_type_mask,
+std::vector &dies) {
   Index();
 
-  std::set resolved_dies;
-  DIEArray offsets;
   if (name_type_mask & eFunctionNameTypeFull) {
-uint32_t num_matches = m_set.function_basenames.Find(name, offsets);
-num_matches += m_set.function_methods.Find(name, offsets);
-num_matches += m_set.function_fullnames.Find(name, offsets);
-for (uint32_t i = 0; i < num_matches; i++) {
-  const DIERef &die_ref = offsets[i];
+DIEArray offsets;
+m_set.function_basenames.Find(name, offsets);
+m_set.function_methods.Find(name, offsets);
+m_set.function_fullnames.Find(name, offsets);
+for (const DIERef &die_ref: offsets) {
   DWARFDIE die = info.GetDIE(die_ref);
-  if (die) {
-if (!SymbolFileDWARF::DIEInDeclContext(parent_decl_ctx, die))
-  continue; // The containing decl contexts don't match
+  if (!die)
+continue;
+  if (!SymbolFileDWARF::DIEInDeclContext(&parent_decl_ctx, die))
+continue; // The containing decl contexts don't match
 
-if (resolved_dies.find(die.GetDIE()) == resolved_dies.end()) {
-  if (resolve_function(die, include_inline

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

2018-06-04 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

FYI I have filed it for libstdc++ but I did not really understand their 
reaction: Bug 86013 - std::vector::shrink_to_fit() could sometimes use 
realloc() 


Repository:
  rL LLVM

https://reviews.llvm.org/D47492



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


[Lldb-commits] [lldb] r333888 - [LLDB] Unit tests basic support for OpenBSD

2018-06-04 Thread David Carlier via lldb-commits
Author: devnexen
Date: Mon Jun  4 04:57:12 2018
New Revision: 333888

URL: http://llvm.org/viewvc/llvm-project?rev=333888&view=rev
Log:
[LLDB] Unit tests basic support for OpenBSD

Add OpenBSD python module in order to support unit tests.

Reviewers: labath, zturner

Reviewed By: labath

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

Modified:
lldb/trunk/lit/lit.cfg
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/lit/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.cfg?rev=333888&r1=333887&r2=333888&view=diff
==
--- lldb/trunk/lit/lit.cfg (original)
+++ lldb/trunk/lit/lit.cfg Mon Jun  4 04:57:12 2018
@@ -78,6 +78,10 @@ if platform.system() in ['Darwin']:
 config.cc += " -isysroot %s" % sdk_path
 config.cxx += " -isysroot %s" % sdk_path
 
+if platform.system() in ['OpenBSD']:
+config.cc += " -pthread"
+config.cxx += " -pthread"
+
 config.substitutions.append(('%cc', config.cc))
 config.substitutions.append(('%cxx', config.cxx))
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=333888&r1=333887&r2=333888&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Jun  4 04:57:12 
2018
@@ -490,6 +490,8 @@ def getsource_if_available(obj):
 def builder_module():
 if sys.platform.startswith("freebsd"):
 return __import__("builder_freebsd")
+if sys.platform.startswith("openbsd"):
+return __import__("builder_openbsd")
 if sys.platform.startswith("netbsd"):
 return __import__("builder_netbsd")
 if sys.platform.startswith("linux"):
@@ -1395,7 +1397,7 @@ class Base(unittest2.TestCase):
 
 def getstdlibFlag(self):
 """ Returns the proper -stdlib flag, or empty if not required."""
-if self.platformIsDarwin() or self.getPlatform() == "freebsd":
+if self.platformIsDarwin() or self.getPlatform() == "freebsd" or 
self.getPlatform() == "openbsd":
 stdlibflag = "-stdlib=libc++"
 else:  # this includes NetBSD
 stdlibflag = ""
@@ -1424,7 +1426,7 @@ class Base(unittest2.TestCase):
  'FRAMEWORK_INCLUDES': "-F%s" % self.framework_dir,
  'LD_EXTRAS': "%s -Wl,-rpath,%s" % (self.dsym, 
self.framework_dir),
  }
-elif sys.platform.rstrip('0123456789') in ('freebsd', 'linux', 
'netbsd', 'darwin') or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
+elif sys.platform.startswith('win'):
 d = {
 'CXX_SOURCES': sources,
 'EXE': exe_name,
@@ -1433,8 +1435,8 @@ class Base(unittest2.TestCase):
  os.path.join(
  os.environ["LLDB_SRC"],
  "include")),
-'LD_EXTRAS': "-L%s/../lib -llldb -Wl,-rpath,%s/../lib" % 
(lib_dir, lib_dir)}
-elif sys.platform.startswith('win'):
+'LD_EXTRAS': "-L%s -lliblldb" % os.environ["LLDB_IMPLIB_DIR"]}
+else:
 d = {
 'CXX_SOURCES': sources,
 'EXE': exe_name,
@@ -1443,7 +1445,7 @@ class Base(unittest2.TestCase):
  os.path.join(
  os.environ["LLDB_SRC"],
  "include")),
-'LD_EXTRAS': "-L%s -lliblldb" % os.environ["LLDB_IMPLIB_DIR"]}
+'LD_EXTRAS': "-L%s/../lib -llldb -Wl,-rpath,%s/../lib" % 
(lib_dir, lib_dir)}
 if self.TraceOn():
 print(
 "Building LLDB Driver (%s) from sources %s" %
@@ -1464,15 +1466,6 @@ class Base(unittest2.TestCase):
  'FRAMEWORK_INCLUDES': "-F%s" % self.framework_dir,
  'LD_EXTRAS': "%s -Wl,-rpath,%s -dynamiclib" % (self.dsym, 
self.framework_dir),
  }
-elif sys.platform.rstrip('0123456789') in ('freebsd', 'linux', 
'netbsd', 'darwin') or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
-d = {
-'DYLIB_CXX_SOURCES': sources,
-'DYLIB_NAME': lib_name,
-'CFLAGS_EXTRAS': "%s -I%s -fPIC" % (stdflag,
-os.path.join(
-os.environ["LLDB_SRC"],
-"include")),
-'LD_EXTRAS': "-shared -L%s/../lib -llldb -Wl,-rpath,%s/../lib" 
% (lib_dir, lib_dir)}
 elif self.getPlatform() == 'windows':
 d = {
 'DY

[Lldb-commits] [lldb] r333889 - [LLDB] Unit tests basic support for OpenBSD

2018-06-04 Thread David Carlier via lldb-commits
Author: devnexen
Date: Mon Jun  4 04:59:18 2018
New Revision: 333889

URL: http://llvm.org/viewvc/llvm-project?rev=333889&view=rev
Log:
[LLDB] Unit tests basic support for OpenBSD

OpenBSD python module.

Added:
lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_openbsd.py

Added: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_openbsd.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_openbsd.py?rev=333889&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_openbsd.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_openbsd.py Mon 
Jun  4 04:59:18 2018
@@ -0,0 +1,10 @@
+from builder_base import *
+
+
+def buildDsym(
+sender=None,
+architecture=None,
+compiler=None,
+dictionary=None,
+testdir=None):
+return False


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


[Lldb-commits] [PATCH] D47708: PDB support of function-level linking and splitted functions

2018-06-04 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov created this revision.
aleksandr.urakov added reviewers: asmith, zturner.
Herald added a subscriber: mgorny.

The patch adds support of splitted functions (when MSVC is used with PGO) and 
function-level linking feature.

SymbolFilePDB::ParseCompileUnitLineTable function relies on fact that ranges of 
compiled source files in the binary are continuous and don't intersect each 
other. The function creates LineSequence for each file and inserts it into 
LineTable, and implementation of last one relies on continuity of the sequence. 
But it's not always true when function-level linking enabled, e.g. in added 
input test file test-pdb-function-level-linking.exe there is xstring's 
std__basic_string_char_std__char_traits_char__std__allocator_char_max_size 
(.00454820) between test-pdb-function-level-linking.cpp's foo (.00454770) and 
main (.004548F0).

To fix the problem this patch renews the sequence on each address gap.


https://reviews.llvm.org/D47708

Files:
  source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  unittests/SymbolFile/PDB/CMakeLists.txt
  unittests/SymbolFile/PDB/Inputs/test-pdb-function-level-linking.cpp
  unittests/SymbolFile/PDB/Inputs/test-pdb-function-level-linking.exe
  unittests/SymbolFile/PDB/Inputs/test-pdb-function-level-linking.pdb
  unittests/SymbolFile/PDB/Inputs/test-pdb-splitted-function.cpp
  unittests/SymbolFile/PDB/Inputs/test-pdb-splitted-function.exe
  unittests/SymbolFile/PDB/Inputs/test-pdb-splitted-function.pdb
  unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp

Index: unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
===
--- unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -56,6 +56,10 @@
 SymbolFilePDB::Initialize();
 
 m_pdb_test_exe = GetInputFilePath("test-pdb.exe");
+m_function_level_linking_test_exe =
+GetInputFilePath("test-pdb-function-level-linking.exe");
+m_splitted_function_test_exe =
+GetInputFilePath("test-pdb-splitted-function.exe");
 m_types_test_exe = GetInputFilePath("test-pdb-types.exe");
   }
 
@@ -73,6 +77,8 @@
 
 protected:
   std::string m_pdb_test_exe;
+  std::string m_function_level_linking_test_exe;
+  std::string m_splitted_function_test_exe;
   std::string m_types_test_exe;
 
   bool FileSpecMatchesAsBaseOrFull(const FileSpec &left,
@@ -354,6 +360,56 @@
   VerifyLineEntry(module, sc, header1, *lt, 9, 0x401090);
 }
 
+void TestLineTableConsistency(llvm::StringRef exe_path, llvm::StringRef source_name)
+{
+  // All line entries of compile unit's line table must be consistent
+  // even if compiled sources are not continuous in the binary file.
+  FileSpec fspec(exe_path, false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared(fspec, aspec);
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFile *symfile = plugin->GetSymbolFile();
+  FileSpec source_file(source_name, false);
+  uint32_t scope = lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
+  SymbolContextList sc_list;
+  uint32_t count =
+  symfile->ResolveSymbolContext(source_file, 0, true, scope, sc_list);
+  EXPECT_EQ(1u, count);
+
+  SymbolContext sc;
+  EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
+
+  LineTable *lt = sc.comp_unit->GetLineTable();
+  EXPECT_NE(nullptr, lt);
+
+  count = lt->GetSize();
+  EXPECT_LT(0u, count);
+
+  LineEntry le;
+  EXPECT_TRUE(lt->GetLineEntryAtIndex(0, le));
+  for (int i = 1; i < count; i++)
+  {
+lldb::addr_t curr_end =
+le.range.GetBaseAddress().GetFileAddress() + le.range.GetByteSize();
+
+EXPECT_TRUE(lt->GetLineEntryAtIndex(i, le));
+
+EXPECT_LE(curr_end, le.range.GetBaseAddress().GetFileAddress());
+  }
+}
+
+TEST_F(SymbolFilePDBTests, TestFunctionLevelLinking) {
+  TestLineTableConsistency(
+  m_function_level_linking_test_exe,
+  "test-pdb-function-level-linking.cpp");
+}
+
+TEST_F(SymbolFilePDBTests, TestSplittedFunction) {
+  TestLineTableConsistency(
+  m_splitted_function_test_exe,
+  "test-pdb-splitted-function.cpp");
+}
+
 TEST_F(SymbolFilePDBTests, TestSimpleClassTypes) {
   FileSpec fspec(m_types_test_exe.c_str(), false);
   ArchSpec aspec("i686-pc-windows");
Index: unittests/SymbolFile/PDB/Inputs/test-pdb-splitted-function.cpp
===
--- /dev/null
+++ unittests/SymbolFile/PDB/Inputs/test-pdb-splitted-function.cpp
@@ -0,0 +1,27 @@
+// Compile with "cl /c /Zi /GL /O2 /EHsc /MTd test-pdb-splitted-function.cpp"
+// Link with "link /debug:full /LTCG /GENPROFILE
+//   test-pdb-splitted-function.obj"
+// Run several times
+// Link with "link /debug:full /LTCG /USEPROFILE
+//   test-pdb-splitted-function.obj"
+
+#include 
+#include 
+
+int main()
+{
+auto b = false;
+for (auto i = 1; i <= 1024; i++)
+{
+if (b)
+{
+std::cout << "Unreachable code" << std::endl;
+auto x 

[Lldb-commits] [PATCH] D47579: dotest: make inline tests compatible with -f

2018-06-04 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

> Can you try inserting something like this instead of the 
> `ApplyDecoratorsToFunction` line and see if your problems go away?
> 
>   @wraps(InlineTest._test)
>   def test_func(*args, **kwargs):
>   return InlineTest._test(*args, **kwargs)
>
>   test_func = ApplyDecoratorsToFunction(test_func, decorators)
>
> 
> This should make sure each test class gets a fresh function object with an 
> independent set of categories.

Alright, I'll give that a shot. Thanks for the suggestion! :-)


https://reviews.llvm.org/D47579



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


[Lldb-commits] [PATCH] D47646: [IRMemoryMap] Use labels in the "malloc" and "free" lldb-test commands

2018-06-04 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

In https://reviews.llvm.org/D47646#1120498, @labath wrote:

> Looks great, thanks for doing this.
>
> As far as windows goes, I believe that there we simply don't have the memory 
> allocation part implemented, so it's not surprising that these tests fail. It 
> may be possible that the host-only tests would work (if you remove the 
> `CanJIT` check in lldb-test), but I can't say that for sure.


I believe you are correct about the implementation - the failure occurs before 
CanJit is even called though, so I don't know if any of the tests can run on 
Windows today.


https://reviews.llvm.org/D47646



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


[Lldb-commits] [lldb] r333930 - [IRMemoryMap] Use labels in the "malloc" and "free" lldb-test commands

2018-06-04 Thread Vedant Kumar via lldb-commits
Author: vedantk
Date: Mon Jun  4 10:11:15 2018
New Revision: 333930

URL: http://llvm.org/viewvc/llvm-project?rev=333930&view=rev
Log:
[IRMemoryMap] Use labels in the "malloc" and "free" lldb-test commands

Change the syntax of the malloc and free commands in lldb-test's
ir-memory-map subcommand to:

   ::=  = malloc  

   ::= free 

This should make it easier to read and extend tests in the future, e.g
to test IRMemoryMap::WriteMemory or double-free behavior.

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

Modified:
lldb/trunk/lit/Expr/Inputs/ir-memory-map-basic
lldb/trunk/lit/Expr/Inputs/ir-memory-map-mix-malloc-free
lldb/trunk/lit/Expr/Inputs/ir-memory-map-overlap1
lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/lit/Expr/Inputs/ir-memory-map-basic
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/Inputs/ir-memory-map-basic?rev=333930&r1=333929&r2=333930&view=diff
==
--- lldb/trunk/lit/Expr/Inputs/ir-memory-map-basic (original)
+++ lldb/trunk/lit/Expr/Inputs/ir-memory-map-basic Mon Jun  4 10:11:15 2018
@@ -1,25 +1,25 @@
-malloc 0 1
-malloc 1 1
+L1 = malloc 0 1
+L2 = malloc 1 1
 
-malloc 2 1
-malloc 2 2
-malloc 2 4
-
-malloc 3 1
-malloc 3 2
-malloc 3 4
-
-malloc 128 1
-malloc 128 2
-malloc 128 4
-malloc 128 128
-
-malloc 2048 1
-malloc 2048 2
-malloc 2048 4
-
-malloc 3968 1
-malloc 3968 2
-malloc 3968 4
+L3 = malloc 2 1
+L4 = malloc 2 2
+L5 = malloc 2 4
+
+L6 = malloc 3 1
+L7 = malloc 3 2
+L8 = malloc 3 4
+
+L9 = malloc 128 1
+L10 = malloc 128 2
+L11 = malloc 128 4
+L12 = malloc 128 128
+
+L13 = malloc 2048 1
+L14 = malloc 2048 2
+L15 = malloc 2048 4
+
+L16 = malloc 3968 1
+L17 = malloc 3968 2
+L18 = malloc 3968 4
 
-malloc 0 1
+L19 = malloc 0 1

Modified: lldb/trunk/lit/Expr/Inputs/ir-memory-map-mix-malloc-free
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/Inputs/ir-memory-map-mix-malloc-free?rev=333930&r1=333929&r2=333930&view=diff
==
--- lldb/trunk/lit/Expr/Inputs/ir-memory-map-mix-malloc-free (original)
+++ lldb/trunk/lit/Expr/Inputs/ir-memory-map-mix-malloc-free Mon Jun  4 
10:11:15 2018
@@ -1,275 +1,272 @@
-# This file was generated by a slightly extended version of a script
-# attached to https://reviews.llvm.org/D47508.
-
-malloc 2 4
-malloc 4095 128
-malloc 3 16
-malloc 8192 2
-malloc 1 128
-malloc 3 2
-free 3
-free 3
-malloc 32 2
-malloc 2 16
-free 1
-malloc 2048 2
-free 2
-malloc 2049 4
-malloc 4097 2
-malloc 2 16
-free 1
-free 6
-malloc 1 16
-malloc 33 128
-malloc 2 128
-malloc 2 16
-malloc 2 4
-malloc 2 4
-free 4
-malloc 4 4
-malloc 2 16
-free 3
-malloc 0 128
-free 6
-free 2
-malloc 33 2
-malloc 4095 2
-free 6
-malloc 2 4
-malloc 0 2
-free 1
-free 9
-free 5
-malloc 32 2
-malloc 4096 2
-free 2
-free 9
-free 6
-malloc 8192 16
-malloc 2 4
-malloc 4096 16
-free 10
-malloc 4 4
-free 7
-malloc 4 4
-malloc 8193 2
-malloc 1 2
-free 3
-free 7
-malloc 4096 2
-free 0
-malloc 4096 4
-free 3
-malloc 4097 128
-malloc 1 2
-malloc 4 2
-free 10
-free 8
-malloc 0 16
-malloc 2049 16
-free 9
-malloc 8193 16
-free 10
-free 1
-malloc 8193 2
-free 11
-malloc 3 16
-free 5
-malloc 33 128
-free 0
-malloc 2049 4
-malloc 1 128
-malloc 32 16
-free 1
-free 9
-malloc 2048 4
-free 0
-free 2
-malloc 5 4
-free 11
-malloc 2048 4
-malloc 4097 16
-malloc 8192 4
-free 2
-free 8
-free 11
-malloc 8192 4
-free 2
-malloc 8191 4
-malloc 32 128
-free 7
-malloc 4 16
-malloc 4096 128
-free 12
-malloc 2 4
-free 9
-malloc 8193 128
-malloc 4095 4
-malloc 2049 16
-malloc 2 4
-free 16
-malloc 0 128
-malloc 5 2
-malloc 2047 4
-malloc 2 2
-free 10
-malloc 0 128
-free 6
-malloc 2047 128
-free 11
-free 0
-free 9
-malloc 4 4
-malloc 3 2
-free 7
-malloc 1 128
-free 13
-malloc 8193 16
-malloc 4097 128
-free 15
-free 3
-malloc 1 2
-malloc 2049 4
-malloc 2048 2
-free 7
-malloc 31 4
-free 5
-free 14
-free 4
-free 10
-malloc 4 4
-free 6
-malloc 3 2
-malloc 1 128
-free 13
-malloc 4 16
-free 4
-free 8
-malloc 3 16
-free 13
-malloc 0 4
-free 8
-free 13
-malloc 1 2
-malloc 8192 128
-free 12
-malloc 2049 2
-malloc 1 16
-free 4
-free 7
-malloc 4 16
-malloc 4 128
-malloc 4096 16
-malloc 2048 16
-malloc 32 4
-malloc 8193 4
-free 2
-malloc 3 16
-malloc 8192 4
-free 1
-malloc 8191 2
-free 3
-malloc 8192 2
-malloc 8192 2
-free 3
-free 7
-malloc 31 4
-malloc 2049 2
-free 4
-free 3
-free 14
-free 1
-malloc 2048 4
-malloc 1 4
-malloc 1 4
-malloc 2 4
-malloc 4 16
-free 12
-free 14
-free 3
-free 0
-free 12
-free 10
-malloc 32 16
-free 5
-free 9
-free 4
-free 9
-free 3
-malloc 4096 16
-malloc 4 2
-free 12
-free 10
-free 3
-free 7
-malloc 4097 4
-malloc 4095 16
-free 3
-malloc 2047 16
-free 12
-malloc 8193 2
-free 2
-free 3
-malloc 0 4
-free 2
-free 9
-malloc 8192 16
-malloc 2 2
-malloc 4096 4
-malloc 5 128
-malloc 4095 4
-malloc 4095 4
-free 9
-malloc 32 4
-malloc 31 16
-free 15
-malloc 4097 16
-malloc 2048 128
-malloc 2048 2
-malloc 4096 128
-malloc 3 1

[Lldb-commits] [PATCH] D47646: [IRMemoryMap] Use labels in the "malloc" and "free" lldb-test commands

2018-06-04 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333930: [IRMemoryMap] Use labels in the "malloc" 
and "free" lldb-test commands (authored by vedantk, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D47646?vs=149517&id=149800#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47646

Files:
  lldb/trunk/lit/Expr/Inputs/ir-memory-map-basic
  lldb/trunk/lit/Expr/Inputs/ir-memory-map-mix-malloc-free
  lldb/trunk/lit/Expr/Inputs/ir-memory-map-overlap1
  lldb/trunk/tools/lldb-test/lldb-test.cpp

Index: lldb/trunk/tools/lldb-test/lldb-test.cpp
===
--- lldb/trunk/tools/lldb-test/lldb-test.cpp
+++ lldb/trunk/tools/lldb-test/lldb-test.cpp
@@ -167,13 +167,25 @@
 cl::init(false), cl::sub(IRMemoryMapSubcommand));
 
 using AllocationT = std::pair;
-bool areAllocationsOverlapping(const AllocationT &L, const AllocationT &R);
 using AddrIntervalMap =
   IntervalMap>;
-bool evalMalloc(IRMemoryMap &IRMemMap, StringRef Line,
-AddrIntervalMap &AllocatedIntervals);
-bool evalFree(IRMemoryMap &IRMemMap, StringRef Line,
-  AddrIntervalMap &AllocatedIntervals);
+
+struct IRMemoryMapTestState {
+  TargetSP Target;
+  IRMemoryMap Map;
+
+  AddrIntervalMap::Allocator IntervalMapAllocator;
+  AddrIntervalMap Allocations;
+
+  StringMap Label2AddrMap;
+
+  IRMemoryMapTestState(TargetSP Target)
+  : Target(Target), Map(Target), Allocations(IntervalMapAllocator) {}
+};
+
+bool areAllocationsOverlapping(const AllocationT &L, const AllocationT &R);
+bool evalMalloc(StringRef Line, IRMemoryMapTestState &State);
+bool evalFree(StringRef Line, IRMemoryMapTestState &State);
 int evaluateMemoryMapCommands(Debugger &Dbg);
 } // namespace irmemorymap
 
@@ -514,17 +526,23 @@
   return R.first < L.second && L.first < R.second;
 }
 
-bool opts::irmemorymap::evalMalloc(IRMemoryMap &IRMemMap, StringRef Line,
-   AddrIntervalMap &AllocatedIntervals) {
-  // ::= malloc  
+bool opts::irmemorymap::evalMalloc(StringRef Line,
+   IRMemoryMapTestState &State) {
+  // ::=  = malloc  
+  StringRef Label;
+  std::tie(Label, Line) = Line.split('=');
+  if (Line.empty())
+return false;
+  Label = Label.trim();
+  Line = Line.trim();
   size_t Size;
   uint8_t Alignment;
   int Matches = sscanf(Line.data(), "malloc %zu %hhu", &Size, &Alignment);
   if (Matches != 2)
 return false;
 
-  outs() << formatv("Command: malloc(size={0}, alignment={1})\n", Size,
-Alignment);
+  outs() << formatv("Command: {0} = malloc(size={1}, alignment={2})\n", Label,
+Size, Alignment);
   if (!isPowerOf2_32(Alignment)) {
 outs() << "Malloc error: alignment is not a power of 2\n";
 exit(1);
@@ -539,7 +557,7 @@
   const bool ZeroMemory = false;
   Status ST;
   addr_t Addr =
-  IRMemMap.Malloc(Size, Alignment, Permissions, AP, ZeroMemory, ST);
+  State.Map.Malloc(Size, Alignment, Permissions, AP, ZeroMemory, ST);
   if (ST.Fail()) {
 outs() << formatv("Malloc error: {0}\n", ST);
 return true;
@@ -557,10 +575,10 @@
   // Check that the allocation does not overlap another allocation. Do so by
   // testing each allocation which may cover the interval [Addr, EndOfRegion).
   addr_t EndOfRegion = Addr + Size;
-  auto Probe = AllocatedIntervals.begin();
+  auto Probe = State.Allocations.begin();
   Probe.advanceTo(Addr); //< First interval s.t stop >= Addr.
   AllocationT NewAllocation = {Addr, EndOfRegion};
-  while (Probe != AllocatedIntervals.end() && Probe.start() < EndOfRegion) {
+  while (Probe != State.Allocations.end() && Probe.start() < EndOfRegion) {
 AllocationT ProbeAllocation = {Probe.start(), Probe.stop()};
 if (areAllocationsOverlapping(ProbeAllocation, NewAllocation)) {
   outs() << "Malloc error: overlapping allocation detected"
@@ -575,41 +593,42 @@
   // to inhibit interval coalescing.
   static unsigned AllocationID = 0;
   if (Size)
-AllocatedIntervals.insert(Addr, EndOfRegion, AllocationID++);
+State.Allocations.insert(Addr, EndOfRegion, AllocationID++);
+
+  // Store the label -> address mapping.
+  State.Label2AddrMap[Label] = Addr;
 
   return true;
 }
 
-bool opts::irmemorymap::evalFree(IRMemoryMap &IRMemMap, StringRef Line,
- AddrIntervalMap &AllocatedIntervals) {
-  // ::= free 
-  size_t AllocIndex;
-  int Matches = sscanf(Line.data(), "free %zu", &AllocIndex);
-  if (Matches != 1)
+bool opts::irmemorymap::evalFree(StringRef Line, IRMemoryMapTestState &State) {
+  // ::= free 
+  if (!Line.consume_front("free"))
 return false;
+  StringRef Label = Line.trim();
 
-  outs() << formatv("Command: free(allocation-index={0})\n", AllocIndex);
-
-  // Find and free the AllocIndex-th allocation.
-  auto Probe = AllocatedIntervals.begin();
-  for (size_t I = 0; I < AllocIndex 

[Lldb-commits] [PATCH] D47384: Remove dependency from Host to clang

2018-06-04 Thread Zachary Turner via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333933: Remove dependency from Host to clang. (authored by 
zturner, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D47384?vs=148640&id=149805#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47384

Files:
  lldb/trunk/include/lldb/Host/HostInfoBase.h
  lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
  lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h
  lldb/trunk/source/API/SBHostOS.cpp
  lldb/trunk/source/Host/common/HostInfoBase.cpp
  lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
  lldb/trunk/source/Host/posix/HostInfoPosix.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.h
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/trunk/unittests/Expression/CMakeLists.txt
  lldb/trunk/unittests/Expression/ClangParserTest.cpp
  lldb/trunk/unittests/Host/HostInfoTest.cpp

Index: lldb/trunk/unittests/Expression/ClangParserTest.cpp
===
--- lldb/trunk/unittests/Expression/ClangParserTest.cpp
+++ lldb/trunk/unittests/Expression/ClangParserTest.cpp
@@ -0,0 +1,64 @@
+//===-- ClangParserTest.cpp --*- C++-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "Plugins/ExpressionParser/Clang/ClangHost.h"
+#include "TestingSupport/TestUtilities.h"
+#include "lldb/lldb-defines.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+
+#ifdef __APPLE__
+static std::string ComputeClangDir(std::string lldb_shlib_path,
+   bool verify = false) {
+  FileSpec clang_dir;
+  FileSpec lldb_shlib_spec(lldb_shlib_path, false);
+  ComputeClangDirectory(lldb_shlib_spec, clang_dir, verify);
+  return clang_dir.GetPath();
+}
+
+TEST_F(HostInfoTest, MacOSX) {
+  // This returns whatever the POSIX fallback returns.
+  std::string posix = "/usr/lib/liblldb.dylib";
+  EXPECT_FALSE(ComputeClangDir(posix).empty());
+
+  std::string build =
+  "/lldb-macosx-x86_64/Library/Frameworks/LLDB.framework/Versions/A";
+  std::string build_clang =
+  "/lldb-macosx-x86_64/Library/Frameworks/LLDB.framework/Resources/Clang";
+  EXPECT_EQ(ComputeClangDir(build), build_clang);
+
+  std::string xcode = "/Applications/Xcode.app/Contents/SharedFrameworks/"
+  "LLDB.framework/Versions/A";
+  std::string xcode_clang =
+  "/Applications/Xcode.app/Contents/Developer/Toolchains/"
+  "XcodeDefault.xctoolchain/usr/lib/swift/clang";
+  EXPECT_EQ(ComputeClangDir(xcode), xcode_clang);
+
+  std::string toolchain =
+  "/Applications/Xcode.app/Contents/Developer/Toolchains/"
+  "Swift-4.1-development-snapshot.xctoolchain/System/Library/"
+  "PrivateFrameworks/LLDB.framework";
+  std::string toolchain_clang =
+  "/Applications/Xcode.app/Contents/Developer/Toolchains/"
+  "Swift-4.1-development-snapshot.xctoolchain/usr/lib/swift/clang";
+  EXPECT_EQ(ComputeClangDir(toolchain), toolchain_clang);
+
+  std::string cltools = "/Library/Developer/CommandLineTools/Library/"
+"PrivateFrameworks/LLDB.framework";
+  std::string cltools_clang =
+  "/Library/Developer/CommandLineTools/Library/PrivateFrameworks/"
+  "LLDB.framework/Resources/Clang";
+  EXPECT_EQ(ComputeClangDir(cltools), cltools_clang);
+
+  // Test that a bogus path is detected.
+  EXPECT_NE(ComputeClangDir(GetInputFilePath(xcode), true),
+ComputeClangDir(GetInputFilePath(xcode)));
+}
+#endif
Index: lldb/trunk/unittests/Expression/CMakeLists.txt
===
--- lldb/trunk/unittests/Expression/CMakeLists.txt
+++ lldb/trunk/unittests/Expression/CMakeLists.txt
@@ -1,7 +1,9 @@
 add_lldb_unittest(ExpressionTests
+  ClangParserTest.cpp
   GoParserTest.cpp
 
   LINK_LIBS
 lldbCore
 lldbPluginExpressionParserGo
+lldbPluginExpressionParserClang
   )
Index: lldb/trunk/unittests/Host/HostInfoTest.cpp
===
--- lldb/trunk/unittests/Host/HostInfoTest.cpp
+++ lldb/trunk/unittests/Host/HostInfoTest.cpp
@@ -12,10 +12,6 @@
 #include "TestingSupport/TestUtilities.h"
 #include "gtest/gtest.h"
 
-#ifdef __APPLE__
-#include "lldb/Host/macosx/HostInfoMacOSX.h"
-#endif
-
 using namespace lldb_private;
 using namespace llvm;
 
@@ -47,59 +43,4 @@
   // Test LLDB_ARCH_DEFAULT
   EXPECT_EQ(HostInfo::GetAugmentedArchSpec(LLDB_ARCH_DEFA

[Lldb-commits] [lldb] r333933 - Remove dependency from Host to clang.

2018-06-04 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Jun  4 10:41:00 2018
New Revision: 333933

URL: http://llvm.org/viewvc/llvm-project?rev=333933&view=rev
Log:
Remove dependency from Host to clang.

Host depended on clang because HostInfo had a function to get
the directory where clang was installed.  We move this over to
the clang expression parser plugin where it's more at home.

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

Added:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.h
lldb/trunk/unittests/Expression/ClangParserTest.cpp
Modified:
lldb/trunk/include/lldb/Host/HostInfoBase.h
lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h
lldb/trunk/source/API/SBHostOS.cpp
lldb/trunk/source/Host/common/HostInfoBase.cpp
lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
lldb/trunk/source/Host/posix/HostInfoPosix.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/unittests/Expression/CMakeLists.txt
lldb/trunk/unittests/Host/HostInfoTest.cpp

Modified: lldb/trunk/include/lldb/Host/HostInfoBase.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostInfoBase.h?rev=333933&r1=333932&r2=333933&view=diff
==
--- lldb/trunk/include/lldb/Host/HostInfoBase.h (original)
+++ lldb/trunk/include/lldb/Host/HostInfoBase.h Mon Jun  4 10:41:00 2018
@@ -98,7 +98,6 @@ protected:
   static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
   static bool ComputeHeaderDirectory(FileSpec &file_spec);
   static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
-  static bool ComputeClangDirectory(FileSpec &file_spec);
   static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
 
   static void ComputeHostArchitectureSupport(ArchSpec &arch_32,

Modified: lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h?rev=333933&r1=333932&r2=333933&view=diff
==
--- lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h (original)
+++ lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h Mon Jun  4 10:41:00 
2018
@@ -37,9 +37,6 @@ protected:
  ArchSpec &arch_64);
   static bool ComputeHeaderDirectory(FileSpec &file_spec);
   static bool ComputePythonDirectory(FileSpec &file_spec);
-  static bool ComputeClangDirectory(FileSpec &file_spec);
-  static bool ComputeClangDirectory(FileSpec &lldb_shlib_spec,
-FileSpec &file_spec, bool verify);
   static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
   static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
 };

Modified: lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h?rev=333933&r1=333932&r2=333933&view=diff
==
--- lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h Mon Jun  4 10:41:00 2018
@@ -33,13 +33,13 @@ public:
 
   static bool GetEnvironmentVar(const std::string &var_name, std::string &var);
 
+  static bool ComputePathRelativeToLibrary(FileSpec &file_spec,
+   llvm::StringRef dir);
+
 protected:
   static bool ComputeSupportExeDirectory(FileSpec &file_spec);
   static bool ComputeHeaderDirectory(FileSpec &file_spec);
   static bool ComputePythonDirectory(FileSpec &file_spec);
-  static bool ComputeClangDirectory(FileSpec &file_spec);
-  static bool ComputePathRelativeToLibrary(FileSpec &file_spec,
-   llvm::StringRef dir);
 };
 }
 

Modified: lldb/trunk/source/API/SBHostOS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=333933&r1=333932&r2=333933&view=diff
==
--- lldb/trunk/source/API/SBHostOS.cpp (original)
+++ lldb/trunk/source/API/SBHostOS.cpp Mon Jun  4 10:41:00 2018
@@ -17,6 +17,8 @@
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Log.h"
 
+#include "Plugins/ExpressionParser/Clang/ClangHost.h"
+
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/Path.h"
 
@@ -41,7 +43,12 @@ SBFileSpec SBHostOS::GetLLDBPythonPath()
 SBFileSpec SBHostOS::GetLLDBPath(lldb::PathType path_type) {
   SBFileSpec sb_fspec;
   FileSpec fspec;
-  if (HostInfo::GetLLDBPath(path_type, fspec))
+  bool Success = true;
+  if (path_type == ePathTypeClangDir)
+fspec = GetClangResourceDir();
+  else
+Success = HostInfo::GetLLDBPath(path_typ

[Lldb-commits] [PATCH] D47679: [lldb, lldb-mi] Enable lldb-mi -break-insert test on Windows.

2018-06-04 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova accepted this revision.
stella.stamenova added a comment.
This revision is now accepted and ready to land.

I stand corrected. The test didn't hang.


https://reviews.llvm.org/D47679



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


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

2018-06-04 Thread David Blaikie via Phabricator via lldb-commits
dblaikie added a comment.

In https://reviews.llvm.org/D47492#1120599, @jankratochvil wrote:

> FYI I have filed it for libstdc++ but I did not really understand their 
> reaction: Bug 86013 - std::vector::shrink_to_fit() could sometimes use 
> realloc() 


Happy to help explain it - which part(s) are you having a bit of trouble with?

It seems like the main one is that the implementation can't be sure that malloc 
was used to allocate the memory - since the global allocation function can be 
replaced & there's no convenient way to detect that.


Repository:
  rL LLVM

https://reviews.llvm.org/D47492



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


[Lldb-commits] [PATCH] D47742: Change SWIG output directory when building LLDB.framework with CMake

2018-06-04 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added a reviewer: clayborg.
Herald added a subscriber: mgorny.

Instead of assuming that SWIG generated files (e.g. lldb.py) will live
in scripts, we should set it to $LLDB_PYTHON_TARGET_DIR. This variable is set to
scripts, except when building LLDB.framework when it is set to
LLDB_FRAMEWORK_DIR.


https://reviews.llvm.org/D47742

Files:
  CMakeLists.txt
  scripts/CMakeLists.txt


Index: scripts/CMakeLists.txt
===
--- scripts/CMakeLists.txt
+++ scripts/CMakeLists.txt
@@ -35,7 +35,7 @@
 find_package(SWIG REQUIRED)
 add_custom_command(
   OUTPUT ${LLDB_WRAP_PYTHON}
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
+  OUTPUT ${LLDB_PYTHON_TARGET_DIR}/lldb.py
   DEPENDS ${SWIG_SOURCES}
   DEPENDS ${SWIG_INTERFACES}
   DEPENDS ${SWIG_HEADERS}
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -138,15 +138,15 @@
${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
--srcRoot=${LLDB_SOURCE_DIR}
--targetDir=${LLDB_PYTHON_TARGET_DIR}
-   --cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts
+   --cfgBldDir=${LLDB_PYTHON_TARGET_DIR}
--prefix=${CMAKE_BINARY_DIR}
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
--lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
${SIX_EXTRA_ARGS}
${FINISH_EXTRA_ARGS}
 VERBATIM
 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
-DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/scripts/lldb.py
+DEPENDS ${LLDB_PYTHON_TARGET_DIR}/lldb.py
 COMMENT "Python script sym-linking LLDB Python API")
 # We depend on liblldb being built before we can do this step.
 add_dependencies(finish_swig liblldb lldb-argdumper)


Index: scripts/CMakeLists.txt
===
--- scripts/CMakeLists.txt
+++ scripts/CMakeLists.txt
@@ -35,7 +35,7 @@
 find_package(SWIG REQUIRED)
 add_custom_command(
   OUTPUT ${LLDB_WRAP_PYTHON}
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
+  OUTPUT ${LLDB_PYTHON_TARGET_DIR}/lldb.py
   DEPENDS ${SWIG_SOURCES}
   DEPENDS ${SWIG_INTERFACES}
   DEPENDS ${SWIG_HEADERS}
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -138,15 +138,15 @@
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
--srcRoot=${LLDB_SOURCE_DIR}
--targetDir=${LLDB_PYTHON_TARGET_DIR}
-   --cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts
+   --cfgBldDir=${LLDB_PYTHON_TARGET_DIR}
--prefix=${CMAKE_BINARY_DIR}
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
--lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
${SIX_EXTRA_ARGS}
${FINISH_EXTRA_ARGS}
 VERBATIM
 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
-DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/scripts/lldb.py
+DEPENDS ${LLDB_PYTHON_TARGET_DIR}/lldb.py
 COMMENT "Python script sym-linking LLDB Python API")
 # We depend on liblldb being built before we can do this step.
 add_dependencies(finish_swig liblldb lldb-argdumper)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D47742: Change SWIG output directory when building LLDB.framework with CMake

2018-06-04 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added reviewers: labath, sas.
xiaobai added a comment.

I'm not sure who else would be interested in reviewing this. If you know 
somebody, please add them. :)


https://reviews.llvm.org/D47742



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


[Lldb-commits] [PATCH] D47742: Change SWIG output directory when building LLDB.framework with CMake

2018-06-04 Thread Stephane Sezer via Phabricator via lldb-commits
sas accepted this revision.
sas added inline comments.
This revision is now accepted and ready to land.



Comment at: CMakeLists.txt:149
 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
-DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/scripts/lldb.py
 COMMENT "Python script sym-linking LLDB Python API")

This path...



Comment at: scripts/CMakeLists.txt:38
   OUTPUT ${LLDB_WRAP_PYTHON}
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
   DEPENDS ${SWIG_SOURCES}

...and this path were not the same before your change. Was that a bug that 
you're fixing?


https://reviews.llvm.org/D47742



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


[Lldb-commits] [PATCH] D47742: Change SWIG output directory when building LLDB.framework with CMake

2018-06-04 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added inline comments.



Comment at: scripts/CMakeLists.txt:38
   OUTPUT ${LLDB_WRAP_PYTHON}
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
   DEPENDS ${SWIG_SOURCES}

sas wrote:
> ...and this path were not the same before your change. Was that a bug that 
> you're fixing?
Yes. Those paths were actually the same if you were not building the framework, 
which is why this bug never surfaced. Specifically, 
`${CMAKE_CURRENT_BINARY_DIR}` in scripts/CMakeLists.txt resolves to  the same 
path as `${CMAKE_CURRENT_BINARY_DIR}/scripts` in the top level CMakeLists.txt.

The pitfall is the assumption that this path is always the same as 
`${LLDB_PYTHON_TARGET_DIR}`, which it is not if you are trying to build the 
framework.


https://reviews.llvm.org/D47742



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


[Lldb-commits] [PATCH] D47679: [lldb, lldb-mi] Enable lldb-mi -break-insert test on Windows.

2018-06-04 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333963: [lldb, lldb-mi] Enable lldb-mi -break-insert test on 
Windows. (authored by apolyakov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47679?vs=149629&id=149863#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47679

Files:
  lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test


Index: lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test
===
--- lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test
+++ lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test
@@ -1,16 +1,15 @@
-# REQUIRES: nowindows
+# XFAIL: windows
 # -> llvm.org/pr24452
-# Rather than XFAILing the test, skip it on Windows because it hangs
-
-# RUN: %cc %p/inputs/break-insert.c -g
+#
+# RUN: %cc -o a.exe %p/inputs/break-insert.c -g
 # RUN: %lldbmi < %s | FileCheck %s
 
 # Test that a breakpoint can be inserted before creating a target.
 
 -break-insert breakpoint
 # CHECK: ^done,bkpt={number="1"
 
--file-exec-and-symbols a.out
+-file-exec-and-symbols a.exe
 # CHECK: ^done
 
 -exec-run


Index: lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test
===
--- lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test
+++ lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test
@@ -1,16 +1,15 @@
-# REQUIRES: nowindows
+# XFAIL: windows
 # -> llvm.org/pr24452
-# Rather than XFAILing the test, skip it on Windows because it hangs
-
-# RUN: %cc %p/inputs/break-insert.c -g
+#
+# RUN: %cc -o a.exe %p/inputs/break-insert.c -g
 # RUN: %lldbmi < %s | FileCheck %s
 
 # Test that a breakpoint can be inserted before creating a target.
 
 -break-insert breakpoint
 # CHECK: ^done,bkpt={number="1"
 
--file-exec-and-symbols a.out
+-file-exec-and-symbols a.exe
 # CHECK: ^done
 
 -exec-run
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333963 - [lldb, lldb-mi] Enable lldb-mi -break-insert test on Windows.

2018-06-04 Thread Alexander Polyakov via lldb-commits
Author: apolyakov
Date: Mon Jun  4 15:39:40 2018
New Revision: 333963

URL: http://llvm.org/viewvc/llvm-project?rev=333963&view=rev
Log:
[lldb, lldb-mi] Enable lldb-mi -break-insert test on Windows.

Summary:
The default name for a compiler output on Linux is `a.out`,
while on Windows it's `a.exe`. But if we add option `-o a.exe`,
the compiler will create the executable `a.exe` on the both systems.

Reviewers: aprantl, stella.stamenova

Reviewed By: stella.stamenova

Subscribers: ki.stfu, llvm-commits, lldb-commits

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

Modified:
lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test

Modified: lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test?rev=333963&r1=333962&r2=333963&view=diff
==
--- lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test (original)
+++ lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test Mon Jun  4 
15:39:40 2018
@@ -1,8 +1,7 @@
-# REQUIRES: nowindows
+# XFAIL: windows
 # -> llvm.org/pr24452
-# Rather than XFAILing the test, skip it on Windows because it hangs
-
-# RUN: %cc %p/inputs/break-insert.c -g
+#
+# RUN: %cc -o a.exe %p/inputs/break-insert.c -g
 # RUN: %lldbmi < %s | FileCheck %s
 
 # Test that a breakpoint can be inserted before creating a target.
@@ -10,7 +9,7 @@
 -break-insert breakpoint
 # CHECK: ^done,bkpt={number="1"
 
--file-exec-and-symbols a.out
+-file-exec-and-symbols a.exe
 # CHECK: ^done
 
 -exec-run


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


[Lldb-commits] [PATCH] D47742: Change SWIG output directory when building LLDB.framework with CMake

2018-06-04 Thread Stephane Sezer via Phabricator via lldb-commits
sas added inline comments.



Comment at: scripts/CMakeLists.txt:38
   OUTPUT ${LLDB_WRAP_PYTHON}
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
   DEPENDS ${SWIG_SOURCES}

xiaobai wrote:
> sas wrote:
> > ...and this path were not the same before your change. Was that a bug that 
> > you're fixing?
> Yes. Those paths were actually the same if you were not building the 
> framework, which is why this bug never surfaced. Specifically, 
> `${CMAKE_CURRENT_BINARY_DIR}` in scripts/CMakeLists.txt resolves to  the same 
> path as `${CMAKE_CURRENT_BINARY_DIR}/scripts` in the top level CMakeLists.txt.
> 
> The pitfall is the assumption that this path is always the same as 
> `${LLDB_PYTHON_TARGET_DIR}`, which it is not if you are trying to build the 
> framework.
Makes sense. This should be good to go then.


https://reviews.llvm.org/D47742



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


[Lldb-commits] [PATCH] D47147: DWARFIndex: Reduce duplication in the GetFunctions methods

2018-06-04 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.

Some if statements simplifications if you want to, but looks good.




Comment at: source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp:193-195
+  if (!ObjCLanguage::IsPossibleObjCMethodName(die_name))
+continue;
+  dies.push_back(die);

```
if (ObjCLanguage::IsPossibleObjCMethodName(die_name))
  dies.push_back(die);
```



Comment at: source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:448-451
+  if (!SymbolFileDWARF::DIEInDeclContext(&parent_decl_ctx, die))
+continue; // The containing decl contexts don't match
+
+  dies.push_back(die);

```
if (SymbolFileDWARF::DIEInDeclContext(&parent_decl_ctx, die))
  dies.push_back(die);
```



Comment at: source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:464
+
+  dies.push_back(die);
 }

```
if (die)
  dies.push_back(die);
```



Comment at: source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:474-477
+  if (!die)
+continue;
+
+  dies.push_back(die);

```
if (die)
  dies.push_back(die);
```


https://reviews.llvm.org/D47147



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


[Lldb-commits] [PATCH] D47629: [DWARF] Add (empty) DebugNamesDWARFIndex class and a setting to control its use

2018-06-04 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:122
+PropertyDefinition g_experimental_properties[] = {
+{"use-debug-names", OptionValue::eTypeBoolean, true, 0, nullptr, nullptr,
+ "Use .debug_names index section."},

Would it be better to use an inverse setting like "always-manually-index"? That 
way if there is something wrong with any of the indexes that are generated, 
then we can fall back to manually indexing? Otherwise we will need to remove 
this later.


https://reviews.llvm.org/D47629



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


[Lldb-commits] [PATCH] D47742: Change SWIG output directory when building LLDB.framework with CMake

2018-06-04 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333968: Change SWIG output directory when building 
LLDB.framework with CMake (authored by xiaobai, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D47742

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/scripts/CMakeLists.txt


Index: lldb/trunk/scripts/CMakeLists.txt
===
--- lldb/trunk/scripts/CMakeLists.txt
+++ lldb/trunk/scripts/CMakeLists.txt
@@ -35,7 +35,7 @@
 find_package(SWIG REQUIRED)
 add_custom_command(
   OUTPUT ${LLDB_WRAP_PYTHON}
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
+  OUTPUT ${LLDB_PYTHON_TARGET_DIR}/lldb.py
   DEPENDS ${SWIG_SOURCES}
   DEPENDS ${SWIG_INTERFACES}
   DEPENDS ${SWIG_HEADERS}
Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -138,15 +138,15 @@
${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
--srcRoot=${LLDB_SOURCE_DIR}
--targetDir=${LLDB_PYTHON_TARGET_DIR}
-   --cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts
+   --cfgBldDir=${LLDB_PYTHON_TARGET_DIR}
--prefix=${CMAKE_BINARY_DIR}
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
--lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
${SIX_EXTRA_ARGS}
${FINISH_EXTRA_ARGS}
 VERBATIM
 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
-DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/scripts/lldb.py
+DEPENDS ${LLDB_PYTHON_TARGET_DIR}/lldb.py
 COMMENT "Python script sym-linking LLDB Python API")
 # We depend on liblldb being built before we can do this step.
 add_dependencies(finish_swig liblldb lldb-argdumper)


Index: lldb/trunk/scripts/CMakeLists.txt
===
--- lldb/trunk/scripts/CMakeLists.txt
+++ lldb/trunk/scripts/CMakeLists.txt
@@ -35,7 +35,7 @@
 find_package(SWIG REQUIRED)
 add_custom_command(
   OUTPUT ${LLDB_WRAP_PYTHON}
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
+  OUTPUT ${LLDB_PYTHON_TARGET_DIR}/lldb.py
   DEPENDS ${SWIG_SOURCES}
   DEPENDS ${SWIG_INTERFACES}
   DEPENDS ${SWIG_HEADERS}
Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -138,15 +138,15 @@
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
--srcRoot=${LLDB_SOURCE_DIR}
--targetDir=${LLDB_PYTHON_TARGET_DIR}
-   --cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts
+   --cfgBldDir=${LLDB_PYTHON_TARGET_DIR}
--prefix=${CMAKE_BINARY_DIR}
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
--lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
${SIX_EXTRA_ARGS}
${FINISH_EXTRA_ARGS}
 VERBATIM
 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
-DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/scripts/lldb.py
+DEPENDS ${LLDB_PYTHON_TARGET_DIR}/lldb.py
 COMMENT "Python script sym-linking LLDB Python API")
 # We depend on liblldb being built before we can do this step.
 add_dependencies(finish_swig liblldb lldb-argdumper)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333968 - Change SWIG output directory when building LLDB.framework with CMake

2018-06-04 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Mon Jun  4 16:47:36 2018
New Revision: 333968

URL: http://llvm.org/viewvc/llvm-project?rev=333968&view=rev
Log:
Change SWIG output directory when building LLDB.framework with CMake

Instead of assuming that SWIG generated files (e.g. lldb.py) will live
in scripts, we should set it to $LLDB_PYTHON_TARGET_DIR. This variable is set to
scripts, except when building LLDB.framework when it is set to
LLDB_FRAMEWORK_DIR.

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

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

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=333968&r1=333967&r2=333968&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Mon Jun  4 16:47:36 2018
@@ -138,7 +138,7 @@ if (NOT LLDB_DISABLE_PYTHON)
${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
--srcRoot=${LLDB_SOURCE_DIR}
--targetDir=${LLDB_PYTHON_TARGET_DIR}
-   --cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts
+   --cfgBldDir=${LLDB_PYTHON_TARGET_DIR}
--prefix=${CMAKE_BINARY_DIR}
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
--lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
@@ -146,7 +146,7 @@ if (NOT LLDB_DISABLE_PYTHON)
${FINISH_EXTRA_ARGS}
 VERBATIM
 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
-DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/scripts/lldb.py
+DEPENDS ${LLDB_PYTHON_TARGET_DIR}/lldb.py
 COMMENT "Python script sym-linking LLDB Python API")
 # We depend on liblldb being built before we can do this step.
 add_dependencies(finish_swig liblldb lldb-argdumper)

Modified: lldb/trunk/scripts/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/CMakeLists.txt?rev=333968&r1=333967&r2=333968&view=diff
==
--- lldb/trunk/scripts/CMakeLists.txt (original)
+++ lldb/trunk/scripts/CMakeLists.txt Mon Jun  4 16:47:36 2018
@@ -35,7 +35,7 @@ get_filename_component(CFGBLDDIR ${LLDB_
 find_package(SWIG REQUIRED)
 add_custom_command(
   OUTPUT ${LLDB_WRAP_PYTHON}
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
+  OUTPUT ${LLDB_PYTHON_TARGET_DIR}/lldb.py
   DEPENDS ${SWIG_SOURCES}
   DEPENDS ${SWIG_INTERFACES}
   DEPENDS ${SWIG_HEADERS}


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


[Lldb-commits] [lldb] r333971 - Add ClangHost.cpp to the Xcode project.

2018-06-04 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Mon Jun  4 17:19:03 2018
New Revision: 333971

URL: http://llvm.org/viewvc/llvm-project?rev=333971&view=rev
Log:
Add ClangHost.cpp to the Xcode project.  

Also add an include that was needed for the if APPLE branch
of the function.


Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=333971&r1=333970&r2=333971&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Jun  4 17:19:03 2018
@@ -758,6 +758,7 @@
4CD44CFD20B37C440003557C /* AppleDWARFIndex.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CD44CFA20B37C440003557C /* AppleDWARFIndex.cpp 
*/; };
4CD44D2220B725DA0003557C /* SystemInitializerLLGS.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CD44D2020B725DA0003557C /* 
SystemInitializerLLGS.cpp */; };
4CD44D4220B777850003557C /* DWARFBaseDIE.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CD44D4020B777850003557C /* DWARFBaseDIE.cpp */; 
};
+   4CD44D5820C603CB0003557C /* ClangHost.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 4CD44D5620C603A80003557C /* ClangHost.cpp */; };
4CDB8D6D1DBA91B6006C5B13 /* LibStdcppUniquePointer.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CDB8D671DBA91A6006C5B13 /* 
LibStdcppUniquePointer.cpp */; };
4CDB8D6E1DBA91B6006C5B13 /* LibStdcppTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp 
*/; };
4CE4EFAA1E8999B900A80C06 /* PlatformOpenBSD.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CE4EFA61E8999B000A80C06 /* PlatformOpenBSD.cpp 
*/; };
@@ -2667,6 +2668,8 @@
4CD44D2320B725F60003557C /* SystemInitializerLLGS.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = 
SystemInitializerLLGS.h; path = "tools/lldb-server/SystemInitializerLLGS.h"; 
sourceTree = ""; };
4CD44D4020B777850003557C /* DWARFBaseDIE.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DWARFBaseDIE.cpp; sourceTree = ""; };
4CD44D4120B777850003557C /* DWARFBaseDIE.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
DWARFBaseDIE.h; sourceTree = ""; };
+   4CD44D5620C603A80003557C /* ClangHost.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ClangHost.cpp; 
path = ExpressionParser/Clang/ClangHost.cpp; sourceTree = ""; };
+   4CD44D5720C603A90003557C /* ClangHost.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ClangHost.h; path 
= ExpressionParser/Clang/ClangHost.h; sourceTree = ""; };
4CDB8D671DBA91A6006C5B13 /* LibStdcppUniquePointer.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = LibStdcppUniquePointer.cpp; path = 
Language/CPlusPlus/LibStdcppUniquePointer.cpp; sourceTree = ""; };
4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibStdcppTuple.cpp; path = Language/CPlusPlus/LibStdcppTuple.cpp; 
sourceTree = ""; };
4CE4EFA61E8999B000A80C06 /* PlatformOpenBSD.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = PlatformOpenBSD.cpp; sourceTree = ""; };
@@ -6003,6 +6006,8 @@
4C98D3E0118FB98F00E575D0 /* 
ClangFunctionCaller.h */,
4C98D3DA118FB96F00E575D0 /* 
ClangFunctionCaller.cpp */,
26BC7DC010F1B79500F91463 /* 
ClangExpressionHelper.h */,
+   4CD44D5720C603A90003557C /* ClangHost.h */,
+   4CD44D5620C603A80003557C /* ClangHost.cpp */,
49445E341225AB6A00C11A81 /* 
ClangUserExpression.h */,
26BC7ED510F1B86700F91463 /* 
ClangUserExpression.cpp */,
497C86C1122823F300B54702 /* 
ClangUtilityFunction.h */,
@@ -8126,6 +8131,7 @@
490A36C0180F0E6F00BA31F8 /* PlatformWindows.cpp 
in Sources */,
260CC65015D0440D002BF2E0 /* 
OptionValueFormat.cpp in Sources */,
260CC65115D0440D002BF2E0 /* 
OptionValueSInt64.cpp in Sources */,
+   4CD44D5820C603CB0003557C /* ClangHost.cpp in 
Sources */,
260CC65215D0440D002BF2E0 /* 
OptionValueString.cpp in Sources */,
6D5

[Lldb-commits] [lldb] r333974 - Fix Expression unittests on Darwin

2018-06-04 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Jun  4 17:32:41 2018
New Revision: 333974

URL: http://llvm.org/viewvc/llvm-project?rev=333974&view=rev
Log:
Fix Expression unittests on Darwin

Fixes the Expression unittests on Darwin after r333933 was landed.

Modified:
lldb/trunk/unittests/Expression/CMakeLists.txt
lldb/trunk/unittests/Expression/ClangParserTest.cpp

Modified: lldb/trunk/unittests/Expression/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Expression/CMakeLists.txt?rev=333974&r1=333973&r2=333974&view=diff
==
--- lldb/trunk/unittests/Expression/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Expression/CMakeLists.txt Mon Jun  4 17:32:41 2018
@@ -4,6 +4,8 @@ add_lldb_unittest(ExpressionTests
 
   LINK_LIBS
 lldbCore
-lldbPluginExpressionParserGo
 lldbPluginExpressionParserClang
+lldbPluginExpressionParserGo
+lldbUtility
+lldbUtilityHelpers
   )

Modified: lldb/trunk/unittests/Expression/ClangParserTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Expression/ClangParserTest.cpp?rev=333974&r1=333973&r2=333974&view=diff
==
--- lldb/trunk/unittests/Expression/ClangParserTest.cpp (original)
+++ lldb/trunk/unittests/Expression/ClangParserTest.cpp Mon Jun  4 17:32:41 2018
@@ -9,6 +9,7 @@
 
 #include "Plugins/ExpressionParser/Clang/ClangHost.h"
 #include "TestingSupport/TestUtilities.h"
+#include "lldb/Utility/FileSpec.h"
 #include "lldb/lldb-defines.h"
 #include "gtest/gtest.h"
 


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