[Lldb-commits] [lldb] r299276 - DisassembleRange can return an empty DisassemblerSP

2017-03-31 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Mar 31 17:39:55 2017
New Revision: 299276

URL: http://llvm.org/viewvc/llvm-project?rev=299276=rev
Log:
DisassembleRange can return an empty DisassemblerSP
check for it.



Modified:
lldb/trunk/source/Target/StackFrame.cpp

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=299276=299275=299276=diff
==
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Fri Mar 31 17:39:55 2017
@@ -1314,7 +1314,7 @@ lldb::ValueObjectSP StackFrame::GuessVal
   DisassemblerSP disassembler_sp = Disassembler::DisassembleRange(
   target_arch, plugin_name, flavor, exe_ctx, pc_range, prefer_file_cache);
 
-  if (!disassembler_sp->GetInstructionList().GetSize()) {
+  if (!disassembler_sp || !disassembler_sp->GetInstructionList().GetSize()) {
 return ValueObjectSP();
   }
 


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


[Lldb-commits] [lldb] r299261 - add more RegisterContext files to xcode project

2017-03-31 Thread Tim Hammerquist via lldb-commits
Author: penryu
Date: Fri Mar 31 16:03:58 2017
New Revision: 299261

URL: http://llvm.org/viewvc/llvm-project?rev=299261=rev
Log:
add more RegisterContext files to xcode project

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=299261=299260=299261=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Mar 31 16:03:58 2017
@@ -864,6 +864,7 @@
966C6B7A18E6A56A0093F5EC /* libz.dylib in Frameworks */ = {isa 
= PBXBuildFile; fileRef = 966C6B7818E6A56A0093F5EC /* libz.dylib */; };
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 */; };
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 */; };
9A22A161135E30370024DDC3 /* EmulateInstructionARM.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A22A15D135E30370024DDC3 /* 
EmulateInstructionARM.cpp */; };
@@ -2795,6 +2796,13 @@
966C6B7818E6A56A0093F5EC /* libz.dylib */ = {isa = 
PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = 
libz.dylib; path = /usr/lib/libz.dylib; sourceTree = ""; };
9694FA6F1B32AA64005EBB16 /* ABISysV_mips.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = ABISysV_mips.cpp; path = "SysV-mips/ABISysV_mips.cpp"; sourceTree = 
""; };
9694FA701B32AA64005EBB16 /* ABISysV_mips.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
ABISysV_mips.h; path = "SysV-mips/ABISysV_mips.h"; sourceTree = ""; };
+   9A0FDE951E8EF5010086B2F5 /* RegisterContext_mips.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
RegisterContext_mips.h; path = Utility/RegisterContext_mips.h; sourceTree = 
""; };
+   9A0FDE961E8EF5010086B2F5 /* RegisterContext_s390x.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
RegisterContext_s390x.h; path = Utility/RegisterContext_s390x.h; sourceTree = 
""; };
+   9A0FDE971E8EF5010086B2F5 /* RegisterContextLinux_mips.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = RegisterContextLinux_mips.cpp; path = 
Utility/RegisterContextLinux_mips.cpp; sourceTree = ""; };
+   9A0FDE981E8EF5010086B2F5 /* RegisterContextLinux_mips.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
name = RegisterContextLinux_mips.h; path = Utility/RegisterContextLinux_mips.h; 
sourceTree = ""; };
+   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 = 
""; };
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 = ""; };
9A22A15D135E30370024DDC3 /* EmulateInstructionARM.cpp */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = EmulateInstructionARM.cpp; sourceTree = ""; };
@@ -4520,6 +4528,13 @@
26B4666E11A2080F00CF6220 /* Utility */ = {
isa = PBXGroup;

[Lldb-commits] [lldb] r299259 - Stop calling ValueObject::SetName from synthetic child providers

2017-03-31 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Mar 31 15:48:00 2017
New Revision: 299259

URL: http://llvm.org/viewvc/llvm-project?rev=299259=rev
Log:
Stop calling ValueObject::SetName from synthetic child providers

Summary:
Calling ValueObject::SetName from a sythetic child provider would change
the underying value object used for the non-synthetic child as well what
is clearly unintentional.

Reviewers: jingham, labath

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/DataFormatters/VectorType.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=299259=299258=299259=diff
==
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Fri Mar 31 15:48:00 2017
@@ -553,6 +553,9 @@ public:
 
   lldb::ValueObjectSP GetSP() { return m_manager->GetSharedPointer(this); }
 
+  // Change the name of the current ValueObject. Should *not* be used from a
+  // synthetic child provider as it would change the name of the non synthetic
+  // child as well.
   void SetName(const ConstString );
 
   virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
@@ -601,6 +604,12 @@ public:
 
   virtual lldb::ValueObjectSP Dereference(Error );
 
+  // Creates a copy of the ValueObject with a new name and setting the current
+  // ValueObject as its parent. It should be used when we want to change the
+  // name of a ValueObject without modifying the actual ValueObject itself
+  // (e.g. sythetic child provider).
+  virtual lldb::ValueObjectSP Clone(const ConstString _name);
+
   virtual lldb::ValueObjectSP AddressOf(Error );
 
   virtual lldb::addr_t GetLiveAddress() { return LLDB_INVALID_ADDRESS; }

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=299259=299258=299259=diff
==
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Mar 31 15:48:00 2017
@@ -2962,6 +2962,10 @@ ValueObjectSP ValueObject::Cast(const Co
   return ValueObjectCast::Create(*this, GetName(), compiler_type);
 }
 
+lldb::ValueObjectSP ValueObject::Clone(const ConstString _name) {
+  return ValueObjectCast::Create(*this, new_name, GetCompilerType());
+}
+
 ValueObjectSP ValueObject::CastPointerType(const char *name,
CompilerType _type) {
   ValueObjectSP valobj_sp;

Modified: lldb/trunk/source/DataFormatters/VectorType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/VectorType.cpp?rev=299259=299258=299259=diff
==
--- lldb/trunk/source/DataFormatters/VectorType.cpp (original)
+++ lldb/trunk/source/DataFormatters/VectorType.cpp Fri Mar 31 15:48:00 2017
@@ -204,14 +204,12 @@ public:
 if (idx >= CalculateNumChildren())
   return lldb::ValueObjectSP();
 auto offset = idx * m_child_type.GetByteSize(nullptr);
-ValueObjectSP child_sp(
-m_backend.GetSyntheticChildAtOffset(offset, m_child_type, true));
-if (!child_sp)
-  return child_sp;
-
 StreamString idx_name;
 idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-child_sp->SetName(ConstString(idx_name.GetString()));
+ValueObjectSP child_sp(m_backend.GetSyntheticChildAtOffset(
+offset, m_child_type, true, ConstString(idx_name.GetString(;
+if (!child_sp)
+  return child_sp;
 
 child_sp->SetFormat(m_item_format);
 

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp?rev=299259=299258=299259=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp Fri Mar 31 
15:48:00 2017
@@ -406,7 +406,7 @@ lldb_private::formatters::LibcxxStdMapSy
 case 1: {
   auto child0_sp = potential_child_sp->GetChildAtIndex(0, true);
   if (child0_sp && child0_sp->GetName() == g___cc)
-potential_child_sp = child0_sp;
+potential_child_sp = child0_sp->Clone(ConstString(name.GetString()));
   break;
 }
 case 2: {
@@ -414,11 +414,10 @@ lldb_private::formatters::LibcxxStdMapSy
   auto child1_sp = potential_child_sp->GetChildAtIndex(1, true);
 

[Lldb-commits] [PATCH] D31371: Stop calling ValueObject::SetName from synthetic child providers

2017-03-31 Thread Tamas Berghammer via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299259: Stop calling ValueObject::SetName from synthetic 
child providers (authored by tberghammer).

Changed prior to commit:
  https://reviews.llvm.org/D31371?vs=93528=93704#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31371

Files:
  lldb/trunk/include/lldb/Core/ValueObject.h
  lldb/trunk/source/Core/ValueObject.cpp
  lldb/trunk/source/DataFormatters/VectorType.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Index: lldb/trunk/source/Core/ValueObject.cpp
===
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -2962,6 +2962,10 @@
   return ValueObjectCast::Create(*this, GetName(), compiler_type);
 }
 
+lldb::ValueObjectSP ValueObject::Clone(const ConstString _name) {
+  return ValueObjectCast::Create(*this, new_name, GetCompilerType());
+}
+
 ValueObjectSP ValueObject::CastPointerType(const char *name,
CompilerType _type) {
   ValueObjectSP valobj_sp;
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -70,19 +70,19 @@
   std::unique_ptr tuple_frontend(
   LibStdcppTupleSyntheticFrontEndCreator(nullptr, tuple_sp));
 
-  m_ptr_obj = tuple_frontend->GetChildAtIndex(0);
-  if (m_ptr_obj)
-m_ptr_obj->SetName(ConstString("pointer"));
-
-  m_del_obj = tuple_frontend->GetChildAtIndex(1);
-  if (m_del_obj)
-m_del_obj->SetName(ConstString("deleter"));
+  ValueObjectSP ptr_obj = tuple_frontend->GetChildAtIndex(0);
+  if (ptr_obj)
+m_ptr_obj = ptr_obj->Clone(ConstString("pointer"));
+
+  ValueObjectSP del_obj = tuple_frontend->GetChildAtIndex(1);
+  if (del_obj)
+m_del_obj = del_obj->Clone(ConstString("deleter"));
 
   if (m_ptr_obj) {
 Error error;
-m_obj_obj = m_ptr_obj->Dereference(error);
+ValueObjectSP obj_obj = m_ptr_obj->Dereference(error);
 if (error.Success()) {
-  m_obj_obj->SetName(ConstString("object"));
+  m_obj_obj = obj_obj->Clone(ConstString("object"));
 }
   }
 
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
@@ -73,9 +73,7 @@
 if (value_sp) {
   StreamString name;
   name.Printf("[%zd]", m_members.size());
-  value_sp->SetName(ConstString(name.GetString()));
-
-  m_members.push_back(value_sp);
+  m_members.push_back(value_sp->Clone(ConstString(name.GetString(;
 }
   }
 }
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -406,19 +406,18 @@
 case 1: {
   auto child0_sp = potential_child_sp->GetChildAtIndex(0, true);
   if (child0_sp && child0_sp->GetName() == g___cc)
-potential_child_sp = child0_sp;
+potential_child_sp = child0_sp->Clone(ConstString(name.GetString()));
   break;
 }
 case 2: {
   auto child0_sp = potential_child_sp->GetChildAtIndex(0, true);
   auto child1_sp = potential_child_sp->GetChildAtIndex(1, true);
   if (child0_sp && child0_sp->GetName() == g___cc && child1_sp &&
   child1_sp->GetName() == g___nc)
-potential_child_sp = child0_sp;
+potential_child_sp = child0_sp->Clone(ConstString(name.GetString()));
   break;
 }
 }
-potential_child_sp->SetName(ConstString(name.GetString()));
   }
   m_iterators[idx] = iterator;
   return potential_child_sp;
Index: lldb/trunk/source/DataFormatters/VectorType.cpp
===
--- lldb/trunk/source/DataFormatters/VectorType.cpp
+++ lldb/trunk/source/DataFormatters/VectorType.cpp
@@ -204,14 +204,12 @@
 if (idx >= CalculateNumChildren())
   return lldb::ValueObjectSP();
 auto offset = idx * m_child_type.GetByteSize(nullptr);
-ValueObjectSP child_sp(
-m_backend.GetSyntheticChildAtOffset(offset, m_child_type, true));
-if (!child_sp)
-  return child_sp;
-
 StreamString idx_name;
 idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-child_sp->SetName(ConstString(idx_name.GetString()));
+ValueObjectSP child_sp(m_backend.GetSyntheticChildAtOffset(
+offset, 

[Lldb-commits] [PATCH] D31451: New C++ function name parsing logic

2017-03-31 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.

Thank you

In https://reviews.llvm.org/D31451#715664, @eugene wrote:

> In https://reviews.llvm.org/D31451#715649, @tberghammer wrote:
>
> > Because of this I think some targeted micro benchmark will be much more 
> > useful to measure the performance of this code then an end-to-end test as 
> > an e2e test would have low signal to noise ratio.
>
>
> I did some micro-benchmarking and on average new parser is ~3 time slower 
> than the old one. (new parser - ~200k string/s, old parser - ~700k string/s) 
>  clang::Lexer appears to be the slowest part of it. 
>  I mitigate this performance loss, by calling simplified parsing code for 
> simple cases and calling new parser only when the old one fails.


It was pretty clear that the new parser will be slower than the old one, even 
if I couldn't tell whether it would be 2x or 20x. That's why I wanted a macro 
benchmark to see whether that matters on the grand scale of things. If you say 
that 10% of time is name parsing, then we definitely don't want to make that 
30%, which means the decision to use two parsers was correct.


https://reviews.llvm.org/D31451



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


[Lldb-commits] [PATCH] D31368: Add support for sythetic operator dereference

2017-03-31 Thread Tamas Berghammer via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299251: Add support for sythetic operator dereference 
(authored by tberghammer).

Changed prior to commit:
  https://reviews.llvm.org/D31368?vs=93529=93701#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31368

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
  lldb/trunk/source/Core/ValueObject.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
  lldb/trunk/source/Target/StackFrame.cpp
  lldb/trunk/www/varformats.html

Index: lldb/trunk/source/Core/ValueObject.cpp
===
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -2889,6 +2889,11 @@
   child_is_base_class, child_is_deref_of_parent, eAddressTypeInvalid,
   language_flags);
 }
+  } else if (HasSyntheticValue()) {
+m_deref_valobj =
+GetSyntheticValue()
+->GetChildMemberWithName(ConstString("$$dereference$$"), true)
+.get();
   }
 
   if (m_deref_valobj) {
Index: lldb/trunk/source/Target/StackFrame.cpp
===
--- lldb/trunk/source/Target/StackFrame.cpp
+++ lldb/trunk/source/Target/StackFrame.cpp
@@ -606,8 +606,10 @@
 // Calculate the next separator index ahead of time
 ValueObjectSP child_valobj_sp;
 const char separator_type = var_expr[0];
+bool expr_is_ptr = false;
 switch (separator_type) {
 case '-':
+  expr_is_ptr = true;
   if (var_expr.size() >= 2 && var_expr[1] != '>')
 return ValueObjectSP();
 
@@ -624,11 +626,32 @@
   return ValueObjectSP();
 }
   }
+
+  // If we have a non pointer type with a sythetic value then lets check if
+  // we have an sythetic dereference specified.
+  if (!valobj_sp->IsPointerType() && valobj_sp->HasSyntheticValue()) {
+Error deref_error;
+if (valobj_sp->GetCompilerType().IsReferenceType()) {
+  valobj_sp = valobj_sp->GetSyntheticValue()->Dereference(deref_error);
+  if (error.Fail()) {
+error.SetErrorStringWithFormatv(
+"Failed to dereference reference type: %s", deref_error);
+return ValueObjectSP();
+  }
+}
+
+valobj_sp = valobj_sp->Dereference(deref_error);
+if (error.Fail()) {
+  error.SetErrorStringWithFormatv(
+  "Failed to dereference sythetic value: %s", deref_error);
+  return ValueObjectSP();
+}
+expr_is_ptr = false;
+  }
+
   var_expr = var_expr.drop_front(); // Remove the '-'
   LLVM_FALLTHROUGH;
 case '.': {
-  const bool expr_is_ptr = var_expr[0] == '>';
-
   var_expr = var_expr.drop_front(); // Remove the '.' or '>'
   separator_idx = var_expr.find_first_of(".-[");
   ConstString child_name(var_expr.substr(0, var_expr.find_first_of(".-[")));
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -114,7 +114,8 @@
 return 0;
   if (name == ConstString("del") || name == ConstString("deleter"))
 return 1;
-  if (name == ConstString("obj") || name == ConstString("object"))
+  if (name == ConstString("obj") || name == ConstString("object") ||
+  name == ConstString("$$dereference$$"))
 return 2;
   return UINT32_MAX;
 }
Index: lldb/trunk/www/varformats.html
===
--- lldb/trunk/www/varformats.html
+++ lldb/trunk/www/varformats.html
@@ -1068,6 +1068,7 @@
 [2] This method is optional (starting with SVN rev166495/LLDB-175). While implementing it in terms of num_children is acceptable, implementors are encouraged to look for optimized coding alternatives whenever reasonable.
 
 [3] This method is optional (starting with SVN revision 219330). The SBValue you return here will most likely be a numeric type (int, float, ...) as its value bytes will be used as-if they were the value of the root SBValue proper. As a shortcut for this, you can inherit from lldb.SBSyntheticValueProvider, and just define get_value as other methods are defaulted in the superclass as returning default no-children responses.
+If a synthetic child provider supplies a special child named $$dereference$$ then it will be used when evaluating opertaor* and operator- in the frame variable command and related SB API functions.
 		For examples of how synthetic children are created, you are encouraged to look at http://llvm.org/svn/llvm-project/lldb/trunk/examples/synthetic/;>examples/synthetic in the LLDB trunk. Please, be aware that the 

[Lldb-commits] [lldb] r299251 - Add support for sythetic operator dereference

2017-03-31 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Mar 31 15:23:22 2017
New Revision: 299251

URL: http://llvm.org/viewvc/llvm-project?rev=299251=rev
Log:
Add support for sythetic operator dereference

Summary:
After this change a sythetic child provider can generate a special child
named "$$dereference$$" what if present is used when "operator*" or
"operator->" used on a ValueObject. The goal of the change is to make
expressions like "up->foo" work inside the "frame variable" command.

Reviewers: labath, jingham

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
lldb/trunk/source/Target/StackFrame.cpp
lldb/trunk/www/varformats.html

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py?rev=299251=299250=299251=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
 Fri Mar 31 15:23:22 2017
@@ -42,13 +42,17 @@ class StdUniquePtrDataFormatterTestCase(
 self.expect("frame variable sdp", substrs=['sdp = 0x', 'deleter = ', 
'a = 3', 'b = 4'])
 
 self.assertEqual(123, 
frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned())
+self.assertEqual(123, 
frame.GetValueForVariablePath("*iup").GetValueAsUnsigned())
 
self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid())
 
 self.assertEqual('"foobar"', 
frame.GetValueForVariablePath("sup.object").GetSummary())
+self.assertEqual('"foobar"', 
frame.GetValueForVariablePath("*sup").GetSummary())
 
self.assertFalse(frame.GetValueForVariablePath("sup.deleter").IsValid())
 
 self.assertEqual(456, 
frame.GetValueForVariablePath("idp.object").GetValueAsUnsigned())
+self.assertEqual(456, 
frame.GetValueForVariablePath("*idp").GetValueAsUnsigned())
 self.assertEqual('"baz"', 
frame.GetValueForVariablePath("sdp.object").GetSummary())
+self.assertEqual('"baz"', 
frame.GetValueForVariablePath("*sdp").GetSummary())
 
 idp_deleter = frame.GetValueForVariablePath("idp.deleter")
 self.assertTrue(idp_deleter.IsValid())
@@ -86,5 +90,7 @@ class StdUniquePtrDataFormatterTestCase(
 frame = self.frame()
 self.assertTrue(frame.IsValid())
 self.assertEqual(2, 
frame.GetValueForVariablePath("f1->fp.object.data").GetValueAsUnsigned())
+self.assertEqual(2, 
frame.GetValueForVariablePath("f1->fp->data").GetValueAsUnsigned())
 self.assertEqual(1, 
frame.GetValueForVariablePath("f1->fp.object.fp.object.data").GetValueAsUnsigned())
+self.assertEqual(1, 
frame.GetValueForVariablePath("f1->fp->fp->data").GetValueAsUnsigned())
 

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=299251=299250=299251=diff
==
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Mar 31 15:23:22 2017
@@ -2889,6 +2889,11 @@ ValueObjectSP ValueObject::Dereference(E
   child_is_base_class, child_is_deref_of_parent, eAddressTypeInvalid,
   language_flags);
 }
+  } else if (HasSyntheticValue()) {
+m_deref_valobj =
+GetSyntheticValue()
+->GetChildMemberWithName(ConstString("$$dereference$$"), true)
+.get();
   }
 
   if (m_deref_valobj) {

Modified: 
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp?rev=299251=299250=299251=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp 
(original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Fri 
Mar 31 15:23:22 2017
@@ -114,7 +114,8 @@ size_t LibStdcppUniquePtrSyntheticFrontE
 return 0;
   if (name == ConstString("del") || name == ConstString("deleter"))
 return 1;
-  if (name == ConstString("obj") || name == ConstString("object"))
+  if (name == 

[Lldb-commits] [PATCH] D31366: Do not dereference std::unique_ptr by default

2017-03-31 Thread Tamas Berghammer via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299249: Do not dereference std::unique_ptr by default 
(authored by tberghammer).

Changed prior to commit:
  https://reviews.llvm.org/D31366?vs=93039=93699#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31366

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -94,29 +94,27 @@
 lldb::ValueObjectSP
 LibStdcppUniquePtrSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
   if (idx == 0)
-return m_obj_obj;
+return m_ptr_obj;
   if (idx == 1)
 return m_del_obj;
   if (idx == 2)
-return m_ptr_obj;
+return m_obj_obj;
   return lldb::ValueObjectSP();
 }
 
 size_t LibStdcppUniquePtrSyntheticFrontEnd::CalculateNumChildren() {
   if (m_del_obj)
 return 2;
-  if (m_ptr_obj && m_ptr_obj->GetValueAsUnsigned(0) != 0)
-return 1;
-  return 0;
+  return 1;
 }
 
 size_t LibStdcppUniquePtrSyntheticFrontEnd::GetIndexOfChildWithName(
 const ConstString ) {
-  if (name == ConstString("obj") || name == ConstString("object"))
+  if (name == ConstString("ptr") || name == ConstString("pointer"))
 return 0;
   if (name == ConstString("del") || name == ConstString("deleter"))
 return 1;
-  if (name == ConstString("ptr") || name == ConstString("pointer"))
+  if (name == ConstString("obj") || name == ConstString("object"))
 return 2;
   return UINT32_MAX;
 }
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
@@ -34,13 +34,13 @@
 self.assertTrue(frame.IsValid())
 
 self.expect("frame variable nup", substrs=['nup = nullptr'])
-self.expect("frame variable iup", substrs=['iup = 0x', 'object = 123'])
-self.expect("frame variable sup", substrs=['sup = 0x', 'object = "foobar"'])
+self.expect("frame variable iup", substrs=['iup = 0x'])
+self.expect("frame variable sup", substrs=['sup = 0x'])
 
 self.expect("frame variable ndp", substrs=['ndp = nullptr'])
-self.expect("frame variable idp", substrs=['idp = 0x', 'object = 456', 'deleter = ', 'a = 1', 'b = 2'])
-self.expect("frame variable sdp", substrs=['sdp = 0x', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4'])
-
+self.expect("frame variable idp", substrs=['idp = 0x', 'deleter = ', 'a = 1', 'b = 2'])
+self.expect("frame variable sdp", substrs=['sdp = 0x', 'deleter = ', 'a = 3', 'b = 4'])
+
 self.assertEqual(123, frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned())
 self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid())
 
@@ -59,3 +59,32 @@
 self.assertTrue(sdp_deleter.IsValid())
 self.assertEqual(3, sdp_deleter.GetChildMemberWithName("a").GetValueAsUnsigned())
 self.assertEqual(4, sdp_deleter.GetChildMemberWithName("b").GetValueAsUnsigned())
+
+@skipIfFreeBSD
+@skipIfWindows  # libstdcpp not ported to Windows
+@skipIfDarwin  # doesn't compile on Darwin
+def test_recursive_unique_ptr(self):
+# Tests that LLDB can handle when we have a loop in the unique_ptr
+# reference chain and that it correctly handles the different options
+# for the frame variable command in this case.
+self.build()
+self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_source_regexp(
+self, "Set break point at this line.")
+self.runCmd("run", RUN_SUCCEEDED)
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs=['stopped', 'stop reason = breakpoint'])
+
+self.expect("frame variable f1->fp",
+substrs=['fp = 0x'])
+self.expect("frame variable --ptr-depth=1 f1->fp",
+substrs=['data = 2', 'fp = 0x'])
+self.expect("frame variable --ptr-depth=2 f1->fp",
+substrs=['data = 2', 'fp = 0x', 'data = 1'])
+
+frame = self.frame()
+

[Lldb-commits] [lldb] r299249 - Do not dereference std::unique_ptr by default

2017-03-31 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Mar 31 15:07:20 2017
New Revision: 299249

URL: http://llvm.org/viewvc/llvm-project?rev=299249=rev
Log:
Do not dereference std::unique_ptr by default

Summary:
Displaying the object pointed by the unique_ptr can cause an infinite
recursion when we have a pointer loop so this change stops that
behavior. Additionally it makes the unique_ptr act more like a class
containing a pointer (what is the underlying truth) instead of some
"magic" class.

Reviewers: labath, jingham

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py?rev=299249=299248=299249=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
 Fri Mar 31 15:07:20 2017
@@ -34,13 +34,13 @@ class StdUniquePtrDataFormatterTestCase(
 self.assertTrue(frame.IsValid())
 
 self.expect("frame variable nup", substrs=['nup = nullptr'])
-self.expect("frame variable iup", substrs=['iup = 0x', 'object = 123'])
-self.expect("frame variable sup", substrs=['sup = 0x', 'object = 
"foobar"'])
+self.expect("frame variable iup", substrs=['iup = 0x'])
+self.expect("frame variable sup", substrs=['sup = 0x'])
 
 self.expect("frame variable ndp", substrs=['ndp = nullptr'])
-self.expect("frame variable idp", substrs=['idp = 0x', 'object = 456', 
'deleter = ', 'a = 1', 'b = 2'])
-self.expect("frame variable sdp", substrs=['sdp = 0x', 'object = 
"baz"', 'deleter = ', 'a = 3', 'b = 4'])
-
+self.expect("frame variable idp", substrs=['idp = 0x', 'deleter = ', 
'a = 1', 'b = 2'])
+self.expect("frame variable sdp", substrs=['sdp = 0x', 'deleter = ', 
'a = 3', 'b = 4'])
+
 self.assertEqual(123, 
frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned())
 
self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid())
 
@@ -59,3 +59,32 @@ class StdUniquePtrDataFormatterTestCase(
 self.assertTrue(sdp_deleter.IsValid())
 self.assertEqual(3, 
sdp_deleter.GetChildMemberWithName("a").GetValueAsUnsigned())
 self.assertEqual(4, 
sdp_deleter.GetChildMemberWithName("b").GetValueAsUnsigned())
+
+@skipIfFreeBSD
+@skipIfWindows  # libstdcpp not ported to Windows
+@skipIfDarwin  # doesn't compile on Darwin
+def test_recursive_unique_ptr(self):
+# Tests that LLDB can handle when we have a loop in the unique_ptr
+# reference chain and that it correctly handles the different options
+# for the frame variable command in this case.
+self.build()
+self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_source_regexp(
+self, "Set break point at this line.")
+self.runCmd("run", RUN_SUCCEEDED)
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs=['stopped', 'stop reason = breakpoint'])
+
+self.expect("frame variable f1->fp",
+substrs=['fp = 0x'])
+self.expect("frame variable --ptr-depth=1 f1->fp",
+substrs=['data = 2', 'fp = 0x'])
+self.expect("frame variable --ptr-depth=2 f1->fp",
+substrs=['data = 2', 'fp = 0x', 'data = 1'])
+
+frame = self.frame()
+self.assertTrue(frame.IsValid())
+self.assertEqual(2, 
frame.GetValueForVariablePath("f1->fp.object.data").GetValueAsUnsigned())
+self.assertEqual(1, 
frame.GetValueForVariablePath("f1->fp.object.fp.object.data").GetValueAsUnsigned())
+

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp?rev=299249=299248=299249=diff
==
--- 

[Lldb-commits] [PATCH] D31451: New C++ function name parsing logic

2017-03-31 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene added a subscriber: labath.
eugene marked 2 inline comments as done.
eugene added a comment.

In https://reviews.llvm.org/D31451#715649, @tberghammer wrote:

> Because of this I think some targeted micro benchmark will be much more 
> useful to measure the performance of this code then an end-to-end test as an 
> e2e test would have low signal to noise ratio.


I did some micro-benchmarking and on average new parser is ~3 time slower than 
the old one. (new parser - ~200k string/s, old parser - ~700k string/s) 
clang::Lexer appears to be the slowest part of it. 
I mitigate this performance loss, by calling simplified parsing code for simple 
cases and calling new parser only when the old one fails.




Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp:18
+using namespace lldb_private;
+using llvm::Optional;
+using llvm::None;

labath wrote:
> Are these necessary? You seem to prefix every occurence of Optional and None 
> anyway...
Well, I used None. Now I use Optional as well.


https://reviews.llvm.org/D31451



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


[Lldb-commits] [PATCH] D31451: New C++ function name parsing logic

2017-03-31 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene updated this revision to Diff 93694.
eugene marked an inline comment as done.

https://reviews.llvm.org/D31451

Files:
  source/Plugins/Language/CPlusPlus/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
  unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

Index: unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
===
--- unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -6,35 +6,139 @@
 // License. See LICENSE.TXT for details.
 //
 //===--===//
-
 #include "gtest/gtest.h"
 
 #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
 
 using namespace lldb_private;
 
-TEST(CPlusPlusLanguage, MethodName) {
+TEST(CPlusPlusLanguage, MethodNameParsing) {
   struct TestCase {
 std::string input;
 std::string context, basename, arguments, qualifiers, scope_qualified_name;
   };
 
   TestCase test_cases[] = {
-  {"foo::bar(baz)", "foo", "bar", "(baz)", "", "foo::bar"},
+  {"main(int, char *[]) ", "", "main", "(int, char *[])", "", "main"},
+  {"foo::bar(baz) const", "foo", "bar", "(baz)", "const", "foo::bar"},
+  {"foo::~bar(baz)", "foo", "~bar", "(baz)", "", "foo::~bar"},
+  {"a::b::c::d(e,f)", "a::b::c", "d", "(e,f)", "", "a::b::c::d"},
+  {"void f(int)", "", "f", "(int)", "", "f"},
+
+  // Operators
   {"std::basic_ostream& "
"std::operator<<"
"(std::basic_ostream&, char const*)",
"std", "operator<<",
"(std::basic_ostream&, char const*)", "",
-   "std::operator<<"}};
+   "std::operator<<"},
+  {"operator delete[](void*, clang::ASTContext const&, unsigned long)", "",
+   "operator delete[]", "(void*, clang::ASTContext const&, unsigned long)",
+   "", "operator delete[]"},
+  {"llvm::Optional::operator bool() const",
+   "llvm::Optional", "operator bool", "()", "const",
+   "llvm::Optional::operator bool"},
+  {"(anonymous namespace)::FactManager::operator[](unsigned short)",
+   "(anonymous namespace)::FactManager", "operator[]", "(unsigned short)",
+   "", "(anonymous namespace)::FactManager::operator[]"},
+  {"const int& std::map>::operator[](short) const",
+   "std::map>", "operator[]", "(short)", "const",
+   "std::map>::operator[]"},
+  {"CompareInsn::operator()(llvm::StringRef, InsnMatchEntry const&)",
+   "CompareInsn", "operator()", "(llvm::StringRef, InsnMatchEntry const&)",
+   "", "CompareInsn::operator()"},
+  {"llvm::Optional::operator*() const &",
+   "llvm::Optional", "operator*", "()", "const &",
+   "llvm::Optional::operator*"},
+  // Internal classes
+  {"operator<<(Cls, Cls)::Subclass::function()",
+   "operator<<(Cls, Cls)::Subclass", "function", "()", "",
+   "operator<<(Cls, Cls)::Subclass::function"},
+  {"SAEC::checkFunction(context&) const::CallBack::CallBack(int)",
+   "SAEC::checkFunction(context&) const::CallBack", "CallBack", "(int)", "",
+   "SAEC::checkFunction(context&) const::CallBack::CallBack"},
+  // Anonymous namespace
+  {"XX::(anonymous namespace)::anon_class::anon_func() const",
+   "XX::(anonymous namespace)::anon_class", "anon_func", "()", "const",
+   "XX::(anonymous namespace)::anon_class::anon_func"},
+
+  // Function pointers
+  {"string (*f(vector&&))(float)", "", "f", "(vector&&)", "",
+   "f"},
+  {"void (*::_Any_data::_M_access())()", "std::_Any_data",
+   "_M_access", "()", "",
+   "std::_Any_data::_M_access"},
+  {"void (*(*(*(*(*(*(*(* const(int))())())())())())())())()", "",
+   "func1", "(int)", "", "func1"},
+
+  // Templates
+  {"void llvm::PM::"
+   "addPass(llvm::VP)",
+   "llvm::PM", "addPass",
+   "(llvm::VP)", "",
+   "llvm::PM::"
+   "addPass"},
+  {"void std::vector"
+   "::_M_emplace_back_aux(Class const&)",
+   "std::vector",
+   "_M_emplace_back_aux", "(Class const&)", "",
+   "std::vector::"
+   "_M_emplace_back_aux"},
+  {"unsigned long llvm::countTrailingOnes"
+   "(unsigned int, llvm::ZeroBehavior)",
+   "llvm", "countTrailingOnes",
+   "(unsigned int, llvm::ZeroBehavior)", "",
+   "llvm::countTrailingOnes"},
+  {"std::enable_if<(10u)<(64), bool>::type llvm::isUInt<10u>(unsigned "
+   

[Lldb-commits] [PATCH] D31451: New C++ function name parsing logic

2017-03-31 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene updated this revision to Diff 93693.
eugene marked 3 inline comments as done.
eugene added a comment.

Addressing review commnets


https://reviews.llvm.org/D31451

Files:
  source/Plugins/Language/CPlusPlus/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
  unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

Index: unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
===
--- unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -6,35 +6,139 @@
 // License. See LICENSE.TXT for details.
 //
 //===--===//
-
 #include "gtest/gtest.h"
 
 #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
 
 using namespace lldb_private;
 
-TEST(CPlusPlusLanguage, MethodName) {
+TEST(CPlusPlusLanguage, MethodNameParsing) {
   struct TestCase {
 std::string input;
 std::string context, basename, arguments, qualifiers, scope_qualified_name;
   };
 
   TestCase test_cases[] = {
-  {"foo::bar(baz)", "foo", "bar", "(baz)", "", "foo::bar"},
+  {"main(int, char *[]) ", "", "main", "(int, char *[])", "", "main"},
+  {"foo::bar(baz) const", "foo", "bar", "(baz)", "const", "foo::bar"},
+  {"foo::~bar(baz)", "foo", "~bar", "(baz)", "", "foo::~bar"},
+  {"a::b::c::d(e,f)", "a::b::c", "d", "(e,f)", "", "a::b::c::d"},
+  {"void f(int)", "", "f", "(int)", "", "f"},
+
+  // Operators
   {"std::basic_ostream& "
"std::operator<<"
"(std::basic_ostream&, char const*)",
"std", "operator<<",
"(std::basic_ostream&, char const*)", "",
-   "std::operator<<"}};
+   "std::operator<<"},
+  {"operator delete[](void*, clang::ASTContext const&, unsigned long)", "",
+   "operator delete[]", "(void*, clang::ASTContext const&, unsigned long)",
+   "", "operator delete[]"},
+  {"llvm::Optional::operator bool() const",
+   "llvm::Optional", "operator bool", "()", "const",
+   "llvm::Optional::operator bool"},
+  {"(anonymous namespace)::FactManager::operator[](unsigned short)",
+   "(anonymous namespace)::FactManager", "operator[]", "(unsigned short)",
+   "", "(anonymous namespace)::FactManager::operator[]"},
+  {"const int& std::map>::operator[](short) const",
+   "std::map>", "operator[]", "(short)", "const",
+   "std::map>::operator[]"},
+  {"CompareInsn::operator()(llvm::StringRef, InsnMatchEntry const&)",
+   "CompareInsn", "operator()", "(llvm::StringRef, InsnMatchEntry const&)",
+   "", "CompareInsn::operator()"},
+  {"llvm::Optional::operator*() const &",
+   "llvm::Optional", "operator*", "()", "const &",
+   "llvm::Optional::operator*"},
+  // Internal classes
+  {"operator<<(Cls, Cls)::Subclass::function()",
+   "operator<<(Cls, Cls)::Subclass", "function", "()", "",
+   "operator<<(Cls, Cls)::Subclass::function"},
+  {"SAEC::checkFunction(context&) const::CallBack::CallBack(int)",
+   "SAEC::checkFunction(context&) const::CallBack", "CallBack", "(int)", "",
+   "SAEC::checkFunction(context&) const::CallBack::CallBack"},
+  // Anonymous namespace
+  {"XX::(anonymous namespace)::anon_class::anon_func() const",
+   "XX::(anonymous namespace)::anon_class", "anon_func", "()", "const",
+   "XX::(anonymous namespace)::anon_class::anon_func"},
+
+  // Function pointers
+  {"string (*f(vector&&))(float)", "", "f", "(vector&&)", "",
+   "f"},
+  {"void (*::_Any_data::_M_access())()", "std::_Any_data",
+   "_M_access", "()", "",
+   "std::_Any_data::_M_access"},
+  {"void (*(*(*(*(*(*(*(* const(int))())())())())())())())()", "",
+   "func1", "(int)", "", "func1"},
+
+  // Templates
+  {"void llvm::PM::"
+   "addPass(llvm::VP)",
+   "llvm::PM", "addPass",
+   "(llvm::VP)", "",
+   "llvm::PM::"
+   "addPass"},
+  {"void std::vector"
+   "::_M_emplace_back_aux(Class const&)",
+   "std::vector",
+   "_M_emplace_back_aux", "(Class const&)", "",
+   "std::vector::"
+   "_M_emplace_back_aux"},
+  {"unsigned long llvm::countTrailingOnes"
+   "(unsigned int, llvm::ZeroBehavior)",
+   "llvm", "countTrailingOnes",
+   "(unsigned int, llvm::ZeroBehavior)", "",
+   "llvm::countTrailingOnes"},
+  

[Lldb-commits] [PATCH] D31485: Verify memory address range validity in GDBRemoteCommunicationClient

2017-03-31 Thread Stephane Sezer via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299239: Verify memory address range validity in 
GDBRemoteCommunicationClient (authored by sas).

Changed prior to commit:
  https://reviews.llvm.org/D31485?vs=93674=93685#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31485

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp


Index: 
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -13,6 +13,7 @@
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/StructuredData.h"
+#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/DataBuffer.h"
 
 #include "llvm/ADT/ArrayRef.h"
@@ -331,3 +332,41 @@
   HandlePacket(server, "QPassSignals:", "OK");
   EXPECT_TRUE(result.get().Success());
 }
+
+TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfo) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::addr_t addr = 0xa000;
+  MemoryRegionInfo region_info;
+  std::future result = std::async(std::launch::async, [&] {
+return client.GetMemoryRegionInfo(addr, region_info);
+  });
+
+  // name is: /foo/bar.so
+  HandlePacket(server,
+  "qMemoryRegionInfo:a000",
+  "start:a000;size:2000;permissions:rx;name:2f666f6f2f6261722e736f;");
+  EXPECT_TRUE(result.get().Success());
+
+}
+
+TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfoInvalidResponse) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::addr_t addr = 0x4000;
+  MemoryRegionInfo region_info;
+  std::future result = std::async(std::launch::async, [&] {
+return client.GetMemoryRegionInfo(addr, region_info);
+  });
+
+  HandlePacket(server, "qMemoryRegionInfo:4000", "start:4000;size:;");
+  EXPECT_FALSE(result.get().Success());
+}
Index: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1503,13 +1503,18 @@
 }
   }
 
-  // We got a valid address range back but no permissions -- which means
-  // this is an unmapped page
-  if (region_info.GetRange().IsValid() && saw_permissions == false) {
-region_info.SetReadable(MemoryRegionInfo::eNo);
-region_info.SetWritable(MemoryRegionInfo::eNo);
-region_info.SetExecutable(MemoryRegionInfo::eNo);
-region_info.SetMapped(MemoryRegionInfo::eNo);
+  if (region_info.GetRange().IsValid()) {
+// We got a valid address range back but no permissions -- which means
+// this is an unmapped page
+if (!saw_permissions) {
+  region_info.SetReadable(MemoryRegionInfo::eNo);
+  region_info.SetWritable(MemoryRegionInfo::eNo);
+  region_info.SetExecutable(MemoryRegionInfo::eNo);
+  region_info.SetMapped(MemoryRegionInfo::eNo);
+}
+  } else {
+// We got an invalid address range back
+error.SetErrorString("Server returned invalid range");
   }
 } else {
   m_supports_memory_region_info = eLazyBoolNo;


Index: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -13,6 +13,7 @@
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/StructuredData.h"
+#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/DataBuffer.h"
 
 #include "llvm/ADT/ArrayRef.h"
@@ -331,3 +332,41 @@
   HandlePacket(server, "QPassSignals:", "OK");
   EXPECT_TRUE(result.get().Success());
 }
+
+TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfo) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::addr_t addr = 0xa000;
+  MemoryRegionInfo region_info;
+  std::future result = std::async(std::launch::async, [&] {
+return client.GetMemoryRegionInfo(addr, region_info);
+  });
+
+  // name is: /foo/bar.so
+  HandlePacket(server,
+  "qMemoryRegionInfo:a000",
+  "start:a000;size:2000;permissions:rx;name:2f666f6f2f6261722e736f;");
+  EXPECT_TRUE(result.get().Success());
+

[Lldb-commits] [lldb] r299239 - Verify memory address range validity in GDBRemoteCommunicationClient

2017-03-31 Thread Stephane Sezer via lldb-commits
Author: sas
Date: Fri Mar 31 13:00:48 2017
New Revision: 299239

URL: http://llvm.org/viewvc/llvm-project?rev=299239=rev
Log:
Verify memory address range validity in GDBRemoteCommunicationClient

Summary:
This aims to verify the validity of the response from the debugging
server in GDBRemoteCommunicationClient::GetMemoryRegionInfo. I was
working with ds2 (https://github.com/facebook/ds2) and encountered a bug
that caused the server's response to have a 'size' value of 0, which
caused lldb to behave incorrectly.

Reviewers: k8stone, labath, clayborg

Reviewed By: labath, clayborg

Subscribers: clayborg, sas, lldb-commits

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

Change by Alex Langford 

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=299239=299238=299239=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Fri Mar 31 13:00:48 2017
@@ -1503,13 +1503,18 @@ Error GDBRemoteCommunicationClient::GetM
 }
   }
 
-  // We got a valid address range back but no permissions -- which means
-  // this is an unmapped page
-  if (region_info.GetRange().IsValid() && saw_permissions == false) {
-region_info.SetReadable(MemoryRegionInfo::eNo);
-region_info.SetWritable(MemoryRegionInfo::eNo);
-region_info.SetExecutable(MemoryRegionInfo::eNo);
-region_info.SetMapped(MemoryRegionInfo::eNo);
+  if (region_info.GetRange().IsValid()) {
+// We got a valid address range back but no permissions -- which means
+// this is an unmapped page
+if (!saw_permissions) {
+  region_info.SetReadable(MemoryRegionInfo::eNo);
+  region_info.SetWritable(MemoryRegionInfo::eNo);
+  region_info.SetExecutable(MemoryRegionInfo::eNo);
+  region_info.SetMapped(MemoryRegionInfo::eNo);
+}
+  } else {
+// We got an invalid address range back
+error.SetErrorString("Server returned invalid range");
   }
 } else {
   m_supports_memory_region_info = eLazyBoolNo;

Modified: 
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp?rev=299239=299238=299239=diff
==
--- 
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp 
(original)
+++ 
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp 
Fri Mar 31 13:00:48 2017
@@ -13,6 +13,7 @@
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/StructuredData.h"
+#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/DataBuffer.h"
 
 #include "llvm/ADT/ArrayRef.h"
@@ -331,3 +332,41 @@ TEST_F(GDBRemoteCommunicationClientTest,
   HandlePacket(server, "QPassSignals:", "OK");
   EXPECT_TRUE(result.get().Success());
 }
+
+TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfo) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::addr_t addr = 0xa000;
+  MemoryRegionInfo region_info;
+  std::future result = std::async(std::launch::async, [&] {
+return client.GetMemoryRegionInfo(addr, region_info);
+  });
+
+  // name is: /foo/bar.so
+  HandlePacket(server,
+  "qMemoryRegionInfo:a000",
+  "start:a000;size:2000;permissions:rx;name:2f666f6f2f6261722e736f;");
+  EXPECT_TRUE(result.get().Success());
+
+}
+
+TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfoInvalidResponse) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::addr_t addr = 0x4000;
+  MemoryRegionInfo region_info;
+  std::future result = std::async(std::launch::async, [&] {
+return client.GetMemoryRegionInfo(addr, region_info);
+  });
+
+  HandlePacket(server, "qMemoryRegionInfo:4000", "start:4000;size:;");
+  EXPECT_FALSE(result.get().Success());
+}


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


[Lldb-commits] [PATCH] D31485: Verify memory address range validity in GDBRemoteCommunicationClient

2017-03-31 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 93674.
xiaobai added a comment.

Removed extra code in unit test


https://reviews.llvm.org/D31485

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp


Index: unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -13,6 +13,7 @@
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/StructuredData.h"
+#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/DataBuffer.h"
 
 #include "llvm/ADT/ArrayRef.h"
@@ -331,3 +332,41 @@
   HandlePacket(server, "QPassSignals:", "OK");
   EXPECT_TRUE(result.get().Success());
 }
+
+TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfo) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::addr_t addr = 0xa000;
+  MemoryRegionInfo region_info;
+  std::future result = std::async(std::launch::async, [&] {
+return client.GetMemoryRegionInfo(addr, region_info);
+  });
+
+  // name is: /foo/bar.so
+  HandlePacket(server,
+  "qMemoryRegionInfo:a000",
+  "start:a000;size:2000;permissions:rx;name:2f666f6f2f6261722e736f;");
+  EXPECT_TRUE(result.get().Success());
+
+}
+
+TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfoInvalidResponse) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::addr_t addr = 0x4000;
+  MemoryRegionInfo region_info;
+  std::future result = std::async(std::launch::async, [&] {
+return client.GetMemoryRegionInfo(addr, region_info);
+  });
+
+  HandlePacket(server, "qMemoryRegionInfo:4000", "start:4000;size:;");
+  EXPECT_FALSE(result.get().Success());
+}
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1503,13 +1503,18 @@
 }
   }
 
-  // We got a valid address range back but no permissions -- which means
-  // this is an unmapped page
-  if (region_info.GetRange().IsValid() && saw_permissions == false) {
-region_info.SetReadable(MemoryRegionInfo::eNo);
-region_info.SetWritable(MemoryRegionInfo::eNo);
-region_info.SetExecutable(MemoryRegionInfo::eNo);
-region_info.SetMapped(MemoryRegionInfo::eNo);
+  if (region_info.GetRange().IsValid()) {
+// We got a valid address range back but no permissions -- which means
+// this is an unmapped page
+if (!saw_permissions) {
+  region_info.SetReadable(MemoryRegionInfo::eNo);
+  region_info.SetWritable(MemoryRegionInfo::eNo);
+  region_info.SetExecutable(MemoryRegionInfo::eNo);
+  region_info.SetMapped(MemoryRegionInfo::eNo);
+}
+  } else {
+// We got an invalid address range back
+error.SetErrorString("Server returned invalid range");
   }
 } else {
   m_supports_memory_region_info = eLazyBoolNo;


Index: unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -13,6 +13,7 @@
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/StructuredData.h"
+#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/DataBuffer.h"
 
 #include "llvm/ADT/ArrayRef.h"
@@ -331,3 +332,41 @@
   HandlePacket(server, "QPassSignals:", "OK");
   EXPECT_TRUE(result.get().Success());
 }
+
+TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfo) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::addr_t addr = 0xa000;
+  MemoryRegionInfo region_info;
+  std::future result = std::async(std::launch::async, [&] {
+return client.GetMemoryRegionInfo(addr, region_info);
+  });
+
+  // name is: /foo/bar.so
+  HandlePacket(server,
+  "qMemoryRegionInfo:a000",
+  "start:a000;size:2000;permissions:rx;name:2f666f6f2f6261722e736f;");
+  EXPECT_TRUE(result.get().Success());
+
+}
+
+TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfoInvalidResponse) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::addr_t addr = 0x4000;
+  MemoryRegionInfo region_info;
+  std::future result = 

[Lldb-commits] [PATCH] D31485: Verify memory address range validity in GDBRemoteCommunicationClient

2017-03-31 Thread Alex Langford via Phabricator via lldb-commits
xiaobai marked an inline comment as done.
xiaobai added a comment.

I'll resubmit after removing the extra code in the test and get somebody to 
commit for me.




Comment at: 
unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp:373
+
+  result = std::async(std::launch::async, [&] {
+return client.GetMemoryRegionInfo(addr, region_info);

labath wrote:
> This seems out of place. Should we delete it?
Whoops! I was going to extend this test further but I decided not to in the end 
and forgot to remove this. Thanks for pointing it out.


https://reviews.llvm.org/D31485



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


[Lldb-commits] [PATCH] D31451: New C++ function name parsing logic

2017-03-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D31451#714850, @eugene wrote:

> I did some micro-benchmarking and on average new parser is ~3 time slower 
> than the old one. (new parser - ~200k string/s, old parser - ~700k string/s) 
>  clang::Lexer appears to be the slowest part of it.
>
> On the clang breakpoint benchmark you proposed, it is hard to notice much of 
> a difference. clang binary has about 500k functions.
>  With new parser it takes about 11s to try to set a breakpoint, on the old 
> one it's about 10s. (release version of  LLDB, debug static version of clang)
>
> I decided to use a hybrid approach, when we use old parsing code for simple 
> cases and call new parser only when it fails.
>  80% of clang functions are simple enough that we don't really need the new 
> parser, so it helped to bring clang breakpoint test back to 10s.
>  I think it's reasonable to assume that similar distribution is true for most 
> programs, and most of their functions can be parsed with the old code.
>
> I don't think we can really improve performance of a new parser without 
> giving up on clang::Lexer, and I'm reluctant to do it. 
>  So I propose to keep hybrid approach and call a new parser only for 
> complicated cases.


I like that idea. Let's go with that.




Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:94
   if (!m_parsed && m_full) {
-//ConstString mangled;
-//m_full.GetMangledCounterpart(mangled);
-//printf ("\n   parsing = '%s'\n", m_full.GetCString());
-//if (mangled)
-//printf ("   mangled = '%s'\n", mangled.GetCString());
-m_parse_error = false;
-m_parsed = true;
-llvm::StringRef full(m_full.GetCString());
-
-size_t arg_start, arg_end;
-llvm::StringRef parens("()", 2);
-if (ReverseFindMatchingChars(full, parens, arg_start, arg_end)) {
-  m_arguments = full.substr(arg_start, arg_end - arg_start + 1);
-  if (arg_end + 1 < full.size())
-m_qualifiers = full.substr(arg_end + 1);
-  if (arg_start > 0) {
-size_t basename_end = arg_start;
-size_t context_start = 0;
-size_t context_end = llvm::StringRef::npos;
-if (basename_end > 0 && full[basename_end - 1] == '>') {
-  // TODO: handle template junk...
-  // Templated function
-  size_t template_start, template_end;
-  llvm::StringRef lt_gt("<>", 2);
-  if (ReverseFindMatchingChars(full, lt_gt, template_start,
-   template_end, basename_end)) {
-// Check for templated functions that include return type like:
-// 'void foo()'
-context_start = full.rfind(' ', template_start);
-if (context_start == llvm::StringRef::npos)
-  context_start = 0;
-else
-  ++context_start;
-
-context_end = full.rfind(':', template_start);
-if (context_end == llvm::StringRef::npos ||
-context_end < context_start)
-  context_end = context_start;
-  } else {
-context_end = full.rfind(':', basename_end);
-  }
-} else if (context_end == llvm::StringRef::npos) {
-  context_end = full.rfind(':', basename_end);
-}
-
-if (context_end == llvm::StringRef::npos)
-  m_basename = full.substr(0, basename_end);
-else {
-  if (context_start < context_end)
-m_context =
-full.substr(context_start, context_end - 1 - context_start);
-  const size_t basename_begin = context_end + 1;
-  m_basename =
-  full.substr(basename_begin, basename_end - basename_begin);
-}
-m_type = eTypeUnknownMethod;
-  } else {
-m_parse_error = true;
-return;
-  }
-
-  if (!IsValidBasename(m_basename)) {
-// The C++ basename doesn't match our regular expressions so this can't
-// be a valid C++ method, clear everything out and indicate an error
-m_context = llvm::StringRef();
-m_basename = llvm::StringRef();
-m_arguments = llvm::StringRef();
-m_qualifiers = llvm::StringRef();
-m_parse_error = true;
-  }
+CPlusPlusNameParser parser(m_full.GetStringRef());
+auto function = parser.ParseAsFunctionDefinition();

eugene wrote:
> labath wrote:
> > How about the following api:
> > ```
> > if (auto function​ = 
> > CPlusPlusNameParser::ParseAsFunctionDefinition(m_full.GetStringRef())) {
> >   ...
> > ```
> If you don't mind I'll leave it as it is. 
> 
> I understand that it's very tempting to have two simple functions 
> ParseAsFunctionDefinition and ParseAsFullName instead of a class, but I can 
> imagine calling second one if first one fails, and in this case it'll be good 
> that parser doesn't need to tokenize string all over again.
Ok, that makes sense -- I didn't expect 

[Lldb-commits] [lldb] r299200 - [LLDB][MIPS] Core Dump Support.

2017-03-31 Thread Nitesh Jain via lldb-commits
Author: nitesh.jain
Date: Fri Mar 31 06:14:02 2017
New Revision: 299200

URL: http://llvm.org/viewvc/llvm-project?rev=299200=rev
Log:
[LLDB][MIPS] Core Dump Support.

Reviewers: labath, emaste

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

Modified:
lldb/trunk/source/Core/ArchSpec.cpp

lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.h

lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h

lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp
lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.h

Modified: lldb/trunk/source/Core/ArchSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=299200=299199=299200=diff
==
--- lldb/trunk/source/Core/ArchSpec.cpp (original)
+++ lldb/trunk/source/Core/ArchSpec.cpp Fri Mar 31 06:14:02 2017
@@ -1380,7 +1380,7 @@ static bool cores_match(const ArchSpec::
   if (core2 >= ArchSpec::kCore_mips32el_first &&
   core2 <= ArchSpec::kCore_mips32el_last)
 return true;
-  try_inverse = false;
+  try_inverse = true;
 }
 break;
 

Modified: 
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.h?rev=299200=299199=299200=diff
==
--- 
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.h
 (original)
+++ 
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.h
 Fri Mar 31 06:14:02 2017
@@ -11,6 +11,7 @@
 #define liblldb_RegisterContextPOSIXProcessMonitor_mips64_H_
 
 #include "Plugins/Process/Utility/RegisterContextPOSIX_mips64.h"
+#include "Plugin/Process/Utility/lldb-mips-freebsd-register-enums.h"
 #include "RegisterContextPOSIX.h"
 
 class RegisterContextPOSIXProcessMonitor_mips64
@@ -72,6 +73,8 @@ protected:
   uint32_t NumSupportedHardwareWatchpoints();
 
 private:
+  uint64_t 
+  m_gpr_mips64[k_num_gpr_registers_mips64]; // general purpose registers.
   ProcessMonitor ();
 };
 

Modified: 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp?rev=299200=299199=299200=diff
==
--- 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp 
Fri Mar 31 06:14:02 2017
@@ -80,152 +80,6 @@ struct pt_watch_regs default_watch_regs;
 using namespace lldb_private;
 using namespace lldb_private::process_linux;
 
-// 
-// Private namespace.
-// 
-
-namespace {
-// mips general purpose registers.
-const uint32_t g_gp_regnums_mips[] = {
-gpr_zero_mips,  gpr_r1_mips,gpr_r2_mips,  gpr_r3_mips,
-gpr_r4_mips,gpr_r5_mips,gpr_r6_mips,  gpr_r7_mips,
-gpr_r8_mips,gpr_r9_mips,gpr_r10_mips, gpr_r11_mips,
-gpr_r12_mips,   gpr_r13_mips,   gpr_r14_mips, gpr_r15_mips,
-gpr_r16_mips,   gpr_r17_mips,   gpr_r18_mips, gpr_r19_mips,
-gpr_r20_mips,   gpr_r21_mips,   gpr_r22_mips, gpr_r23_mips,
-gpr_r24_mips,   gpr_r25_mips,   gpr_r26_mips, gpr_r27_mips,
-gpr_gp_mips,gpr_sp_mips,gpr_r30_mips, gpr_ra_mips,
-gpr_sr_mips,gpr_mullo_mips, gpr_mulhi_mips,   gpr_badvaddr_mips,
-gpr_cause_mips, gpr_pc_mips,gpr_config5_mips,
-LLDB_INVALID_REGNUM // register sets need to end with this flag
-};
-
-static_assert((sizeof(g_gp_regnums_mips) / sizeof(g_gp_regnums_mips[0])) - 1 ==
-  k_num_gpr_registers_mips,
-  

[Lldb-commits] [PATCH] D30457: [LLDB][MIPS] Core Dump Support

2017-03-31 Thread Nitesh Jain via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299200: [LLDB][MIPS] Core Dump Support. (authored by 
nitesh.jain).

Changed prior to commit:
  https://reviews.llvm.org/D30457?vs=92768=93616#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30457

Files:
  lldb/trunk/source/Core/ArchSpec.cpp
  
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.h
  lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h
  lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
  lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
  lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp
  lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.h

Index: lldb/trunk/source/Core/ArchSpec.cpp
===
--- lldb/trunk/source/Core/ArchSpec.cpp
+++ lldb/trunk/source/Core/ArchSpec.cpp
@@ -1380,7 +1380,7 @@
   if (core2 >= ArchSpec::kCore_mips32el_first &&
   core2 <= ArchSpec::kCore_mips32el_last)
 return true;
-  try_inverse = false;
+  try_inverse = true;
 }
 break;
 
Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h
===
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h
@@ -22,6 +22,10 @@
 
   const lldb_private::RegisterInfo *GetRegisterInfo() const override;
 
+  const lldb_private::RegisterSet *GetRegisterSet(size_t set) const;
+
+  size_t GetRegisterSetCount() const;
+
   uint32_t GetRegisterCount() const override;
 
   uint32_t GetUserRegisterCount() const override;
Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp
===
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp
@@ -9,11 +9,33 @@
 
 #include "RegisterContextFreeBSD_mips64.h"
 #include "RegisterContextPOSIX_mips64.h"
+#include "lldb-mips-freebsd-register-enums.h"
 #include 
 
 using namespace lldb_private;
 using namespace lldb;
 
+static const uint32_t g_gpr_regnums[] = {
+gpr_zero_mips64,  gpr_r1_mips64,gpr_r2_mips64,gpr_r3_mips64,
+gpr_r4_mips64,gpr_r5_mips64,gpr_r6_mips64,gpr_r7_mips64,
+gpr_r8_mips64,gpr_r9_mips64,gpr_r10_mips64,   gpr_r11_mips64,
+gpr_r12_mips64,   gpr_r13_mips64,   gpr_r14_mips64,   gpr_r15_mips64,
+gpr_r16_mips64,   gpr_r17_mips64,   gpr_r18_mips64,   gpr_r19_mips64,
+gpr_r20_mips64,   gpr_r21_mips64,   gpr_r22_mips64,   gpr_r23_mips64,
+gpr_r24_mips64,   gpr_r25_mips64,   gpr_r26_mips64,   gpr_r27_mips64,
+gpr_gp_mips64,gpr_sp_mips64,gpr_r30_mips64,   gpr_ra_mips64,
+gpr_sr_mips64,gpr_mullo_mips64, gpr_mulhi_mips64, gpr_badvaddr_mips64,
+gpr_cause_mips64, gpr_pc_mips64,gpr_ic_mips64,gpr_dummy_mips64};
+
+// Number of register sets provided by this context.
+constexpr size_t k_num_register_sets = 1;
+
+static const RegisterSet g_reg_sets_mips64[k_num_register_sets] = {
+{"General Purpose Registers", "gpr", k_num_gpr_registers_mips64,
+ g_gpr_regnums},
+};
+
+
 // http://svnweb.freebsd.org/base/head/sys/mips/include/regnum.h
 typedef struct _GPR {
   uint64_t zero;
@@ -74,6 +96,19 @@
   return sizeof(GPR_freebsd_mips);
 }
 
+const RegisterSet *
+RegisterContextFreeBSD_mips64::GetRegisterSet(size_t set) const {
+   // Check if RegisterSet is available
+   if (set < k_num_register_sets)
+ return _reg_sets_mips64[set];
+   return nullptr;
+}
+
+size_t
+RegisterContextFreeBSD_mips64::GetRegisterSetCount() const {
+  return k_num_register_sets;
+}
+
 const RegisterInfo *RegisterContextFreeBSD_mips64::GetRegisterInfo() const {
   assert(m_target_arch.GetCore() == ArchSpec::eCore_mips64);
   return g_register_infos_mips64;
Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h
===
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h
@@ -7,8 +7,6 

[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information

2017-03-31 Thread Nitesh Jain via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299199: [LLDB][MIPS] Fix Core file Architecture and OS 
information. (authored by nitesh.jain).

Changed prior to commit:
  https://reviews.llvm.org/D31280?vs=93130=93615#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31280

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.core
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.out
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.core
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.out
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -21,10 +21,14 @@
 _i386_pid = 32306
 _x86_64_pid = 32259
 _s390x_pid = 1045
+_mips64_n64_pid = 25619
+_mips64_n32_pid = 3670
+_mips_o32_pid = 3532
 
 _i386_regions = 4
 _x86_64_regions = 5
 _s390x_regions = 2
+_mips_regions = 5
 
 def setUp(self):
 super(LinuxCoreTestCase, self).setUp()
@@ -40,6 +44,18 @@
 """Test that lldb can read the process information from an i386 linux core file."""
 self.do_test("linux-i386", self._i386_pid, self._i386_regions)
 
+def test_mips_o32(self):
+"""Test that lldb can read the process information from an MIPS O32 linux core file."""
+self.do_test("linux-mipsel-gnuabio32", self._mips_o32_pid, self._mips_regions)
+
+def test_mips_n32(self):
+"""Test that lldb can read the process information from an MIPS N32 linux core file """
+self.do_test("linux-mips64el-gnuabin32", self._mips64_n32_pid, self._mips_regions)
+
+def test_mips_n64(self):
+"""Test that lldb can read the process information from an MIPS N64 linux core file """
+self.do_test("linux-mips64el-gnuabi64", self._mips64_n64_pid, self._mips_regions)
+
 @skipIf(oslist=['windows'])
 @skipIf(triple='^mips')
 def test_x86_64(self):
Index: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -214,9 +214,12 @@
   // Even if the architecture is set in the target, we need to override
   // it to match the core file which is always single arch.
   ArchSpec arch(m_core_module_sp->GetArchitecture());
-  if (arch.IsValid())
-GetTarget().SetArchitecture(arch);
 
+  ArchSpec target_arch = GetTarget().GetArchitecture();
+  ArchSpec core_arch(m_core_module_sp->GetArchitecture());
+  target_arch.MergeFrom(core_arch);
+  GetTarget().SetArchitecture(target_arch);
+ 
   SetUnixSignals(UnixSignals::Create(GetArchitecture()));
 
   // Ensure we found at least one thread that was stopped on a signal.
@@ -370,6 +373,10 @@
   lldb::addr_t bytes_left =
   0; // Number of bytes available in the core file from the given address
 
+  // Don't proceed if core file doesn't contain the actual data for this address range.
+  if (file_start == file_end)
+return 0;
+
   // Figure out how many on-disk bytes remain in this segment
   // starting at the given offset
   if (file_end > file_start + offset)
@@ -652,6 +659,8 @@
 // The result from FXSAVE is in NT_PRXFPREG for i386 core files
 if (arch.GetCore() == ArchSpec::eCore_x86_64_x86_64)
   thread_data->fpregset = note_data;
+else if(arch.IsMIPS())
+  thread_data->fpregset = note_data;
 break;
   case NT_PRPSINFO:
 have_prpsinfo = true;
@@ -719,6 +728,12 @@
   (ObjectFileELF *)(m_core_module_sp->GetObjectFile());
   ArchSpec arch;
   core_file->GetArchitecture(arch);
+
+  ArchSpec target_arch = GetTarget().GetArchitecture();
+  
+  if (target_arch.IsMIPS())
+return target_arch;
+
   return arch;
 }
 
Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ 

[Lldb-commits] [lldb] r299199 - [LLDB][MIPS] Fix Core file Architecture and OS information.

2017-03-31 Thread Nitesh Jain via lldb-commits
Author: nitesh.jain
Date: Fri Mar 31 06:06:25 2017
New Revision: 299199

URL: http://llvm.org/viewvc/llvm-project?rev=299199=rev
Log:
[LLDB][MIPS] Fix Core file Architecture and OS information.

Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out
   (with props)

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.core

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.out
   (with props)

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.core

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.out
   (with props)
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py?rev=299199=299198=299199=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 Fri Mar 31 06:06:25 2017
@@ -21,10 +21,14 @@ class LinuxCoreTestCase(TestBase):
 _i386_pid = 32306
 _x86_64_pid = 32259
 _s390x_pid = 1045
+_mips64_n64_pid = 25619
+_mips64_n32_pid = 3670
+_mips_o32_pid = 3532
 
 _i386_regions = 4
 _x86_64_regions = 5
 _s390x_regions = 2
+_mips_regions = 5
 
 def setUp(self):
 super(LinuxCoreTestCase, self).setUp()
@@ -40,6 +44,18 @@ class LinuxCoreTestCase(TestBase):
 """Test that lldb can read the process information from an i386 linux 
core file."""
 self.do_test("linux-i386", self._i386_pid, self._i386_regions)
 
+def test_mips_o32(self):
+"""Test that lldb can read the process information from an MIPS O32 
linux core file."""
+self.do_test("linux-mipsel-gnuabio32", self._mips_o32_pid, 
self._mips_regions)
+
+def test_mips_n32(self):
+"""Test that lldb can read the process information from an MIPS N32 
linux core file """
+self.do_test("linux-mips64el-gnuabin32", self._mips64_n32_pid, 
self._mips_regions)
+
+def test_mips_n64(self):
+"""Test that lldb can read the process information from an MIPS N64 
linux core file """
+self.do_test("linux-mips64el-gnuabi64", self._mips64_n64_pid, 
self._mips_regions)
+
 @skipIf(oslist=['windows'])
 @skipIf(triple='^mips')
 def test_x86_64(self):

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core?rev=299199=auto
==
Binary files 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core
 (added) and 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core
 Fri Mar 31 06:06:25 2017 differ

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out?rev=299199=auto
==
Binary files 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out
 (added) and 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out
 Fri Mar 31 06:06:25 2017 differ

Propchange: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out
--
svn:executable = *

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.core
URL: 

[Lldb-commits] [PATCH] D30454: [LLDB][MIPS] Check if memory_info.GetName() is empty before finding corresponding module.

2017-03-31 Thread Nitesh Jain via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299196: [LLDB][MIPS] Check if memory_info.GetName() is empty 
before finding… (authored by nitesh.jain).

Changed prior to commit:
  https://reviews.llvm.org/D30454?vs=91855=93614#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30454

Files:
  lldb/trunk/source/Core/DynamicLoader.cpp


Index: lldb/trunk/source/Core/DynamicLoader.cpp
===
--- lldb/trunk/source/Core/DynamicLoader.cpp
+++ lldb/trunk/source/Core/DynamicLoader.cpp
@@ -189,7 +189,8 @@
 MemoryRegionInfo memory_info;
 Error error = m_process->GetMemoryRegionInfo(base_addr, memory_info);
 if (error.Success() && memory_info.GetMapped() &&
-memory_info.GetRange().GetRangeBase() == base_addr) {
+memory_info.GetRange().GetRangeBase() == base_addr && 
+!(memory_info.GetName().IsEmpty())) {
   ModuleSpec new_module_spec(
   FileSpec(memory_info.GetName().AsCString(), false),
   target.GetArchitecture());


Index: lldb/trunk/source/Core/DynamicLoader.cpp
===
--- lldb/trunk/source/Core/DynamicLoader.cpp
+++ lldb/trunk/source/Core/DynamicLoader.cpp
@@ -189,7 +189,8 @@
 MemoryRegionInfo memory_info;
 Error error = m_process->GetMemoryRegionInfo(base_addr, memory_info);
 if (error.Success() && memory_info.GetMapped() &&
-memory_info.GetRange().GetRangeBase() == base_addr) {
+memory_info.GetRange().GetRangeBase() == base_addr && 
+!(memory_info.GetName().IsEmpty())) {
   ModuleSpec new_module_spec(
   FileSpec(memory_info.GetName().AsCString(), false),
   target.GetArchitecture());
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r299196 - [LLDB][MIPS] Check if memory_info.GetName() is empty before finding corresponding module.

2017-03-31 Thread Nitesh Jain via lldb-commits
Author: nitesh.jain
Date: Fri Mar 31 05:55:55 2017
New Revision: 299196

URL: http://llvm.org/viewvc/llvm-project?rev=299196=rev
Log:
[LLDB][MIPS] Check if memory_info.GetName() is empty before finding 
corresponding module.

Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

Modified:
lldb/trunk/source/Core/DynamicLoader.cpp

Modified: lldb/trunk/source/Core/DynamicLoader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DynamicLoader.cpp?rev=299196=299195=299196=diff
==
--- lldb/trunk/source/Core/DynamicLoader.cpp (original)
+++ lldb/trunk/source/Core/DynamicLoader.cpp Fri Mar 31 05:55:55 2017
@@ -189,7 +189,8 @@ ModuleSP DynamicLoader::LoadModuleAtAddr
 MemoryRegionInfo memory_info;
 Error error = m_process->GetMemoryRegionInfo(base_addr, memory_info);
 if (error.Success() && memory_info.GetMapped() &&
-memory_info.GetRange().GetRangeBase() == base_addr) {
+memory_info.GetRange().GetRangeBase() == base_addr && 
+!(memory_info.GetName().IsEmpty())) {
   ModuleSpec new_module_spec(
   FileSpec(memory_info.GetName().AsCString(), false),
   target.GetArchitecture());


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


Re: [Lldb-commits] [PATCH] D31367: Expression: add missing linkage to RuntimeDyld component

2017-03-31 Thread Michał Górny via lldb-commits
On czw, 2017-03-30 at 13:55 -0700, Chris Bieneman wrote:
> I had a talk with Lang about the ExecutionEngine library structuring, and it 
> sounds like there are some problems there that need to be worked out.
> 
> Luckily for this specific case, I think the solution is actually quite simple:
> 
> ```
> diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h 
> b/include/llvm/ExecutionEngine/ExecutionEngine.h
> index f68337c..cc99f94 100644
> --- a/include/llvm/ExecutionEngine/ExecutionEngine.h
> +++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
> @@ -15,7 +15,6 @@
>  #ifndef LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
>  #define LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
>  
> -#include "RuntimeDyld.h"
>  #include "llvm-c/ExecutionEngine.h"
>  #include "llvm/ADT/SmallVector.h"
>  #include "llvm/ADT/StringRef.h"
> @@ -49,6 +48,7 @@ class ObjectCache;
>  class RTDyldMemoryManager;
>  class Triple;
>  class Type;
> +class JITSymbolResolver;
>  
>  namespace object {
>class Archive;
> ```
> 
> It seems to me that there is no reason why ExecutionEngine.h needs to include 
> RuntimeDyld.h. a forward declaration of the JITSymbolResolver class will 
> suffice.
> 

This does not solve the problem:

lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):IRExecutionUnit.cpp:function 
llvm::RTDyldMemoryManager::deregisterEHFrames(unsigned char*, unsigned long, 
unsigned long): error: undefined reference to 
'llvm::RTDyldMemoryManager::deregisterEHFramesInProcess(unsigned char*, 
unsigned long)'
lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):IRExecutionUnit.cpp:vtable for 
lldb_private::IRExecutionUnit::MemoryManager: error: undefined reference to 
'llvm::RuntimeDyld::MemoryManager::anchor()'
lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):IRExecutionUnit.cpp:vtable for 
lldb_private::IRExecutionUnit::MemoryManager: error: undefined reference to 
'llvm::JITSymbolResolver::anchor()'
collect2: error: ld returned 1 exit status

-- 
Best regards,
Michał Górny


signature.asc
Description: This is a digitally signed message part
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits