[Lldb-commits] [lldb] r268274 - Add an argument to ValueObject::GetSyntheticBase that allows for name customization on the generated value

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Mon May 2 11:13:19 PDT 2016


Author: enrico
Date: Mon May  2 13:13:18 2016
New Revision: 268274

URL: http://llvm.org/viewvc/llvm-project?rev=268274&view=rev
Log:
Add an argument to ValueObject::GetSyntheticBase that allows for name customization on the generated value

Modified:
    lldb/trunk/include/lldb/Core/ValueObject.h
    lldb/trunk/source/Core/ValueObject.cpp

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=268274&r1=268273&r2=268274&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Mon May  2 13:13:18 2016
@@ -705,7 +705,10 @@ public:
                               ConstString name_const_str = ConstString());
     
     virtual lldb::ValueObjectSP
-    GetSyntheticBase (uint32_t offset, const CompilerType& type, bool can_create);
+    GetSyntheticBase (uint32_t offset,
+                      const CompilerType& type,
+                      bool can_create,
+                      ConstString name_const_str = ConstString());
 
     virtual lldb::ValueObjectSP
     GetDynamicValue (lldb::DynamicValueType valueType);

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=268274&r1=268273&r2=268274&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Mon May  2 13:13:18 2016
@@ -2227,13 +2227,19 @@ ValueObject::GetSyntheticChildAtOffset(u
 }
 
 ValueObjectSP
-ValueObject::GetSyntheticBase (uint32_t offset, const CompilerType& type, bool can_create)
+ValueObject::GetSyntheticBase (uint32_t offset,
+                               const CompilerType& type,
+                               bool can_create,
+                               ConstString name_const_str)
 {
     ValueObjectSP synthetic_child_sp;
     
-    char name_str[64];
-    snprintf(name_str, sizeof(name_str), "%s", type.GetTypeName().AsCString("<unknown>"));
-    ConstString name_const_str(name_str);
+    if (name_const_str.IsEmpty())
+    {
+        char name_str[128];
+        snprintf(name_str, sizeof(name_str), "base%s@%i", type.GetTypeName().AsCString("<unknown>"), offset);
+        name_const_str.SetCString(name_str);
+    }
     
     // Check if we have already created a synthetic array member in this
     // valid object. If we have we will re-use it.




More information about the lldb-commits mailing list