summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-06-18 20:06:08 +0000
committerGreg Clayton <gclayton@apple.com>2011-06-18 20:06:08 +0000
commit316d498baaa168aac61560c12388f6e4c4a4de6d (patch)
tree2b87b1b3545e2b67aa44a522fe0b2a56add55bc6 /lldb/source/API
parentdc7f4ee3823c35d4cf2c124483b9ff4653dc9ecb (diff)
downloadbcm5719-llvm-316d498baaa168aac61560c12388f6e4c4a4de6d.tar.gz
bcm5719-llvm-316d498baaa168aac61560c12388f6e4c4a4de6d.zip
Added two new API functions to SBFrame:
const char * SBFrame::GetFunctionName(); bool SBFrame::IsInlined(); The first one will return the correct name for a frame. The name of a frame is: - the name of the inlined function (if there is one) - the name of the concrete function (if there is one) - the name of the symbol (if there is one) - NULL We also can now easily check if a frame is an inline function or not. llvm-svn: 133357
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBFrame.cpp92
1 files changed, 79 insertions, 13 deletions
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 0a5988e1795..334429a1944 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -343,8 +343,13 @@ SBFrame::Clear()
SBValue
SBFrame::FindVariable (const char *name)
{
- lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
- return FindVariable (name, use_dynamic);
+ SBValue value;
+ if (m_opaque_sp)
+ {
+ lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
+ value = FindVariable (name, use_dynamic);
+ }
+ return value;
}
SBValue
@@ -373,11 +378,12 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
var_sp = variable_list.FindVariable (ConstString(name));
}
}
+
+ if (var_sp)
+ *sb_value = ValueObjectSP (m_opaque_sp->GetValueObjectForFrameVariable(var_sp, use_dynamic));
+
}
- if (var_sp)
- *sb_value = ValueObjectSP (m_opaque_sp->GetValueObjectForFrameVariable(var_sp, use_dynamic));
-
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
@@ -389,8 +395,13 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
SBValue
SBFrame::FindValue (const char *name, ValueType value_type)
{
- lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
- return FindValue (name, value_type, use_dynamic);
+ SBValue value;
+ if (m_opaque_sp)
+ {
+ lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
+ value = FindValue (name, value_type, use_dynamic);
+ }
+ return value;
}
SBValue
@@ -579,8 +590,13 @@ SBFrame::GetVariables (bool arguments,
bool statics,
bool in_scope_only)
{
- lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
- return GetVariables (arguments, locals, statics, in_scope_only, use_dynamic);
+ SBValueList value_list;
+ if (m_opaque_sp)
+ {
+ lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
+ value_list = GetVariables (arguments, locals, statics, in_scope_only, use_dynamic);
+ }
+ return value_list;
}
SBValueList
@@ -706,15 +722,18 @@ SBFrame::GetDescription (SBStream &description)
SBValue
SBFrame::EvaluateExpression (const char *expr)
{
- lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
- return EvaluateExpression (expr, use_dynamic);
+ SBValue result;
+ if (m_opaque_sp)
+ {
+ lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
+ result = EvaluateExpression (expr, use_dynamic);
+ }
+ return result;
}
SBValue
SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dynamic_value)
{
- Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
-
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
LogSP expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -725,6 +744,8 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
if (m_opaque_sp)
{
+ Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
+
ExecutionResults exe_results;
const bool unwind_on_error = true;
const bool keep_in_memory = false;
@@ -749,3 +770,48 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
return expr_result;
}
+
+bool
+SBFrame::IsInlined()
+{
+ if (m_opaque_sp)
+ {
+ Block *block = m_opaque_sp->GetSymbolContext(eSymbolContextBlock).block;
+ if (block)
+ return block->GetContainingInlinedBlock () != NULL;
+ }
+ return false;
+}
+
+const char *
+SBFrame::GetFunctionName()
+{
+ const char *name = NULL;
+ if (m_opaque_sp)
+ {
+ SymbolContext sc (m_opaque_sp->GetSymbolContext(eSymbolContextFunction | eSymbolContextBlock | eSymbolContextSymbol));
+ if (sc.block)
+ {
+ Block *inlined_block = sc.block->GetContainingInlinedBlock ();
+ if (inlined_block)
+ {
+ const InlineFunctionInfo* inlined_info = inlined_block->GetInlinedFunctionInfo();
+ name = inlined_info->GetName().AsCString();
+ }
+ }
+
+ if (name == NULL)
+ {
+ if (sc.function)
+ name = sc.function->GetName().GetCString();
+ }
+
+ if (name == NULL)
+ {
+ if (sc.symbol)
+ name = sc.symbol->GetName().GetCString();
+ }
+ }
+ return name;
+}
+
OpenPOWER on IntegriCloud