xref: /freebsd/contrib/llvm-project/lldb/include/lldb/Target/ExecutionContextScope.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
1 //===-- ExecutionContextScope.h ---------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_TARGET_EXECUTIONCONTEXTSCOPE_H
10 #define LLDB_TARGET_EXECUTIONCONTEXTSCOPE_H
11 
12 #include "lldb/lldb-private.h"
13 
14 namespace lldb_private {
15 
16 /// @class ExecutionContextScope ExecutionContextScope.h
17 /// "lldb/Target/ExecutionContextScope.h" Inherit from this if your object can
18 /// reconstruct its
19 ///        execution context.
20 ///
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.
26 ///
27 /// Objects can contain a valid pointer to an instance of this so they can
28 /// reconstruct the execution context.
29 ///
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 {
33 public:
34   virtual ~ExecutionContextScope() = default;
35 
36   virtual lldb::TargetSP CalculateTarget() = 0;
37 
38   virtual lldb::ProcessSP CalculateProcess() = 0;
39 
40   virtual lldb::ThreadSP CalculateThread() = 0;
41 
42   virtual lldb::StackFrameSP CalculateStackFrame() = 0;
43 
44   /// Reconstruct the object's execution context into \a sc.
45   ///
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
48   /// given object.
49   ///
50   /// \param[out] exe_ctx
51   ///     A reference to an execution context object that gets filled
52   ///     in.
53   virtual void CalculateExecutionContext(ExecutionContext &exe_ctx) = 0;
54 };
55 
56 } // namespace lldb_private
57 
58 #endif // LLDB_TARGET_EXECUTIONCONTEXTSCOPE_H
59