1 //===-- TypeSynthetic.cpp ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/lldb-python.h"
16 // Other libraries and framework includes
19 #include "lldb/lldb-public.h"
20 #include "lldb/lldb-enumerations.h"
22 #include "lldb/Core/Debugger.h"
23 #include "lldb/Core/StreamString.h"
24 #include "lldb/DataFormatters/TypeSynthetic.h"
25 #include "lldb/Interpreter/CommandInterpreter.h"
26 #include "lldb/Symbol/ClangASTType.h"
27 #include "lldb/Target/StackFrame.h"
28 #include "lldb/Target/Target.h"
31 using namespace lldb_private;
34 TypeFilterImpl::GetDescription()
37 sstr.Printf("%s%s%s {\n",
38 Cascades() ? "" : " (not cascading)",
39 SkipsPointers() ? " (skip pointers)" : "",
40 SkipsReferences() ? " (skip references)" : "");
42 for (size_t i = 0; i < GetCount(); i++)
45 GetExpressionPathAtIndex(i));
49 return sstr.GetString();
53 CXXSyntheticChildren::GetDescription()
56 sstr.Printf("%s%s%s Generator at %p - %s",
57 Cascades() ? "" : " (not cascading)",
58 SkipsPointers() ? " (skip pointers)" : "",
59 SkipsReferences() ? " (skip references)" : "",
61 m_description.c_str());
63 return sstr.GetString();
66 #ifndef LLDB_DISABLE_PYTHON
68 ScriptedSyntheticChildren::FrontEnd::FrontEnd(std::string pclass, ValueObject &backend) :
69 SyntheticChildrenFrontEnd(backend),
70 m_python_class(pclass),
74 if (backend == LLDB_INVALID_UID)
77 TargetSP target_sp = backend.GetTargetSP();
82 m_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
84 if (m_interpreter != NULL)
85 m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class.c_str(), backend.GetSP());
88 ScriptedSyntheticChildren::FrontEnd::~FrontEnd()
93 ScriptedSyntheticChildren::FrontEnd::GetChildAtIndex (size_t idx)
95 if (!m_wrapper_sp || !m_interpreter)
96 return lldb::ValueObjectSP();
98 return m_interpreter->GetChildAtIndex(m_wrapper_sp, idx);
102 ScriptedSyntheticChildren::GetDescription()
105 sstr.Printf("%s%s%s Python class %s",
106 Cascades() ? "" : " (not cascading)",
107 SkipsPointers() ? " (skip pointers)" : "",
108 SkipsReferences() ? " (skip references)" : "",
109 m_python_class.c_str());
111 return sstr.GetString();
114 #endif // #ifndef LLDB_DISABLE_PYTHON