LanguageRuntime.h revision 263367
1//===-- LanguageRuntime.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_LanguageRuntime_h_
11#define liblldb_LanguageRuntime_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/lldb-public.h"
18#include "lldb/Breakpoint/BreakpointResolver.h"
19#include "lldb/Breakpoint/BreakpointResolverName.h"
20#include "lldb/Core/PluginInterface.h"
21#include "lldb/lldb-private.h"
22#include "lldb/Core/ValueObject.h"
23#include "lldb/Core/Value.h"
24#include "lldb/Target/ExecutionContextScope.h"
25
26namespace lldb_private {
27
28class LanguageRuntime :
29    public PluginInterface
30{
31public:
32    virtual
33    ~LanguageRuntime();
34
35    static LanguageRuntime*
36    FindPlugin (Process *process, lldb::LanguageType language);
37
38    virtual lldb::LanguageType
39    GetLanguageType () const = 0;
40
41    virtual bool
42    GetObjectDescription (Stream &str, ValueObject &object) = 0;
43
44    virtual bool
45    GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope) = 0;
46
47    // this call should return true if it could set the name and/or the type
48    virtual bool
49    GetDynamicTypeAndAddress (ValueObject &in_value,
50                              lldb::DynamicValueType use_dynamic,
51                              TypeAndOrName &class_type_or_name,
52                              Address &address) = 0;
53
54    // This should be a fast test to determine whether it is likely that this value would
55    // have a dynamic type.
56    virtual bool
57    CouldHaveDynamicValue (ValueObject &in_value) = 0;
58
59    virtual void
60    SetExceptionBreakpoints ()
61    {
62    }
63
64    virtual void
65    ClearExceptionBreakpoints ()
66    {
67    }
68
69    virtual bool
70    ExceptionBreakpointsAreSet ()
71    {
72        return false;
73    }
74
75    virtual bool
76    ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason)
77    {
78        return false;
79    }
80
81    static lldb::BreakpointSP
82    CreateExceptionBreakpoint (Target &target,
83                               lldb::LanguageType language,
84                               bool catch_bp,
85                               bool throw_bp,
86                               bool is_internal = false);
87
88    static lldb::LanguageType
89    GetLanguageTypeFromString (const char *string);
90
91    static const char *
92    GetNameForLanguageType (lldb::LanguageType language);
93
94    Process *
95    GetProcess()
96    {
97        return m_process;
98    }
99
100    virtual lldb::BreakpointResolverSP
101    CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp) = 0;
102
103    virtual lldb::SearchFilterSP
104    CreateExceptionSearchFilter ();
105
106protected:
107    //------------------------------------------------------------------
108    // Classes that inherit from LanguageRuntime can see and modify these
109    //------------------------------------------------------------------
110
111    LanguageRuntime(Process *process);
112    Process *m_process;
113private:
114    DISALLOW_COPY_AND_ASSIGN (LanguageRuntime);
115};
116
117} // namespace lldb_private
118
119#endif  // liblldb_LanguageRuntime_h_
120