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