aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/lldb/Target/StackFrameRecognizer.h37
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py2
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py1
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp2
-rw-r--r--source/Target/StackFrameRecognizer.cpp8
5 files changed, 49 insertions, 1 deletions
diff --git a/include/lldb/Target/StackFrameRecognizer.h b/include/lldb/Target/StackFrameRecognizer.h
index 774226990..7fcdc8f85 100644
--- a/include/lldb/Target/StackFrameRecognizer.h
+++ b/include/lldb/Target/StackFrameRecognizer.h
@@ -9,6 +9,7 @@
#ifndef liblldb_StackFrameRecognizer_h_
#define liblldb_StackFrameRecognizer_h_
+#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Utility/StructuredData.h"
@@ -123,6 +124,42 @@ public:
static lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame);
};
+/// @class ValueObjectRecognizerSynthesizedValue
+///
+/// ValueObject subclass that presents the passed ValueObject as a recognized
+/// value with the specified ValueType. Frame recognizers should return
+/// instances of this class as the returned objects in GetRecognizedArguments().
+
+class ValueObjectRecognizerSynthesizedValue : public ValueObject {
+ public:
+ static lldb::ValueObjectSP Create(ValueObject &parent, lldb::ValueType type) {
+ return (new ValueObjectRecognizerSynthesizedValue(parent, type))->GetSP();
+ }
+ ValueObjectRecognizerSynthesizedValue(ValueObject &parent,
+ lldb::ValueType type)
+ : ValueObject(parent), m_type(type) {
+ SetName(parent.GetName());
+ }
+
+ uint64_t GetByteSize() override { return m_parent->GetByteSize(); }
+ lldb::ValueType GetValueType() const override { return m_type; }
+ bool UpdateValue() override {
+ if (!m_parent->UpdateValueIfNeeded()) return false;
+ m_value = m_parent->GetValue();
+ return true;
+ }
+ size_t CalculateNumChildren(uint32_t max = UINT32_MAX) override {
+ return m_parent->GetNumChildren(max);
+ }
+ CompilerType GetCompilerTypeImpl() override {
+ return m_parent->GetCompilerType();
+ }
+ bool IsSynthetic() override { return true; }
+
+ private:
+ lldb::ValueType m_type;
+};
+
} // namespace lldb_private
#endif // liblldb_StackFrameRecognizer_h_
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py b/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
index 1162157ba..2ecbe1e4c 100644
--- a/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
+++ b/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
@@ -89,8 +89,10 @@ class FrameRecognizerTestCase(TestBase):
self.assertEqual(variables.GetSize(), 2)
self.assertEqual(variables.GetValueAtIndex(0).name, "a")
self.assertEqual(variables.GetValueAtIndex(0).signed, 42)
+ self.assertEqual(variables.GetValueAtIndex(0).GetValueType(), lldb.eValueTypeVariableArgument)
self.assertEqual(variables.GetValueAtIndex(1).name, "b")
self.assertEqual(variables.GetValueAtIndex(1).signed, 56)
+ self.assertEqual(variables.GetValueAtIndex(1).GetValueType(), lldb.eValueTypeVariableArgument)
self.expect("frame recognizer info 0",
substrs=['frame 0 is recognized by recognizer.MyFrameRecognizer'])
diff --git a/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py b/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
index aa6460696..cc68e3677 100644
--- a/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
+++ b/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
@@ -44,6 +44,7 @@ class ObjCExceptionsTestCase(TestBase):
self.assertEqual(variables.GetSize(), 1)
self.assertEqual(variables.GetValueAtIndex(0).name, "exception")
+ self.assertEqual(variables.GetValueAtIndex(0).GetValueType(), lldb.eValueTypeVariableArgument)
lldbutil.run_to_source_breakpoint(self, "// Set break point at this line.", lldb.SBFileSpec("main.mm"), launch_info=launch_info)
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 3520fee6d..96e2c098e 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2628,6 +2628,8 @@ class ObjCExceptionRecognizedStackFrame : public RecognizedStackFrame {
value.SetCompilerType(voidstar);
exception = ValueObjectConstResult::Create(frame_sp.get(), value,
ConstString("exception"));
+ exception = ValueObjectRecognizerSynthesizedValue::Create(
+ *exception, eValueTypeVariableArgument);
exception = exception->GetDynamicValue(eDynamicDontRunTarget);
m_arguments = ValueObjectListSP(new ValueObjectList());
diff --git a/source/Target/StackFrameRecognizer.cpp b/source/Target/StackFrameRecognizer.cpp
index 23b45f6b6..b6ba3126f 100644
--- a/source/Target/StackFrameRecognizer.cpp
+++ b/source/Target/StackFrameRecognizer.cpp
@@ -40,8 +40,14 @@ ScriptedStackFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame) {
ValueObjectListSP args =
m_interpreter->GetRecognizedArguments(m_python_object_sp, frame);
+ auto args_synthesized = ValueObjectListSP(new ValueObjectList());
+ for (const auto o : args->GetObjects()) {
+ args_synthesized->Append(ValueObjectRecognizerSynthesizedValue::Create(
+ *o, eValueTypeVariableArgument));
+ }
- return RecognizedStackFrameSP(new ScriptedRecognizedStackFrame(args));
+ return RecognizedStackFrameSP(
+ new ScriptedRecognizedStackFrame(args_synthesized));
}
#endif