Index: include/lldb/Target/StackFrameRecognizer.h =================================================================== --- include/lldb/Target/StackFrameRecognizer.h +++ include/lldb/Target/StackFrameRecognizer.h @@ -10,6 +10,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" @@ -124,6 +125,42 @@ 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_ Index: packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py +++ packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py @@ -89,8 +89,10 @@ 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']) Index: packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py +++ packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py @@ -44,6 +44,7 @@ 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) Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -2629,6 +2629,8 @@ 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()); Index: source/Target/StackFrameRecognizer.cpp =================================================================== --- source/Target/StackFrameRecognizer.cpp +++ source/Target/StackFrameRecognizer.cpp @@ -41,8 +41,14 @@ 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