Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:53

0001 //===-- ExecutionContext.h --------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_TARGET_EXECUTIONCONTEXT_H
0010 #define LLDB_TARGET_EXECUTIONCONTEXT_H
0011 
0012 #include <mutex>
0013 
0014 #include "lldb/Target/StackID.h"
0015 #include "lldb/lldb-private.h"
0016 
0017 namespace lldb_private {
0018 
0019 //===----------------------------------------------------------------------===//
0020 /// Execution context objects refer to objects in the execution of the program
0021 /// that is being debugged. The consist of one or more of the following
0022 /// objects: target, process, thread, and frame. Many objects in the debugger
0023 /// need to track different executions contexts. For example, a local function
0024 /// variable might have an execution context that refers to a stack frame. A
0025 /// global or static variable might refer to a target since a stack frame
0026 /// isn't required in order to evaluate a global or static variable (a process
0027 /// isn't necessarily needed for a global variable since we might be able to
0028 /// read the variable value from a data section in one of the object files in
0029 /// a target). There are two types of objects that hold onto execution
0030 /// contexts: ExecutionContextRef and ExecutionContext. Both of these objects
0031 /// are described below.
0032 ///
0033 /// Not all objects in an ExecutionContext objects will be valid. If you want
0034 /// to refer strongly (ExecutionContext) or weakly (ExecutionContextRef) to a
0035 /// process, then only the process and target references will be valid. For
0036 /// threads, only the thread, process and target references will be filled in.
0037 /// For frames, all of the objects will be filled in.
0038 ///
0039 /// These classes are designed to be used as baton objects that get passed to
0040 /// a wide variety of functions that require execution contexts.
0041 //===----------------------------------------------------------------------===//
0042 
0043 /// \class ExecutionContextRef ExecutionContext.h
0044 /// "lldb/Target/ExecutionContext.h"
0045 /// A class that holds a weak reference to an execution context.
0046 ///
0047 /// ExecutionContextRef objects are designed to hold onto an execution context
0048 /// that might change over time. For example, if an object wants to refer to a
0049 /// stack frame, it should hold onto an ExecutionContextRef to a frame object.
0050 /// The backing object that represents the stack frame might change over time
0051 /// and instances of this object can track the logical object that refers to a
0052 /// frame even if it does change.
0053 ///
0054 /// These objects also don't keep execution objects around longer than they
0055 /// should since they use weak pointers. For example if an object refers to a
0056 /// stack frame and a stack frame is no longer in a thread, then a
0057 /// ExecutionContextRef object that refers to that frame will not be able to
0058 /// get a shared pointer to those objects since they are no longer around.
0059 ///
0060 /// ExecutionContextRef objects can also be used as objects in classes that
0061 /// want to track a "previous execution context". Since the weak references to
0062 /// the execution objects (target, process, thread and frame) don't keep these
0063 /// objects around, they are safe to keep around.
0064 ///
0065 /// The general rule of thumb is all long lived objects that want to refer to
0066 /// execution contexts should use ExecutionContextRef objects. The
0067 /// ExecutionContext class is used to temporarily get shared pointers to any
0068 /// execution context objects that are still around so they are guaranteed to
0069 /// exist during a function that requires the objects. ExecutionContext
0070 /// objects should NOT be used for long term storage since they will keep
0071 /// objects alive with extra shared pointer references to these  objects.
0072 class ExecutionContextRef {
0073 public:
0074   /// Default Constructor.
0075   ExecutionContextRef();
0076 
0077   /// Copy Constructor.
0078   ExecutionContextRef(const ExecutionContextRef &rhs);
0079 
0080   /// Construct using an ExecutionContext object that might be nullptr.
0081   ///
0082   /// If \a exe_ctx_ptr is valid, then make weak references to any valid
0083   /// objects in the ExecutionContext, otherwise no weak references to any
0084   /// execution context objects will be made.
0085   ExecutionContextRef(const ExecutionContext *exe_ctx_ptr);
0086 
0087   /// Construct using an ExecutionContext object.
0088   ///
0089   /// Make weak references to any valid objects in the ExecutionContext.
0090   ExecutionContextRef(const ExecutionContext &exe_ctx);
0091 
0092   /// Construct using the target and all the selected items inside of it (the
0093   /// process and its selected thread, and the thread's selected frame). If
0094   /// there is no selected thread, default to the first thread If there is no
0095   /// selected frame, default to the first frame.
0096   ExecutionContextRef(Target *target, bool adopt_selected);
0097 
0098   /// Construct using an execution context scope.
0099   ///
0100   /// If the ExecutionContextScope object is valid and refers to a frame, make
0101   /// weak references too the frame, thread, process and target. If the
0102   /// ExecutionContextScope object is valid and refers to a thread, make weak
0103   /// references too the thread, process and target. If the
0104   /// ExecutionContextScope object is valid and refers to a process, make weak
0105   /// references too the process and target. If the ExecutionContextScope
0106   /// object is valid and refers to a target, make weak references too the
0107   /// target.
0108   ExecutionContextRef(ExecutionContextScope *exe_scope);
0109 
0110   /// Construct using an execution context scope.
0111   ///
0112   /// If the ExecutionContextScope object refers to a frame, make weak
0113   /// references too the frame, thread, process and target. If the
0114   /// ExecutionContextScope object refers to a thread, make weak references
0115   /// too the thread, process and target. If the ExecutionContextScope object
0116   /// refers to a process, make weak references too the process and target. If
0117   /// the ExecutionContextScope object refers to a target, make weak
0118   /// references too the target.
0119   ExecutionContextRef(ExecutionContextScope &exe_scope);
0120 
0121   ~ExecutionContextRef();
0122 
0123   /// Assignment operator
0124   ///
0125   /// Copy all weak references in \a rhs.
0126   ExecutionContextRef &operator=(const ExecutionContextRef &rhs);
0127 
0128   /// Assignment operator from a ExecutionContext
0129   ///
0130   /// Make weak references to any strongly referenced objects in \a exe_ctx.
0131   ExecutionContextRef &operator=(const ExecutionContext &exe_ctx);
0132 
0133   /// Clear the object's state.
0134   ///
0135   /// Sets the process and thread to nullptr, and the frame index to an
0136   /// invalid value.
0137   void Clear();
0138 
0139   /// Set accessor that creates a weak reference to the target referenced in
0140   /// \a target_sp.
0141   ///
0142   /// If \a target_sp is valid this object will create a weak reference to
0143   /// that object, otherwise any previous target weak reference contained in
0144   /// this object will be reset.
0145   ///
0146   /// Only the weak reference to the target will be updated, no other weak
0147   /// references will be modified. If you want this execution context to make
0148   /// a weak reference to the target's process, use the
0149   /// ExecutionContextRef::SetContext() functions.
0150   ///
0151   /// \see ExecutionContextRef::SetContext(const lldb::TargetSP &, bool)
0152   void SetTargetSP(const lldb::TargetSP &target_sp);
0153 
0154   /// Set accessor that creates a weak reference to the process referenced in
0155   /// \a process_sp.
0156   ///
0157   /// If \a process_sp is valid this object will create a weak reference to
0158   /// that object, otherwise any previous process weak reference contained in
0159   /// this object will be reset.
0160   ///
0161   /// Only the weak reference to the process will be updated, no other weak
0162   /// references will be modified. If you want this execution context to make
0163   /// a weak reference to the target, use the
0164   /// ExecutionContextRef::SetContext() functions.
0165   ///
0166   /// \see ExecutionContextRef::SetContext(const lldb::ProcessSP &)
0167   void SetProcessSP(const lldb::ProcessSP &process_sp);
0168 
0169   /// Set accessor that creates a weak reference to the thread referenced in
0170   /// \a thread_sp.
0171   ///
0172   /// If \a thread_sp is valid this object will create a weak reference to
0173   /// that object, otherwise any previous thread weak reference contained in
0174   /// this object will be reset.
0175   ///
0176   /// Only the weak reference to the thread will be updated, no other weak
0177   /// references will be modified. If you want this execution context to make
0178   /// a weak reference to the thread's process and target, use the
0179   /// ExecutionContextRef::SetContext() functions.
0180   ///
0181   /// \see ExecutionContextRef::SetContext(const lldb::ThreadSP &)
0182   void SetThreadSP(const lldb::ThreadSP &thread_sp);
0183 
0184   /// Set accessor that creates a weak reference to the frame referenced in \a
0185   /// frame_sp.
0186   ///
0187   /// If \a frame_sp is valid this object will create a weak reference to that
0188   /// object, otherwise any previous frame weak reference contained in this
0189   /// object will be reset.
0190   ///
0191   /// Only the weak reference to the frame will be updated, no other weak
0192   /// references will be modified. If you want this execution context to make
0193   /// a weak reference to the frame's thread, process and target, use the
0194   /// ExecutionContextRef::SetContext() functions.
0195   ///
0196   /// \see ExecutionContextRef::SetContext(const lldb::StackFrameSP &)
0197   void SetFrameSP(const lldb::StackFrameSP &frame_sp);
0198 
0199   void SetTargetPtr(Target *target, bool adopt_selected);
0200 
0201   void SetProcessPtr(Process *process);
0202 
0203   void SetThreadPtr(Thread *thread);
0204 
0205   void SetFramePtr(StackFrame *frame);
0206 
0207   /// Get accessor that creates a strong reference from the weak target
0208   /// reference contained in this object.
0209   ///
0210   /// \returns
0211   ///     A shared pointer to a target that is not guaranteed to be valid.
0212   lldb::TargetSP GetTargetSP() const;
0213 
0214   /// Get accessor that creates a strong reference from the weak process
0215   /// reference contained in this object.
0216   ///
0217   /// \returns
0218   ///     A shared pointer to a process that is not guaranteed to be valid.
0219   lldb::ProcessSP GetProcessSP() const;
0220 
0221   /// Get accessor that creates a strong reference from the weak thread
0222   /// reference contained in this object.
0223   ///
0224   /// \returns
0225   ///     A shared pointer to a thread that is not guaranteed to be valid.
0226   lldb::ThreadSP GetThreadSP() const;
0227 
0228   /// Get accessor that creates a strong reference from the weak frame
0229   /// reference contained in this object.
0230   ///
0231   /// \returns
0232   ///     A shared pointer to a frame that is not guaranteed to be valid.
0233   lldb::StackFrameSP GetFrameSP() const;
0234 
0235   /// Create an ExecutionContext object from this object.
0236   ///
0237   /// Create strong references to any execution context objects that are still
0238   /// valid. Any of the returned shared pointers in the ExecutionContext
0239   /// objects is not guaranteed to be valid. \returns
0240   ///     An execution context object that has strong references to
0241   ///     any valid weak references in this object.
0242   ExecutionContext Lock(bool thread_and_frame_only_if_stopped) const;
0243 
0244   /// Returns true if this object has a weak reference to a thread. The return
0245   /// value is only an indication of whether this object has a weak reference
0246   /// and does not indicate whether the weak reference is valid or not.
0247   bool HasThreadRef() const { return m_tid != LLDB_INVALID_THREAD_ID; }
0248 
0249   /// Returns true if this object has a weak reference to a frame. The return
0250   /// value is only an indication of whether this object has a weak reference
0251   /// and does not indicate whether the weak reference is valid or not.
0252   bool HasFrameRef() const { return m_stack_id.IsValid(); }
0253 
0254   void ClearThread() {
0255     m_thread_wp.reset();
0256     m_tid = LLDB_INVALID_THREAD_ID;
0257   }
0258 
0259   void ClearFrame() { m_stack_id.Clear(); }
0260 
0261 protected:
0262   // Member variables
0263   lldb::TargetWP m_target_wp;         ///< A weak reference to a target
0264   lldb::ProcessWP m_process_wp;       ///< A weak reference to a process
0265   mutable lldb::ThreadWP m_thread_wp; ///< A weak reference to a thread
0266   lldb::tid_t m_tid = LLDB_INVALID_THREAD_ID; ///< The thread ID that this
0267                                               ///< object refers to in case the
0268                                               /// backing object changes
0269   StackID m_stack_id; ///< The stack ID that this object refers to in case the
0270                       ///backing object changes
0271 };
0272 
0273 /// \class ExecutionContext ExecutionContext.h
0274 /// "lldb/Target/ExecutionContext.h"
0275 /// A class that contains an execution context.
0276 ///
0277 /// This baton object can be passed into any function that requires a context
0278 /// that specifies a target, process, thread and frame. These objects are
0279 /// designed to be used for short term execution context object storage while
0280 /// a function might be trying to evaluate something that requires a thread or
0281 /// frame. ExecutionContextRef objects can be used to initialize one of these
0282 /// objects to turn the weak execution context object references to the
0283 /// target, process, thread and frame into strong references (shared pointers)
0284 /// so that functions can guarantee that these objects won't go away in the
0285 /// middle of a function.
0286 ///
0287 /// ExecutionContext objects should be used as short lived objects (typically
0288 /// on the stack) in order to lock down an execution context for local use and
0289 /// for passing down to other functions that also require specific contexts.
0290 /// They should NOT be used for long term storage, for long term storage use
0291 /// ExecutionContextRef objects.
0292 class ExecutionContext {
0293 public:
0294   /// Default Constructor.
0295   ExecutionContext();
0296 
0297   // Copy constructor
0298   ExecutionContext(const ExecutionContext &rhs);
0299 
0300   // Adopt the target and optionally its current context.
0301   ExecutionContext(Target *t, bool fill_current_process_thread_frame = true);
0302 
0303   // Create execution contexts from shared pointers
0304   ExecutionContext(const lldb::TargetSP &target_sp, bool get_process);
0305   ExecutionContext(const lldb::ProcessSP &process_sp);
0306   ExecutionContext(const lldb::ThreadSP &thread_sp);
0307   ExecutionContext(const lldb::StackFrameSP &frame_sp);
0308 
0309   // Create execution contexts from weak pointers
0310   ExecutionContext(const lldb::TargetWP &target_wp, bool get_process);
0311   ExecutionContext(const lldb::ProcessWP &process_wp);
0312   ExecutionContext(const lldb::ThreadWP &thread_wp);
0313   ExecutionContext(const lldb::StackFrameWP &frame_wp);
0314   ExecutionContext(const ExecutionContextRef &exe_ctx_ref);
0315   ExecutionContext(const ExecutionContextRef *exe_ctx_ref,
0316                    bool thread_and_frame_only_if_stopped = false);
0317 
0318   // These two variants take in a locker, and grab the target, lock the API
0319   // mutex into locker, then fill in the rest of the shared pointers.
0320   ExecutionContext(const ExecutionContextRef &exe_ctx_ref,
0321                    std::unique_lock<std::recursive_mutex> &locker);
0322   ExecutionContext(const ExecutionContextRef *exe_ctx_ref,
0323                    std::unique_lock<std::recursive_mutex> &locker);
0324   // Create execution contexts from execution context scopes
0325   ExecutionContext(ExecutionContextScope *exe_scope);
0326   ExecutionContext(ExecutionContextScope &exe_scope);
0327 
0328   /// Construct with process, thread, and frame index.
0329   ///
0330   /// Initialize with process \a p, thread \a t, and frame index \a f.
0331   ///
0332   /// \param[in] process
0333   ///     The process for this execution context.
0334   ///
0335   /// \param[in] thread
0336   ///     The thread for this execution context.
0337   ///
0338   /// \param[in] frame
0339   ///     The frame index for this execution context.
0340   ExecutionContext(Process *process, Thread *thread = nullptr,
0341                    StackFrame *frame = nullptr);
0342 
0343   ~ExecutionContext();
0344 
0345   ExecutionContext &operator=(const ExecutionContext &rhs);
0346 
0347   bool operator==(const ExecutionContext &rhs) const;
0348 
0349   bool operator!=(const ExecutionContext &rhs) const;
0350 
0351   /// Clear the object's state.
0352   ///
0353   /// Sets the process and thread to nullptr, and the frame index to an
0354   /// invalid value.
0355   void Clear();
0356 
0357   RegisterContext *GetRegisterContext() const;
0358 
0359   ExecutionContextScope *GetBestExecutionContextScope() const;
0360 
0361   uint32_t GetAddressByteSize() const;
0362 
0363   lldb::ByteOrder GetByteOrder() const;
0364 
0365   /// Returns a pointer to the target object.
0366   ///
0367   /// The returned pointer might be nullptr. Calling HasTargetScope(),
0368   /// HasProcessScope(), HasThreadScope(), or HasFrameScope() can help to pre-
0369   /// validate this pointer so that this accessor can freely be used without
0370   /// having to check for nullptr each time.
0371   ///
0372   /// \see ExecutionContext::HasTargetScope() const @see
0373   /// ExecutionContext::HasProcessScope() const @see
0374   /// ExecutionContext::HasThreadScope() const @see
0375   /// ExecutionContext::HasFrameScope() const
0376   Target *GetTargetPtr() const;
0377 
0378   /// Returns a pointer to the process object.
0379   ///
0380   /// The returned pointer might be nullptr. Calling HasProcessScope(),
0381   /// HasThreadScope(), or HasFrameScope()  can help to pre-validate this
0382   /// pointer so that this accessor can freely be used without having to check
0383   /// for nullptr each time.
0384   ///
0385   /// \see ExecutionContext::HasProcessScope() const @see
0386   /// ExecutionContext::HasThreadScope() const @see
0387   /// ExecutionContext::HasFrameScope() const
0388   Process *GetProcessPtr() const;
0389 
0390   /// Returns a pointer to the thread object.
0391   ///
0392   /// The returned pointer might be nullptr. Calling HasThreadScope() or
0393   /// HasFrameScope() can help to pre-validate this pointer so that this
0394   /// accessor can freely be used without having to check for nullptr each
0395   /// time.
0396   ///
0397   /// \see ExecutionContext::HasThreadScope() const @see
0398   /// ExecutionContext::HasFrameScope() const
0399   Thread *GetThreadPtr() const { return m_thread_sp.get(); }
0400 
0401   /// Returns a pointer to the frame object.
0402   ///
0403   /// The returned pointer might be nullptr. Calling HasFrameScope(), can help
0404   /// to pre-validate this pointer so that this accessor can freely be used
0405   /// without having to check for nullptr each time.
0406   ///
0407   /// \see ExecutionContext::HasFrameScope() const
0408   StackFrame *GetFramePtr() const { return m_frame_sp.get(); }
0409 
0410   /// Returns a reference to the target object.
0411   ///
0412   /// Clients should call HasTargetScope(), HasProcessScope(),
0413   /// HasThreadScope(), or HasFrameScope() prior to calling this function to
0414   /// ensure that this ExecutionContext object contains a valid target.
0415   ///
0416   /// \see ExecutionContext::HasTargetScope() const @see
0417   /// ExecutionContext::HasProcessScope() const @see
0418   /// ExecutionContext::HasThreadScope() const @see
0419   /// ExecutionContext::HasFrameScope() const
0420   Target &GetTargetRef() const;
0421 
0422   /// Returns a reference to the process object.
0423   ///
0424   /// Clients should call HasProcessScope(), HasThreadScope(), or
0425   /// HasFrameScope() prior to calling this  function to ensure that this
0426   /// ExecutionContext object contains a valid target.
0427   ///
0428   /// \see ExecutionContext::HasProcessScope() const @see
0429   /// ExecutionContext::HasThreadScope() const @see
0430   /// ExecutionContext::HasFrameScope() const
0431   Process &GetProcessRef() const;
0432 
0433   /// Returns a reference to the thread object.
0434   ///
0435   /// Clients should call HasThreadScope(), or  HasFrameScope() prior to
0436   /// calling this  function to ensure that  this ExecutionContext object
0437   /// contains a valid target.
0438   ///
0439   /// \see ExecutionContext::HasThreadScope() const @see
0440   /// ExecutionContext::HasFrameScope() const
0441   Thread &GetThreadRef() const;
0442 
0443   /// Returns a reference to the thread object.
0444   ///
0445   /// Clients should call HasFrameScope() prior to calling this function to
0446   /// ensure that  this ExecutionContext object contains a valid target.
0447   ///
0448   /// \see ExecutionContext::HasFrameScope() const
0449   StackFrame &GetFrameRef() const;
0450 
0451   /// Get accessor to get the target shared pointer.
0452   ///
0453   /// The returned shared pointer is not guaranteed to be valid.
0454   const lldb::TargetSP &GetTargetSP() const { return m_target_sp; }
0455 
0456   /// Get accessor to get the process shared pointer.
0457   ///
0458   /// The returned shared pointer is not guaranteed to be valid.
0459   const lldb::ProcessSP &GetProcessSP() const { return m_process_sp; }
0460 
0461   /// Get accessor to get the thread shared pointer.
0462   ///
0463   /// The returned shared pointer is not guaranteed to be valid.
0464   const lldb::ThreadSP &GetThreadSP() const { return m_thread_sp; }
0465 
0466   /// Get accessor to get the frame shared pointer.
0467   ///
0468   /// The returned shared pointer is not guaranteed to be valid.
0469   const lldb::StackFrameSP &GetFrameSP() const { return m_frame_sp; }
0470 
0471   /// Set accessor to set only the target shared pointer.
0472   void SetTargetSP(const lldb::TargetSP &target_sp);
0473 
0474   /// Set accessor to set only the process shared pointer.
0475   void SetProcessSP(const lldb::ProcessSP &process_sp);
0476 
0477   /// Set accessor to set only the thread shared pointer.
0478   void SetThreadSP(const lldb::ThreadSP &thread_sp);
0479 
0480   /// Set accessor to set only the frame shared pointer.
0481   void SetFrameSP(const lldb::StackFrameSP &frame_sp);
0482 
0483   /// Set accessor to set only the target shared pointer from a target
0484   /// pointer.
0485   void SetTargetPtr(Target *target);
0486 
0487   /// Set accessor to set only the process shared pointer from a process
0488   /// pointer.
0489   void SetProcessPtr(Process *process);
0490 
0491   /// Set accessor to set only the thread shared pointer from a thread
0492   /// pointer.
0493   void SetThreadPtr(Thread *thread);
0494 
0495   /// Set accessor to set only the frame shared pointer from a frame pointer.
0496   void SetFramePtr(StackFrame *frame);
0497 
0498   // Set the execution context using a target shared pointer.
0499   //
0500   // If "target_sp" is valid, sets the target context to match and if
0501   // "get_process" is true, sets the process shared pointer if the target
0502   // currently has a process.
0503   void SetContext(const lldb::TargetSP &target_sp, bool get_process);
0504 
0505   // Set the execution context using a process shared pointer.
0506   //
0507   // If "process_sp" is valid, then set the process and target in this context.
0508   // Thread and frame contexts will be cleared. If "process_sp" is not valid,
0509   // all shared pointers are reset.
0510   void SetContext(const lldb::ProcessSP &process_sp);
0511 
0512   // Set the execution context using a thread shared pointer.
0513   //
0514   // If "thread_sp" is valid, then set the thread, process and target in this
0515   // context. The frame context will be cleared. If "thread_sp" is not valid,
0516   // all shared pointers are reset.
0517   void SetContext(const lldb::ThreadSP &thread_sp);
0518 
0519   // Set the execution context using a frame shared pointer.
0520   //
0521   // If "frame_sp" is valid, then set the frame, thread, process and target in
0522   // this context If "frame_sp" is not valid, all shared pointers are reset.
0523   void SetContext(const lldb::StackFrameSP &frame_sp);
0524 
0525   /// Returns true the ExecutionContext object contains a valid target.
0526   ///
0527   /// This function can be called after initializing an ExecutionContext
0528   /// object, and if it returns true, calls to GetTargetPtr() and
0529   /// GetTargetRef() do not need to be checked for validity.
0530   bool HasTargetScope() const;
0531 
0532   /// Returns true the ExecutionContext object contains a valid target and
0533   /// process.
0534   ///
0535   /// This function can be called after initializing an ExecutionContext
0536   /// object, and if it returns true, calls to GetTargetPtr() and
0537   /// GetTargetRef(), GetProcessPtr(), and GetProcessRef(), do not need to be
0538   /// checked for validity.
0539   bool HasProcessScope() const;
0540 
0541   /// Returns true the ExecutionContext object contains a valid target,
0542   /// process, and thread.
0543   ///
0544   /// This function can be called after initializing an ExecutionContext
0545   /// object, and if it returns true, calls to GetTargetPtr(), GetTargetRef(),
0546   /// GetProcessPtr(), GetProcessRef(), GetThreadPtr(), and GetThreadRef() do
0547   /// not need to be checked for validity.
0548   bool HasThreadScope() const;
0549 
0550   /// Returns true the ExecutionContext object contains a valid target,
0551   /// process, thread and frame.
0552   ///
0553   /// This function can be called after initializing an ExecutionContext
0554   /// object, and if it returns true, calls to GetTargetPtr(), GetTargetRef(),
0555   /// GetProcessPtr(), GetProcessRef(), GetThreadPtr(), GetThreadRef(),
0556   /// GetFramePtr(), and GetFrameRef() do not need to be checked for validity.
0557   bool HasFrameScope() const;
0558 
0559 protected:
0560   // Member variables
0561   lldb::TargetSP m_target_sp; ///< The target that owns the process/thread/frame
0562   lldb::ProcessSP m_process_sp;  ///< The process that owns the thread/frame
0563   lldb::ThreadSP m_thread_sp;    ///< The thread that owns the frame
0564   lldb::StackFrameSP m_frame_sp; ///< The stack frame in thread.
0565 };
0566 
0567 } // namespace lldb_private
0568 
0569 #endif // LLDB_TARGET_EXECUTIONCONTEXT_H