ExecutionContextScope.h 2.1 KB

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