AppleObjCRuntime.h revision 0de37195f17fefb536157b3296a18999116b8125
1//===-- AppleObjCRuntime.h ----------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_AppleObjCRuntime_h_
11#define liblldb_AppleObjCRuntime_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/lldb-private.h"
18#include "lldb/Target/LanguageRuntime.h"
19#include "lldb/Target/ObjCLanguageRuntime.h"
20#include "lldb/Core/ValueObject.h"
21#include "AppleObjCTrampolineHandler.h"
22#include "AppleThreadPlanStepThroughObjCTrampoline.h"
23
24namespace lldb_private {
25
26class AppleObjCRuntime :
27        public lldb_private::ObjCLanguageRuntime
28{
29public:
30
31    ~AppleObjCRuntime() { }
32
33    // These are generic runtime functions:
34    virtual bool
35    GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope);
36
37    virtual bool
38    GetObjectDescription (Stream &str, ValueObject &object);
39
40    virtual lldb::ValueObjectSP
41    GetDynamicValue (lldb::ValueObjectSP in_value);
42
43    // These are the ObjC specific functions.
44
45    virtual bool
46    IsModuleObjCLibrary (const lldb::ModuleSP &module_sp);
47
48    virtual bool
49    ReadObjCLibrary (const lldb::ModuleSP &module_sp);
50
51    virtual bool
52    HasReadObjCLibrary ()
53    {
54        return m_read_objc_library;
55    }
56
57    virtual lldb::ThreadPlanSP
58    GetStepThroughTrampolinePlan (Thread &thread, bool stop_others);
59
60    //------------------------------------------------------------------
61    // Static Functions
62    //------------------------------------------------------------------
63    // Note there is no CreateInstance, Initialize & Terminate functions here, because
64    // you can't make an instance of this generic runtime.
65
66protected:
67    static bool
68    AppleIsModuleObjCLibrary (const lldb::ModuleSP &module_sp);
69
70    static enum ObjCRuntimeVersions
71    GetObjCVersion (Process *process, ModuleSP &objc_module_sp);
72
73    //------------------------------------------------------------------
74    // PluginInterface protocol
75    //------------------------------------------------------------------
76public:
77
78    virtual void
79    ClearExceptionBreakpoints ();
80
81    virtual bool
82    ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason);
83protected:
84    Address *
85    GetPrintForDebuggerAddr();
86
87    std::auto_ptr<Address>  m_PrintForDebugger_addr;
88    bool m_read_objc_library;
89    std::auto_ptr<lldb_private::AppleObjCTrampolineHandler> m_objc_trampoline_handler_ap;
90    lldb::BreakpointSP m_objc_exception_bp_sp;
91
92    AppleObjCRuntime(Process *process) :
93        lldb_private::ObjCLanguageRuntime(process),
94        m_read_objc_library (false),
95        m_objc_trampoline_handler_ap(NULL)
96     { } // Call CreateInstance instead.
97};
98
99} // namespace lldb_private
100
101#endif  // liblldb_AppleObjCRuntime_h_
102