Some descriptive text for the Python script feature:
- help type summary add now gives some hints on how to use it
frame variable and target variable now have a --no-summary-depth (-Y) option:
- simply using -Y without an argument will skip one level of summaries, i.e.
your aggregate types will expand their children and display no summary, even
if they have one. children will behave normally
- using -Y<int>, as in -Y4, -Y7, ..., will skip as many levels of summaries as
given by the <int> parameter (obviously, -Y and -Y1 are the same thing). children
beneath the given depth level will behave normally
-Y0 is the same as omitting the --no-summary-depth parameter entirely
This option replaces the defined-but-unimplemented --no-summary
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135336 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index 5956784..26eaaf3 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -658,7 +658,8 @@
use_objc,
use_dynamic,
scope_already_checked,
- flat_output);
+ flat_output,
+ 0);
}
else
description.Printf ("No value");
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index 57dd7c7..4a25477 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -329,7 +329,8 @@
m_options.print_object, // Print the objective C object?
use_dynamic,
true, // Scope is already checked. Const results are always in scope.
- false); // Don't flatten output
+ false, // Don't flatten output
+ 0); // Always use summaries (you might want an option --no-summary like there is for frame variable)
if (result)
result->SetStatus (eReturnStatusSuccessFinishResult);
}
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 9d8f429..e99c1e0 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -501,7 +501,8 @@
m_varobj_options.use_objc,
m_varobj_options.use_dynamic,
false,
- m_varobj_options.flat_output);
+ m_varobj_options.flat_output,
+ m_varobj_options.no_summary_depth);
}
}
}
@@ -552,7 +553,8 @@
m_varobj_options.use_objc,
m_varobj_options.use_dynamic,
false,
- m_varobj_options.flat_output);
+ m_varobj_options.flat_output,
+ m_varobj_options.no_summary_depth);
}
else
{
@@ -642,7 +644,8 @@
m_varobj_options.use_objc,
m_varobj_options.use_dynamic,
false,
- m_varobj_options.flat_output);
+ m_varobj_options.flat_output,
+ m_varobj_options.no_summary_depth);
}
}
}
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index 98b1df5..e91490c 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -658,7 +658,8 @@
m_varobj_options.use_objc,
m_varobj_options.use_dynamic,
scope_already_checked,
- m_varobj_options.flat_output);
+ m_varobj_options.flat_output,
+ 0);
}
else
{
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index c450046..1af50f0 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -489,7 +489,8 @@
m_varobj_options.use_objc,
m_varobj_options.use_dynamic,
false,
- m_varobj_options.flat_output);
+ m_varobj_options.flat_output,
+ m_varobj_options.no_summary_depth);
}
diff --git a/source/Commands/CommandObjectType.cpp b/source/Commands/CommandObjectType.cpp
index 770d61f..d408a60 100644
--- a/source/Commands/CommandObjectType.cpp
+++ b/source/Commands/CommandObjectType.cpp
@@ -1009,6 +1009,18 @@
"\n"
"A command you may definitely want to try if you're doing C++ debugging is:\n"
"type summary add -f \"${var._M_dataplus._M_p}\" std::string\n"
+ "\n"
+ "You can also add Python summaries, in which case you will use lldb public API to gather information from your variables"
+ "and elaborate them to a meaningful summary inside a script written in Python. The variable object will be passed to your"
+ "script as an SBValue object. The following example might help you when starting to use the Python summaries feature:\n"
+ "type summary add JustADemo -s \"value = valobj.GetChildMemberWithName('value'); return 'My value is ' + value.GetValue();\"\n"
+ "If you prefer to type your scripts on multiple lines, you will use the -P option and then type your script, ending it with "
+ "the word DONE on a line by itself to mark you're finished editing your code:\n"
+ "(lldb)type summary add JustADemo -P\n"
+ " value = valobj.GetChildMemberWithName('value');\n"
+ " return 'My value is ' + value.GetValue();\n"
+ "DONE\n"
+ "(lldb)"
);
}
diff --git a/source/Core/ValueObject.cpp b/source/Core/ValueObject.cpp
index 5264db2..4f0c8dc 100644
--- a/source/Core/ValueObject.cpp
+++ b/source/Core/ValueObject.cpp
@@ -2398,7 +2398,8 @@
bool use_objc,
lldb::DynamicValueType use_dynamic,
bool scope_already_checked,
- bool flat_output
+ bool flat_output,
+ uint32_t omit_summary_depth
)
{
if (valobj)
@@ -2458,6 +2459,9 @@
const char *sum_cstr = NULL;
SummaryFormat* entry = valobj->GetSummaryFormat().get();
+ if (omit_summary_depth > 0)
+ entry = NULL;
+
if (err_cstr == NULL)
{
val_cstr = valobj->GetValueAsCString();
@@ -2474,7 +2478,7 @@
if (print_valobj)
{
- sum_cstr = valobj->GetSummaryAsCString();
+ sum_cstr = (omit_summary_depth == 0) ? valobj->GetSummaryAsCString() : NULL;
// We must calculate this value in realtime because entry might alter this variable's value
// (e.g. by saying ${var%fmt}) and render precached values useless
@@ -2571,7 +2575,8 @@
false,
use_dynamic,
true,
- flat_output);
+ flat_output,
+ omit_summary_depth > 1 ? omit_summary_depth - 1 : 0);
}
}
diff --git a/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/source/Interpreter/OptionGroupValueObjectDisplay.cpp
index edc5dbb..b8a767c 100644
--- a/source/Interpreter/OptionGroupValueObjectDisplay.cpp
+++ b/source/Interpreter/OptionGroupValueObjectDisplay.cpp
@@ -38,7 +38,7 @@
{ LLDB_OPT_SET_1, false, "objc", 'O', no_argument, NULL, 0, eArgTypeNone, "Print as an Objective-C object."},
{ LLDB_OPT_SET_1, false, "ptr-depth", 'P', required_argument, NULL, 0, eArgTypeCount, "The number of pointers to be traversed when dumping values (default is zero)."},
{ LLDB_OPT_SET_1, false, "show-types", 'T', no_argument, NULL, 0, eArgTypeNone, "Show variable types when dumping values."},
- { LLDB_OPT_SET_1, false, "no-summary", 'Y', no_argument, NULL, 0, eArgTypeNone, "Omit summary information."},
+ { LLDB_OPT_SET_1, false, "no-summary-depth",'Y', optional_argument, NULL, 0, eArgTypeCount, "Set a depth for omitting summary information (default is 1)."},
{ 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL }
};
@@ -80,7 +80,6 @@
}
break;
case 'T': show_types = true; break;
- case 'Y': show_summary = false; break;
case 'L': show_location= true; break;
case 'F': flat_output = true; break;
case 'O': use_objc = true; break;
@@ -96,6 +95,17 @@
error.SetErrorStringWithFormat("Invalid pointer depth '%s'.\n", option_arg);
break;
+ case 'Y':
+ if (option_arg)
+ {
+ no_summary_depth = Args::StringToUInt32 (option_arg, 0, 0, &success);
+ if (!success)
+ error.SetErrorStringWithFormat("Invalid pointer depth '%s'.\n", option_arg);
+ }
+ else
+ no_summary_depth = 1;
+ break;
+
default:
error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option);
break;
@@ -107,13 +117,13 @@
void
OptionGroupValueObjectDisplay::OptionParsingStarting (CommandInterpreter &interpreter)
{
- show_types = false;
- show_summary = true;
- show_location = false;
- flat_output = false;
- use_objc = false;
- max_depth = UINT32_MAX;
- ptr_depth = 0;
+ show_types = false;
+ no_summary_depth = 0;
+ show_location = false;
+ flat_output = false;
+ use_objc = false;
+ max_depth = UINT32_MAX;
+ ptr_depth = 0;
Target *target = interpreter.GetExecutionContext().target;
if (target != NULL)