Adding two new markers to the ${var..} specifier
- %N = show the name of the variable
- %> = show the expression path of the variable
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184502 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h
index 49c6198..26fa3aa 100644
--- a/include/lldb/Core/ValueObject.h
+++ b/include/lldb/Core/ValueObject.h
@@ -80,7 +80,9 @@
eValueObjectRepresentationStyleLanguageSpecific,
eValueObjectRepresentationStyleLocation,
eValueObjectRepresentationStyleChildrenCount,
- eValueObjectRepresentationStyleType
+ eValueObjectRepresentationStyleType,
+ eValueObjectRepresentationStyleName,
+ eValueObjectRepresentationStyleExpressionPath
};
enum ExpressionPathScanEndReason
diff --git a/source/Core/Debugger.cpp b/source/Core/Debugger.cpp
index 2be1dbb..4a6477f 100644
--- a/source/Core/Debugger.cpp
+++ b/source/Core/Debugger.cpp
@@ -1232,6 +1232,12 @@
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());
diff --git a/source/Core/ValueObject.cpp b/source/Core/ValueObject.cpp
index 67b46bb..e2a87d4 100644
--- a/source/Core/ValueObject.cpp
+++ b/source/Core/ValueObject.cpp
@@ -1693,6 +1693,10 @@
{
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 @@
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)