LLDB mainline
SBExecutionContext.cpp
Go to the documentation of this file.
1//===-- SBExecutionContext.cpp --------------------------------------------===//
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
11
12#include "lldb/API/SBFrame.h"
13#include "lldb/API/SBProcess.h"
14#include "lldb/API/SBTarget.h"
15#include "lldb/API/SBThread.h"
16
18
19using namespace lldb;
20using namespace lldb_private;
21
23
25 : m_exe_ctx_sp(rhs.m_exe_ctx_sp) {
26 LLDB_INSTRUMENT_VA(this, rhs);
27}
28
30 lldb::ExecutionContextRefSP exe_ctx_ref_sp)
31 : m_exe_ctx_sp(exe_ctx_ref_sp) {
32 LLDB_INSTRUMENT_VA(this, exe_ctx_ref_sp);
33}
34
36 : m_exe_ctx_sp(new ExecutionContextRef()) {
37 LLDB_INSTRUMENT_VA(this, target);
38
39 m_exe_ctx_sp->SetTargetSP(target.GetSP());
40}
41
43 : m_exe_ctx_sp(new ExecutionContextRef()) {
44 LLDB_INSTRUMENT_VA(this, process);
45
46 m_exe_ctx_sp->SetProcessSP(process.GetSP());
47}
48
50 : m_exe_ctx_sp(new ExecutionContextRef()) {
51 LLDB_INSTRUMENT_VA(this, thread);
52
53 m_exe_ctx_sp->SetThreadPtr(thread.get());
54}
55
57 : m_exe_ctx_sp(new ExecutionContextRef()) {
58 LLDB_INSTRUMENT_VA(this, frame);
59
60 m_exe_ctx_sp->SetFrameSP(frame.GetFrameSP());
61}
62
64
67 LLDB_INSTRUMENT_VA(this, rhs);
68
70 return *this;
71}
72
74 return m_exe_ctx_sp.get();
75}
76
79
80 SBTarget sb_target;
81 if (m_exe_ctx_sp) {
82 TargetSP target_sp(m_exe_ctx_sp->GetTargetSP());
83 if (target_sp)
84 sb_target.SetSP(target_sp);
85 }
86 return sb_target;
87}
88
91
92 SBProcess sb_process;
93 if (m_exe_ctx_sp) {
94 ProcessSP process_sp(m_exe_ctx_sp->GetProcessSP());
95 if (process_sp)
96 sb_process.SetSP(process_sp);
97 }
98 return sb_process;
99}
100
102 LLDB_INSTRUMENT_VA(this);
103
104 SBThread sb_thread;
105 if (m_exe_ctx_sp) {
106 ThreadSP thread_sp(m_exe_ctx_sp->GetThreadSP());
107 if (thread_sp)
108 sb_thread.SetThread(thread_sp);
109 }
110 return sb_thread;
111}
112
114 LLDB_INSTRUMENT_VA(this);
115
116 SBFrame sb_frame;
117 if (m_exe_ctx_sp) {
118 StackFrameSP frame_sp(m_exe_ctx_sp->GetFrameSP());
119 if (frame_sp)
120 sb_frame.SetFrameSP(frame_sp);
121 }
122 return sb_frame;
123}
#define LLDB_INSTRUMENT_VA(...)
lldb_private::ExecutionContextRef * get() const
const SBExecutionContext & operator=(const lldb::SBExecutionContext &rhs)
lldb::ExecutionContextRefSP m_exe_ctx_sp
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition: SBFrame.cpp:89
lldb::StackFrameSP GetFrameSP() const
Definition: SBFrame.cpp:85
lldb::ProcessSP GetSP() const
Definition: SBProcess.cpp:102
void SetSP(const lldb::ProcessSP &process_sp)
Definition: SBProcess.cpp:104
void SetSP(const lldb::TargetSP &target_sp)
Definition: SBTarget.cpp:579
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:577
lldb_private::Thread * get()
Definition: SBThread.cpp:1317
void SetThread(const lldb::ThreadSP &lldb_object_sp)
Definition: SBThread.cpp:372
Execution context objects refer to objects in the execution of the program that is being debugged.
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
Definition: SBAddress.h:15