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 
10 #include "SBReproducerPrivate.h"
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 
24 }
25 
27  : m_exe_ctx_sp(rhs.m_exe_ctx_sp) {
29  (const lldb::SBExecutionContext &), rhs);
30 }
31 
33  lldb::ExecutionContextRefSP exe_ctx_ref_sp)
34  : m_exe_ctx_sp(exe_ctx_ref_sp) {
35  LLDB_RECORD_CONSTRUCTOR(SBExecutionContext, (lldb::ExecutionContextRefSP),
36  exe_ctx_ref_sp);
37 }
38 
40  : m_exe_ctx_sp(new ExecutionContextRef()) {
42 
43  m_exe_ctx_sp->SetTargetSP(target.GetSP());
44 }
45 
47  : m_exe_ctx_sp(new ExecutionContextRef()) {
49  process);
50 
51  m_exe_ctx_sp->SetProcessSP(process.GetSP());
52 }
53 
55  : m_exe_ctx_sp(new ExecutionContextRef()) {
57 
58  m_exe_ctx_sp->SetThreadPtr(thread.get());
59 }
60 
62  : m_exe_ctx_sp(new ExecutionContextRef()) {
64 
65  m_exe_ctx_sp->SetFrameSP(frame.GetFrameSP());
66 }
67 
69 
74  SBExecutionContext, operator=,(const lldb::SBExecutionContext &), rhs);
75 
77  return LLDB_RECORD_RESULT(*this);
78 }
79 
81  return m_exe_ctx_sp.get();
82 }
83 
86  GetTarget);
87 
88  SBTarget sb_target;
89  if (m_exe_ctx_sp) {
90  TargetSP target_sp(m_exe_ctx_sp->GetTargetSP());
91  if (target_sp)
92  sb_target.SetSP(target_sp);
93  }
94  return LLDB_RECORD_RESULT(sb_target);
95 }
96 
99  GetProcess);
100 
101  SBProcess sb_process;
102  if (m_exe_ctx_sp) {
103  ProcessSP process_sp(m_exe_ctx_sp->GetProcessSP());
104  if (process_sp)
105  sb_process.SetSP(process_sp);
106  }
107  return LLDB_RECORD_RESULT(sb_process);
108 }
109 
112  GetThread);
113 
114  SBThread sb_thread;
115  if (m_exe_ctx_sp) {
116  ThreadSP thread_sp(m_exe_ctx_sp->GetThreadSP());
117  if (thread_sp)
118  sb_thread.SetThread(thread_sp);
119  }
120  return LLDB_RECORD_RESULT(sb_thread);
121 }
122 
125 
126  SBFrame sb_frame;
127  if (m_exe_ctx_sp) {
128  StackFrameSP frame_sp(m_exe_ctx_sp->GetFrameSP());
129  if (frame_sp)
130  sb_frame.SetFrameSP(frame_sp);
131  }
132  return LLDB_RECORD_RESULT(sb_frame);
133 }
134 
135 namespace lldb_private {
136 namespace repro {
137 
138 template <>
142  (const lldb::SBExecutionContext &));
144  (lldb::ExecutionContextRefSP));
150  const lldb::SBExecutionContext &,
151  SBExecutionContext, operator=,(const lldb::SBExecutionContext &));
153  ());
155  ());
157  ());
159 }
160 
161 }
162 }
lldb::SBThread
Definition: SBThread.h:20
lldb::SBThread::SetThread
void SetThread(const lldb::ThreadSP &lldb_object_sp)
Definition: SBThread.cpp:379
lldb::SBFrame::GetFrameSP
lldb::StackFrameSP GetFrameSP() const
Definition: SBFrame.cpp:84
LLDB_RECORD_RESULT
#define LLDB_RECORD_RESULT(Result)
Definition: ReproducerInstrumentation.h:211
LLDB_RECORD_METHOD_CONST_NO_ARGS
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:168
lldb_private::repro::RegisterMethods< SBExecutionContext >
void RegisterMethods< SBExecutionContext >(Registry &R)
Definition: SBExecutionContext.cpp:139
lldb::SBProcess::SetSP
void SetSP(const lldb::ProcessSP &process_sp)
Definition: SBProcess.cpp:108
LLDB_RECORD_CONSTRUCTOR_NO_ARGS
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
Definition: ReproducerInstrumentation.h:136
LLDB_REGISTER_METHOD_CONST
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:98
lldb::SBExecutionContext::get
lldb_private::ExecutionContextRef * get() const
Definition: SBExecutionContext.cpp:80
lldb::SBProcess
Definition: SBProcess.h:23
SBReproducerPrivate.h
LLDB_REGISTER_CONSTRUCTOR
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
Definition: ReproducerInstrumentation.h:89
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
LLDB_RECORD_METHOD
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
Definition: ReproducerInstrumentation.h:158
SBThread.h
lldb::SBExecutionContext::GetFrame
SBFrame GetFrame() const
Definition: SBExecutionContext.cpp:123
SBFrame.h
lldb::SBThread::get
lldb_private::Thread * get()
Definition: SBThread.cpp:1363
lldb::SBExecutionContext::GetTarget
SBTarget GetTarget() const
Definition: SBExecutionContext.cpp:84
LLDB_RECORD_CONSTRUCTOR
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
Definition: ReproducerInstrumentation.h:133
lldb_private::repro::Registry
The registry contains a unique mapping between functions and their ID.
Definition: ReproducerInstrumentation.h:517
lldb::SBExecutionContext::GetProcess
SBProcess GetProcess() const
Definition: SBExecutionContext.cpp:97
lldb::SBProcess::GetSP
lldb::ProcessSP GetSP() const
Definition: SBProcess.cpp:106
lldb::SBExecutionContext::operator=
const SBExecutionContext & operator=(const lldb::SBExecutionContext &rhs)
Definition: SBExecutionContext.cpp:71
SBExecutionContext.h
lldb::SBTarget::SetSP
void SetSP(const lldb::TargetSP &target_sp)
Definition: SBTarget.cpp:609
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:607
SBProcess.h
lldb::SBFrame::SetFrameSP
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition: SBFrame.cpp:88
lldb::SBExecutionContext::GetThread
SBThread GetThread() const
Definition: SBExecutionContext.cpp:110
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_REGISTER_METHOD
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:93
lldb::SBExecutionContext::SBExecutionContext
SBExecutionContext()
Definition: SBExecutionContext.cpp:22