1 //===-- ExecutionContextScope.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_ExecutionContextScope_h_
11 #define liblldb_ExecutionContextScope_h_
12 
13 #include "lldb/lldb-private.h"
14 
15 namespace lldb_private {
16 
17 //----------------------------------------------------------------------
18 /// @class ExecutionContextScope ExecutionContextScope.h
19 /// "lldb/Symbol/ExecutionContextScope.h" Inherit from this if your object can
20 /// reconstruct its
21 ///        execution context.
22 ///
23 /// Many objects that have pointers back to parent execution context objects
24 /// can inherit from this pure virtual class can reconstruct their execution
25 /// context without having to keep a complete ExecutionContext object in the
26 /// object state. Examples of these objects include: Process, Thread,
27 /// RegisterContext and StackFrame.
28 ///
29 /// Objects can contain a valid pointer to an instance of this so they can
30 /// reconstruct the execution context.
31 ///
32 /// Objects that adhere to this protocol can reconstruct enough of a execution
33 /// context to allow functions that take a execution contexts to be called.
34 //----------------------------------------------------------------------
35 class ExecutionContextScope {
36 public:
~ExecutionContextScope()37   virtual ~ExecutionContextScope() {}
38 
39   virtual lldb::TargetSP CalculateTarget() = 0;
40 
41   virtual lldb::ProcessSP CalculateProcess() = 0;
42 
43   virtual lldb::ThreadSP CalculateThread() = 0;
44 
45   virtual lldb::StackFrameSP CalculateStackFrame() = 0;
46 
47   //------------------------------------------------------------------
48   /// Reconstruct the object's execution context into \a sc.
49   ///
50   /// The object should fill in as much of the ExecutionContextScope as it can
51   /// so function calls that require a execution context can be made for the
52   /// given object.
53   ///
54   /// @param[out] exe_ctx
55   ///     A reference to an execution context object that gets filled
56   ///     in.
57   //------------------------------------------------------------------
58   virtual void CalculateExecutionContext(ExecutionContext &exe_ctx) = 0;
59 };
60 
61 } // namespace lldb_private
62 
63 #endif // liblldb_ExecutionContextScope_h_
64