1 //===-- ExecutionContext.h --------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ExecutionContext_h_
11 #define liblldb_ExecutionContext_h_
17 // Other libraries and framework includes
19 #include "lldb/Target/StackID.h"
20 #include "lldb/lldb-private.h"
22 namespace lldb_private {
24 //===----------------------------------------------------------------------===//
25 /// Execution context objects refer to objects in the execution of the
26 /// program that is being debugged. The consist of one or more of the
27 /// following objects: target, process, thread, and frame. Many objects
28 /// in the debugger need to track different executions contexts. For
29 /// example, a local function variable might have an execution context
30 /// that refers to a stack frame. A global or static variable might
31 /// refer to a target since a stack frame isn't required in order to
32 /// evaluate a global or static variable (a process isn't necessarily
33 /// needed for a global variable since we might be able to read the
34 /// variable value from a data section in one of the object files in
35 /// a target). There are two types of objects that hold onto execution
36 /// contexts: ExecutionContextRef and ExecutionContext. Both of these
37 /// objects are described below.
39 /// Not all objects in an ExectionContext objects will be valid. If you want
40 /// to refer strongly (ExectionContext) or weakly (ExectionContextRef) to
41 /// a process, then only the process and target references will be valid.
42 /// For threads, only the thread, process and target references will be
43 /// filled in. For frames, all of the objects will be filled in.
45 /// These classes are designed to be used as baton objects that get passed
46 /// to a wide variety of functions that require execution contexts.
47 //===----------------------------------------------------------------------===//
49 //----------------------------------------------------------------------
50 /// @class ExecutionContextRef ExecutionContext.h
51 /// "lldb/Target/ExecutionContext.h"
52 /// @brief A class that holds a weak reference to an execution context.
54 /// ExecutionContextRef objects are designed to hold onto an execution
55 /// context that might change over time. For example, if an object wants
56 /// to refer to a stack frame, it should hold onto an ExecutionContextRef
57 /// to a frame object. The backing object that represents the stack frame
58 /// might change over time and instances of this object can track the logical
59 /// object that refers to a frame even if it does change.
61 /// These objects also don't keep execution objects around longer than they
62 /// should since they use weak pointers. For example if an object refers
63 /// to a stack frame and a stack frame is no longer in a thread, then a
64 /// ExecutionContextRef object that refers to that frame will not be able
65 /// to get a shared pointer to those objects since they are no longer around.
67 /// ExecutionContextRef objects can also be used as objects in classes
68 /// that want to track a "previous execution context". Since the weak
69 /// references to the execution objects (target, process, thread and frame)
70 /// don't keep these objects around, they are safe to keep around.
72 /// The general rule of thumb is all long lived objects that want to
73 /// refer to execution contexts should use ExecutionContextRef objects.
74 /// The ExecutionContext class is used to temporarily get shared
75 /// pointers to any execution context objects that are still around
76 /// so they are guaranteed to exist during a function that requires the
77 /// objects. ExecutionContext objects should NOT be used for long term
78 /// storage since they will keep objects alive with extra shared pointer
79 /// references to these objects.
80 //----------------------------------------------------------------------
81 class ExecutionContextRef {
83 //------------------------------------------------------------------
84 /// Default Constructor.
85 //------------------------------------------------------------------
86 ExecutionContextRef();
88 //------------------------------------------------------------------
90 //------------------------------------------------------------------
91 ExecutionContextRef(const ExecutionContextRef &rhs);
93 //------------------------------------------------------------------
94 /// Construct using an ExecutionContext object that might be nullptr.
96 /// If \a exe_ctx_ptr is valid, then make weak references to any
97 /// valid objects in the ExecutionContext, otherwise no weak
98 /// references to any execution context objects will be made.
99 //------------------------------------------------------------------
100 ExecutionContextRef(const ExecutionContext *exe_ctx_ptr);
102 //------------------------------------------------------------------
103 /// Construct using an ExecutionContext object.
105 /// Make weak references to any valid objects in the ExecutionContext.
106 //------------------------------------------------------------------
107 ExecutionContextRef(const ExecutionContext &exe_ctx);
109 //------------------------------------------------------------------
110 /// Construct using the target and all the selected items inside of it
111 /// (the process and its selected thread, and the thread's selected
112 /// frame). If there is no selected thread, default to the first thread
113 /// If there is no selected frame, default to the first frame.
114 //------------------------------------------------------------------
115 ExecutionContextRef(Target *target, bool adopt_selected);
117 //------------------------------------------------------------------
118 /// Construct using an execution context scope.
120 /// If the ExecutionContextScope object is valid and refers to a frame,
121 /// make weak references too the frame, thread, process and target.
122 /// If the ExecutionContextScope object is valid and refers to a thread,
123 /// make weak references too the thread, process and target.
124 /// If the ExecutionContextScope object is valid and refers to a process,
125 /// make weak references too the process and target.
126 /// If the ExecutionContextScope object is valid and refers to a target,
127 /// make weak references too the target.
128 //------------------------------------------------------------------
129 ExecutionContextRef(ExecutionContextScope *exe_scope);
131 //------------------------------------------------------------------
132 /// Construct using an execution context scope.
134 /// If the ExecutionContextScope object refers to a frame,
135 /// make weak references too the frame, thread, process and target.
136 /// If the ExecutionContextScope object refers to a thread,
137 /// make weak references too the thread, process and target.
138 /// If the ExecutionContextScope object refers to a process,
139 /// make weak references too the process and target.
140 /// If the ExecutionContextScope object refers to a target,
141 /// make weak references too the target.
142 //------------------------------------------------------------------
143 ExecutionContextRef(ExecutionContextScope &exe_scope);
145 ~ExecutionContextRef();
147 //------------------------------------------------------------------
148 /// Assignment operator
150 /// Copy all weak references in \a rhs.
151 //------------------------------------------------------------------
152 ExecutionContextRef &operator=(const ExecutionContextRef &rhs);
154 //------------------------------------------------------------------
155 /// Assignment operator from a ExecutionContext
157 /// Make weak references to any strongly referenced objects in \a exe_ctx.
158 //------------------------------------------------------------------
159 ExecutionContextRef &operator=(const ExecutionContext &exe_ctx);
161 //------------------------------------------------------------------
162 /// Clear the object's state.
164 /// Sets the process and thread to nullptr, and the frame index to an
166 //------------------------------------------------------------------
169 //------------------------------------------------------------------
170 /// Set accessor that creates a weak reference to the target
171 /// referenced in \a target_sp.
173 /// If \a target_sp is valid this object will create a weak
174 /// reference to that object, otherwise any previous target weak
175 /// reference contained in this object will be reset.
177 /// Only the weak reference to the target will be updated, no other
178 /// weak references will be modified. If you want this execution
179 /// context to make a weak reference to the target's process, use
180 /// the ExecutionContextRef::SetContext() functions.
182 /// @see ExecutionContextRef::SetContext(const lldb::TargetSP &, bool)
183 //------------------------------------------------------------------
184 void SetTargetSP(const lldb::TargetSP &target_sp);
186 //------------------------------------------------------------------
187 /// Set accessor that creates a weak reference to the process
188 /// referenced in \a process_sp.
190 /// If \a process_sp is valid this object will create a weak
191 /// reference to that object, otherwise any previous process weak
192 /// reference contained in this object will be reset.
194 /// Only the weak reference to the process will be updated, no other
195 /// weak references will be modified. If you want this execution
196 /// context to make a weak reference to the target, use the
197 /// ExecutionContextRef::SetContext() functions.
199 /// @see ExecutionContextRef::SetContext(const lldb::ProcessSP &)
200 //------------------------------------------------------------------
201 void SetProcessSP(const lldb::ProcessSP &process_sp);
203 //------------------------------------------------------------------
204 /// Set accessor that creates a weak reference to the thread
205 /// referenced in \a thread_sp.
207 /// If \a thread_sp is valid this object will create a weak
208 /// reference to that object, otherwise any previous thread weak
209 /// reference contained in this object will be reset.
211 /// Only the weak reference to the thread will be updated, no other
212 /// weak references will be modified. If you want this execution
213 /// context to make a weak reference to the thread's process and
214 /// target, use the ExecutionContextRef::SetContext() functions.
216 /// @see ExecutionContextRef::SetContext(const lldb::ThreadSP &)
217 //------------------------------------------------------------------
218 void SetThreadSP(const lldb::ThreadSP &thread_sp);
220 //------------------------------------------------------------------
221 /// Set accessor that creates a weak reference to the frame
222 /// referenced in \a frame_sp.
224 /// If \a frame_sp is valid this object will create a weak
225 /// reference to that object, otherwise any previous frame weak
226 /// reference contained in this object will be reset.
228 /// Only the weak reference to the frame will be updated, no other
229 /// weak references will be modified. If you want this execution
230 /// context to make a weak reference to the frame's thread, process
231 /// and target, use the ExecutionContextRef::SetContext() functions.
233 /// @see ExecutionContextRef::SetContext(const lldb::StackFrameSP &)
234 //------------------------------------------------------------------
235 void SetFrameSP(const lldb::StackFrameSP &frame_sp);
237 void SetTargetPtr(Target *target, bool adopt_selected);
239 void SetProcessPtr(Process *process);
241 void SetThreadPtr(Thread *thread);
243 void SetFramePtr(StackFrame *frame);
245 //------------------------------------------------------------------
246 /// Get accessor that creates a strong reference from the weak target
247 /// reference contained in this object.
250 /// A shared pointer to a target that is not guaranteed to be valid.
251 //------------------------------------------------------------------
252 lldb::TargetSP GetTargetSP() const;
254 //------------------------------------------------------------------
255 /// Get accessor that creates a strong reference from the weak process
256 /// reference contained in this object.
259 /// A shared pointer to a process that is not guaranteed to be valid.
260 //------------------------------------------------------------------
261 lldb::ProcessSP GetProcessSP() const;
263 //------------------------------------------------------------------
264 /// Get accessor that creates a strong reference from the weak thread
265 /// reference contained in this object.
268 /// A shared pointer to a thread that is not guaranteed to be valid.
269 //------------------------------------------------------------------
270 lldb::ThreadSP GetThreadSP() const;
272 //------------------------------------------------------------------
273 /// Get accessor that creates a strong reference from the weak frame
274 /// reference contained in this object.
277 /// A shared pointer to a frame that is not guaranteed to be valid.
278 //------------------------------------------------------------------
279 lldb::StackFrameSP GetFrameSP() const;
281 //------------------------------------------------------------------
282 /// Create an ExecutionContext object from this object.
284 /// Create strong references to any execution context objects that
285 /// are still valid. Any of the returned shared pointers in the
286 /// ExecutionContext objects is not guaranteed to be valid.
288 /// An execution context object that has strong references to
289 /// any valid weak references in this object.
290 //------------------------------------------------------------------
291 ExecutionContext Lock(bool thread_and_frame_only_if_stopped) const;
293 //------------------------------------------------------------------
294 /// Returns true if this object has a weak reference to a thread.
295 /// The return value is only an indication of whether this object has
296 /// a weak reference and does not indicate whether the weak reference
298 //------------------------------------------------------------------
299 bool HasThreadRef() const { return m_tid != LLDB_INVALID_THREAD_ID; }
301 //------------------------------------------------------------------
302 /// Returns true if this object has a weak reference to a frame.
303 /// The return value is only an indication of whether this object has
304 /// a weak reference and does not indicate whether the weak reference
306 //------------------------------------------------------------------
307 bool HasFrameRef() const { return m_stack_id.IsValid(); }
311 m_tid = LLDB_INVALID_THREAD_ID;
314 void ClearFrame() { m_stack_id.Clear(); }
317 //------------------------------------------------------------------
319 //------------------------------------------------------------------
320 lldb::TargetWP m_target_wp; ///< A weak reference to a target
321 lldb::ProcessWP m_process_wp; ///< A weak reference to a process
322 mutable lldb::ThreadWP m_thread_wp; ///< A weak reference to a thread
323 lldb::tid_t m_tid; ///< The thread ID that this object refers to in case the
324 ///backing object changes
325 StackID m_stack_id; ///< The stack ID that this object refers to in case the
326 ///backing object changes
329 //----------------------------------------------------------------------
330 /// @class ExecutionContext ExecutionContext.h "lldb/Target/ExecutionContext.h"
331 /// @brief A class that contains an execution context.
333 /// This baton object can be passed into any function that requires
334 /// a context that specifies a target, process, thread and frame.
335 /// These objects are designed to be used for short term execution
336 /// context object storage while a function might be trying to evaluate
337 /// something that requires a thread or frame. ExecutionContextRef
338 /// objects can be used to initialize one of these objects to turn
339 /// the weak execution context object references to the target, process,
340 /// thread and frame into strong references (shared pointers) so that
341 /// functions can guarantee that these objects won't go away in the
342 /// middle of a function.
344 /// ExecutionContext objects should be used as short lived objects
345 /// (typically on the stack) in order to lock down an execution context
346 /// for local use and for passing down to other functions that also
347 /// require specific contexts. They should NOT be used for long term
348 /// storage, for long term storage use ExecutionContextRef objects.
349 //----------------------------------------------------------------------
350 class ExecutionContext {
352 //------------------------------------------------------------------
353 /// Default Constructor.
354 //------------------------------------------------------------------
357 //------------------------------------------------------------------
359 //------------------------------------------------------------------
360 ExecutionContext(const ExecutionContext &rhs);
362 //------------------------------------------------------------------
363 // Adopt the target and optionally its current context.
364 //------------------------------------------------------------------
365 ExecutionContext(Target *t, bool fill_current_process_thread_frame = true);
367 //------------------------------------------------------------------
368 // Create execution contexts from shared pointers
369 //------------------------------------------------------------------
370 ExecutionContext(const lldb::TargetSP &target_sp, bool get_process);
371 ExecutionContext(const lldb::ProcessSP &process_sp);
372 ExecutionContext(const lldb::ThreadSP &thread_sp);
373 ExecutionContext(const lldb::StackFrameSP &frame_sp);
375 //------------------------------------------------------------------
376 // Create execution contexts from weak pointers
377 //------------------------------------------------------------------
378 ExecutionContext(const lldb::TargetWP &target_wp, bool get_process);
379 ExecutionContext(const lldb::ProcessWP &process_wp);
380 ExecutionContext(const lldb::ThreadWP &thread_wp);
381 ExecutionContext(const lldb::StackFrameWP &frame_wp);
382 ExecutionContext(const ExecutionContextRef &exe_ctx_ref);
383 ExecutionContext(const ExecutionContextRef *exe_ctx_ref,
384 bool thread_and_frame_only_if_stopped = false);
386 // These two variants take in a locker, and grab the target, lock the API
387 // mutex into locker, then
388 // fill in the rest of the shared pointers.
389 ExecutionContext(const ExecutionContextRef &exe_ctx_ref,
390 std::unique_lock<std::recursive_mutex> &locker);
391 ExecutionContext(const ExecutionContextRef *exe_ctx_ref,
392 std::unique_lock<std::recursive_mutex> &locker);
393 //------------------------------------------------------------------
394 // Create execution contexts from execution context scopes
395 //------------------------------------------------------------------
396 ExecutionContext(ExecutionContextScope *exe_scope);
397 ExecutionContext(ExecutionContextScope &exe_scope);
399 //------------------------------------------------------------------
400 /// Construct with process, thread, and frame index.
402 /// Initialize with process \a p, thread \a t, and frame index \a f.
404 /// @param[in] process
405 /// The process for this execution context.
407 /// @param[in] thread
408 /// The thread for this execution context.
411 /// The frame index for this execution context.
412 //------------------------------------------------------------------
413 ExecutionContext(Process *process, Thread *thread = nullptr,
414 StackFrame *frame = nullptr);
418 ExecutionContext &operator=(const ExecutionContext &rhs);
420 bool operator==(const ExecutionContext &rhs) const;
422 bool operator!=(const ExecutionContext &rhs) const;
424 //------------------------------------------------------------------
425 /// Clear the object's state.
427 /// Sets the process and thread to nullptr, and the frame index to an
429 //------------------------------------------------------------------
432 RegisterContext *GetRegisterContext() const;
434 ExecutionContextScope *GetBestExecutionContextScope() const;
436 uint32_t GetAddressByteSize() const;
438 lldb::ByteOrder GetByteOrder() const;
440 //------------------------------------------------------------------
441 /// Returns a pointer to the target object.
443 /// The returned pointer might be nullptr. Calling HasTargetScope(),
444 /// HasProcessScope(), HasThreadScope(), or HasFrameScope()
445 /// can help to pre-validate this pointer so that this accessor can
446 /// freely be used without having to check for nullptr each time.
448 /// @see ExecutionContext::HasTargetScope() const
449 /// @see ExecutionContext::HasProcessScope() const
450 /// @see ExecutionContext::HasThreadScope() const
451 /// @see ExecutionContext::HasFrameScope() const
452 //------------------------------------------------------------------
453 Target *GetTargetPtr() const;
455 //------------------------------------------------------------------
456 /// Returns a pointer to the process object.
458 /// The returned pointer might be nullptr. Calling HasProcessScope(),
459 /// HasThreadScope(), or HasFrameScope() can help to pre-validate
460 /// this pointer so that this accessor can freely be used without
461 /// having to check for nullptr each time.
463 /// @see ExecutionContext::HasProcessScope() const
464 /// @see ExecutionContext::HasThreadScope() const
465 /// @see ExecutionContext::HasFrameScope() const
466 //------------------------------------------------------------------
467 Process *GetProcessPtr() const;
469 //------------------------------------------------------------------
470 /// Returns a pointer to the thread object.
472 /// The returned pointer might be nullptr. Calling HasThreadScope() or
473 /// HasFrameScope() can help to pre-validate this pointer so that
474 /// this accessor can freely be used without having to check for
475 /// nullptr each time.
477 /// @see ExecutionContext::HasThreadScope() const
478 /// @see ExecutionContext::HasFrameScope() const
479 //------------------------------------------------------------------
480 Thread *GetThreadPtr() const { return m_thread_sp.get(); }
482 //------------------------------------------------------------------
483 /// Returns a pointer to the frame object.
485 /// The returned pointer might be nullptr. Calling HasFrameScope(),
486 /// can help to pre-validate this pointer so that this accessor can
487 /// freely be used without having to check for nullptr each time.
489 /// @see ExecutionContext::HasFrameScope() const
490 //------------------------------------------------------------------
491 StackFrame *GetFramePtr() const { return m_frame_sp.get(); }
493 //------------------------------------------------------------------
494 /// Returns a reference to the target object.
496 /// Clients should call HasTargetScope(), HasProcessScope(),
497 /// HasThreadScope(), or HasFrameScope() prior to calling this
498 /// function to ensure that this ExecutionContext object contains
501 /// @see ExecutionContext::HasTargetScope() const
502 /// @see ExecutionContext::HasProcessScope() const
503 /// @see ExecutionContext::HasThreadScope() const
504 /// @see ExecutionContext::HasFrameScope() const
505 //------------------------------------------------------------------
506 Target &GetTargetRef() const;
508 //------------------------------------------------------------------
509 /// Returns a reference to the process object.
511 /// Clients should call HasProcessScope(), HasThreadScope(), or
512 /// HasFrameScope() prior to calling this function to ensure that
513 /// this ExecutionContext object contains a valid target.
515 /// @see ExecutionContext::HasProcessScope() const
516 /// @see ExecutionContext::HasThreadScope() const
517 /// @see ExecutionContext::HasFrameScope() const
518 //------------------------------------------------------------------
519 Process &GetProcessRef() const;
521 //------------------------------------------------------------------
522 /// Returns a reference to the thread object.
524 /// Clients should call HasThreadScope(), or HasFrameScope() prior
525 /// to calling this function to ensure that this ExecutionContext
526 /// object contains a valid target.
528 /// @see ExecutionContext::HasThreadScope() const
529 /// @see ExecutionContext::HasFrameScope() const
530 //------------------------------------------------------------------
531 Thread &GetThreadRef() const;
533 //------------------------------------------------------------------
534 /// Returns a reference to the thread object.
536 /// Clients should call HasFrameScope() prior to calling this
537 /// function to ensure that this ExecutionContext object contains
540 /// @see ExecutionContext::HasFrameScope() const
541 //------------------------------------------------------------------
542 StackFrame &GetFrameRef() const;
544 //------------------------------------------------------------------
545 /// Get accessor to get the target shared pointer.
547 /// The returned shared pointer is not guaranteed to be valid.
548 //------------------------------------------------------------------
549 const lldb::TargetSP &GetTargetSP() const { return m_target_sp; }
551 //------------------------------------------------------------------
552 /// Get accessor to get the process shared pointer.
554 /// The returned shared pointer is not guaranteed to be valid.
555 //------------------------------------------------------------------
556 const lldb::ProcessSP &GetProcessSP() const { return m_process_sp; }
558 //------------------------------------------------------------------
559 /// Get accessor to get the thread shared pointer.
561 /// The returned shared pointer is not guaranteed to be valid.
562 //------------------------------------------------------------------
563 const lldb::ThreadSP &GetThreadSP() const { return m_thread_sp; }
565 //------------------------------------------------------------------
566 /// Get accessor to get the frame shared pointer.
568 /// The returned shared pointer is not guaranteed to be valid.
569 //------------------------------------------------------------------
570 const lldb::StackFrameSP &GetFrameSP() const { return m_frame_sp; }
572 //------------------------------------------------------------------
573 /// Set accessor to set only the target shared pointer.
574 //------------------------------------------------------------------
575 void SetTargetSP(const lldb::TargetSP &target_sp);
577 //------------------------------------------------------------------
578 /// Set accessor to set only the process shared pointer.
579 //------------------------------------------------------------------
580 void SetProcessSP(const lldb::ProcessSP &process_sp);
582 //------------------------------------------------------------------
583 /// Set accessor to set only the thread shared pointer.
584 //------------------------------------------------------------------
585 void SetThreadSP(const lldb::ThreadSP &thread_sp);
587 //------------------------------------------------------------------
588 /// Set accessor to set only the frame shared pointer.
589 //------------------------------------------------------------------
590 void SetFrameSP(const lldb::StackFrameSP &frame_sp);
592 //------------------------------------------------------------------
593 /// Set accessor to set only the target shared pointer from a target
595 //------------------------------------------------------------------
596 void SetTargetPtr(Target *target);
598 //------------------------------------------------------------------
599 /// Set accessor to set only the process shared pointer from a
601 //------------------------------------------------------------------
602 void SetProcessPtr(Process *process);
604 //------------------------------------------------------------------
605 /// Set accessor to set only the thread shared pointer from a thread
607 //------------------------------------------------------------------
608 void SetThreadPtr(Thread *thread);
610 //------------------------------------------------------------------
611 /// Set accessor to set only the frame shared pointer from a frame
613 //------------------------------------------------------------------
614 void SetFramePtr(StackFrame *frame);
616 //------------------------------------------------------------------
617 // Set the execution context using a target shared pointer.
619 // If "target_sp" is valid, sets the target context to match and
620 // if "get_process" is true, sets the process shared pointer if
621 // the target currently has a process.
622 //------------------------------------------------------------------
623 void SetContext(const lldb::TargetSP &target_sp, bool get_process);
625 //------------------------------------------------------------------
626 // Set the execution context using a process shared pointer.
628 // If "process_sp" is valid, then set the process and target in this
629 // context. Thread and frame contexts will be cleared.
630 // If "process_sp" is not valid, all shared pointers are reset.
631 //------------------------------------------------------------------
632 void SetContext(const lldb::ProcessSP &process_sp);
634 //------------------------------------------------------------------
635 // Set the execution context using a thread shared pointer.
637 // If "thread_sp" is valid, then set the thread, process and target
638 // in this context. The frame context will be cleared.
639 // If "thread_sp" is not valid, all shared pointers are reset.
640 //------------------------------------------------------------------
641 void SetContext(const lldb::ThreadSP &thread_sp);
643 //------------------------------------------------------------------
644 // Set the execution context using a frame shared pointer.
646 // If "frame_sp" is valid, then set the frame, thread, process and
647 // target in this context
648 // If "frame_sp" is not valid, all shared pointers are reset.
649 //------------------------------------------------------------------
650 void SetContext(const lldb::StackFrameSP &frame_sp);
652 //------------------------------------------------------------------
653 /// Returns true the ExecutionContext object contains a valid
656 /// This function can be called after initializing an ExecutionContext
657 /// object, and if it returns true, calls to GetTargetPtr() and
658 /// GetTargetRef() do not need to be checked for validity.
659 //------------------------------------------------------------------
660 bool HasTargetScope() const;
662 //------------------------------------------------------------------
663 /// Returns true the ExecutionContext object contains a valid
664 /// target and process.
666 /// This function can be called after initializing an ExecutionContext
667 /// object, and if it returns true, calls to GetTargetPtr() and
668 /// GetTargetRef(), GetProcessPtr(), and GetProcessRef(), do not
669 /// need to be checked for validity.
670 //------------------------------------------------------------------
671 bool HasProcessScope() const;
673 //------------------------------------------------------------------
674 /// Returns true the ExecutionContext object contains a valid
675 /// target, process, and thread.
677 /// This function can be called after initializing an ExecutionContext
678 /// object, and if it returns true, calls to GetTargetPtr(),
679 /// GetTargetRef(), GetProcessPtr(), GetProcessRef(), GetThreadPtr(),
680 /// and GetThreadRef() do not need to be checked for validity.
681 //------------------------------------------------------------------
682 bool HasThreadScope() const;
684 //------------------------------------------------------------------
685 /// Returns true the ExecutionContext object contains a valid
686 /// target, process, thread and frame.
688 /// This function can be called after initializing an ExecutionContext
689 /// object, and if it returns true, calls to GetTargetPtr(),
690 /// GetTargetRef(), GetProcessPtr(), GetProcessRef(), GetThreadPtr(),
691 /// GetThreadRef(), GetFramePtr(), and GetFrameRef() do not need
692 /// to be checked for validity.
693 //------------------------------------------------------------------
694 bool HasFrameScope() const;
697 //------------------------------------------------------------------
699 //------------------------------------------------------------------
700 lldb::TargetSP m_target_sp; ///< The target that owns the process/thread/frame
701 lldb::ProcessSP m_process_sp; ///< The process that owns the thread/frame
702 lldb::ThreadSP m_thread_sp; ///< The thread that owns the frame
703 lldb::StackFrameSP m_frame_sp; ///< The stack frame in thread.
706 } // namespace lldb_private
708 #endif // liblldb_ExecutionContext_h_