summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBFrame.cpp
diff options
context:
space:
mode:
authorKuba Mracek <mracek@apple.com>2018-10-31 04:00:22 +0000
committerKuba Mracek <mracek@apple.com>2018-10-31 04:00:22 +0000
commit41ae8e744531410943be6e67107b2f845e595ebb (patch)
tree5c5f4a1648f33aac37177856b334302d69c1b66a /lldb/source/API/SBFrame.cpp
parent7c44da279e399d302a685c500e7f802f8adf9762 (diff)
downloadbcm5719-llvm-41ae8e744531410943be6e67107b2f845e595ebb.tar.gz
bcm5719-llvm-41ae8e744531410943be6e67107b2f845e595ebb.zip
[lldb] Introduce StackFrameRecognizer [take 3]
This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 llvm-svn: 345693
Diffstat (limited to 'lldb/source/API/SBFrame.cpp')
-rw-r--r--lldb/source/API/SBFrame.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 8a9088de176..33348f8bcdf 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -36,6 +36,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/StackFrameRecognizer.h"
#include "lldb/Target/StackID.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
@@ -960,6 +961,7 @@ SBValueList SBFrame::GetVariables(const lldb::SBVariablesOptions &options) {
const bool statics = options.GetIncludeStatics();
const bool arguments = options.GetIncludeArguments();
+ const bool recognized_arguments = options.GetIncludeRecognizedArguments();
const bool locals = options.GetIncludeLocals();
const bool in_scope_only = options.GetInScopeOnly();
const bool include_runtime_support_values =
@@ -967,10 +969,11 @@ SBValueList SBFrame::GetVariables(const lldb::SBVariablesOptions &options) {
const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
if (log)
- 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);
+ log->Printf(
+ "SBFrame::GetVariables (arguments=%i, recognized_arguments=%i, "
+ "locals=%i, statics=%i, in_scope_only=%i runtime=%i dynamic=%i)",
+ arguments, recognized_arguments, locals, statics, in_scope_only,
+ include_runtime_support_values, use_dynamic);
std::set<VariableSP> variable_set;
Process *process = exe_ctx.GetProcessPtr();
@@ -1032,6 +1035,20 @@ SBValueList SBFrame::GetVariables(const lldb::SBVariablesOptions &options) {
}
}
}
+ if (recognized_arguments) {
+ auto recognized_frame = frame->GetRecognizedFrame();
+ if (recognized_frame) {
+ ValueObjectListSP recognized_arg_list =
+ recognized_frame->GetRecognizedArguments();
+ if (recognized_arg_list) {
+ for (auto &rec_value_sp : recognized_arg_list->GetObjects()) {
+ SBValue value_sb;
+ value_sb.SetSP(rec_value_sp, use_dynamic);
+ value_list.Append(value_sb);
+ }
+ }
+ }
+ }
} else {
if (log)
log->Printf("SBFrame::GetVariables () => error: could not "
OpenPOWER on IntegriCloud