[Lldb-commits] [PATCH] D30272: Improve data formatter for libstdcpp unique_ptr

2017-03-25 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer abandoned this revision.
tberghammer added a comment.

I wasn't able to get this approach working so I propose an alternative solution 
at https://reviews.llvm.org/D31366 for the infinite loop issue and I will 
create a separate CL for dereferencing smart pointers in "frame variable".


https://reviews.llvm.org/D30272



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


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

2017-03-25 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added a project: LLDB.

Add missing linkage from lldbExpression library to LLVMRuntimeDyld.
Otherwise the build against shared LLVM libraries fails with:

  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)'


Repository:
  rL LLVM

https://reviews.llvm.org/D31367

Files:
  source/Expression/CMakeLists.txt


Index: source/Expression/CMakeLists.txt
===
--- source/Expression/CMakeLists.txt
+++ source/Expression/CMakeLists.txt
@@ -34,5 +34,6 @@
   LINK_COMPONENTS
 Core
 ExecutionEngine
+RuntimeDyld
 Support
   )


Index: source/Expression/CMakeLists.txt
===
--- source/Expression/CMakeLists.txt
+++ source/Expression/CMakeLists.txt
@@ -34,5 +34,6 @@
   LINK_COMPONENTS
 Core
 ExecutionEngine
+RuntimeDyld
 Support
   )
___
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-25 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer created this revision.

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.


https://reviews.llvm.org/D31368

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

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ 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,24 @@
   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()) {
+valobj_sp = valobj_sp->GetSyntheticValue()->GetChildMemberWithName(
+ConstString("$$dereference$$"), true);
+if (valobj_sp) {
+  expr_is_ptr = false;
+} else {
+  error.SetErrorString(
+  "Failed to access synthetic dereference member.");
+  return ValueObjectSP();
+}
+  }
+
   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: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===
--- source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ 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: source/Core/ValueObject.cpp
===
--- source/Core/ValueObject.cpp
+++ 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: packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
===
--- packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
+++ packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
@@ -42,13 +42,17 @@
 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 @@
 frame = self.frame()
 self.assertTrue(frame.Is

[Lldb-commits] [PATCH] D31369: PluginUnwindAssemblyX86: add missing linkage to MCDisasm

2017-03-25 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added a project: LLDB.

Add missing linkage of the lldbPluginUnwindAssemblyX86 to LLVMMCDisasm
library. This fixes the following build failure when linking against
shared libraries:

  
lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function
 lldb_private::x86AssemblyInspectionEngine::instruction_length(unsigned char*, 
int&): error: undefined reference to 'LLVMDisasmInstruction'
  
lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function
 lldb_private::x86AssemblyInspectionEngine::~x86AssemblyInspectionEngine(): 
error: undefined reference to 'LLVMDisasmDispose'
  
lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function
 
lldb_private::x86AssemblyInspectionEngine::x86AssemblyInspectionEngine(lldb_private::ArchSpec
 const&): error: undefined reference to 'LLVMCreateDisasm'


Repository:
  rL LLVM

https://reviews.llvm.org/D31369

Files:
  source/Plugins/UnwindAssembly/x86/CMakeLists.txt


Index: source/Plugins/UnwindAssembly/x86/CMakeLists.txt
===
--- source/Plugins/UnwindAssembly/x86/CMakeLists.txt
+++ source/Plugins/UnwindAssembly/x86/CMakeLists.txt
@@ -10,4 +10,5 @@
   LINK_COMPONENTS
 Support
 MC
+MCDisassembler
   )


Index: source/Plugins/UnwindAssembly/x86/CMakeLists.txt
===
--- source/Plugins/UnwindAssembly/x86/CMakeLists.txt
+++ source/Plugins/UnwindAssembly/x86/CMakeLists.txt
@@ -10,4 +10,5 @@
   LINK_COMPONENTS
 Support
 MC
+MCDisassembler
   )
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r298776 - Expression: add missing linkage to RuntimeDyld component

2017-03-25 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Sat Mar 25 13:51:29 2017
New Revision: 298776

URL: http://llvm.org/viewvc/llvm-project?rev=298776&view=rev
Log:
Expression: add missing linkage to RuntimeDyld component

Add missing linkage from lldbExpression library to LLVMRuntimeDyld.
Otherwise the build against shared LLVM libraries fails with:


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)'

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

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

Modified: lldb/trunk/source/Expression/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/CMakeLists.txt?rev=298776&r1=298775&r2=298776&view=diff
==
--- lldb/trunk/source/Expression/CMakeLists.txt (original)
+++ lldb/trunk/source/Expression/CMakeLists.txt Sat Mar 25 13:51:29 2017
@@ -34,5 +34,6 @@ add_lldb_library(lldbExpression
   LINK_COMPONENTS
 Core
 ExecutionEngine
+RuntimeDyld
 Support
   )


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


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

2017-03-25 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL298776: Expression: add missing linkage to RuntimeDyld 
component (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D31367?vs=93041&id=93051#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31367

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


Index: lldb/trunk/source/Expression/CMakeLists.txt
===
--- lldb/trunk/source/Expression/CMakeLists.txt
+++ lldb/trunk/source/Expression/CMakeLists.txt
@@ -34,5 +34,6 @@
   LINK_COMPONENTS
 Core
 ExecutionEngine
+RuntimeDyld
 Support
   )


Index: lldb/trunk/source/Expression/CMakeLists.txt
===
--- lldb/trunk/source/Expression/CMakeLists.txt
+++ lldb/trunk/source/Expression/CMakeLists.txt
@@ -34,5 +34,6 @@
   LINK_COMPONENTS
 Core
 ExecutionEngine
+RuntimeDyld
 Support
   )
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r298777 - PluginUnwindAssemblyX86: add missing linkage to MCDisasm

2017-03-25 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Sat Mar 25 13:51:37 2017
New Revision: 298777

URL: http://llvm.org/viewvc/llvm-project?rev=298777&view=rev
Log:
PluginUnwindAssemblyX86: add missing linkage to MCDisasm

Add missing linkage of the lldbPluginUnwindAssemblyX86 to LLVMMCDisasm
library. This fixes the following build failure when linking against
shared libraries:


lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function
 lldb_private::x86AssemblyInspectionEngine::instruction_length(unsigned char*, 
int&): error: undefined reference to 'LLVMDisasmInstruction'

lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function
 lldb_private::x86AssemblyInspectionEngine::~x86AssemblyInspectionEngine(): 
error: undefined reference to 'LLVMDisasmDispose'

lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function
 
lldb_private::x86AssemblyInspectionEngine::x86AssemblyInspectionEngine(lldb_private::ArchSpec
 const&): error: undefined reference to 'LLVMCreateDisasm'

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

Modified:
lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt?rev=298777&r1=298776&r2=298777&view=diff
==
--- lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt Sat Mar 25 
13:51:37 2017
@@ -10,4 +10,5 @@ add_lldb_library(lldbPluginUnwindAssembl
   LINK_COMPONENTS
 Support
 MC
+MCDisassembler
   )


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


[Lldb-commits] [PATCH] D31369: PluginUnwindAssemblyX86: add missing linkage to MCDisasm

2017-03-25 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL298777: PluginUnwindAssemblyX86: add missing linkage to 
MCDisasm (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D31369?vs=93043&id=93052#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31369

Files:
  lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt


Index: lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt
+++ lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt
@@ -10,4 +10,5 @@
   LINK_COMPONENTS
 Support
 MC
+MCDisassembler
   )


Index: lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt
+++ lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt
@@ -10,4 +10,5 @@
   LINK_COMPONENTS
 Support
 MC
+MCDisassembler
   )
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2017-03-25 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer created this revision.

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.


https://reviews.llvm.org/D31371

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

Index: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===
--- source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ 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"));
+  ValueObjectSP ptr_obj = tuple_frontend->GetChildAtIndex(0);
+  if (ptr_obj)
+m_ptr_obj = ptr_obj->Clone(ConstString("pointer"));
 
-  m_del_obj = tuple_frontend->GetChildAtIndex(1);
-  if (m_del_obj)
-m_del_obj->SetName(ConstString("deleter"));
+  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: source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
===
--- source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
+++ 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: source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
===
--- source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ 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: source/DataFormatters/VectorType.cpp
===
--- source/DataFormatters/VectorType.cpp
+++ 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, m_child_type, true, ConstString(idx_name.GetString(;
+if (!child_sp)
+  return child_sp;
 
 child_sp->SetFormat(m_item_format);
 
Index: source/Core/ValueObject.cpp
===
--- source/Core/ValueObject.cpp
+++ source/Core/ValueObject.cpp
@@ -2957,6 +2957,10 @@
   return ValueObjectCast::Create(*this, GetName(), compiler_type);
 }
 
+lldb::ValueObjectSP ValueObject::Clone(const ConstString &new_name) {
+  return ValueObjectCast::Create(*this, new_name, GetCompilerType());
+}
+
 ValueObjectSP ValueObject::CastPointerType(const char *name,
CompilerType &compiler_type) {
   ValueObjectSP valobj_sp;
Index: include/lldb/Core/ValueObject.h
===
--- include/lldb/Core/ValueObject.h
+++ include/lldb/Core/ValueObje