[Lldb-commits] [PATCH] D35083: [TypeSystem] Guard the global `ASTSourceMap` with a mutex

2017-07-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

This is an awfully complex solution which in the end doesn't actually enforce 
that you take the lock to get the SourceMap.  You have to know to wrap the 
access in this WithExclusiveSourceMap.  Wouldn't it be simpler to make 
GetSourceMap take a reference to a std::unique_lock which it fills in as, for 
instance:

  ExecutionContext::ExecutionContext(const ExecutionContextRef _ctx_ref,
 std::unique_lock 
)

does, constructing the unique_lock with its mutex:

  lock = std::unique_lock(m_target_sp->GetAPIMutex());

Then the caller will have to make this lock, pass it in, and the lock hold for 
the scope of the caller, e.g.:

  SBCompileUnit SBFrame::GetCompileUnit() const {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
SBCompileUnit sb_comp_unit;
std::unique_lock lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
  
  ...
  }

This is much more readable AND enforces that you have to provide a lock to call 
the function.


Repository:
  rL LLVM

https://reviews.llvm.org/D35083



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


[Lldb-commits] [PATCH] D35083: [TypeSystem] Guard the global `ASTSourceMap` with a mutex

2017-07-06 Thread Lang Hames via Phabricator via lldb-commits
lhames added inline comments.



Comment at: source/Symbol/ClangExternalASTSourceCommon.cpp:24
+template 
+static decltype(std::declval()(std::declval()))
+WithExclusiveSourceMap(FnType fn) {

Does std::result_of::type work as the return type?

http://en.cppreference.com/w/cpp/types/result_of



Comment at: source/Symbol/ClangExternalASTSourceCommon.cpp:28
   static ASTSourceMap *s_source_map = new ASTSourceMap;
-  return *s_source_map;
+  static std::mutex s_source_map_mutex;
+  

Should this be on a context object of some kind (ASTContext?).


Repository:
  rL LLVM

https://reviews.llvm.org/D35083



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


[Lldb-commits] [lldb] r307335 - Fix Xcode project file for gtest schemes.

2017-07-06 Thread Tim Hammerquist via lldb-commits
Author: penryu
Date: Thu Jul  6 16:25:35 2017
New Revision: 307335

URL: http://llvm.org/viewvc/llvm-project?rev=307335=rev
Log:
Fix Xcode project file for gtest schemes.



Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=307335=307334=307335=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jul  6 16:25:35 2017
@@ -868,6 +868,8 @@
966C6B7C18E6A56A0093F5EC /* libz.dylib in Frameworks */ = {isa 
= PBXBuildFile; fileRef = 966C6B7818E6A56A0093F5EC /* libz.dylib */; };
9694FA711B32AA64005EBB16 /* ABISysV_mips.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9694FA6F1B32AA64005EBB16 /* ABISysV_mips.cpp */; 
};
9A0FDEA71E8EF5110086B2F5 /* RegisterContextLinux_mips.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A0FDE971E8EF5010086B2F5 /* 
RegisterContextLinux_mips.cpp */; };
+   9A1542F91F0EE48600DEA1D8 /* MockTildeExpressionResolver.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A1542F51F0EE44000DEA1D8 /* 
MockTildeExpressionResolver.cpp */; };
+   9A1542FA1F0EE48600DEA1D8 /* TestUtilities.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A1542F71F0EE44000DEA1D8 /* TestUtilities.cpp 
*/; };
9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = 
PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = 
{ATTRIBUTES = (Public, ); }; };
9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; };
9A1E595C1EB2B141002206A5 /* SBTrace.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */; };
@@ -2815,6 +2817,11 @@
9A0FDE991E8EF5010086B2F5 /* RegisterInfos_arm.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
RegisterInfos_arm.h; path = Utility/RegisterInfos_arm.h; sourceTree = 
""; };
9A0FDE9A1E8EF5010086B2F5 /* RegisterInfos_arm64.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
RegisterInfos_arm64.h; path = Utility/RegisterInfos_arm64.h; sourceTree = 
""; };
9A0FDE9B1E8EF5010086B2F5 /* RegisterInfos_mips.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
RegisterInfos_mips.h; path = Utility/RegisterInfos_mips.h; sourceTree = 
""; };
+   9A1542F41F0EE44000DEA1D8 /* CMakeLists.txt */ = {isa = 
PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = 
""; };
+   9A1542F51F0EE44000DEA1D8 /* MockTildeExpressionResolver.cpp */ 
= {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
MockTildeExpressionResolver.cpp; sourceTree = ""; };
+   9A1542F61F0EE44000DEA1D8 /* MockTildeExpressionResolver.h */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
MockTildeExpressionResolver.h; sourceTree = ""; };
+   9A1542F71F0EE44000DEA1D8 /* TestUtilities.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
TestUtilities.cpp; sourceTree = ""; };
+   9A1542F81F0EE44000DEA1D8 /* TestUtilities.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestUtilities.h; 
sourceTree = ""; };
9A19A6A51163BB7E00E0D453 /* SBValue.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBValue.h; path = include/lldb/API/SBValue.h; sourceTree = ""; };
9A19A6AD1163BB9800E0D453 /* SBValue.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBValue.cpp; path = source/API/SBValue.cpp; sourceTree = ""; };
9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBTrace.cpp; path = source/API/SBTrace.cpp; sourceTree = ""; };
@@ -3305,6 +3312,7 @@
2321F9421BDD343A00BA9A93 /* Utility */ = {
isa = PBXGroup;
children = (
+   9A1542F31F0EE44000DEA1D8 /* Helpers */,
2321F9431BDD346100BA9A93 /* CMakeLists.txt */,
23CB15041D66CD9200EDDDE1 /* Inputs */,
2321F9441BDD346100BA9A93 /* 
StringExtractorTest.cpp */,
@@ -6216,6 +6224,18 @@
name = "SysV-mips";
sourceTree = "";
};
+   9A1542F31F0EE44000DEA1D8 /* Helpers */ = {
+   isa = PBXGroup;
+   

[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Joerg Sonnenberger via Phabricator via lldb-commits
joerg added inline comments.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:115
   _type:   
\
   name = #_type
   switch (type) {

krytarowski wrote:
> brunoalr wrote:
> > joerg wrote:
> > > labath wrote:
> > > > If we go about renaming them, then we should change this, as we still 
> > > > want to display the standard name of the entries.
> > > Or name = "AUXV_AT_???" ENTRY_NAME(type) name = #type and then return 
> > > name + 4;
> > Hmm that looks too "hacky", doesn't it?
> `name + 4` looks prettier to me.
Just using the name directly makes this searchable. The cleanup is an 
implementation detail, even if it might waste a bit space.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:46
+  /// Added AUXV prefix because some targets already define names such as
+  /// AT_DCACHEBSIZE in system headers
   enum EntryType {

brunoalr wrote:
> joerg wrote:
> > I think most targets do, but they don't pull the relevant system headers in 
> > via namespace pollution.
> Should I change this comment to
> 
> ```
> /// Added AUXV prefix to avoid potential conflicts with system-defined MACROS
> ```
> ?
Yes, please.


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:115
   _type:   
\
   name = #_type
   switch (type) {

brunoalr wrote:
> joerg wrote:
> > labath wrote:
> > > If we go about renaming them, then we should change this, as we still 
> > > want to display the standard name of the entries.
> > Or name = "AUXV_AT_???" ENTRY_NAME(type) name = #type and then return name 
> > + 4;
> Hmm that looks too "hacky", doesn't it?
`name + 4` looks prettier to me.


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr added inline comments.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:115
   _type:   
\
   name = #_type
   switch (type) {

joerg wrote:
> labath wrote:
> > If we go about renaming them, then we should change this, as we still want 
> > to display the standard name of the entries.
> Or name = "AUXV_AT_???" ENTRY_NAME(type) name = #type and then return name + 
> 4;
Hmm that looks too "hacky", doesn't it?


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr added inline comments.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:46
+  /// Added AUXV prefix because some targets already define names such as
+  /// AT_DCACHEBSIZE in system headers
   enum EntryType {

joerg wrote:
> I think most targets do, but they don't pull the relevant system headers in 
> via namespace pollution.
Should I change this comment to

```
/// Added AUXV prefix to avoid potential conflicts with system-defined MACROS
```
?


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Joerg Sonnenberger via Phabricator via lldb-commits
joerg added inline comments.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:115
   _type:   
\
   name = #_type
   switch (type) {

labath wrote:
> If we go about renaming them, then we should change this, as we still want to 
> display the standard name of the entries.
Or name = "AUXV_AT_???" ENTRY_NAME(type) name = #type and then return name + 4;



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:46
+  /// Added AUXV prefix because some targets already define names such as
+  /// AT_DCACHEBSIZE in system headers
   enum EntryType {

I think most targets do, but they don't pull the relevant system headers in via 
namespace pollution.


https://reviews.llvm.org/D35065



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


[Lldb-commits] [lldb] r307320 - Change remaining references to lit.util.capture to use subprocess.check_output.

2017-07-06 Thread David L. Jones via lldb-commits
Author: dlj
Date: Thu Jul  6 14:46:47 2017
New Revision: 307320

URL: http://llvm.org/viewvc/llvm-project?rev=307320=rev
Log:
Change remaining references to lit.util.capture to use subprocess.check_output.

Summary:
The capture() function was removed in r306625. This should fix PGO breakages
reported by Michael Zolotukhin.

Reviewers: mzolotukhin

Subscribers: sanjoy, llvm-commits

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

Modified:
lldb/trunk/lit/lit.cfg

Modified: lldb/trunk/lit/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.cfg?rev=307320=307319=307320=diff
==
--- lldb/trunk/lit/lit.cfg (original)
+++ lldb/trunk/lit/lit.cfg Thu Jul  6 14:46:47 2017
@@ -95,8 +95,8 @@ if config.test_exec_root is None:
 lit_config.fatal('No site specific configuration available!')
 
 # Get the source and object roots.
-llvm_src_root = lit.util.capture(['llvm-config', '--src-root']).strip()
-llvm_obj_root = lit.util.capture(['llvm-config', '--obj-root']).strip()
+llvm_src_root = subprocess.check_output(['llvm-config', 
'--src-root']).strip()
+llvm_obj_root = subprocess.check_output(['llvm-config', 
'--obj-root']).strip()
 lldb_src_root = os.path.join(llvm_src_root, "tools", "lldb")
 lldb_obj_root = os.path.join(llvm_obj_root, "tools", "lldb")
 
@@ -132,7 +132,7 @@ if not os.path.exists(config.cxx):
 
 if platform.system() in ['Darwin']:
 try:
-out = lit.util.capture(['xcrun', '--show-sdk-path']).strip()
+out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip()
 res = 0
 except OSError:
 res = -1


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


[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr updated this revision to Diff 105517.
brunoalr added a comment.

Add comments


https://reviews.llvm.org/D35065

Files:
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -561,7 +561,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::EvalVdsoStatus() {
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_SYSINFO_EHDR);
 
   if (I != m_auxv->end())
 m_vdso_base = I->value;
@@ -574,7 +574,7 @@
   if (m_auxv.get() == NULL)
 return LLDB_INVALID_ADDRESS;
 
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_ENTRY);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_ENTRY);
 
   if (I == m_auxv->end())
 return LLDB_INVALID_ADDRESS;
Index: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
@@ -42,41 +42,43 @@
 
   /// Constants describing the type of entry.
   /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX information.
+  /// Added AUXV prefix because some targets already define names such as
+  /// AT_DCACHEBSIZE in system headers
   enum EntryType {
-AT_NULL = 0,  ///< End of auxv.
-AT_IGNORE = 1,///< Ignore entry.
-AT_EXECFD = 2,///< File descriptor of program.
-AT_PHDR = 3,  ///< Program headers.
-AT_PHENT = 4, ///< Size of program header.
-AT_PHNUM = 5, ///< Number of program headers.
-AT_PAGESZ = 6,///< Page size.
-AT_BASE = 7,  ///< Interpreter base address.
-AT_FLAGS = 8, ///< Flags.
-AT_ENTRY = 9, ///< Program entry point.
-AT_NOTELF = 10,   ///< Set if program is not an ELF.
-AT_UID = 11,  ///< UID.
-AT_EUID = 12, ///< Effective UID.
-AT_GID = 13,  ///< GID.
-AT_EGID = 14, ///< Effective GID.
-AT_CLKTCK = 17,   ///< Clock frequency (e.g. times(2)).
-AT_PLATFORM = 15, ///< String identifying platform.
-AT_HWCAP = 16,///< Machine dependent hints about processor capabilities.
-AT_FPUCW = 18,///< Used FPU control word.
-AT_DCACHEBSIZE = 19,   ///< Data cache block size.
-AT_ICACHEBSIZE = 20,   ///< Instruction cache block size.
-AT_UCACHEBSIZE = 21,   ///< Unified cache block size.
-AT_IGNOREPPC = 22, ///< Entry should be ignored.
-AT_SECURE = 23,///< Boolean, was exec setuid-like?
-AT_BASE_PLATFORM = 24, ///< String identifying real platforms.
-AT_RANDOM = 25,///< Address of 16 random bytes.
-AT_EXECFN = 31,///< Filename of executable.
-AT_SYSINFO = 32, ///< Pointer to the global system page used for system
- ///calls and other nice things.
-AT_SYSINFO_EHDR = 33,
-AT_L1I_CACHESHAPE = 34, ///< Shapes of the caches.
-AT_L1D_CACHESHAPE = 35,
-AT_L2_CACHESHAPE = 36,
-AT_L3_CACHESHAPE = 37,
+AUXV_AT_NULL = 0,///< End of auxv.
+AUXV_AT_IGNORE = 1,  ///< Ignore entry.
+AUXV_AT_EXECFD = 2,  ///< File descriptor of program.
+AUXV_AT_PHDR = 3,///< Program headers.
+AUXV_AT_PHENT = 4,   ///< Size of program header.
+AUXV_AT_PHNUM = 5,   ///< Number of program headers.
+AUXV_AT_PAGESZ = 6,  ///< Page size.
+AUXV_AT_BASE = 7,///< Interpreter base address.
+AUXV_AT_FLAGS = 8,   ///< Flags.
+AUXV_AT_ENTRY = 9,   ///< Program entry point.
+AUXV_AT_NOTELF = 10, ///< Set if program is not an ELF.
+AUXV_AT_UID = 11,///< UID.
+AUXV_AT_EUID = 12,   ///< Effective UID.
+AUXV_AT_GID = 13,///< GID.
+AUXV_AT_EGID = 14,   ///< Effective GID.
+AUXV_AT_CLKTCK = 17, ///< Clock frequency (e.g. times(2)).
+AUXV_AT_PLATFORM = 15,   ///< String identifying platform.
+AUXV_AT_HWCAP = 16,  ///< Machine dependent hints about processor capabilities.
+AUXV_AT_FPUCW = 18,  ///< Used FPU control word.
+AUXV_AT_DCACHEBSIZE = 19,///< Data cache block size.
+AUXV_AT_ICACHEBSIZE = 20,///< Instruction cache block size.
+AUXV_AT_UCACHEBSIZE = 21,///< Unified cache block size.
+AUXV_AT_IGNOREPPC = 22,  ///< Entry should be ignored.
+AUXV_AT_SECURE = 23, ///< Boolean, was exec setuid-like?
+AUXV_AT_BASE_PLATFORM = 24,  ///< String identifying real platforms.
+AUXV_AT_RANDOM = 25, ///< Address of 16 

[Lldb-commits] [PATCH] D35083: [TypeSystem] Guard the global `ASTSourceMap` with a mutex

2017-07-06 Thread Sean Callanan via Phabricator via lldb-commits
spyffe created this revision.

`s_source_map` in `ClangExternalASTSourceCommon.cpp` is unguarded and therefore 
can break in multithreaded conditions.  This can cause crashes in particular if 
multiple targets are being set up at once.

This patch wraps `s_source_map` in a function that ensures exclusivity, and 
makes every user of it use that function instead.


Repository:
  rL LLVM

https://reviews.llvm.org/D35083

Files:
  source/Symbol/ClangExternalASTSourceCommon.cpp


Index: source/Symbol/ClangExternalASTSourceCommon.cpp
===
--- source/Symbol/ClangExternalASTSourceCommon.cpp
+++ source/Symbol/ClangExternalASTSourceCommon.cpp
@@ -10,41 +10,55 @@
 #include "lldb/Symbol/ClangExternalASTSourceCommon.h"
 #include "lldb/Utility/Stream.h"
 
+#include 
+
 using namespace lldb_private;
 
 uint64_t g_TotalSizeOfMetadata = 0;
 
 typedef llvm::DenseMap
 ASTSourceMap;
 
-static ASTSourceMap () {
+template 
+static decltype(std::declval()(std::declval()))
+WithExclusiveSourceMap(FnType fn) {
   // Intentionally leaked to avoid problems with global destructors.
   static ASTSourceMap *s_source_map = new ASTSourceMap;
-  return *s_source_map;
+  static std::mutex s_source_map_mutex;
+  
+  {
+std::lock_guard source_map_locker(s_source_map_mutex);
+return fn(*s_source_map);
+  }
 }
 
 ClangExternalASTSourceCommon *
 ClangExternalASTSourceCommon::Lookup(clang::ExternalASTSource *source) {
-  ASTSourceMap _map = GetSourceMap();
-
-  ASTSourceMap::iterator iter = source_map.find(source);
-
-  if (iter != source_map.end()) {
-return iter->second;
-  } else {
-return nullptr;
-  }
+  return WithExclusiveSourceMap(
+  [source](ASTSourceMap _map) -> ClangExternalASTSourceCommon * {
+ASTSourceMap::iterator iter = source_map.find(source);
+
+if (iter != source_map.end()) {
+  return iter->second;
+} else {
+  return nullptr;
+}
+  });
 }
 
 ClangExternalASTSourceCommon::ClangExternalASTSourceCommon()
 : clang::ExternalASTSource() {
+  WithExclusiveSourceMap([this](ASTSourceMap _map) {
+source_map[this] = this;
+  });
   g_TotalSizeOfMetadata += m_metadata.size();
-  GetSourceMap()[this] = this;
 }
 
 ClangExternalASTSourceCommon::~ClangExternalASTSourceCommon() {
-  GetSourceMap().erase(this);
+  WithExclusiveSourceMap([this](ASTSourceMap _map) {
+source_map.erase(this);
+  });
   g_TotalSizeOfMetadata -= m_metadata.size();
 }
 


Index: source/Symbol/ClangExternalASTSourceCommon.cpp
===
--- source/Symbol/ClangExternalASTSourceCommon.cpp
+++ source/Symbol/ClangExternalASTSourceCommon.cpp
@@ -10,41 +10,55 @@
 #include "lldb/Symbol/ClangExternalASTSourceCommon.h"
 #include "lldb/Utility/Stream.h"
 
+#include 
+
 using namespace lldb_private;
 
 uint64_t g_TotalSizeOfMetadata = 0;
 
 typedef llvm::DenseMap
 ASTSourceMap;
 
-static ASTSourceMap () {
+template 
+static decltype(std::declval()(std::declval()))
+WithExclusiveSourceMap(FnType fn) {
   // Intentionally leaked to avoid problems with global destructors.
   static ASTSourceMap *s_source_map = new ASTSourceMap;
-  return *s_source_map;
+  static std::mutex s_source_map_mutex;
+  
+  {
+std::lock_guard source_map_locker(s_source_map_mutex);
+return fn(*s_source_map);
+  }
 }
 
 ClangExternalASTSourceCommon *
 ClangExternalASTSourceCommon::Lookup(clang::ExternalASTSource *source) {
-  ASTSourceMap _map = GetSourceMap();
-
-  ASTSourceMap::iterator iter = source_map.find(source);
-
-  if (iter != source_map.end()) {
-return iter->second;
-  } else {
-return nullptr;
-  }
+  return WithExclusiveSourceMap(
+  [source](ASTSourceMap _map) -> ClangExternalASTSourceCommon * {
+ASTSourceMap::iterator iter = source_map.find(source);
+
+if (iter != source_map.end()) {
+  return iter->second;
+} else {
+  return nullptr;
+}
+  });
 }
 
 ClangExternalASTSourceCommon::ClangExternalASTSourceCommon()
 : clang::ExternalASTSource() {
+  WithExclusiveSourceMap([this](ASTSourceMap _map) {
+source_map[this] = this;
+  });
   g_TotalSizeOfMetadata += m_metadata.size();
-  GetSourceMap()[this] = this;
 }
 
 ClangExternalASTSourceCommon::~ClangExternalASTSourceCommon() {
-  GetSourceMap().erase(this);
+  WithExclusiveSourceMap([this](ASTSourceMap _map) {
+source_map.erase(this);
+  });
   g_TotalSizeOfMetadata -= m_metadata.size();
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr updated this revision to Diff 105515.
brunoalr added a comment.

Fixing replace mistake.


https://reviews.llvm.org/D35065

Files:
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -561,7 +561,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::EvalVdsoStatus() {
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_SYSINFO_EHDR);
 
   if (I != m_auxv->end())
 m_vdso_base = I->value;
@@ -574,7 +574,7 @@
   if (m_auxv.get() == NULL)
 return LLDB_INVALID_ADDRESS;
 
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_ENTRY);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_ENTRY);
 
   if (I == m_auxv->end())
 return LLDB_INVALID_ADDRESS;
Index: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
@@ -43,40 +43,40 @@
   /// Constants describing the type of entry.
   /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX information.
   enum EntryType {
-AT_NULL = 0,  ///< End of auxv.
-AT_IGNORE = 1,///< Ignore entry.
-AT_EXECFD = 2,///< File descriptor of program.
-AT_PHDR = 3,  ///< Program headers.
-AT_PHENT = 4, ///< Size of program header.
-AT_PHNUM = 5, ///< Number of program headers.
-AT_PAGESZ = 6,///< Page size.
-AT_BASE = 7,  ///< Interpreter base address.
-AT_FLAGS = 8, ///< Flags.
-AT_ENTRY = 9, ///< Program entry point.
-AT_NOTELF = 10,   ///< Set if program is not an ELF.
-AT_UID = 11,  ///< UID.
-AT_EUID = 12, ///< Effective UID.
-AT_GID = 13,  ///< GID.
-AT_EGID = 14, ///< Effective GID.
-AT_CLKTCK = 17,   ///< Clock frequency (e.g. times(2)).
-AT_PLATFORM = 15, ///< String identifying platform.
-AT_HWCAP = 16,///< Machine dependent hints about processor capabilities.
-AT_FPUCW = 18,///< Used FPU control word.
-AT_DCACHEBSIZE = 19,   ///< Data cache block size.
-AT_ICACHEBSIZE = 20,   ///< Instruction cache block size.
-AT_UCACHEBSIZE = 21,   ///< Unified cache block size.
-AT_IGNOREPPC = 22, ///< Entry should be ignored.
-AT_SECURE = 23,///< Boolean, was exec setuid-like?
-AT_BASE_PLATFORM = 24, ///< String identifying real platforms.
-AT_RANDOM = 25,///< Address of 16 random bytes.
-AT_EXECFN = 31,///< Filename of executable.
-AT_SYSINFO = 32, ///< Pointer to the global system page used for system
- ///calls and other nice things.
-AT_SYSINFO_EHDR = 33,
-AT_L1I_CACHESHAPE = 34, ///< Shapes of the caches.
-AT_L1D_CACHESHAPE = 35,
-AT_L2_CACHESHAPE = 36,
-AT_L3_CACHESHAPE = 37,
+AUXV_AT_NULL = 0,///< End of auxv.
+AUXV_AT_IGNORE = 1,  ///< Ignore entry.
+AUXV_AT_EXECFD = 2,  ///< File descriptor of program.
+AUXV_AT_PHDR = 3,///< Program headers.
+AUXV_AT_PHENT = 4,   ///< Size of program header.
+AUXV_AT_PHNUM = 5,   ///< Number of program headers.
+AUXV_AT_PAGESZ = 6,  ///< Page size.
+AUXV_AT_BASE = 7,///< Interpreter base address.
+AUXV_AT_FLAGS = 8,   ///< Flags.
+AUXV_AT_ENTRY = 9,   ///< Program entry point.
+AUXV_AT_NOTELF = 10, ///< Set if program is not an ELF.
+AUXV_AT_UID = 11,///< UID.
+AUXV_AT_EUID = 12,   ///< Effective UID.
+AUXV_AT_GID = 13,///< GID.
+AUXV_AT_EGID = 14,   ///< Effective GID.
+AUXV_AT_CLKTCK = 17, ///< Clock frequency (e.g. times(2)).
+AUXV_AT_PLATFORM = 15,   ///< String identifying platform.
+AUXV_AT_HWCAP = 16,  ///< Machine dependent hints about processor capabilities.
+AUXV_AT_FPUCW = 18,  ///< Used FPU control word.
+AUXV_AT_DCACHEBSIZE = 19,///< Data cache block size.
+AUXV_AT_ICACHEBSIZE = 20,///< Instruction cache block size.
+AUXV_AT_UCACHEBSIZE = 21,///< Unified cache block size.
+AUXV_AT_IGNOREPPC = 22,  ///< Entry should be ignored.
+AUXV_AT_SECURE = 23, ///< Boolean, was exec setuid-like?
+AUXV_AT_BASE_PLATFORM = 24,  ///< String identifying real platforms.
+AUXV_AT_RANDOM = 25, ///< Address of 16 random bytes.
+AUXV_AT_EXECFN = 31, ///< Filename of executable.
+AUXV_AT_SYSINFO = 32,   

[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr updated this revision to Diff 105514.
brunoalr added a comment.

Renaming enum consistently and updating name ENTRY_NAME macro to
correctly assign the standard names of aux vector entries.


https://reviews.llvm.org/D35065

Files:
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -561,7 +561,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::EvalVdsoStatus() {
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_SYSINFO_EHDR);
 
   if (I != m_auxv->end())
 m_vdso_base = I->value;
@@ -574,7 +574,7 @@
   if (m_auxv.get() == NULL)
 return LLDB_INVALID_ADDRESS;
 
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_ENTRY);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_ENTRY);
 
   if (I == m_auxv->end())
 return LLDB_INVALID_ADDRESS;
Index: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
@@ -43,40 +43,40 @@
   /// Constants describing the type of entry.
   /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX information.
   enum EntryType {
-AT_NULL = 0,  ///< End of auxv.
-AT_IGNORE = 1,///< Ignore entry.
-AT_EXECFD = 2,///< File descriptor of program.
-AT_PHDR = 3,  ///< Program headers.
-AT_PHENT = 4, ///< Size of program header.
-AT_PHNUM = 5, ///< Number of program headers.
-AT_PAGESZ = 6,///< Page size.
-AT_BASE = 7,  ///< Interpreter base address.
-AT_FLAGS = 8, ///< Flags.
-AT_ENTRY = 9, ///< Program entry point.
-AT_NOTELF = 10,   ///< Set if program is not an ELF.
-AT_UID = 11,  ///< UID.
-AT_EUID = 12, ///< Effective UID.
-AT_GID = 13,  ///< GID.
-AT_EGID = 14, ///< Effective GID.
-AT_CLKTCK = 17,   ///< Clock frequency (e.g. times(2)).
-AT_PLATFORM = 15, ///< String identifying platform.
-AT_HWCAP = 16,///< Machine dependent hints about processor capabilities.
-AT_FPUCW = 18,///< Used FPU control word.
-AT_DCACHEBSIZE = 19,   ///< Data cache block size.
-AT_ICACHEBSIZE = 20,   ///< Instruction cache block size.
-AT_UCACHEBSIZE = 21,   ///< Unified cache block size.
-AT_IGNOREPPC = 22, ///< Entry should be ignored.
-AT_SECURE = 23,///< Boolean, was exec setuid-like?
-AT_BASE_PLATFORM = 24, ///< String identifying real platforms.
-AT_RANDOM = 25,///< Address of 16 random bytes.
-AT_EXECFN = 31,///< Filename of executable.
-AT_SYSINFO = 32, ///< Pointer to the global system page used for system
- ///calls and other nice things.
-AT_SYSINFO_EHDR = 33,
-AT_L1I_CACHESHAPE = 34, ///< Shapes of the caches.
-AT_L1D_CACHESHAPE = 35,
-AT_L2_CACHESHAPE = 36,
-AT_L3_CACHESHAPE = 37,
+AUXV_AT_NULL = 0,///< End of auxv.
+AUXV_AT_IGNORE = 1,  ///< Ignore entry.
+AUXV_AT_EXECFD = 2,  ///< File descriptor of program.
+AUXV_AT_PHDR = 3,///< Program headers.
+AUXV_AT_PHENT = 4,   ///< Size of program header.
+AUXV_AT_PHNUM = 5,   ///< Number of program headers.
+AUXV_AT_PAGESZ = 6,  ///< Page size.
+AUXV_AT_BASE = 7,///< Interpreter base address.
+AUXV_AT_FLAGS = 8,   ///< Flags.
+AUXV_AT_ENTRY = 9,   ///< Program entry point.
+AUXV_AT_NOTELF = 10, ///< Set if program is not an ELF.
+AUXV_AT_UID = 11,///< UID.
+AUXV_AT_EUID = 12,   ///< Effective UID.
+AUXV_AT_GID = 13,///< GID.
+AUXV_AT_EGID = 14,   ///< Effective GID.
+AUXV_AT_CLKTCK = 17, ///< Clock frequency (e.g. times(2)).
+AUXV_AT_PLATFORM = 15,   ///< String identifying platform.
+AUXV_AT_HWCAP = 16,  ///< Machine dependent hints about processor capabilities.
+AUXV_AT_FPUCW = 18,  ///< Used FPU control word.
+AUXV_AT_DCACHEBSIZE = 19,///< Data cache block size.
+AUXV_AT_ICACHEBSIZE = 20,///< Instruction cache block size.
+AUXV_AT_UCACHEBSIZE = 21,///< Unified cache block size.
+AUXV_AT_IGNOREPPC = 22,  ///< Entry should be ignored.
+AUXV_AT_SECURE = 23, ///< Boolean, was exec setuid-like?
+AUXV_AT_BASE_PLATFORM = 24,  ///< String identifying real platforms.
+AUXV_AT_RANDOM = 25, ///< Address of 16 

[Lldb-commits] [lldb] r307287 - Working through testcases, converting to run_to_source_breakpoint.

2017-07-06 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Jul  6 11:06:25 2017
New Revision: 307287

URL: http://llvm.org/viewvc/llvm-project?rev=307287=rev
Log:
Working through testcases, converting to run_to_source_breakpoint.

Modified:

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

lldb/trunk/packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py

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

lldb/trunk/packages/Python/lldbsuite/test/expression_command/timeout/TestCallWithTimeout.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py?rev=307287=307286=307287=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py
 Thu Jul  6 11:06:25 2017
@@ -32,26 +32,9 @@ class Issue11581TestCase(TestBase):
 """valobj.AddressOf() should return correct values."""
 self.build()
 
-exe = os.path.join(os.getcwd(), "a.out")
-
-target = self.dbg.CreateTarget(exe)
-self.assertTrue(target, VALID_TARGET)
-
-breakpoint = target.BreakpointCreateBySourceRegex(
-'Set breakpoint here.', lldb.SBFileSpec("main.cpp", False))
-
-process = target.LaunchSimple(
-None, None, self.get_process_working_directory())
-self.assertTrue(process, "Created a process.")
-self.assertTrue(
-process.GetState() == lldb.eStateStopped,
-"Stopped it too.")
-
-thread_list = lldbutil.get_threads_stopped_at_breakpoint(
-process, breakpoint)
-self.assertTrue(len(thread_list) == 1)
-thread = thread_list[0]
-
+(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self, 
+  'Set breakpoint here.', 
+  lldb.SBFileSpec("main.cpp", 
False))
 self.runCmd("command script import --allow-reload s11588.py")
 self.runCmd(
 "type synthetic add --python-class 
s11588.Issue11581SyntheticProvider StgClosure")

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py?rev=307287=307286=307287=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py
 Thu Jul  6 11:06:25 2017
@@ -30,32 +30,8 @@ class TestMacros(TestBase):
 src_file_spec = lldb.SBFileSpec(src_file)
 self.assertTrue(src_file_spec.IsValid(), "Main source file")
 
-# Get the path of the executable
-cwd = os.getcwd()
-exe_file = "a.out"
-exe_path = os.path.join(cwd, exe_file)
-
-# Load the executable
-target = self.dbg.CreateTarget(exe_path)
-self.assertTrue(target.IsValid(), VALID_TARGET)
-
-# Set breakpoints
-bp1 = target.BreakpointCreateBySourceRegex("Break here", src_file_spec)
-self.assertTrue(
-bp1.IsValid() and bp1.GetNumLocations() >= 1,
-VALID_BREAKPOINT)
-
-# Launch the process
-process = target.LaunchSimple(
-None, None, self.get_process_working_directory())
-self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
-
-# Get the thread of the process
-self.assertTrue(
-process.GetState() == lldb.eStateStopped,
-PROCESS_STOPPED)
-thread = lldbutil.get_stopped_thread(
-process, lldb.eStopReasonBreakpoint)
+(target, process, thread, bp1) = lldbutil.run_to_source_breakpoint(
+self, "Break here", src_file_spec)
 
 # Get frame for current thread
 frame = thread.GetSelectedFrame()

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py?rev=307287=307286=307287=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py
 Thu Jul  6 11:06:25 2017
@@ 

[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr marked 2 inline comments as done.
brunoalr added a comment.

In https://reviews.llvm.org/D35065#800906, @joerg wrote:

> If you want to go this way, rename them consistently and use a different 
> prefix (e.g. AUXV_*) please.


Wiil do.


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr marked an inline comment as done.
brunoalr added inline comments.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:11
 // C Includes
 #include 
 #include 

labath wrote:
> Do you still get the error if you remove these includes?
> 
> As far as I can tell they are unused, and this part of the code should not 
> depend on system headers anyway.
> 
> If that doesn't help, then we should use a different prefix as joerg suggests.
I just tried it and it doesn't help, unfortunately.


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr added a comment.

In https://reviews.llvm.org/D35065#800877, @krytarowski wrote:

> What are the build failures?




  [2397/3183] Building CXX object 
tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeFiles/lldbPluginDynamicLoaderPosixDYLD.dir/AuxVector.cpp.o
  FAILED: 
tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeFiles/lldbPluginDynamicLoaderPosixDYLD.dir/AuxVector.cpp.o
  /usr/bin/c++   -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLIBXML2_DEFINED 
-DLLDB_USE_BUILTIN_DEMANGLER -DLLVM_BUILD_GLOBAL_ISEL -D_DEBUG -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIM
  IT_MACROS -Itools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD 
-I/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD 
-Itools/lldb/include -I/home/brosa/llvm/tools/lldb/include -Iinclude
  -I/home/brosa/llvm/include -I/usr/include/python2.7 
-I/home/brosa/llvm/tools/clang/include -Itools/lldb/../clang/include 
-I/usr/include/libxml2 -I/home/brosa/llvm/tools/lldb/source/. -fPIC 
-fvisibility-
  inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic 
-Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virt
  ual-dtor -Wno-comment -Wno-deprecated-declarations -Wno-unknown-pragmas 
-Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -g
-fno-exceptions -fno-rtti -MD -MT tools/lldb/source/Plugins
  
/DynamicLoader/POSIX-DYLD/CMakeFiles/lldbPluginDynamicLoaderPosixDYLD.dir/AuxVector.cpp.o
 -MF 
tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeFiles/lldbPluginDynamicLoaderPosixDYLD.dir/AuxVector
  .cpp.o.d -o 
tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeFiles/lldbPluginDynamicLoaderPosixDYLD.dir/AuxVector.cpp.o
 -c /home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxV
  ector.cpp
  In file included from /usr/include/powerpc64le-linux-gnu/asm/elf.h:17:0,
   from /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:13,
   from /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:27,
   from /usr/include/signal.h:306,
   from 
/home/brosa/llvm/tools/lldb/include/lldb/lldb-types.h:17,
   from 
/home/brosa/llvm/tools/lldb/include/lldb/lldb-private-interfaces.h:17,
   from 
/home/brosa/llvm/tools/lldb/include/lldb/lldb-private.h:17,
   from 
/home/brosa/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h:21,
   from 
/home/brosa/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointSite.h:22,
   from 
/home/brosa/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointSiteList.h:21,
   from 
/home/brosa/llvm/tools/lldb/include/lldb/Target/Process.h:29,
   from 
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:17:
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:65:5:
 error: expected identifier before numeric constant
   AT_DCACHEBSIZE = 19,   ///< Data cache block size.
   ^
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:65:5:
 error: expected ‘}’ before numeric constant
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:65:5:
 error: expected unqualified-id before numeric constant
  In file included from 
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:26:0:
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:82:1:
 error: expected unqualified-id before ‘private’
   private:
   ^~~
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:85:1:
 error: expected unqualified-id before ‘public’
   public:
   ^~
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:88:3:
 error: ‘iterator’ does not name a type
 iterator begin() const { return m_auxv.begin(); }
 ^~~~
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:89:3:
 error: ‘iterator’ does not name a type
 iterator end() const { return m_auxv.end(); }
 ^~~~
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:91:3:
 error: ‘iterator’ does not name a type
 iterator FindEntry(EntryType type) const;
 ^~~~
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:93:41:
 error: ‘Entry’ does not name a type
 static const char *GetEntryName(const Entry ) {
   ^
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:
 In function ‘const char* GetEntryName(const int&)’:
  
/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h:94:37:
 error: ‘EntryType’ does not name a type
   return GetEntryName(static_cast(entry.type));
   

[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:11
 // C Includes
 #include 
 #include 

Do you still get the error if you remove these includes?

As far as I can tell they are unused, and this part of the code should not 
depend on system headers anyway.

If that doesn't help, then we should use a different prefix as joerg suggests.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:115
   _type:   
\
   name = #_type
   switch (type) {

If we go about renaming them, then we should change this, as we still want to 
display the standard name of the entries.


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35070: Extend DynamicLibrary class to be usable without loading permanently.

2017-07-06 Thread Frederich Munch via Phabricator via lldb-commits
marsupial created this revision.

https://reviews.llvm.org/D35070

Files:
  include/lldb/Core/Debugger.h
  include/lldb/lldb-private-types.h
  source/API/SBDebugger.cpp
  source/Core/Debugger.cpp
  source/Core/PluginManager.cpp

Index: source/Core/PluginManager.cpp
===
--- source/Core/PluginManager.cpp
+++ source/Core/PluginManager.cpp
@@ -52,11 +52,9 @@
 typedef void (*PluginTermCallback)();
 
 struct PluginInfo {
-  PluginInfo() : plugin_init_callback(nullptr), plugin_term_callback(nullptr) {}
-
-  llvm::sys::DynamicLibrary library;
-  PluginInitCallback plugin_init_callback;
-  PluginTermCallback plugin_term_callback;
+  llvm::sys::DynamicLibrary* library = nullptr;
+  PluginInitCallback plugin_init_callback = nullptr;
+  PluginTermCallback plugin_term_callback = nullptr;
 };
 
 typedef std::map PluginTerminateMap;
@@ -113,19 +111,19 @@
   std::string pluginLoadError;
   plugin_info.library = llvm::sys::DynamicLibrary::getPermanentLibrary(
   plugin_file_spec.GetPath().c_str(), );
-  if (plugin_info.library.isValid()) {
+  if (plugin_info.library) {
 bool success = false;
 plugin_info.plugin_init_callback = CastToFPtr(
-plugin_info.library.getAddressOfSymbol("LLDBPluginInitialize"));
+plugin_info.library->getAddressOfSymbol("LLDBPluginInitialize"));
 if (plugin_info.plugin_init_callback) {
   // Call the plug-in "bool LLDBPluginInitialize(void)" function
   success = plugin_info.plugin_init_callback();
 }
 
 if (success) {
   // It is ok for the "LLDBPluginTerminate" symbol to be nullptr
   plugin_info.plugin_term_callback = CastToFPtr(
-  plugin_info.library.getAddressOfSymbol("LLDBPluginTerminate"));
+  plugin_info.library->getAddressOfSymbol("LLDBPluginTerminate"));
 } else {
   // The initialize function returned FALSE which means the plug-in
   // might not be
@@ -185,14 +183,12 @@
   std::lock_guard guard(GetPluginMapMutex());
   PluginTerminateMap _map = GetPluginMap();
 
-  PluginTerminateMap::const_iterator pos, end = plugin_map.end();
-  for (pos = plugin_map.begin(); pos != end; ++pos) {
+  for (const auto  : plugin_map) {
+const PluginInfo  = pos.second;
 // Call the plug-in "void LLDBPluginTerminate (void)" function if there
 // is one (if the symbol was not nullptr).
-if (pos->second.library.isValid()) {
-  if (pos->second.plugin_term_callback)
-pos->second.plugin_term_callback();
-}
+if (plugin.library && plugin.plugin_term_callback)
+  plugin.plugin_term_callback();
   }
   plugin_map.clear();
 }
Index: source/Core/Debugger.cpp
===
--- source/Core/Debugger.cpp
+++ source/Core/Debugger.cpp
@@ -582,9 +582,8 @@
 
 bool Debugger::LoadPlugin(const FileSpec , Status ) {
   if (g_load_plugin_callback) {
-llvm::sys::DynamicLibrary dynlib =
-g_load_plugin_callback(shared_from_this(), spec, error);
-if (dynlib.isValid()) {
+if (llvm::sys::DynamicLibrary *dynlib =
+g_load_plugin_callback(shared_from_this(), spec, error)) {
   m_loaded_plugins.push_back(dynlib);
   return true;
 }
Index: source/API/SBDebugger.cpp
===
--- source/API/SBDebugger.cpp
+++ source/API/SBDebugger.cpp
@@ -55,21 +55,20 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static llvm::sys::DynamicLibrary LoadPlugin(const lldb::DebuggerSP _sp,
-const FileSpec ,
-Status ) {
-  llvm::sys::DynamicLibrary dynlib =
-  llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str());
-  if (dynlib.isValid()) {
+static llvm::sys::DynamicLibrary *
+LoadPlugin(const lldb::DebuggerSP _sp, const FileSpec ,
+   Status ) {
+  if (llvm::sys::DynamicLibrary *dynlib =
+  llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str())) {
 typedef bool (*LLDBCommandPluginInit)(lldb::SBDebugger & debugger);
 
 lldb::SBDebugger debugger_sb(debugger_sp);
 // This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger)
 // function.
 // TODO: mangle this differently for your system - on OSX, the first
 // underscore needs to be removed and the second one stays
 LLDBCommandPluginInit init_func =
-(LLDBCommandPluginInit)dynlib.getAddressOfSymbol(
+(LLDBCommandPluginInit)dynlib->getAddressOfSymbol(
 "_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
 if (init_func) {
   if (init_func(debugger_sb))
@@ -88,7 +87,7 @@
 else
   error.SetErrorString("no such file");
   }
-  return llvm::sys::DynamicLibrary();
+  return nullptr;
 }
 
 static llvm::ManagedStatic g_debugger_lifetime;
Index: 

[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Joerg Sonnenberger via Phabricator via lldb-commits
joerg added a comment.

If you want to go this way, rename them consistently and use a different prefix 
(e.g. AUXV_*) please.


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

What are the build failures?


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-06 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr added a comment.

In https://reviews.llvm.org/D35065#800852, @krytarowski wrote:

> Values like AT_NULL are macros on NetBSD and there are no problems?


I haven't tested in ppc64le on NetBSD, but I'm afraid the same problems would 
occur.


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35065: Rename enums in AuxVector

2017-07-06 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr created this revision.

On linux on ppc64le some of the enums in AuxVector have the same name
as macros defined in the system.


https://reviews.llvm.org/D35065

Files:
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp


Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -561,7 +561,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::EvalVdsoStatus() {
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDRENTRY);
 
   if (I != m_auxv->end())
 m_vdso_base = I->value;
Index: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
@@ -62,17 +62,17 @@
 AT_PLATFORM = 15, ///< String identifying platform.
 AT_HWCAP = 16,///< Machine dependent hints about processor 
capabilities.
 AT_FPUCW = 18,///< Used FPU control word.
-AT_DCACHEBSIZE = 19,   ///< Data cache block size.
-AT_ICACHEBSIZE = 20,   ///< Instruction cache block size.
-AT_UCACHEBSIZE = 21,   ///< Unified cache block size.
-AT_IGNOREPPC = 22, ///< Entry should be ignored.
+AT_DCACHEBLOCKSIZE = 19,   ///< Data cache block size.
+AT_ICACHEBLOCKSIZE = 20,   ///< Instruction cache block size.
+AT_UCACHEBLOCKSIZE = 21,   ///< Unified cache block size.
+AT_IGNOREPPCENTRY = 22, ///< Entry should be ignored.
 AT_SECURE = 23,///< Boolean, was exec setuid-like?
 AT_BASE_PLATFORM = 24, ///< String identifying real platforms.
 AT_RANDOM = 25,///< Address of 16 random bytes.
 AT_EXECFN = 31,///< Filename of executable.
 AT_SYSINFO = 32, ///< Pointer to the global system page used for system
  ///calls and other nice things.
-AT_SYSINFO_EHDR = 33,
+AT_SYSINFO_EHDRENTRY = 33,
 AT_L1I_CACHESHAPE = 34, ///< Shapes of the caches.
 AT_L1D_CACHESHAPE = 35,
 AT_L2_CACHESHAPE = 36,
Index: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
@@ -133,16 +133,16 @@
 case ENTRY_NAME(AT_PLATFORM);   break;
 case ENTRY_NAME(AT_HWCAP);  break;
 case ENTRY_NAME(AT_FPUCW);  break;
-case ENTRY_NAME(AT_DCACHEBSIZE);break;
-case ENTRY_NAME(AT_ICACHEBSIZE);break;
-case ENTRY_NAME(AT_UCACHEBSIZE);break;
-case ENTRY_NAME(AT_IGNOREPPC);  break;
+case ENTRY_NAME(AT_DCACHEBLOCKSIZE);break;
+case ENTRY_NAME(AT_ICACHEBLOCKSIZE);break;
+case ENTRY_NAME(AT_UCACHEBLOCKSIZE);break;
+case ENTRY_NAME(AT_IGNOREPPCENTRY);  break;
 case ENTRY_NAME(AT_SECURE); break;
 case ENTRY_NAME(AT_BASE_PLATFORM);  break;
 case ENTRY_NAME(AT_RANDOM); break;
 case ENTRY_NAME(AT_EXECFN); break;
 case ENTRY_NAME(AT_SYSINFO);break;
-case ENTRY_NAME(AT_SYSINFO_EHDR);   break;
+case ENTRY_NAME(AT_SYSINFO_EHDRENTRY);   break;
 case ENTRY_NAME(AT_L1I_CACHESHAPE); break;
 case ENTRY_NAME(AT_L1D_CACHESHAPE); break;
 case ENTRY_NAME(AT_L2_CACHESHAPE);  break;


Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -561,7 +561,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::EvalVdsoStatus() {
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDRENTRY);
 
   if (I != m_auxv->end())
 m_vdso_base = I->value;
Index: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
@@ -62,17 +62,17 @@
 AT_PLATFORM = 15, ///< String identifying platform.
 AT_HWCAP = 16,///< Machine dependent hints about processor capabilities.
 AT_FPUCW = 18,///< Used FPU control word.
-AT_DCACHEBSIZE = 19,   ///< Data cache block size.
-AT_ICACHEBSIZE = 20,   ///< Instruction cache block size.
-AT_UCACHEBSIZE = 21,   ///< Unified cache block size.
-AT_IGNOREPPC = 22, ///< Entry should be ignored.
+AT_DCACHEBLOCKSIZE = 

[Lldb-commits] [PATCH] D33035: Tool for using Intel(R) Processor Trace hardware feature

2017-07-06 Thread Abhishek via Phabricator via lldb-commits
abhishek.aggarwal updated this revision to Diff 105434.
abhishek.aggarwal added a comment.

Removed std::vector<> from public APIs


https://reviews.llvm.org/D33035

Files:
  tools/CMakeLists.txt
  tools/intel-features/CMakeLists.txt
  tools/intel-features/README.txt
  tools/intel-features/cli-wrapper.cpp
  tools/intel-features/intel-mpx/CMakeLists.txt
  tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp
  tools/intel-features/intel-mpx/cli-wrapper-mpxtable.h
  tools/intel-features/intel-mpx/test/Makefile
  tools/intel-features/intel-mpx/test/README.txt
  tools/intel-features/intel-mpx/test/TestMPXTable.py
  tools/intel-features/intel-mpx/test/main.cpp
  tools/intel-features/intel-pt/CMakeLists.txt
  tools/intel-features/intel-pt/Decoder.cpp
  tools/intel-features/intel-pt/Decoder.h
  tools/intel-features/intel-pt/PTDecoder.cpp
  tools/intel-features/intel-pt/PTDecoder.h
  tools/intel-features/intel-pt/README_CLI.txt
  tools/intel-features/intel-pt/README_TOOL.txt
  tools/intel-features/intel-pt/interface/PTDecoder.i
  tools/intel-features/scripts/CMakeLists.txt
  tools/intel-features/scripts/lldb-intel-features.swig
  tools/intel-features/scripts/python-typemaps.txt
  tools/intel-mpx/CMakeLists.txt
  tools/intel-mpx/IntelMPXTablePlugin.cpp
  tools/intel-mpx/test/Makefile
  tools/intel-mpx/test/README.txt
  tools/intel-mpx/test/TestMPXTable.py
  tools/intel-mpx/test/main.cpp

Index: tools/intel-mpx/CMakeLists.txt
===
--- tools/intel-mpx/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
-  return ()
-endif ()
-
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
-add_library(lldb-intel-mpxtable SHARED
-  IntelMPXTablePlugin.cpp
-  )
-
-target_link_libraries(lldb-intel-mpxtable
-  PUBLIC liblldb LLVMSupport)
-
-install(TARGETS lldb-intel-mpxtable
-  LIBRARY DESTINATION bin)
Index: tools/intel-features/scripts/python-typemaps.txt
===
--- /dev/null
+++ tools/intel-features/scripts/python-typemaps.txt
@@ -0,0 +1,15 @@
+/* Typemap definitions to allow SWIG to properly handle some data types */
+
+// typemap for a char buffer
+%typemap(in) (char *dst, size_t dst_len) {
+   if (!PyInt_Check($input)) {
+   PyErr_SetString(PyExc_ValueError, "Expecting an integer");
+   return NULL;
+   }
+   $2 = PyInt_AsLong($input);
+   if ($2 <= 0) {
+   PyErr_SetString(PyExc_ValueError, "Positive integer expected");
+   return NULL;
+   }
+   $1 = (char *) malloc($2);
+}
Index: tools/intel-features/scripts/lldb-intel-features.swig
===
--- /dev/null
+++ tools/intel-features/scripts/lldb-intel-features.swig
@@ -0,0 +1,16 @@
+%module lldbIntelFeatures
+
+%{
+#include "lldb/lldb-public.h"
+#include "intel-pt/PTDecoder.h"
+using namespace ptdecoder;
+%}
+
+/* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h */
+#define __extension__
+
+/* Combined python typemap for all features */
+%include "python-typemaps.txt"
+
+/* Feature specific python interface files*/
+%include "../intel-pt/interface/PTDecoder.i"
Index: tools/intel-features/scripts/CMakeLists.txt
===
--- /dev/null
+++ tools/intel-features/scripts/CMakeLists.txt
@@ -0,0 +1,37 @@
+file(GLOB_RECURSE SWIG_SOURCES *.swig)
+
+set(FLAGS
+  -c++
+  -shadow
+  -python
+  -D__STDC_LIMIT_MACROS
+  -D__STDC_CONSTANT_MACROS
+  )
+
+set(INCLUDES
+  -I${LLDB_SOURCE_DIR}/include
+  -I${LLDB_SOURCE_DIR}/tools/intel-features/intel-pt
+  )
+
+set(OUTPUT_PYTHON_WRAPPER
+  ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+  )
+
+set(OUTPUT_PYTHON_SCRIPT_DIR
+  ${CMAKE_CURRENT_BINARY_DIR}
+  )
+
+find_package(SWIG REQUIRED)
+add_custom_command(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldbIntelFeatures.py
+  DEPENDS ${SWIG_SOURCES}
+  COMMAND ${SWIG_EXECUTABLE} ${FLAGS} ${INCLUDES} -o ${OUTPUT_PYTHON_WRAPPER} -outdir ${OUTPUT_PYTHON_SCRIPT_DIR} ${SWIG_SOURCES}
+  COMMENT "Generating python wrapper for features library")
+
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp PROPERTIES GENERATED 1)
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldbIntelFeatures.py PROPERTIES GENERATED 1)
+
+add_custom_target(intel-features-swig_wrapper ALL
+  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+  )
Index: tools/intel-features/intel-pt/interface/PTDecoder.i
===
--- /dev/null
+++ tools/intel-features/intel-pt/interface/PTDecoder.i
@@ -0,0 +1,10 @@
+%include "stdint.i"
+
+%include "lldb/lldb-defines.h"
+%include "lldb/lldb-enumerations.h"
+%include "lldb/lldb-forward.h"
+%include "lldb/lldb-types.h"
+
+%include "lldb/API/SBDefines.h"
+
+%include 

[Lldb-commits] [lldb] r307253 - Fix a copy-paste error in r307161

2017-07-06 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Jul  6 04:43:25 2017
New Revision: 307253

URL: http://llvm.org/viewvc/llvm-project?rev=307253=rev
Log:
Fix a copy-paste error in r307161

Modified:
lldb/trunk/tools/lldb-server/lldb-platform.cpp

Modified: lldb/trunk/tools/lldb-server/lldb-platform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-platform.cpp?rev=307253=307252=307253=diff
==
--- lldb/trunk/tools/lldb-server/lldb-platform.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-platform.cpp Thu Jul  6 04:43:25 2017
@@ -202,7 +202,7 @@ int main_platform(int argc, char *argv[]
 option_error = 4;
 break;
   }
-  if (port_offset HIGH_PORT) {
+  if (port_offset < LOW_PORT || port_offset > HIGH_PORT) {
 llvm::errs() << llvm::formatv("error: port offset {0} is not in the "
   "valid user port range of {1} - {2}\n",
   port_offset, LOW_PORT, HIGH_PORT);
@@ -219,7 +219,7 @@ int main_platform(int argc, char *argv[]
 option_error = 2;
 break;
   }
-  if (port_offset HIGH_PORT) {
+  if (portnum < LOW_PORT || portnum > HIGH_PORT) {
 llvm::errs() << llvm::formatv("error: port number {0} is not in the "
   "valid user port range of {1} - {2}\n",
   portnum, LOW_PORT, HIGH_PORT);


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


[Lldb-commits] [lldb] r307252 - Revert "Android.rules: build x86 tests with -mstackrealign"

2017-07-06 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Jul  6 04:43:20 2017
New Revision: 307252

URL: http://llvm.org/viewvc/llvm-project?rev=307252=rev
Log:
Revert "Android.rules: build x86 tests with -mstackrealign"

Starting with android ndk r15, clang much more tests are affected by the
-mstackrealign bugl (now nearly all functions are affected, and not just
the ones requiring 16-byte alignment). Due to their numbers, Xfailing
all of them is not a viable option, so we will just have to declare this
configuration unsupported, and wait until ndk ships a clang version that
has this bug fixed.

Modified:

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

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py?rev=307252=307251=307252=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
 Thu Jul  6 04:43:20 2017
@@ -31,8 +31,6 @@ class ReturnValueTestCase(TestBase):
 "<=",
 "3.6"],
 archs=["i386"])
-@expectedFailureAll(compiler="clang", compiler_version=["<=", 
"5.0.300080"],
-triple='.*-android', archs=["i386"])
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
 @add_test_categories(['pyapi'])
 def test_with_python(self):

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules?rev=307252=307251=307252=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules Thu Jul  6 
04:43:20 2017
@@ -90,7 +90,3 @@ else
 
ARCH_LDFLAGS += 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
 endif
-
-ifeq "$(ARCH)" "i386"
-   ARCH_CFLAGS += -mstackrealign
-endif


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


[Lldb-commits] [PATCH] D34945: Adding Support for Error Strings in Remote Packets

2017-07-06 Thread Ravitheja Addepally via Phabricator via lldb-commits
ravitheja updated this revision to Diff 105395.
ravitheja added a comment.

Correcting mistakes.


https://reviews.llvm.org/D34945

Files:
  docs/lldb-gdb-remote.txt
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.h

Index: source/Utility/StringExtractorGDBRemote.h
===
--- source/Utility/StringExtractorGDBRemote.h
+++ source/Utility/StringExtractorGDBRemote.h
@@ -10,6 +10,7 @@
 #ifndef utility_StringExtractorGDBRemote_h_
 #define utility_StringExtractorGDBRemote_h_
 
+#include "lldb/Utility/Status.h"
 #include "lldb/Utility/StringExtractor.h"
 #include "llvm/ADT/StringRef.h" // for StringRef
 
@@ -72,6 +73,7 @@
 eServerPacketType_qGetWorkingDir,
 eServerPacketType_qFileLoadAddress,
 eServerPacketType_QEnvironment,
+eServerPacketType_QEnableErrorStrings,
 eServerPacketType_QLaunchArch,
 eServerPacketType_QSetDisableASLR,
 eServerPacketType_QSetDetachOnError,
@@ -190,6 +192,8 @@
   // digits. Otherwise the error encoded in XX is returned.
   uint8_t GetError();
 
+  lldb_private::Status GetStatus();
+
   size_t GetEscapedBinaryData(std::string );
 
 protected:
Index: source/Utility/StringExtractorGDBRemote.cpp
===
--- source/Utility/StringExtractorGDBRemote.cpp
+++ source/Utility/StringExtractorGDBRemote.cpp
@@ -19,8 +19,18 @@
 
   switch (m_packet[0]) {
   case 'E':
-if (m_packet.size() == 3 && isxdigit(m_packet[1]) && isxdigit(m_packet[2]))
-  return eError;
+if (isxdigit(m_packet[1]) && isxdigit(m_packet[2])) {
+  if (m_packet.size() == 3)
+return eError;
+  llvm::StringRef packet_ref(m_packet);
+  if (packet_ref[3] == ';') {
+auto err_string = packet_ref.substr(4);
+for (auto e : err_string)
+  if (!isxdigit(e))
+return eResponse;
+return eError;
+  }
+}
 break;
 
   case 'O':
@@ -86,6 +96,8 @@
 return eServerPacketType_QEnvironment;
   if (PACKET_STARTS_WITH("QEnvironmentHexEncoded:"))
 return eServerPacketType_QEnvironmentHexEncoded;
+  if (PACKET_STARTS_WITH("QEnableErrorStrings"))
+return eServerPacketType_QEnableErrorStrings;
   break;
 
 case 'P':
@@ -438,8 +450,8 @@
 }
 
 bool StringExtractorGDBRemote::IsErrorResponse() const {
-  return GetResponseType() == eError && m_packet.size() == 3 &&
- isxdigit(m_packet[1]) && isxdigit(m_packet[2]);
+  return GetResponseType() == eError && isxdigit(m_packet[1]) &&
+ isxdigit(m_packet[2]);
 }
 
 uint8_t StringExtractorGDBRemote::GetError() {
@@ -450,6 +462,23 @@
   return 0;
 }
 
+lldb_private::Status StringExtractorGDBRemote::GetStatus() {
+  lldb_private::Status error;
+  if (GetResponseType() == eError) {
+SetFilePos(1);
+uint8_t errc = GetHexU8(255);
+error.SetError(errc, lldb::eErrorTypeGeneric);
+
+std::string error_messg("Error ");
+error_messg += std::to_string(errc);
+if (GetChar() == ';')
+  GetHexByteString(error_messg);
+
+error.SetErrorString(error_messg);
+  }
+  return error;
+}
+
 size_t StringExtractorGDBRemote::GetEscapedBinaryData(std::string ) {
   // Just get the data bytes in the string as
   // GDBRemoteCommunication::CheckForPacket()
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1031,6 +1031,7 @@
   m_gdb_comm.GetHostInfo();
   m_gdb_comm.GetVContSupported('c');
   m_gdb_comm.GetVAttachOrWaitSupported();
+  m_gdb_comm.EnableErrorStringInPacket();
 
   // Ask the remote server for the default thread id
   if (GetTarget().GetNonStopModeEnabled())
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1128,7 +1128,7 @@
   uid = m_debugged_process_sp->StartTrace(options, error);
   LLDB_LOG(log, "uid is {0} , error is {1}", uid, error.GetError());
   if (error.Fail())
-return SendErrorResponse(error.GetError());
+return SendErrorResponse(error);
 
   StreamGDBRemote response;
   response.Printf("%" PRIx64, uid);
@@ -1165,7 +1165,7 @@
   Status error = m_debugged_process_sp->StopTrace(uid, tid);
 
   if (error.Fail())
-

[Lldb-commits] [PATCH] D34945: Adding Support for Error Strings in Remote Packets

2017-07-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I am generally happy with this, just a couple of things I noticed below:




Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:3329
 } else {
-  error.SetError(response.GetError(), eErrorTypeGeneric);
+error = response.GetStatus();
 }

The indenting look wrong. Please run the patch through clang-format before 
submission.



Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h:158
 
+  PacketResult Handle_QErrorStringInPacketSupported(StringExtractorGDBRemote 
);
+

It doesn't look like you're implementing this anywhere. Please remove.



Comment at: source/Utility/StringExtractorGDBRemote.cpp:26
+  if (m_packet[3] == ';') {
+auto err_string = m_packet.substr(4);
+for(auto e : err_string)

Please use StringRef here. No need to copy the string just to examine it's 
contents.



Comment at: source/Utility/StringExtractorGDBRemote.cpp:29
+  if (!isxdigit(e))
+break;
+return eError;

This will break out of the inner for loop, which is probably not what you 
intended.


https://reviews.llvm.org/D34945



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


[Lldb-commits] [PATCH] D34945: Adding Support for Error Strings in Remote Packets

2017-07-06 Thread Ravitheja Addepally via Phabricator via lldb-commits
ravitheja updated this revision to Diff 105380.
ravitheja added a comment.

Support for Hex encoded strings and more error checking.


https://reviews.llvm.org/D34945

Files:
  docs/lldb-gdb-remote.txt
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.h

Index: source/Utility/StringExtractorGDBRemote.h
===
--- source/Utility/StringExtractorGDBRemote.h
+++ source/Utility/StringExtractorGDBRemote.h
@@ -11,6 +11,7 @@
 #define utility_StringExtractorGDBRemote_h_
 
 #include "lldb/Utility/StringExtractor.h"
+#include "lldb/Utility/Status.h"
 #include "llvm/ADT/StringRef.h" // for StringRef
 
 #include 
@@ -72,6 +73,7 @@
 eServerPacketType_qGetWorkingDir,
 eServerPacketType_qFileLoadAddress,
 eServerPacketType_QEnvironment,
+eServerPacketType_QEnableErrorStrings,
 eServerPacketType_QLaunchArch,
 eServerPacketType_QSetDisableASLR,
 eServerPacketType_QSetDetachOnError,
@@ -190,6 +192,8 @@
   // digits. Otherwise the error encoded in XX is returned.
   uint8_t GetError();
 
+  lldb_private::Status GetStatus();
+
   size_t GetEscapedBinaryData(std::string );
 
 protected:
Index: source/Utility/StringExtractorGDBRemote.cpp
===
--- source/Utility/StringExtractorGDBRemote.cpp
+++ source/Utility/StringExtractorGDBRemote.cpp
@@ -19,8 +19,17 @@
 
   switch (m_packet[0]) {
   case 'E':
-if (m_packet.size() == 3 && isxdigit(m_packet[1]) && isxdigit(m_packet[2]))
-  return eError;
+if (isxdigit(m_packet[1]) && isxdigit(m_packet[2])) {
+  if (m_packet.size() == 3)
+return eError;
+  if (m_packet[3] == ';') {
+auto err_string = m_packet.substr(4);
+for(auto e : err_string)
+  if (!isxdigit(e))
+break;
+return eError;
+  }
+}
 break;
 
   case 'O':
@@ -86,6 +95,8 @@
 return eServerPacketType_QEnvironment;
   if (PACKET_STARTS_WITH("QEnvironmentHexEncoded:"))
 return eServerPacketType_QEnvironmentHexEncoded;
+  if (PACKET_STARTS_WITH("QEnableErrorStrings"))
+return eServerPacketType_QEnableErrorStrings;
   break;
 
 case 'P':
@@ -438,7 +449,7 @@
 }
 
 bool StringExtractorGDBRemote::IsErrorResponse() const {
-  return GetResponseType() == eError && m_packet.size() == 3 &&
+  return GetResponseType() == eError &&
  isxdigit(m_packet[1]) && isxdigit(m_packet[2]);
 }
 
@@ -450,6 +461,24 @@
   return 0;
 }
 
+lldb_private::Status
+StringExtractorGDBRemote::GetStatus() {
+  lldb_private::Status error;
+  if (GetResponseType() == eError) {
+SetFilePos(1);
+uint8_t errc = GetHexU8(255);
+error.SetError(errc, lldb::eErrorTypeGeneric);
+
+std::string error_messg ("Error ");
+error_messg += std::to_string(errc);
+if (GetChar() == ';')
+  GetHexByteString(error_messg);
+
+error.SetErrorString(error_messg);
+  }
+  return error;
+}
+
 size_t StringExtractorGDBRemote::GetEscapedBinaryData(std::string ) {
   // Just get the data bytes in the string as
   // GDBRemoteCommunication::CheckForPacket()
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1031,6 +1031,7 @@
   m_gdb_comm.GetHostInfo();
   m_gdb_comm.GetVContSupported('c');
   m_gdb_comm.GetVAttachOrWaitSupported();
+  m_gdb_comm.EnableErrorStringInPacket();
 
   // Ask the remote server for the default thread id
   if (GetTarget().GetNonStopModeEnabled())
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -155,6 +155,8 @@
 
   PacketResult Handle_qRegisterInfo(StringExtractorGDBRemote );
 
+  PacketResult Handle_QErrorStringInPacketSupported(StringExtractorGDBRemote );
+
   PacketResult Handle_qfThreadInfo(StringExtractorGDBRemote );
 
   PacketResult Handle_qsThreadInfo(StringExtractorGDBRemote );
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++