diff options
| author | Enrico Granata <egranata@apple.com> | 2015-02-11 02:35:39 +0000 |
|---|---|---|
| committer | Enrico Granata <egranata@apple.com> | 2015-02-11 02:35:39 +0000 |
| commit | 560558eb7c1deee76a1adb941e001e074dba460d (patch) | |
| tree | 361a34a9afb6b9516874d4537736cae2b917806a | |
| parent | 7ad134a7467c97ce9d8ef46fea90267a03c30b30 (diff) | |
| download | bcm5719-llvm-560558eb7c1deee76a1adb941e001e074dba460d.tar.gz bcm5719-llvm-560558eb7c1deee76a1adb941e001e074dba460d.zip | |
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
| -rw-r--r-- | lldb/include/lldb/API/SBFrame.h | 8 | ||||
| -rw-r--r-- | lldb/include/lldb/API/SBValue.h | 3 | ||||
| -rw-r--r-- | lldb/include/lldb/Core/ValueObject.h | 3 | ||||
| -rw-r--r-- | lldb/include/lldb/Target/LanguageRuntime.h | 6 | ||||
| -rw-r--r-- | lldb/include/lldb/Target/Target.h | 6 | ||||
| -rw-r--r-- | lldb/scripts/Python/interface/SBFrame.i | 8 | ||||
| -rw-r--r-- | lldb/scripts/Python/interface/SBValue.i | 3 | ||||
| -rw-r--r-- | lldb/source/API/SBFrame.cpp | 25 | ||||
| -rw-r--r-- | lldb/source/API/SBValue.cpp | 16 | ||||
| -rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 16 | ||||
| -rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 4 | ||||
| -rw-r--r-- | lldb/source/Core/ValueObject.cpp | 15 | ||||
| -rw-r--r-- | lldb/source/Target/Target.cpp | 19 |
13 files changed, 127 insertions, 5 deletions
diff --git a/lldb/include/lldb/API/SBFrame.h b/lldb/include/lldb/API/SBFrame.h index b93e36afecd..550d86a4958 100644 --- a/lldb/include/lldb/API/SBFrame.h +++ b/lldb/include/lldb/API/SBFrame.h @@ -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 diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h index bedac4ef1d2..1d6278b33ea 100644 --- a/lldb/include/lldb/API/SBValue.h +++ b/lldb/include/lldb/API/SBValue.h @@ -326,6 +326,9 @@ public: //------------------------------------------------------------------ bool MightHaveChildren (); + + bool + IsRuntimeSupportValue (); uint32_t GetNumChildren (); diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index b50adfb6956..a29b67dc9e4 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -992,6 +992,9 @@ public: //------------------------------------------------------------------ virtual bool MightHaveChildren(); + + virtual bool + IsRuntimeSupportValue (); protected: typedef ClusterManager<ValueObject> ValueObjectManager; diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h index d5ed8195647..e2d470ee795 100644 --- a/lldb/include/lldb/Target/LanguageRuntime.h +++ b/lldb/include/lldb/Target/LanguageRuntime.h @@ -109,6 +109,12 @@ public: { return false; } + + virtual bool + IsRuntimeSupportValue (const ValueObject& valobj) + { + return false; + } protected: //------------------------------------------------------------------ diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index e9389cfbc08..f6f0966c185 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -189,6 +189,12 @@ public: void SetUserSpecifiedTrapHandlerNames (const Args &args); + + bool + GetDisplayRuntimeSupportValues () const; + + void + SetDisplayRuntimeSupportValues (bool b); }; typedef std::shared_ptr<TargetProperties> TargetPropertiesSP; diff --git a/lldb/scripts/Python/interface/SBFrame.i b/lldb/scripts/Python/interface/SBFrame.i index 207f282a263..5cacb5ea1b3 100644 --- a/lldb/scripts/Python/interface/SBFrame.i +++ b/lldb/scripts/Python/interface/SBFrame.i @@ -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", " diff --git a/lldb/scripts/Python/interface/SBValue.i b/lldb/scripts/Python/interface/SBValue.i index 03938077275..e7e67b71898 100644 --- a/lldb/scripts/Python/interface/SBValue.i +++ b/lldb/scripts/Python/interface/SBValue.i @@ -314,6 +314,9 @@ public: bool MightHaveChildren (); + + bool + IsRuntimeSupportValue (); uint32_t GetNumChildren (); diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index 325f40fd5b5..da1d32f2e80 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -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); diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index edecb93944a..e383f4ca919 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -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 () { diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index 4458a692a18..cd382165457 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -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); diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 9188283966f..b9e4942caef 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -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: diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index b72e5c3f18c..ebbcb8ec408 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -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; diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 8ea6942c2f0..657d819b652 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -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 //---------------------------------------------------------------------- |

