summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py
diff options
context:
space:
mode:
authorKuba Mracek <mracek@apple.com>2018-10-31 00:21:03 +0000
committerKuba Mracek <mracek@apple.com>2018-10-31 00:21:03 +0000
commitac0ba8c52493012daabb73512a5739394c37a2dc (patch)
tree60ae5cde6970cb9d828e8ca3c7bcdf2e4095b4c5 /lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py
parent1079d7ccfeccf8344eb799bef392a875693ab353 (diff)
downloadbcm5719-llvm-ac0ba8c52493012daabb73512a5739394c37a2dc.tar.gz
bcm5719-llvm-ac0ba8c52493012daabb73512a5739394c37a2dc.zip
[lldb] Introduce StackFrameRecognizer
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: 345678
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py
new file mode 100644
index 00000000000..a8a50674511
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py
@@ -0,0 +1,21 @@
+# encoding: utf-8
+
+import lldb
+
+class MyFrameRecognizer(object):
+ def get_recognized_arguments(self, frame):
+ if frame.name == "foo":
+ arg1 = frame.EvaluateExpression("$arg1").signed
+ arg2 = frame.EvaluateExpression("$arg2").signed
+ val1 = lldb.target.CreateValueFromExpression("a", "%d" % arg1)
+ val2 = lldb.target.CreateValueFromExpression("b", "%d" % arg2)
+ return [val1, val2]
+ elif frame.name == "bar":
+ arg1 = frame.EvaluateExpression("$arg1").signed
+ val1 = lldb.target.CreateValueFromExpression("a", "(int *)%d" % arg1)
+ return [val1]
+ return []
+
+class MyOtherFrameRecognizer(object):
+ def get_recognized_arguments(self, frame):
+ return []
OpenPOWER on IntegriCloud