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 
42 
43  m_exe_ctx_sp->SetTargetSP(target.GetSP());
44 }
45 
49  process);
50 
51  m_exe_ctx_sp->SetProcessSP(process.GetSP());
52 }
53 
57 
58  m_exe_ctx_sp->SetThreadPtr(thread.get());
59 }
60 
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 }
The registry contains a unique mapping between functions and their ID.
A class that represents a running process on the host machine.
lldb_private::Thread * get()
Definition: SBThread.cpp:1346
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition: SBFrame.cpp:88
void SetSP(const lldb::ProcessSP &process_sp)
Definition: SBProcess.cpp:109
const SBExecutionContext & operator=(const lldb::SBExecutionContext &rhs)
lldb_private::ExecutionContextRef * get() const
void SetSP(const lldb::TargetSP &target_sp)
Definition: SBTarget.cpp:610
lldb::ExecutionContextRefSP m_exe_ctx_sp
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:608
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
lldb::ProcessSP GetSP() const
Definition: SBProcess.cpp:107
Execution context objects refer to objects in the execution of the program that is being debugged...
void SetThread(const lldb::ThreadSP &lldb_object_sp)
Definition: SBThread.cpp:363
void RegisterMethods< SBExecutionContext >(Registry &R)
lldb::StackFrameSP GetFrameSP() const
Definition: SBFrame.cpp:84
Definition: SBAddress.h:15
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
#define LLDB_RECORD_RESULT(Result)
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)