1 //===-- ExecutionContextScope.h ---------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_ExecutionContextScope_h_
10 #define liblldb_ExecutionContextScope_h_
12 #include "lldb/lldb-private.h"
14 namespace lldb_private {
16 /// @class ExecutionContextScope ExecutionContextScope.h
17 /// "lldb/Target/ExecutionContextScope.h" Inherit from this if your object can
19 /// execution context.
21 /// Many objects that have pointers back to parent execution context objects
22 /// can inherit from this pure virtual class can reconstruct their execution
23 /// context without having to keep a complete ExecutionContext object in the
24 /// object state. Examples of these objects include: Process, Thread,
25 /// RegisterContext and StackFrame.
27 /// Objects can contain a valid pointer to an instance of this so they can
28 /// reconstruct the execution context.
30 /// Objects that adhere to this protocol can reconstruct enough of a execution
31 /// context to allow functions that take a execution contexts to be called.
32 class ExecutionContextScope {
34 virtual ~ExecutionContextScope() {}
36 virtual lldb::TargetSP CalculateTarget() = 0;
38 virtual lldb::ProcessSP CalculateProcess() = 0;
40 virtual lldb::ThreadSP CalculateThread() = 0;
42 virtual lldb::StackFrameSP CalculateStackFrame() = 0;
44 /// Reconstruct the object's execution context into \a sc.
46 /// The object should fill in as much of the ExecutionContextScope as it can
47 /// so function calls that require a execution context can be made for the
50 /// \param[out] exe_ctx
51 /// A reference to an execution context object that gets filled
53 virtual void CalculateExecutionContext(ExecutionContext &exe_ctx) = 0;
56 } // namespace lldb_private
58 #endif // liblldb_ExecutionContextScope_h_