diff options
author | emaste <emaste@FreeBSD.org> | 2015-07-03 16:57:06 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2015-07-03 16:57:06 +0000 |
commit | 8037fa4ee916fa20b3c63cbf531f4ee7e1c76138 (patch) | |
tree | 3c2e41c3be19b7fc7666ed45a5f91ec3b6e35f2a /source/API/SBFrame.cpp | |
parent | d61b076ede88b56f3372a55e7d1eac6a9d717120 (diff) | |
download | FreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.zip FreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.tar.gz |
Import LLDB as of upstream SVN 241361 (git 612c075f)
Diffstat (limited to 'source/API/SBFrame.cpp')
-rw-r--r-- | source/API/SBFrame.cpp | 115 |
1 files changed, 89 insertions, 26 deletions
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp index 325f40f..e845aef 100644 --- a/source/API/SBFrame.cpp +++ b/source/API/SBFrame.cpp @@ -21,6 +21,7 @@ #include "lldb/Core/StreamFile.h" #include "lldb/Core/ValueObjectRegister.h" #include "lldb/Core/ValueObjectVariable.h" +#include "lldb/Expression/ClangPersistentVariables.h" #include "lldb/Expression/ClangUserExpression.h" #include "lldb/Host/Host.h" #include "lldb/Symbol/Block.h" @@ -44,6 +45,7 @@ #include "lldb/API/SBStream.h" #include "lldb/API/SBSymbolContext.h" #include "lldb/API/SBThread.h" +#include "lldb/API/SBVariablesOptions.h" using namespace lldb; using namespace lldb_private; @@ -452,6 +454,17 @@ SBFrame::GetFrameID () const return frame_idx; } +lldb::addr_t +SBFrame::GetCFA () const +{ + ExecutionContext exe_ctx(m_opaque_sp.get()); + StackFrame *frame = exe_ctx.GetFramePtr(); + if (frame) + return frame->GetStackID().GetCallFrameAddress(); + return LLDB_INVALID_ADDRESS; +} + + addr_t SBFrame::GetPC () const { @@ -868,32 +881,30 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy case eValueTypeVariableArgument: // function argument variables case eValueTypeVariableLocal: // function local variables { - SymbolContext sc (frame->GetSymbolContext (eSymbolContextBlock)); + SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock)); const bool can_create = true; const bool get_parent_variables = true; const bool stop_if_block_is_inlined_function = true; - if (sc.block && sc.block->AppendVariables (can_create, - get_parent_variables, - stop_if_block_is_inlined_function, - &variable_list)) + if (sc.block) + sc.block->AppendVariables(can_create, + get_parent_variables, + stop_if_block_is_inlined_function, + &variable_list); + if (value_type == eValueTypeVariableGlobal) { - if (value_type == eValueTypeVariableGlobal) - { - const bool get_file_globals = true; - VariableList* frame_vars = frame->GetVariableList(get_file_globals); - if (frame_vars) - frame_vars->AppendVariablesIfUnique(variable_list); - } - ConstString const_name(name); - VariableSP variable_sp(variable_list.FindVariable(const_name,value_type)); - if (variable_sp) - { - value_sp = frame->GetValueObjectForFrameVariable (variable_sp, eNoDynamicValues); - sb_value.SetSP (value_sp, use_dynamic); - break; - } + const bool get_file_globals = true; + VariableList *frame_vars = frame->GetVariableList(get_file_globals); + if (frame_vars) + frame_vars->AppendVariablesIfUnique(variable_list); + } + ConstString const_name(name); + VariableSP variable_sp(variable_list.FindVariable(const_name, value_type)); + if (variable_sp) + { + value_sp = frame->GetValueObjectForFrameVariable(variable_sp, eNoDynamicValues); + sb_value.SetSP(value_sp, use_dynamic); } } break; @@ -1075,18 +1086,44 @@ SBFrame::GetVariables (bool arguments, if (frame && target) { lldb::DynamicValueType use_dynamic = frame->CalculateTarget()->GetPreferDynamicValue(); - value_list = GetVariables (arguments, locals, statics, in_scope_only, use_dynamic); + const bool include_runtime_support_values = target ? target->GetDisplayRuntimeSupportValues() : false; + + SBVariablesOptions options; + options.SetIncludeArguments(arguments); + options.SetIncludeLocals(locals); + options.SetIncludeStatics(statics); + options.SetInScopeOnly(in_scope_only); + options.SetIncludeRuntimeSupportValues(include_runtime_support_values); + options.SetUseDynamic(use_dynamic); + + value_list = GetVariables (options); } return value_list; } -SBValueList +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(); + const bool include_runtime_support_values = target ? target->GetDisplayRuntimeSupportValues() : false; + SBVariablesOptions options; + options.SetIncludeArguments(arguments); + options.SetIncludeLocals(locals); + options.SetIncludeStatics(statics); + options.SetInScopeOnly(in_scope_only); + options.SetIncludeRuntimeSupportValues(include_runtime_support_values); + options.SetUseDynamic(use_dynamic); + return GetVariables(options); +} + +SBValueList +SBFrame::GetVariables (const lldb::SBVariablesOptions& options) +{ Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBValueList value_list; @@ -1096,10 +1133,19 @@ SBFrame::GetVariables (bool arguments, StackFrame *frame = NULL; Target *target = exe_ctx.GetTargetPtr(); + const bool statics = options.GetIncludeStatics(); + const bool arguments = options.GetIncludeArguments(); + const bool locals = options.GetIncludeLocals(); + const bool in_scope_only = options.GetInScopeOnly(); + const bool include_runtime_support_values = options.GetIncludeRuntimeSupportValues(); + const lldb::DynamicValueType use_dynamic = options.GetUseDynamic(); + if (log) - log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)", - arguments, locals, statics, in_scope_only); - + log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i runtime=%i dynamic=%i)", + arguments, locals, + statics, in_scope_only, + include_runtime_support_values, use_dynamic); + Process *process = exe_ctx.GetProcessPtr(); if (target && process) { @@ -1147,6 +1193,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); @@ -1449,6 +1501,12 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option bool SBFrame::IsInlined() { + return static_cast<const SBFrame*>(this)->IsInlined(); +} + +bool +SBFrame::IsInlined() const +{ Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); ExecutionContext exe_ctx(m_opaque_sp.get()); StackFrame *frame = NULL; @@ -1486,6 +1544,12 @@ SBFrame::IsInlined() const char * SBFrame::GetFunctionName() { + return static_cast<const SBFrame*>(this)->GetFunctionName(); +} + +const char * +SBFrame::GetFunctionName() const +{ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); const char *name = NULL; ExecutionContext exe_ctx(m_opaque_sp.get()); @@ -1538,4 +1602,3 @@ SBFrame::GetFunctionName() } return name; } - |