[Lldb-commits] [lldb] r184502 - Adding two new markers to the ${var..} specifier

Enrico Granata egranata at apple.com
Thu Jun 20 17:04:51 PDT 2013


Author: enrico
Date: Thu Jun 20 19:04:51 2013
New Revision: 184502

URL: http://llvm.org/viewvc/llvm-project?rev=184502&view=rev
Log:
Adding two new markers to the ${var..} specifier
- %N = show the name of the variable
- %> = show the expression path of the variable


Modified:
    lldb/trunk/include/lldb/Core/ValueObject.h
    lldb/trunk/source/Core/Debugger.cpp
    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=184502&r1=184501&r2=184502&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Thu Jun 20 19:04:51 2013
@@ -80,7 +80,9 @@ public:
         eValueObjectRepresentationStyleLanguageSpecific,
         eValueObjectRepresentationStyleLocation,
         eValueObjectRepresentationStyleChildrenCount,
-        eValueObjectRepresentationStyleType
+        eValueObjectRepresentationStyleType,
+        eValueObjectRepresentationStyleName,
+        eValueObjectRepresentationStyleExpressionPath
     };
     
     enum ExpressionPathScanEndReason

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=184502&r1=184501&r2=184502&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu Jun 20 19:04:51 2013
@@ -1232,6 +1232,12 @@ ScanFormatDescriptor (const char* var_na
                 case 'T': // if this is a 'T', print the type
                     *val_obj_display = ValueObject::eValueObjectRepresentationStyleType;
                     break;
+                case 'N': // if this is a 'N', print the name
+                    *val_obj_display = ValueObject::eValueObjectRepresentationStyleName;
+                    break;
+                case '>': // if this is a '>', print the name
+                    *val_obj_display = ValueObject::eValueObjectRepresentationStyleExpressionPath;
+                    break;
                 default:
                     if (log)
                         log->Printf("ScanFormatDescriptor] %s is an error, leaving the previous value alone", format_name.c_str());

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=184502&r1=184501&r2=184502&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Thu Jun 20 19:04:51 2013
@@ -1693,6 +1693,10 @@ ValueObject::DumpPrintableRepresentation
     
     {
         const char *cstr = NULL;
+        
+         // this is a local stream that we are using to ensure that the data pointed to by cstr survives
+        // long enough for us to copy it to its destination - it is necessary to have this temporary storage
+        // area for cases where our desired output is not backed by some other longer-term storage
         StreamString strm;
 
         if (custom_format != eFormatInvalid)
@@ -1724,6 +1728,15 @@ ValueObject::DumpPrintableRepresentation
             case eValueObjectRepresentationStyleType:
                 cstr = GetTypeName().AsCString();
                 break;
+                
+            case eValueObjectRepresentationStyleName:
+                cstr = GetName().AsCString();
+                break;
+                
+            case eValueObjectRepresentationStyleExpressionPath:
+                GetExpressionPath(strm, false);
+                cstr = strm.GetString().c_str();
+                break;
         }
         
         if (!cstr)





More information about the lldb-commits mailing list