summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorEnrico Granata <granata.enrico@gmail.com>2011-07-16 01:22:04 +0000
committerEnrico Granata <granata.enrico@gmail.com>2011-07-16 01:22:04 +0000
commit0c5ef693a2b0fef31b43b079bb70e9abd4c3b652 (patch)
treea8ab74c01793b0fddda2bacb739079fc0365664a /lldb/source
parentc591f3afc33f5188cad47fd5a8a6d769ef290020 (diff)
downloadbcm5719-llvm-0c5ef693a2b0fef31b43b079bb70e9abd4c3b652.tar.gz
bcm5719-llvm-0c5ef693a2b0fef31b43b079bb70e9abd4c3b652.zip
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 llvm-svn: 135336
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBValue.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp9
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectType.cpp12
-rw-r--r--lldb/source/Core/ValueObject.cpp11
-rw-r--r--lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp28
8 files changed, 53 insertions, 19 deletions
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 5956784bbc7..26eaaf32209 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -658,7 +658,8 @@ SBValue::GetDescription (SBStream &description)
use_objc,
use_dynamic,
scope_already_checked,
- flat_output);
+ flat_output,
+ 0);
}
else
description.Printf ("No value");
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index 57dd7c70bb3..4a25477ce29 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -329,7 +329,8 @@ CommandObjectExpression::EvaluateExpression
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/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 9d8f429cabc..e99c1e09fd0 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -501,7 +501,8 @@ public:
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 @@ public:
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 @@ public:
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/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 98b1df53b57..e91490ccf27 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -658,7 +658,8 @@ public:
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/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index c450046cef9..1af50f0b76e 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -489,7 +489,8 @@ public:
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/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 770d61f15e8..d408a603e85 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -1009,6 +1009,18 @@ CommandObject (interpreter,
"\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/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 5264db2c4cb..4f0c8dc9069 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -2398,7 +2398,8 @@ ValueObject::DumpValueObject
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 @@ ValueObject::DumpValueObject
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 @@ ValueObject::DumpValueObject
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 @@ ValueObject::DumpValueObject
false,
use_dynamic,
true,
- flat_output);
+ flat_output,
+ omit_summary_depth > 1 ? omit_summary_depth - 1 : 0);
}
}
diff --git a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
index edc5dbbdfbf..b8a767c1780 100644
--- a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
+++ b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
@@ -38,7 +38,7 @@ g_option_table[] =
{ 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 @@ OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter,
}
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 @@ OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter,
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 @@ OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter,
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)
OpenPOWER on IntegriCloud