Author: enrico
Date: Tue Feb 10 20:35:39 2015
New Revision: 228791
URL: http://llvm.org/viewvc/llvm-project?rev=228791&view=rev
Log:
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
Modified:
lldb/trunk/include/lldb/API/SBFrame.h
lldb/trunk/include/lldb/API/SBValue.h
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Target/LanguageRuntime.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/scripts/Python/interface/SBFrame.i
lldb/trunk/scripts/Python/interface/SBValue.i
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/include/lldb/API/SBFrame.h
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFrame.h?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFrame.h (original)
+++ lldb/trunk/include/lldb/API/SBFrame.h Tue Feb 10 20:35:39 2015
@@ -157,6 +157,14 @@ public:
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 ();
lldb::SBValue
Modified: lldb/trunk/include/lldb/API/SBValue.h
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Tue Feb 10 20:35:39 2015
@@ -326,6 +326,9 @@ public:
//------------------------------------------------------------------
bool
MightHaveChildren ();
+
+ bool
+ IsRuntimeSupportValue ();
uint32_t
GetNumChildren ();
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Feb 10 20:35:39 2015
@@ -992,6 +992,9 @@ public:
//------------------------------------------------------------------
virtual bool
MightHaveChildren();
+
+ virtual bool
+ IsRuntimeSupportValue ();
protected:
typedef ClusterManager<ValueObject> ValueObjectManager;
Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Tue Feb 10 20:35:39 2015
@@ -109,6 +109,12 @@ public:
{
return false;
}
+
+ virtual bool
+ IsRuntimeSupportValue (const ValueObject& valobj)
+ {
+ return false;
+ }
protected:
//------------------------------------------------------------------
Modified: lldb/trunk/include/lldb/Target/Target.h
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Tue Feb 10 20:35:39 2015
@@ -189,6 +189,12 @@ public:
void
SetUserSpecifiedTrapHandlerNames (const Args &args);
+
+ bool
+ GetDisplayRuntimeSupportValues () const;
+
+ void
+ SetDisplayRuntimeSupportValues (bool b);
};
typedef std::shared_ptr<TargetProperties> TargetPropertiesSP;
Modified: lldb/trunk/scripts/Python/interface/SBFrame.i
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBFrame.i?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBFrame.i (original)
+++ lldb/trunk/scripts/Python/interface/SBFrame.i Tue Feb 10 20:35:39 2015
@@ -199,6 +199,14 @@ public:
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 ();
%feature("docstring", "
Modified: lldb/trunk/scripts/Python/interface/SBValue.i
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBValue.i (original)
+++ lldb/trunk/scripts/Python/interface/SBValue.i Tue Feb 10 20:35:39 2015
@@ -314,6 +314,9 @@ public:
bool
MightHaveChildren ();
+
+ bool
+ IsRuntimeSupportValue ();
uint32_t
GetNumChildren ();
Modified: lldb/trunk/source/API/SBFrame.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Tue Feb 10 20:35:39 2015
@@ -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);
Modified: lldb/trunk/source/API/SBValue.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Tue Feb 10 20:35:39 2015
@@ -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 ()
{
Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Feb 10 20:35:39 2015
@@ -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);
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Feb 10 20:35:39 2015
@@ -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:
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Feb 10 20:35:39 2015
@@ -2064,6 +2064,21 @@ ValueObject::IsPossibleDynamicType ()
}
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 ()
{
const uint32_t mask = eTypeIsObjC | eTypeIsPointer;
Modified: lldb/trunk/source/Target/Target.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=228791&r1=228790&r2=228791&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue Feb 10 20:35:39 2015
@@ -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::SetUserSpecifiedTrapHa
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
//----------------------------------------------------------------------
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits