forked from OSchip/llvm-project
Fixed formats being able to be applied recursively when using:
target variable -f <format> [args] frame variable -f <format> [args] expression -f <format> -- expr llvm-svn: 149080
This commit is contained in:
parent
48fd81b484
commit
6efba4fc97
|
@ -216,19 +216,21 @@ public:
|
|||
bool m_flat_output;
|
||||
uint32_t m_omit_summary_depth;
|
||||
bool m_ignore_cap;
|
||||
lldb::Format m_override_format;
|
||||
|
||||
DumpValueObjectOptions() :
|
||||
m_ptr_depth(0),
|
||||
m_max_depth(UINT32_MAX),
|
||||
m_show_types(false),
|
||||
m_show_location(false),
|
||||
m_use_objc(false),
|
||||
m_use_dynamic(lldb::eNoDynamicValues),
|
||||
m_use_synthetic(lldb::eUseSyntheticFilter),
|
||||
m_scope_already_checked(false),
|
||||
m_flat_output(false),
|
||||
m_omit_summary_depth(0),
|
||||
m_ignore_cap(false)
|
||||
m_ptr_depth(0),
|
||||
m_max_depth(UINT32_MAX),
|
||||
m_show_types(false),
|
||||
m_show_location(false),
|
||||
m_use_objc(false),
|
||||
m_use_dynamic(lldb::eNoDynamicValues),
|
||||
m_use_synthetic(lldb::eUseSyntheticFilter),
|
||||
m_scope_already_checked(false),
|
||||
m_flat_output(false),
|
||||
m_omit_summary_depth(0),
|
||||
m_ignore_cap(false),
|
||||
m_override_format (lldb::eFormatDefault)
|
||||
{}
|
||||
|
||||
static const DumpValueObjectOptions
|
||||
|
@ -829,7 +831,8 @@ public:
|
|||
static void
|
||||
DumpValueObject (Stream &s,
|
||||
ValueObject *valobj,
|
||||
const DumpValueObjectOptions& options)
|
||||
const DumpValueObjectOptions& options,
|
||||
lldb::Format format = lldb::eFormatDefault)
|
||||
{
|
||||
|
||||
if (!valobj)
|
||||
|
@ -849,14 +852,16 @@ public:
|
|||
options.m_scope_already_checked,
|
||||
options.m_flat_output,
|
||||
options.m_omit_summary_depth,
|
||||
options.m_ignore_cap);
|
||||
options.m_ignore_cap,
|
||||
format);
|
||||
}
|
||||
|
||||
static void
|
||||
DumpValueObject (Stream &s,
|
||||
ValueObject *valobj,
|
||||
const char *root_valobj_name,
|
||||
const DumpValueObjectOptions& options)
|
||||
const DumpValueObjectOptions& options,
|
||||
lldb::Format format = lldb::eFormatDefault)
|
||||
{
|
||||
|
||||
if (!valobj)
|
||||
|
@ -876,7 +881,8 @@ public:
|
|||
options.m_scope_already_checked,
|
||||
options.m_flat_output,
|
||||
options.m_omit_summary_depth,
|
||||
options.m_ignore_cap);
|
||||
options.m_ignore_cap,
|
||||
format);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -894,7 +900,8 @@ public:
|
|||
bool scope_already_checked,
|
||||
bool flat_output,
|
||||
uint32_t omit_summary_depth,
|
||||
bool ignore_cap);
|
||||
bool ignore_cap,
|
||||
lldb::Format format = lldb::eFormatDefault);
|
||||
|
||||
// returns true if this is a char* or a char[]
|
||||
// if it is a char* and check_pointer is true,
|
||||
|
|
|
@ -368,7 +368,8 @@ CommandObjectExpression::EvaluateExpression
|
|||
true, // Scope is already checked. Const results are always in scope.
|
||||
false, // Don't flatten output
|
||||
0, // Always use summaries (you might want an option --no-summary like there is for frame variable)
|
||||
false); // Do not show more children than settings allow
|
||||
false, // Do not show more children than settings allow
|
||||
format); // Format override
|
||||
if (result)
|
||||
result->SetStatus (eReturnStatusSuccessFinishResult);
|
||||
}
|
||||
|
|
|
@ -476,8 +476,8 @@ public:
|
|||
valobj_sp = frame->GetValueObjectForFrameVariable (var_sp, m_varobj_options.use_dynamic);
|
||||
if (valobj_sp)
|
||||
{
|
||||
if (format != eFormatDefault)
|
||||
valobj_sp->SetFormat (format);
|
||||
// if (format != eFormatDefault)
|
||||
// valobj_sp->SetFormat (format);
|
||||
|
||||
if (m_option_variable.show_decl && var_sp->GetDeclaration ().GetFile())
|
||||
{
|
||||
|
@ -490,7 +490,8 @@ public:
|
|||
valobj_sp->SetCustomSummaryFormat(summary_format_sp);
|
||||
ValueObject::DumpValueObject (result.GetOutputStream(),
|
||||
valobj_sp.get(),
|
||||
options);
|
||||
options,
|
||||
format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -521,8 +522,8 @@ public:
|
|||
error);
|
||||
if (valobj_sp)
|
||||
{
|
||||
if (format != eFormatDefault)
|
||||
valobj_sp->SetFormat (format);
|
||||
// if (format != eFormatDefault)
|
||||
// valobj_sp->SetFormat (format);
|
||||
if (m_option_variable.show_decl && var_sp && var_sp->GetDeclaration ().GetFile())
|
||||
{
|
||||
var_sp->GetDeclaration ().DumpStopContext (&s, false);
|
||||
|
@ -535,7 +536,8 @@ public:
|
|||
ValueObject::DumpValueObject (output_stream,
|
||||
valobj_sp.get(),
|
||||
valobj_sp->GetParent() ? name_cstr : NULL,
|
||||
options);
|
||||
options,
|
||||
format);
|
||||
// Process watchpoint if necessary.
|
||||
if (m_option_watchpoint.watch_variable)
|
||||
{
|
||||
|
@ -639,8 +641,8 @@ public:
|
|||
m_varobj_options.use_dynamic);
|
||||
if (valobj_sp)
|
||||
{
|
||||
if (format != eFormatDefault)
|
||||
valobj_sp->SetFormat (format);
|
||||
// if (format != eFormatDefault)
|
||||
// valobj_sp->SetFormat (format);
|
||||
|
||||
// When dumping all variables, don't print any variables
|
||||
// that are not in scope to avoid extra unneeded output
|
||||
|
@ -656,7 +658,8 @@ public:
|
|||
ValueObject::DumpValueObject (result.GetOutputStream(),
|
||||
valobj_sp.get(),
|
||||
name_cstr,
|
||||
options);
|
||||
options,
|
||||
format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -705,7 +705,8 @@ public:
|
|||
scope_already_checked,
|
||||
m_varobj_options.flat_output,
|
||||
m_varobj_options.be_raw ? UINT32_MAX : m_varobj_options.no_summary_depth,
|
||||
m_varobj_options.be_raw ? true : m_varobj_options.ignore_cap);
|
||||
m_varobj_options.be_raw ? true : m_varobj_options.ignore_cap,
|
||||
format);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -593,7 +593,8 @@ public:
|
|||
ValueObject::DumpValueObject (s,
|
||||
valobj_sp.get(),
|
||||
root_name,
|
||||
options);
|
||||
options,
|
||||
format);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2979,7 +2979,8 @@ ValueObject::DumpValueObject
|
|||
bool scope_already_checked,
|
||||
bool flat_output,
|
||||
uint32_t omit_summary_depth,
|
||||
bool ignore_cap
|
||||
bool ignore_cap,
|
||||
Format format_override // Normally the format is in the valobj, but we might want to override this
|
||||
)
|
||||
{
|
||||
if (valobj)
|
||||
|
@ -3064,6 +3065,7 @@ ValueObject::DumpValueObject
|
|||
}
|
||||
}
|
||||
|
||||
std::string value_str;
|
||||
const char *val_cstr = NULL;
|
||||
const char *sum_cstr = NULL;
|
||||
SummaryFormat* entry = valobj->GetSummaryFormat().get();
|
||||
|
@ -3071,9 +3073,26 @@ ValueObject::DumpValueObject
|
|||
if (omit_summary_depth > 0)
|
||||
entry = NULL;
|
||||
|
||||
Format orig_format = kNumFormats;
|
||||
if (err_cstr == NULL)
|
||||
{
|
||||
if (format_override != eFormatDefault)
|
||||
{
|
||||
orig_format = valobj->GetFormat();
|
||||
valobj->SetFormat (format_override);
|
||||
}
|
||||
val_cstr = valobj->GetValueAsCString();
|
||||
if (val_cstr)
|
||||
{
|
||||
// Cache the value in our own storage as running summaries might
|
||||
// change our value from underneath us
|
||||
value_str = val_cstr;
|
||||
}
|
||||
if (orig_format != kNumFormats && orig_format != format_override)
|
||||
{
|
||||
valobj->SetFormat (orig_format);
|
||||
orig_format = kNumFormats;
|
||||
}
|
||||
err_cstr = valobj->GetError().AsCString();
|
||||
}
|
||||
|
||||
|
@ -3086,13 +3105,13 @@ ValueObject::DumpValueObject
|
|||
const bool is_ref = type_flags.Test (ClangASTContext::eTypeIsReference);
|
||||
if (print_valobj)
|
||||
{
|
||||
|
||||
sum_cstr = (omit_summary_depth == 0) ? valobj->GetSummaryAsCString() : NULL;
|
||||
if (omit_summary_depth == 0)
|
||||
sum_cstr = valobj->GetSummaryAsCString();
|
||||
|
||||
// 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
|
||||
if (val_cstr && (!entry || entry->DoesPrintValue() || !sum_cstr))
|
||||
s.Printf(" %s", valobj->GetValueAsCString());
|
||||
// Make sure we have a value and make sure the summary didn't
|
||||
// specify that the value should not be printed
|
||||
if (!value_str.empty() && (entry == NULL || entry->DoesPrintValue() || sum_cstr == NULL))
|
||||
s.Printf(" %s", value_str.c_str());
|
||||
|
||||
if (sum_cstr)
|
||||
{
|
||||
|
@ -3199,7 +3218,8 @@ ValueObject::DumpValueObject
|
|||
true,
|
||||
flat_output,
|
||||
omit_summary_depth > 1 ? omit_summary_depth - 1 : 0,
|
||||
ignore_cap);
|
||||
ignore_cap,
|
||||
format_override);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue