diff options
author | Jim Ingham <jingham@apple.com> | 2010-09-23 02:01:19 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2010-09-23 02:01:19 +0000 |
commit | 2277701c7b826544fb39b5684c4da8c6d590adf2 (patch) | |
tree | 6a53cdfe3086b89fb331c53fa98ae9d24efb12a4 | |
parent | 19964dbe3bb05aedc65952c7299e4c610ee01579 (diff) | |
download | bcm5719-llvm-2277701c7b826544fb39b5684c4da8c6d590adf2.tar.gz bcm5719-llvm-2277701c7b826544fb39b5684c4da8c6d590adf2.zip |
Committing the skeleton of Language runtime plugin classes.
llvm-svn: 114620
21 files changed, 897 insertions, 0 deletions
diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h index 00bbf4010d0..1671bb96647 100644 --- a/lldb/include/lldb/Core/PluginManager.h +++ b/lldb/include/lldb/Core/PluginManager.h @@ -73,6 +73,24 @@ public: //------------------------------------------------------------------ + // LanguageRuntime + //------------------------------------------------------------------ + static bool + RegisterPlugin (const char *name, + const char *description, + LanguageRuntimeCreateInstance create_callback); + + static bool + UnregisterPlugin (LanguageRuntimeCreateInstance create_callback); + + static LanguageRuntimeCreateInstance + GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx); + + static LanguageRuntimeCreateInstance + GetLanguageRuntimeCreateCallbackForPluginName (const char *name); + + + //------------------------------------------------------------------ // ObjectFile //------------------------------------------------------------------ static bool diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 899516ff69f..ec521331975 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -175,6 +175,15 @@ public: lldb::ValueObjectSP GetSyntheticArrayMemberFromPointer (int32_t index, bool can_create); + + lldb::ValueObjectSP + GetDynamicValue () + { + return m_dynamic_value_sp; + } + + bool + SetDynamicValue (); protected: //------------------------------------------------------------------ @@ -198,6 +207,7 @@ protected: // in that the summary is consed up by us, the object_desc_string is builtin. std::vector<lldb::ValueObjectSP> m_children; std::map<ConstString, lldb::ValueObjectSP> m_synthetic_children; + lldb::ValueObjectSP m_dynamic_value_sp; bool m_value_is_valid:1, m_value_did_change:1, m_children_count_valid:1, diff --git a/lldb/include/lldb/Target/CPPLanguageRuntime.h b/lldb/include/lldb/Target/CPPLanguageRuntime.h new file mode 100644 index 00000000000..08b2a8d5321 --- /dev/null +++ b/lldb/include/lldb/Target/CPPLanguageRuntime.h @@ -0,0 +1,50 @@ +//===-- CPPLanguageRuntime.h ---------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_CPPLanguageRuntime_h_ +#define liblldb_CPPLanguageRuntime_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Core/PluginInterface.h" +#include "lldb/lldb-private.h" +#include "lldb/Target/LanguageRuntime.h" + +namespace lldb_private { + +class CPPLanguageRuntime : + public LanguageRuntime +{ +public: + virtual + ~CPPLanguageRuntime(); + + virtual lldb::LanguageType + GetLanguageType () const + { + return lldb::eLanguageTypeC_plus_plus; + } + + virtual bool + IsVTableName (const char *name) = 0; + +protected: + //------------------------------------------------------------------ + // Classes that inherit from CPPLanguageRuntime can see and modify these + //------------------------------------------------------------------ + CPPLanguageRuntime(Process *process); +private: + DISALLOW_COPY_AND_ASSIGN (CPPLanguageRuntime); +}; + +} // namespace lldb_private + +#endif // liblldb_CPPLanguageRuntime_h_ diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h new file mode 100644 index 00000000000..bacf21b990d --- /dev/null +++ b/lldb/include/lldb/Target/LanguageRuntime.h @@ -0,0 +1,47 @@ +//===-- LanguageRuntime.h ---------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_LanguageRuntime_h_ +#define liblldb_LanguageRuntime_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Core/PluginInterface.h" +#include "lldb/lldb-private.h" + +namespace lldb_private { + +class LanguageRuntime : + public PluginInterface +{ +public: + virtual + ~LanguageRuntime(); + + static LanguageRuntime* + FindPlugin (Process *process, lldb::LanguageType language); + + virtual lldb::LanguageType + GetLanguageType () const = 0; + +protected: + //------------------------------------------------------------------ + // Classes that inherit from LanguageRuntime can see and modify these + //------------------------------------------------------------------ + LanguageRuntime(Process *process); +private: + Process *m_process_ptr; + DISALLOW_COPY_AND_ASSIGN (LanguageRuntime); +}; + +} // namespace lldb_private + +#endif // liblldb_LanguageRuntime_h_ diff --git a/lldb/include/lldb/Target/ObjCLanguageRuntime.h b/lldb/include/lldb/Target/ObjCLanguageRuntime.h new file mode 100644 index 00000000000..c2616147d29 --- /dev/null +++ b/lldb/include/lldb/Target/ObjCLanguageRuntime.h @@ -0,0 +1,47 @@ +//===-- ObjCLanguageRuntime.h ---------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ObjCLanguageRuntime_h_ +#define liblldb_ObjCLanguageRuntime_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Core/PluginInterface.h" +#include "lldb/lldb-private.h" +#include "lldb/Target/LanguageRuntime.h" + +namespace lldb_private { + +class ObjCLanguageRuntime : + public LanguageRuntime +{ +public: + virtual + ~ObjCLanguageRuntime(); + + virtual lldb::LanguageType + GetLanguageType () const + { + return lldb::eLanguageTypeObjC; + } + +protected: + //------------------------------------------------------------------ + // Classes that inherit from ObjCLanguageRuntime can see and modify these + //------------------------------------------------------------------ + ObjCLanguageRuntime(Process *process); +private: + DISALLOW_COPY_AND_ASSIGN (ObjCLanguageRuntime); +}; + +} // namespace lldb_private + +#endif // liblldb_ObjCLanguageRuntime_h_ diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index d87bd74a9d9..438ed587a65 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -1548,6 +1548,15 @@ public: virtual DynamicLoader * GetDynamicLoader (); + + virtual LanguageRuntime * + GetLanguageRuntime (lldb::LanguageType language); + + virtual CPPLanguageRuntime * + GetCPPLanguageRuntime (); + + virtual ObjCLanguageRuntime * + GetObjCLanguageRuntime (); bool IsRunning () const; @@ -1616,6 +1625,9 @@ protected: ConstString m_target_triple; lldb::ABISP m_abi_sp; ObjCObjectPrinter m_objc_object_printer; + + typedef std::map<lldb::LanguageType, lldb::LanguageRuntimeSP> LanguageRuntimeCollection; + LanguageRuntimeCollection m_language_runtimes; size_t RemoveBreakpointOpcodesFromBuffer (lldb::addr_t addr, size_t size, uint8_t *buf) const; diff --git a/lldb/include/lldb/lldb-forward-rtti.h b/lldb/include/lldb/lldb-forward-rtti.h index 44b5029b3ca..469c33972a3 100644 --- a/lldb/include/lldb/lldb-forward-rtti.h +++ b/lldb/include/lldb/lldb-forward-rtti.h @@ -40,6 +40,7 @@ namespace lldb { typedef SharedPtr<lldb_private::InlineFunctionInfo>::Type InlineFunctionInfoSP; typedef SharedPtr<lldb_private::InputReader>::Type InputReaderSP; typedef SharedPtr<lldb_private::InstanceSettings>::Type InstanceSettingsSP; + typedef SharedPtr<lldb_private::LanguageRuntime>::Type LanguageRuntimeSP; typedef SharedPtr<lldb_private::LineTable>::Type LineTableSP; typedef SharedPtr<lldb_private::Listener>::Type ListenerSP; typedef SharedPtr<lldb_private::Log>::Type LogSP; diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h index bae6c4ac51e..673165e36a6 100644 --- a/lldb/include/lldb/lldb-forward.h +++ b/lldb/include/lldb/lldb-forward.h @@ -39,6 +39,7 @@ class BreakpointResolver; class BreakpointSite; class BreakpointSiteList; class Broadcaster; +class CPPLanguageRuntime; class ClangASTContext; class ClangExpression; class ClangExpressionDeclMap; @@ -76,6 +77,7 @@ class FunctionInfo; class InlineFunctionInfo; class InputReader; class InstanceSettings; +class LanguageRuntime; class LineTable; class Listener; class Log; @@ -84,6 +86,7 @@ class Mangled; class Module; class ModuleList; class Mutex; +class ObjCLanguageRuntime; class ObjCObjectPrinter; class ObjectContainer; class ObjectFile; diff --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h index ed6b08421f9..f450618443b 100644 --- a/lldb/include/lldb/lldb-private-interfaces.h +++ b/lldb/include/lldb/lldb-private-interfaces.h @@ -22,6 +22,7 @@ namespace lldb_private typedef ObjectContainer* (*ObjectContainerCreateInstance) (Module* module, lldb::DataBufferSP& dataSP, const FileSpec *file, lldb::addr_t offset, lldb::addr_t length); typedef ObjectFile* (*ObjectFileCreateInstance) (Module* module, lldb::DataBufferSP& dataSP, const FileSpec* file, lldb::addr_t offset, lldb::addr_t length); typedef LogChannel* (*LogChannelCreateInstance) (); + typedef LanguageRuntime *(*LanguageRuntimeCreateInstance) (Process *process, lldb::LanguageType language); typedef Process* (*ProcessCreateInstance) (Target &target, Listener &listener); typedef SymbolFile* (*SymbolFileCreateInstance) (ObjectFile* obj_file); typedef SymbolVendor* (*SymbolVendorCreateInstance) (Module *module); // Module can be NULL for default system symbol vendor diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index d21be5479af..249f896626d 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -351,10 +351,20 @@ 49FB515E121481B000DF8983 /* DWARFExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7ED810F1B86700F91463 /* DWARFExpression.cpp */; }; 4C08CDE811C81EF8001610A8 /* ThreadSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C08CDE711C81EF8001610A8 /* ThreadSpec.cpp */; }; 4C08CDEC11C81F1E001610A8 /* ThreadSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */; }; + 4C139EA5124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */; }; + 4C139EA6124A8B03000BFF8D /* AppleObjCRuntimeV2.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C139EA4124A8B03000BFF8D /* AppleObjCRuntimeV2.h */; }; 4C5DBBC811E3FEC60035160F /* CommandObjectCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C5DBBC611E3FEC60035160F /* CommandObjectCommands.cpp */; }; 4C5DBBC911E3FEC60035160F /* CommandObjectCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C5DBBC711E3FEC60035160F /* CommandObjectCommands.h */; }; 4C74CB6312288704006A8171 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C74CB6212288704006A8171 /* Carbon.framework */; }; 4CA9637B11B6E99A00780E28 /* CommandObjectApropos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */; }; + 4CB4430B12491DDA00C13DC2 /* LanguageRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CB4430912491DDA00C13DC2 /* LanguageRuntime.h */; }; + 4CB4430C12491DDA00C13DC2 /* LanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CB4430A12491DDA00C13DC2 /* LanguageRuntime.cpp */; }; + 4CB4436B124944B000C13DC2 /* ItaniumABILanguageRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CB44369124944B000C13DC2 /* ItaniumABILanguageRuntime.h */; }; + 4CB4436C124944B000C13DC2 /* ItaniumABILanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CB4436A124944B000C13DC2 /* ItaniumABILanguageRuntime.cpp */; }; + 4CB443BD1249920C00C13DC2 /* CPPLanguageRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CB443BB1249920C00C13DC2 /* CPPLanguageRuntime.h */; }; + 4CB443BE1249920C00C13DC2 /* CPPLanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CB443BC1249920C00C13DC2 /* CPPLanguageRuntime.cpp */; }; + 4CB443F312499B5000C13DC2 /* ObjCLanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CB443F212499B5000C13DC2 /* ObjCLanguageRuntime.cpp */; }; + 4CB443F712499B6E00C13DC2 /* ObjCLanguageRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CB443F612499B6E00C13DC2 /* ObjCLanguageRuntime.h */; }; 69A01E211236C5D400C660B5 /* Condition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69A01E1B1236C5D400C660B5 /* Condition.cpp */; }; 69A01E221236C5D400C660B5 /* Host.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69A01E1C1236C5D400C660B5 /* Host.cpp */; }; 69A01E241236C5D400C660B5 /* Mutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69A01E1E1236C5D400C660B5 /* Mutex.cpp */; }; @@ -961,6 +971,8 @@ 4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSpec.h; path = include/lldb/Target/ThreadSpec.h; sourceTree = "<group>"; }; 4C09CB73116BD98B00C7A725 /* CommandCompletions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandCompletions.h; path = include/lldb/Interpreter/CommandCompletions.h; sourceTree = "<group>"; }; 4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandCompletions.cpp; path = source/Commands/CommandCompletions.cpp; sourceTree = "<group>"; }; + 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCRuntimeV2.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp; sourceTree = "<group>"; }; + 4C139EA4124A8B03000BFF8D /* AppleObjCRuntimeV2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCRuntimeV2.h; path = LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h; sourceTree = "<group>"; }; 4C43DEF9110641F300E55CBF /* ThreadPlanShouldStopHere.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanShouldStopHere.h; path = include/lldb/Target/ThreadPlanShouldStopHere.h; sourceTree = "<group>"; }; 4C43DEFA110641F300E55CBF /* ThreadPlanShouldStopHere.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanShouldStopHere.cpp; path = source/Target/ThreadPlanShouldStopHere.cpp; sourceTree = "<group>"; }; 4C43DF8511069BFD00E55CBF /* ThreadPlanStepInRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanStepInRange.h; path = include/lldb/Target/ThreadPlanStepInRange.h; sourceTree = "<group>"; }; @@ -982,6 +994,14 @@ 4CA9637A11B6E99A00780E28 /* CommandObjectApropos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectApropos.h; path = source/Commands/CommandObjectApropos.h; sourceTree = "<group>"; }; 4CAFCE001101216B00CA63DB /* ThreadPlanRunToAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanRunToAddress.h; path = include/lldb/Target/ThreadPlanRunToAddress.h; sourceTree = "<group>"; }; 4CAFCE031101218900CA63DB /* ThreadPlanRunToAddress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanRunToAddress.cpp; path = source/Target/ThreadPlanRunToAddress.cpp; sourceTree = "<group>"; }; + 4CB4430912491DDA00C13DC2 /* LanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LanguageRuntime.h; path = include/lldb/Target/LanguageRuntime.h; sourceTree = "<group>"; }; + 4CB4430A12491DDA00C13DC2 /* LanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LanguageRuntime.cpp; path = source/Target/LanguageRuntime.cpp; sourceTree = "<group>"; }; + 4CB44369124944B000C13DC2 /* ItaniumABILanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ItaniumABILanguageRuntime.h; path = LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h; sourceTree = "<group>"; }; + 4CB4436A124944B000C13DC2 /* ItaniumABILanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ItaniumABILanguageRuntime.cpp; path = LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp; sourceTree = "<group>"; }; + 4CB443BB1249920C00C13DC2 /* CPPLanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPPLanguageRuntime.h; path = include/lldb/Target/CPPLanguageRuntime.h; sourceTree = "<group>"; }; + 4CB443BC1249920C00C13DC2 /* CPPLanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CPPLanguageRuntime.cpp; path = source/Target/CPPLanguageRuntime.cpp; sourceTree = "<group>"; }; + 4CB443F212499B5000C13DC2 /* ObjCLanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjCLanguageRuntime.cpp; path = source/Target/ObjCLanguageRuntime.cpp; sourceTree = "<group>"; }; + 4CB443F612499B6E00C13DC2 /* ObjCLanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjCLanguageRuntime.h; path = include/lldb/Target/ObjCLanguageRuntime.h; sourceTree = "<group>"; }; 4CEDAED311754F5E00E875A6 /* ThreadPlanStepUntil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanStepUntil.h; path = include/lldb/Target/ThreadPlanStepUntil.h; sourceTree = "<group>"; }; 4CEE62FA1145F2130064CF93 /* ProcessGDBRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProcessGDBRemote.cpp; path = "source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp"; sourceTree = "<group>"; }; 4CEE62FB1145F2130064CF93 /* ProcessGDBRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProcessGDBRemote.h; path = "source/Plugins/Process/gdb-remote/ProcessGDBRemote.h"; sourceTree = "<group>"; }; @@ -1180,6 +1200,7 @@ 493C63D711891A8000914D5E /* ABI */, 260C897210F57C5600BB2B04 /* Disassembler */, 260C897810F57C5600BB2B04 /* DynamicLoader */, + 4CB443651249446F00C13DC2 /* LanguageRuntime */, 260C897E10F57C5600BB2B04 /* ObjectContainer */, 260C898210F57C5600BB2B04 /* ObjectFile */, 260C898A10F57C5600BB2B04 /* Process */, @@ -1982,10 +2003,16 @@ children = ( 497E7B331188ED300065CCA1 /* ABI.h */, 497E7B9D1188F6690065CCA1 /* ABI.cpp */, + 4CB443BB1249920C00C13DC2 /* CPPLanguageRuntime.h */, + 4CB443BC1249920C00C13DC2 /* CPPLanguageRuntime.cpp */, 26BC7DF110F1B81A00F91463 /* DynamicLoader.h */, 26BC7DF210F1B81A00F91463 /* ExecutionContext.h */, 26BC7F3510F1B90C00F91463 /* ExecutionContext.cpp */, 26DAFD9711529BC7005A394E /* ExecutionContextScope.h */, + 4CB4430912491DDA00C13DC2 /* LanguageRuntime.h */, + 4CB4430A12491DDA00C13DC2 /* LanguageRuntime.cpp */, + 4CB443F612499B6E00C13DC2 /* ObjCLanguageRuntime.h */, + 4CB443F212499B5000C13DC2 /* ObjCLanguageRuntime.cpp */, 49BF48E011ADF37D008863BD /* ObjCObjectPrinter.h */, 49BF48DC11ADF356008863BD /* ObjCObjectPrinter.cpp */, 495BBACF119A0DE700418BEA /* PathMappingList.h */, @@ -2142,6 +2169,49 @@ name = "MacOSX-i386"; sourceTree = "<group>"; }; + 4C139EA0124A8AC7000BFF8D /* CPlusPlus */ = { + isa = PBXGroup; + children = ( + 4CB443661249448300C13DC2 /* ItaniumABI */, + ); + name = CPlusPlus; + sourceTree = "<group>"; + }; + 4C139EA1124A8AD5000BFF8D /* ObjC */ = { + isa = PBXGroup; + children = ( + 4C139EA2124A8AE5000BFF8D /* AppleRuntimeV2 */, + ); + name = ObjC; + sourceTree = "<group>"; + }; + 4C139EA2124A8AE5000BFF8D /* AppleRuntimeV2 */ = { + isa = PBXGroup; + children = ( + 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */, + 4C139EA4124A8B03000BFF8D /* AppleObjCRuntimeV2.h */, + ); + name = AppleRuntimeV2; + sourceTree = "<group>"; + }; + 4CB443651249446F00C13DC2 /* LanguageRuntime */ = { + isa = PBXGroup; + children = ( + 4C139EA0124A8AC7000BFF8D /* CPlusPlus */, + 4C139EA1124A8AD5000BFF8D /* ObjC */, + ); + name = LanguageRuntime; + sourceTree = "<group>"; + }; + 4CB443661249448300C13DC2 /* ItaniumABI */ = { + isa = PBXGroup; + children = ( + 4CB44369124944B000C13DC2 /* ItaniumABILanguageRuntime.h */, + 4CB4436A124944B000C13DC2 /* ItaniumABILanguageRuntime.cpp */, + ); + name = ItaniumABI; + sourceTree = "<group>"; + }; 4CEE62F71145F1C70064CF93 /* GDB Remote */ = { isa = PBXGroup; children = ( @@ -2302,7 +2372,12 @@ 2618D7901240115500F2B8FE /* SectionLoadList.h in Headers */, 2618D959124056C700F2B8FE /* NameToDIE.h in Headers */, 26C72C94124322890068DC16 /* SBStream.h in Headers */, + 4CB4430B12491DDA00C13DC2 /* LanguageRuntime.h in Headers */, + 4CB4436B124944B000C13DC2 /* ItaniumABILanguageRuntime.h in Headers */, + 4CB443BD1249920C00C13DC2 /* CPPLanguageRuntime.h in Headers */, + 4CB443F712499B6E00C13DC2 /* ObjCLanguageRuntime.h in Headers */, 96A6D9CA1249D98800250B38 /* ArchVolatileRegs-x86.h in Headers */, + 4C139EA6124A8B03000BFF8D /* AppleObjCRuntimeV2.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2767,8 +2842,13 @@ 2618D7921240116900F2B8FE /* SectionLoadList.cpp in Sources */, 2618D9EB12406FE600F2B8FE /* NameToDIE.cpp in Sources */, 26C72C961243229A0068DC16 /* SBStream.cpp in Sources */, + 4CB4430C12491DDA00C13DC2 /* LanguageRuntime.cpp in Sources */, + 4CB4436C124944B000C13DC2 /* ItaniumABILanguageRuntime.cpp in Sources */, + 4CB443BE1249920C00C13DC2 /* CPPLanguageRuntime.cpp in Sources */, + 4CB443F312499B5000C13DC2 /* ObjCLanguageRuntime.cpp in Sources */, 96A6D9C61249D96F00250B38 /* ArchVolatileRegs.cpp in Sources */, 96A6D9C91249D98800250B38 /* ArchVolatileRegs-x86.cpp in Sources */, + 4C139EA5124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index 0207c4b4d45..e68bafea838 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -392,8 +392,128 @@ PluginManager::GetDynamicLoaderCreateCallbackForPluginName (const char *name) } +#pragma mark LanguageRuntime +struct LanguageRuntimeInstance +{ + LanguageRuntimeInstance() : + name(), + description(), + create_callback(NULL) + { + } + + std::string name; + std::string description; + LanguageRuntimeCreateInstance create_callback; +}; + +typedef std::vector<LanguageRuntimeInstance> LanguageRuntimeInstances; + +static bool +AccessLanguageRuntimeInstances (PluginAction action, LanguageRuntimeInstance &instance, uint32_t index) +{ + static LanguageRuntimeInstances g_plugin_instances; + + switch (action) + { + case ePluginRegisterInstance: + if (instance.create_callback) + { + g_plugin_instances.push_back (instance); + return true; + } + break; + + case ePluginUnregisterInstance: + if (instance.create_callback) + { + LanguageRuntimeInstances::iterator pos, end = g_plugin_instances.end(); + for (pos = g_plugin_instances.begin(); pos != end; ++ pos) + { + if (pos->create_callback == instance.create_callback) + { + g_plugin_instances.erase(pos); + return true; + } + } + } + break; + + case ePluginGetInstanceAtIndex: + if (index < g_plugin_instances.size()) + { + instance = g_plugin_instances[index]; + return true; + } + break; + + default: + break; + } + return false; +} + + +bool +PluginManager::RegisterPlugin + ( + const char *name, + const char *description, + LanguageRuntimeCreateInstance create_callback + ) +{ + if (create_callback) + { + LanguageRuntimeInstance instance; + assert (name && name[0]); + instance.name = name; + if (description && description[0]) + instance.description = description; + instance.create_callback = create_callback; + return AccessLanguageRuntimeInstances (ePluginRegisterInstance, instance, 0); + } + return false; +} + +bool +PluginManager::UnregisterPlugin (LanguageRuntimeCreateInstance create_callback) +{ + if (create_callback) + { + LanguageRuntimeInstance instance; + instance.create_callback = create_callback; + return AccessLanguageRuntimeInstances (ePluginUnregisterInstance, instance, 0); + } + return false; +} + +LanguageRuntimeCreateInstance +PluginManager::GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx) +{ + LanguageRuntimeInstance instance; + if (AccessLanguageRuntimeInstances (ePluginGetInstanceAtIndex, instance, idx)) + return instance.create_callback; + return NULL; +} + +LanguageRuntimeCreateInstance +PluginManager::GetLanguageRuntimeCreateCallbackForPluginName (const char *name) +{ + if (name && name[0]) + { + LanguageRuntimeInstance instance; + std::string ss_name(name); + for (uint32_t idx = 0; AccessLanguageRuntimeInstances (ePluginGetInstanceAtIndex, instance, idx); ++idx) + { + if (instance.name == ss_name) + return instance.create_callback; + } + } + return NULL; +} + #pragma mark ObjectFile struct ObjectFileInstance diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 5d866bc9b9a..a030ee5975c 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -823,3 +823,17 @@ ValueObject::GetSyntheticArrayMemberFromPointer (int32_t index, bool can_create) } return synthetic_child_sp; } + +bool +ValueObject::SetDynamicValue () +{ + if (!IsPointerOrReferenceType()) + return false; + + // Check that the runtime class is correct for determining the most specific class. + // If it is a C++ class, see if it is dynamic: + //if (!decl->isDynamicClass()) + // return false; + + return true; +} diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp new file mode 100644 index 00000000000..ee54e319a6b --- /dev/null +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -0,0 +1,111 @@ +//===-- ItaniumABILanguageRuntime.cpp --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "ItaniumABILanguageRuntime.h" + +#include "lldb/Core/ConstString.h" +#include "lldb/Core/Error.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Core/Scalar.h" +#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/RegisterContext.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Thread.h" + +#include <vector> + +using namespace lldb; +using namespace lldb_private; + +static const char *pluginName = "ItaniumABILanguageRuntime"; +static const char *pluginDesc = "Itanium ABI for the C++ language"; +static const char *pluginShort = "language.itanium"; + +//------------------------------------------------------------------ +// Static Functions +//------------------------------------------------------------------ +lldb_private::LanguageRuntime * +ItaniumABILanguageRuntime::CreateInstance (Process *process, lldb::LanguageType language) +{ + // FIXME: We have to check the process and make sure we actually know that this process supports + // the Itanium ABI. + if (language == eLanguageTypeC_plus_plus) + return new ItaniumABILanguageRuntime (process); + else + return NULL; +} + +void +ItaniumABILanguageRuntime::Initialize() +{ + PluginManager::RegisterPlugin (pluginName, + pluginDesc, + CreateInstance); +} + +void +ItaniumABILanguageRuntime::Terminate() +{ + PluginManager::UnregisterPlugin (CreateInstance); +} + +//------------------------------------------------------------------ +// PluginInterface protocol +//------------------------------------------------------------------ +const char * +ItaniumABILanguageRuntime::GetPluginName() +{ + return pluginName; +} + +const char * +ItaniumABILanguageRuntime::GetShortPluginName() +{ + return pluginShort; +} + +uint32_t +ItaniumABILanguageRuntime::GetPluginVersion() +{ + return 1; +} + +void +ItaniumABILanguageRuntime::GetPluginCommandHelp (const char *command, Stream *strm) +{ +} + +Error +ItaniumABILanguageRuntime::ExecutePluginCommand (Args &command, Stream *strm) +{ + Error error; + error.SetErrorString("No plug-in command are currently supported."); + return error; +} + +Log * +ItaniumABILanguageRuntime::EnablePluginLogging (Stream *strm, Args &command) +{ + return NULL; +} + +bool +ItaniumABILanguageRuntime::IsVTableName (const char *name) +{ + if (name == NULL) + return false; + + // Can we maybe ask Clang about this? + if (strstr (name, "_vptr$") == name) + return true; + else + return false; +} diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h new file mode 100644 index 00000000000..4ae6a89bad8 --- /dev/null +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h @@ -0,0 +1,72 @@ +//===-- ItaniumABILanguageRuntime.h ----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ItaniumABILanguageRuntime_h_ +#define liblldb_ItaniumABILanguageRuntime_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/lldb-private.h" +#include "lldb/Target/LanguageRuntime.h" +#include "lldb/Target/CPPLanguageRuntime.h" +#include "lldb/Core/Value.h" + +namespace lldb_private { + + class ItaniumABILanguageRuntime : + public lldb_private::CPPLanguageRuntime + { + public: + ~ItaniumABILanguageRuntime() { } + + virtual bool + IsVTableName (const char *name); + + //------------------------------------------------------------------ + // Static Functions + //------------------------------------------------------------------ + static void + Initialize(); + + static void + Terminate(); + + static lldb_private::LanguageRuntime * + CreateInstance (Process *process, lldb::LanguageType language); + + //------------------------------------------------------------------ + // PluginInterface protocol + //------------------------------------------------------------------ + virtual const char * + GetPluginName(); + + virtual const char * + GetShortPluginName(); + + virtual uint32_t + GetPluginVersion(); + + virtual void + GetPluginCommandHelp (const char *command, lldb_private::Stream *strm); + + virtual lldb_private::Error + ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm); + + virtual lldb_private::Log * + EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command); + protected: + private: + ItaniumABILanguageRuntime(Process *process) : lldb_private::CPPLanguageRuntime(process) { } // Call CreateInstance instead. + }; + +} // namespace lldb_private + +#endif // liblldb_ItaniumABILanguageRuntime_h_ diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp new file mode 100644 index 00000000000..655e72ed6c7 --- /dev/null +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp @@ -0,0 +1,98 @@ +//===-- AppleObjCRuntimeV2.cpp --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "AppleObjCRuntimeV2.h" + +#include "lldb/Core/ConstString.h" +#include "lldb/Core/Error.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Core/Scalar.h" +#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/RegisterContext.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Thread.h" + +#include <vector> + +using namespace lldb; +using namespace lldb_private; + +static const char *pluginName = "AppleObjCRuntimeV2"; +static const char *pluginDesc = "Apple Objective C Language Runtime - Version 2"; +static const char *pluginShort = "language.apple.objc.v2"; + +//------------------------------------------------------------------ +// Static Functions +//------------------------------------------------------------------ +lldb_private::LanguageRuntime * +AppleObjCRuntimeV2::CreateInstance (Process *process, lldb::LanguageType language) +{ + // FIXME: This should be a MacOS or iOS process, and we need to look for the OBJC section to make + // sure we aren't using the V1 runtime. + if (language == eLanguageTypeObjC) + return new AppleObjCRuntimeV2 (process); + else + return NULL; +} + +void +AppleObjCRuntimeV2::Initialize() +{ + PluginManager::RegisterPlugin (pluginName, + pluginDesc, + CreateInstance); +} + +void +AppleObjCRuntimeV2::Terminate() +{ + PluginManager::UnregisterPlugin (CreateInstance); +} + +//------------------------------------------------------------------ +// PluginInterface protocol +//------------------------------------------------------------------ +const char * +AppleObjCRuntimeV2::GetPluginName() +{ + return pluginName; +} + +const char * +AppleObjCRuntimeV2::GetShortPluginName() +{ + return pluginShort; +} + +uint32_t +AppleObjCRuntimeV2::GetPluginVersion() +{ + return 1; +} + +void +AppleObjCRuntimeV2::GetPluginCommandHelp (const char *command, Stream *strm) +{ +} + +Error +AppleObjCRuntimeV2::ExecutePluginCommand (Args &command, Stream *strm) +{ + Error error; + error.SetErrorString("No plug-in command are currently supported."); + return error; +} + +Log * +AppleObjCRuntimeV2::EnablePluginLogging (Stream *strm, Args &command) +{ + return NULL; +} diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h new file mode 100644 index 00000000000..9c447b82f8d --- /dev/null +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h @@ -0,0 +1,70 @@ +//===-- AppleObjCRuntimeV2.h ----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_AppleObjCRuntimeV2_h_ +#define liblldb_AppleObjCRuntimeV2_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/lldb-private.h" +#include "lldb/Target/LanguageRuntime.h" +#include "lldb/Target/ObjCLanguageRuntime.h" +#include "lldb/Core/Value.h" + +namespace lldb_private { + + class AppleObjCRuntimeV2 : + public lldb_private::ObjCLanguageRuntime + { + public: + ~AppleObjCRuntimeV2() { } + + + //------------------------------------------------------------------ + // Static Functions + //------------------------------------------------------------------ + static void + Initialize(); + + static void + Terminate(); + + static lldb_private::LanguageRuntime * + CreateInstance (Process *process, lldb::LanguageType language); + + //------------------------------------------------------------------ + // PluginInterface protocol + //------------------------------------------------------------------ + virtual const char * + GetPluginName(); + + virtual const char * + GetShortPluginName(); + + virtual uint32_t + GetPluginVersion(); + + virtual void + GetPluginCommandHelp (const char *command, lldb_private::Stream *strm); + + virtual lldb_private::Error + ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm); + + virtual lldb_private::Log * + EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command); + protected: + private: + AppleObjCRuntimeV2(Process *process) : lldb_private::ObjCLanguageRuntime(process) { } // Call CreateInstance instead. + }; + +} // namespace lldb_private + +#endif // liblldb_AppleObjCRuntimeV2_h_ diff --git a/lldb/source/Target/CPPLanguageRuntime.cpp b/lldb/source/Target/CPPLanguageRuntime.cpp new file mode 100644 index 00000000000..3e825bb2c3a --- /dev/null +++ b/lldb/source/Target/CPPLanguageRuntime.cpp @@ -0,0 +1,27 @@ +//===-- CPPLanguageRuntime.cpp -------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/Target/CPPLanguageRuntime.h" +#include "lldb/Core/PluginManager.h" + +using namespace lldb; +using namespace lldb_private; + +//---------------------------------------------------------------------- +// Destructor +//---------------------------------------------------------------------- +CPPLanguageRuntime::~CPPLanguageRuntime() +{ +} + +CPPLanguageRuntime::CPPLanguageRuntime (Process *process) : + LanguageRuntime (process) +{ + +}
\ No newline at end of file diff --git a/lldb/source/Target/LanguageRuntime.cpp b/lldb/source/Target/LanguageRuntime.cpp new file mode 100644 index 00000000000..00c35f80633 --- /dev/null +++ b/lldb/source/Target/LanguageRuntime.cpp @@ -0,0 +1,47 @@ +//===-- LanguageRuntime.cpp -------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/Target/LanguageRuntime.h" +#include "lldb/Core/PluginManager.h" + +using namespace lldb; +using namespace lldb_private; + +LanguageRuntime* +LanguageRuntime::FindPlugin (Process *process, lldb::LanguageType language) +{ + std::auto_ptr<LanguageRuntime> language_runtime_ap; + LanguageRuntimeCreateInstance create_callback; + + for (uint32_t idx = 0; + (create_callback = PluginManager::GetLanguageRuntimeCreateCallbackAtIndex(idx)) != NULL; + ++idx) + { + language_runtime_ap.reset (create_callback(process, language)); + + if (language_runtime_ap.get()) + return language_runtime_ap.release(); + } + + return NULL; +} + +//---------------------------------------------------------------------- +// Constructor +//---------------------------------------------------------------------- +LanguageRuntime::LanguageRuntime(Process *process) +{ +} + +//---------------------------------------------------------------------- +// Destructor +//---------------------------------------------------------------------- +LanguageRuntime::~LanguageRuntime() +{ +} diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp new file mode 100644 index 00000000000..ab7e7e55a90 --- /dev/null +++ b/lldb/source/Target/ObjCLanguageRuntime.cpp @@ -0,0 +1,27 @@ +//===-- CPPLanguageRuntime.cpp -------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/Target/ObjCLanguageRuntime.h" +#include "lldb/Core/PluginManager.h" + +using namespace lldb; +using namespace lldb_private; + +//---------------------------------------------------------------------- +// Destructor +//---------------------------------------------------------------------- +ObjCLanguageRuntime::~ObjCLanguageRuntime() +{ +} + +ObjCLanguageRuntime::ObjCLanguageRuntime (Process *process) : + LanguageRuntime (process) +{ + +}
\ No newline at end of file diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 6c264051742..a12377792d0 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -21,6 +21,9 @@ #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Host/Host.h" #include "lldb/Target/ABI.h" +#include "lldb/Target/LanguageRuntime.h" +#include "lldb/Target/CPPLanguageRuntime.h" +#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" @@ -460,6 +463,41 @@ Process::GetABI() return m_abi_sp.get(); } +LanguageRuntime * +Process::GetLanguageRuntime(lldb::LanguageType language) +{ + LanguageRuntimeCollection::iterator pos; + pos = m_language_runtimes.find (language); + if (pos == m_language_runtimes.end()) + { + lldb::LanguageRuntimeSP runtime(LanguageRuntime::FindPlugin(this, language)); + + m_language_runtimes[language] + = runtime; + return runtime.get(); + } + else + return (*pos).second.get(); +} + +CPPLanguageRuntime * +Process::GetCPPLanguageRuntime () +{ + LanguageRuntime *runtime = GetLanguageRuntime(eLanguageTypeC_plus_plus); + if (runtime != NULL && runtime->GetLanguageType() == eLanguageTypeC_plus_plus) + return static_cast<CPPLanguageRuntime *> (runtime); + return NULL; +} + +ObjCLanguageRuntime * +Process::GetObjCLanguageRuntime () +{ + LanguageRuntime *runtime = GetLanguageRuntime(eLanguageTypeObjC); + if (runtime != NULL && runtime->GetLanguageType() == eLanguageTypeObjC) + return static_cast<ObjCLanguageRuntime *> (runtime); + return NULL; +} + BreakpointSiteList & Process::GetBreakpointSiteList() { diff --git a/lldb/source/lldb.cpp b/lldb/source/lldb.cpp index ca6ed724df4..fdc649b1f92 100644 --- a/lldb/source/lldb.cpp +++ b/lldb/source/lldb.cpp @@ -30,6 +30,8 @@ #include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h" #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h" #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h" +#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h" +#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h" #include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h" #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" #include "Plugins/Process/MacOSX-User/source/ProcessMacOSX.h" @@ -73,6 +75,8 @@ lldb_private::Initialize () ABIMacOSX_i386::Initialize(); ABISysV_x86_64::Initialize(); DynamicLoaderMacOSXDYLD::Initialize(); + ItaniumABILanguageRuntime::Initialize(); + AppleObjCRuntimeV2::Initialize(); ObjectContainerUniversalMachO::Initialize(); ObjectFileMachO::Initialize(); ProcessGDBRemote::Initialize(); |