forked from OSchip/llvm-project
Introduce the notion of "runtime support values"
A runtime support value is a ValueObject whose only purpose is to support some language runtime's operation, but it does not directly provide any user-visible benefit As such, unless the user is working on the runtime support, it is mostly safe for them not to see such a value when debugging It is a language runtime's job to check whether a ValueObject is a support value, and that - in conjunction with a target setting - is used by frame variable and target variable SBFrame::GetVariables gets a new overload with yet another flag to dictate whether to return those support values to the caller - that which defaults to the setting's value rdar://problem/15539930 llvm-svn: 228791
This commit is contained in:
parent
7ad134a746
commit
560558eb7c
|
@ -156,6 +156,14 @@ public:
|
|||
bool in_scope_only,
|
||||
lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValueList
|
||||
GetVariables (bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
bool in_scope_only,
|
||||
bool include_runtime_support_values,
|
||||
lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValueList
|
||||
GetRegisters ();
|
||||
|
||||
|
|
|
@ -326,6 +326,9 @@ public:
|
|||
//------------------------------------------------------------------
|
||||
bool
|
||||
MightHaveChildren ();
|
||||
|
||||
bool
|
||||
IsRuntimeSupportValue ();
|
||||
|
||||
uint32_t
|
||||
GetNumChildren ();
|
||||
|
|
|
@ -992,6 +992,9 @@ public:
|
|||
//------------------------------------------------------------------
|
||||
virtual bool
|
||||
MightHaveChildren();
|
||||
|
||||
virtual bool
|
||||
IsRuntimeSupportValue ();
|
||||
|
||||
protected:
|
||||
typedef ClusterManager<ValueObject> ValueObjectManager;
|
||||
|
|
|
@ -109,6 +109,12 @@ public:
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
IsRuntimeSupportValue (const ValueObject& valobj)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -189,6 +189,12 @@ public:
|
|||
|
||||
void
|
||||
SetUserSpecifiedTrapHandlerNames (const Args &args);
|
||||
|
||||
bool
|
||||
GetDisplayRuntimeSupportValues () const;
|
||||
|
||||
void
|
||||
SetDisplayRuntimeSupportValues (bool b);
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<TargetProperties> TargetPropertiesSP;
|
||||
|
|
|
@ -198,6 +198,14 @@ public:
|
|||
bool in_scope_only,
|
||||
lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValueList
|
||||
GetVariables (bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
bool in_scope_only,
|
||||
bool include_runtime_support_values,
|
||||
lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValueList
|
||||
GetRegisters ();
|
||||
|
||||
|
|
|
@ -314,6 +314,9 @@ public:
|
|||
|
||||
bool
|
||||
MightHaveChildren ();
|
||||
|
||||
bool
|
||||
IsRuntimeSupportValue ();
|
||||
|
||||
uint32_t
|
||||
GetNumChildren ();
|
||||
|
|
|
@ -1080,11 +1080,30 @@ SBFrame::GetVariables (bool arguments,
|
|||
return value_list;
|
||||
}
|
||||
|
||||
lldb::SBValueList
|
||||
SBFrame::GetVariables (bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
bool in_scope_only,
|
||||
lldb::DynamicValueType use_dynamic)
|
||||
{
|
||||
ExecutionContext exe_ctx(m_opaque_sp.get());
|
||||
Target *target = exe_ctx.GetTargetPtr();
|
||||
bool include_runtime_support_values = target ? target->GetDisplayRuntimeSupportValues() : false;
|
||||
return GetVariables(arguments,
|
||||
locals,
|
||||
statics,
|
||||
in_scope_only,
|
||||
include_runtime_support_values,
|
||||
use_dynamic);
|
||||
}
|
||||
|
||||
SBValueList
|
||||
SBFrame::GetVariables (bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
bool in_scope_only,
|
||||
bool include_runtime_support_values,
|
||||
lldb::DynamicValueType use_dynamic)
|
||||
{
|
||||
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
|
@ -1147,6 +1166,12 @@ SBFrame::GetVariables (bool arguments,
|
|||
continue;
|
||||
|
||||
ValueObjectSP valobj_sp(frame->GetValueObjectForFrameVariable (variable_sp, eNoDynamicValues));
|
||||
|
||||
if (false == include_runtime_support_values &&
|
||||
valobj_sp &&
|
||||
true == valobj_sp->IsRuntimeSupportValue())
|
||||
continue;
|
||||
|
||||
SBValue value_sb;
|
||||
value_sb.SetSP(valobj_sp,use_dynamic);
|
||||
value_list.Append(value_sb);
|
||||
|
|
|
@ -1244,6 +1244,22 @@ SBValue::MightHaveChildren ()
|
|||
return has_children;
|
||||
}
|
||||
|
||||
bool
|
||||
SBValue::IsRuntimeSupportValue ()
|
||||
{
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
bool is_support = false;
|
||||
ValueLocker locker;
|
||||
lldb::ValueObjectSP value_sp(GetSP(locker));
|
||||
if (value_sp)
|
||||
is_support = value_sp->IsRuntimeSupportValue();
|
||||
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::IsRuntimeSupportValue() => %i",
|
||||
static_cast<void*>(value_sp.get()), is_support);
|
||||
return is_support;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
SBValue::GetNumChildren ()
|
||||
{
|
||||
|
|
|
@ -522,30 +522,31 @@ protected:
|
|||
{
|
||||
var_sp = variable_list->GetVariableAtIndex(i);
|
||||
bool dump_variable = true;
|
||||
std::string scope_string;
|
||||
switch (var_sp->GetScope())
|
||||
{
|
||||
case eValueTypeVariableGlobal:
|
||||
dump_variable = m_option_variable.show_globals;
|
||||
if (dump_variable && m_option_variable.show_scope)
|
||||
s.PutCString("GLOBAL: ");
|
||||
scope_string = "GLOBAL: ";
|
||||
break;
|
||||
|
||||
case eValueTypeVariableStatic:
|
||||
dump_variable = m_option_variable.show_globals;
|
||||
if (dump_variable && m_option_variable.show_scope)
|
||||
s.PutCString("STATIC: ");
|
||||
scope_string = "STATIC: ";
|
||||
break;
|
||||
|
||||
case eValueTypeVariableArgument:
|
||||
dump_variable = m_option_variable.show_args;
|
||||
if (dump_variable && m_option_variable.show_scope)
|
||||
s.PutCString(" ARG: ");
|
||||
scope_string = " ARG: ";
|
||||
break;
|
||||
|
||||
case eValueTypeVariableLocal:
|
||||
dump_variable = m_option_variable.show_locals;
|
||||
if (dump_variable && m_option_variable.show_scope)
|
||||
s.PutCString(" LOCAL: ");
|
||||
scope_string = " LOCAL: ";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -568,6 +569,13 @@ protected:
|
|||
// that are not in scope to avoid extra unneeded output
|
||||
if (valobj_sp->IsInScope ())
|
||||
{
|
||||
if (false == valobj_sp->GetTargetSP()->GetDisplayRuntimeSupportValues() &&
|
||||
true == valobj_sp->IsRuntimeSupportValue())
|
||||
continue;
|
||||
|
||||
if (!scope_string.empty())
|
||||
s.PutCString(scope_string.c_str());
|
||||
|
||||
if (m_option_variable.show_decl && var_sp->GetDeclaration ().GetFile())
|
||||
{
|
||||
var_sp->GetDeclaration ().DumpStopContext (&s, false);
|
||||
|
|
|
@ -773,6 +773,10 @@ public:
|
|||
{
|
||||
DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions());
|
||||
|
||||
if (false == valobj_sp->GetTargetSP()->GetDisplayRuntimeSupportValues() &&
|
||||
true == valobj_sp->IsRuntimeSupportValue())
|
||||
return;
|
||||
|
||||
switch (var_sp->GetScope())
|
||||
{
|
||||
case eValueTypeVariableGlobal:
|
||||
|
|
|
@ -2063,6 +2063,21 @@ ValueObject::IsPossibleDynamicType ()
|
|||
return GetClangType().IsPossibleDynamicType (NULL, true, true);
|
||||
}
|
||||
|
||||
bool
|
||||
ValueObject::IsRuntimeSupportValue ()
|
||||
{
|
||||
Process *process(GetProcessSP().get());
|
||||
if (process)
|
||||
{
|
||||
LanguageRuntime *runtime = process->GetLanguageRuntime(GetObjectRuntimeLanguage());
|
||||
if (!runtime)
|
||||
runtime = process->GetObjCLanguageRuntime();
|
||||
if (runtime)
|
||||
return runtime->IsRuntimeSupportValue(*this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ValueObject::IsObjCNil ()
|
||||
{
|
||||
|
|
|
@ -2889,8 +2889,10 @@ g_properties[] =
|
|||
"'minimal' is the fastest setting and will load section data with no symbols, but should rarely be used as stack frames in these memory regions will be inaccurate and not provide any context (fastest). " },
|
||||
{ "display-expression-in-crashlogs" , OptionValue::eTypeBoolean , false, false, NULL, NULL, "Expressions that crash will show up in crash logs if the host system supports executable specific crash log strings and this setting is set to true." },
|
||||
{ "trap-handler-names" , OptionValue::eTypeArray , true, OptionValue::eTypeString, NULL, NULL, "A list of trap handler function names, e.g. a common Unix user process one is _sigtramp." },
|
||||
{ "display-runtime-support-values" , OptionValue::eTypeBoolean , false, false, NULL, NULL, "If true, LLDB will show variables that are meant to support the operation of a language's runtime support." },
|
||||
{ NULL , OptionValue::eTypeInvalid , false, 0 , NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ePropertyDefaultArch,
|
||||
|
@ -2923,7 +2925,8 @@ enum
|
|||
ePropertyLoadScriptFromSymbolFile,
|
||||
ePropertyMemoryModuleLoadLevel,
|
||||
ePropertyDisplayExpressionsInCrashlogs,
|
||||
ePropertyTrapHandlerNames
|
||||
ePropertyTrapHandlerNames,
|
||||
ePropertyDisplayRuntimeSupportValues
|
||||
};
|
||||
|
||||
|
||||
|
@ -3358,6 +3361,20 @@ TargetProperties::SetUserSpecifiedTrapHandlerNames (const Args &args)
|
|||
m_collection_sp->SetPropertyAtIndexFromArgs (NULL, idx, args);
|
||||
}
|
||||
|
||||
bool
|
||||
TargetProperties::GetDisplayRuntimeSupportValues () const
|
||||
{
|
||||
const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, false);
|
||||
}
|
||||
|
||||
void
|
||||
TargetProperties::SetDisplayRuntimeSupportValues (bool b)
|
||||
{
|
||||
const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean (NULL, idx, b);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Target::TargetEventData
|
||||
//----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue