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 
19 using namespace lldb;
20 using 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 
78  LLDB_INSTRUMENT_VA(this);
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 
90  LLDB_INSTRUMENT_VA(this);
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 }
Instrumentation.h
lldb::SBThread
Definition: SBThread.h:20
lldb::SBThread::SetThread
void SetThread(const lldb::ThreadSP &lldb_object_sp)
Definition: SBThread.cpp:372
lldb::SBFrame::GetFrameSP
lldb::StackFrameSP GetFrameSP() const
Definition: SBFrame.cpp:83
lldb::SBProcess::SetSP
void SetSP(const lldb::ProcessSP &process_sp)
Definition: SBProcess.cpp:104
lldb::SBExecutionContext::get
lldb_private::ExecutionContextRef * get() const
Definition: SBExecutionContext.cpp:73
lldb::SBProcess
Definition: SBProcess.h:23
lldb::SBExecutionContext::m_exe_ctx_sp
lldb::ExecutionContextRefSP m_exe_ctx_sp
Definition: SBExecutionContext.h:56
lldb::SBExecutionContext
Definition: SBExecutionContext.h:20
lldb::SBTarget
Definition: SBTarget.h:29
lldb::SBFrame
Definition: SBFrame.h:17
SBThread.h
lldb::SBExecutionContext::GetFrame
SBFrame GetFrame() const
Definition: SBExecutionContext.cpp:113
SBFrame.h
lldb::SBThread::get
lldb_private::Thread * get()
Definition: SBThread.cpp:1317
lldb::SBExecutionContext::GetTarget
SBTarget GetTarget() const
Definition: SBExecutionContext.cpp:77
lldb::SBExecutionContext::GetProcess
SBProcess GetProcess() const
Definition: SBExecutionContext.cpp:89
lldb::SBProcess::GetSP
lldb::ProcessSP GetSP() const
Definition: SBProcess.cpp:102
lldb::SBExecutionContext::operator=
const SBExecutionContext & operator=(const lldb::SBExecutionContext &rhs)
Definition: SBExecutionContext.cpp:66
SBExecutionContext.h
lldb::SBTarget::SetSP
void SetSP(const lldb::TargetSP &target_sp)
Definition: SBTarget.cpp:578
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::SBExecutionContext::~SBExecutionContext
~SBExecutionContext()
lldb::SBTarget::GetSP
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:576
LLDB_INSTRUMENT_VA
#define LLDB_INSTRUMENT_VA(...)
Definition: Instrumentation.h:98
SBProcess.h
lldb::SBFrame::SetFrameSP
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition: SBFrame.cpp:87
lldb::SBExecutionContext::GetThread
SBThread GetThread() const
Definition: SBExecutionContext.cpp:101
SBTarget.h
lldb
Definition: SBAddress.h:15
lldb_private::ExecutionContextRef
Execution context objects refer to objects in the execution of the program that is being debugged.
Definition: ExecutionContext.h:72
ExecutionContext.h
lldb::SBExecutionContext::SBExecutionContext
SBExecutionContext()
Definition: SBExecutionContext.cpp:22