LLDB  mainline
SBExecutionContext.cpp
Go to the documentation of this file.
1 //===-- SBExecutionContext.cpp ------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
11 #include "SBReproducerPrivate.h"
12 
13 #include "lldb/API/SBFrame.h"
14 #include "lldb/API/SBProcess.h"
15 #include "lldb/API/SBTarget.h"
16 #include "lldb/API/SBThread.h"
17 
19 
20 using namespace lldb;
21 using namespace lldb_private;
22 
25 }
26 
28  : m_exe_ctx_sp(rhs.m_exe_ctx_sp) {
30  (const lldb::SBExecutionContext &), rhs);
31 }
32 
34  lldb::ExecutionContextRefSP exe_ctx_ref_sp)
35  : m_exe_ctx_sp(exe_ctx_ref_sp) {
36  LLDB_RECORD_CONSTRUCTOR(SBExecutionContext, (lldb::ExecutionContextRefSP),
37  exe_ctx_ref_sp);
38 }
39 
41  : m_exe_ctx_sp(new ExecutionContextRef()) {
43 
44  m_exe_ctx_sp->SetTargetSP(target.GetSP());
45 }
46 
48  : m_exe_ctx_sp(new ExecutionContextRef()) {
50  process);
51 
52  m_exe_ctx_sp->SetProcessSP(process.GetSP());
53 }
54 
56  : m_exe_ctx_sp(new ExecutionContextRef()) {
58 
59  m_exe_ctx_sp->SetThreadPtr(thread.get());
60 }
61 
63  : m_exe_ctx_sp(new ExecutionContextRef()) {
65 
66  m_exe_ctx_sp->SetFrameSP(frame.GetFrameSP());
67 }
68 
70 
75  SBExecutionContext, operator=,(const lldb::SBExecutionContext &), rhs);
76 
77  m_exe_ctx_sp = rhs.m_exe_ctx_sp;
78  return LLDB_RECORD_RESULT(*this);
79 }
80 
82  return m_exe_ctx_sp.get();
83 }
84 
87  GetTarget);
88 
89  SBTarget sb_target;
90  if (m_exe_ctx_sp) {
91  TargetSP target_sp(m_exe_ctx_sp->GetTargetSP());
92  if (target_sp)
93  sb_target.SetSP(target_sp);
94  }
95  return LLDB_RECORD_RESULT(sb_target);
96 }
97 
100  GetProcess);
101 
102  SBProcess sb_process;
103  if (m_exe_ctx_sp) {
104  ProcessSP process_sp(m_exe_ctx_sp->GetProcessSP());
105  if (process_sp)
106  sb_process.SetSP(process_sp);
107  }
108  return LLDB_RECORD_RESULT(sb_process);
109 }
110 
113  GetThread);
114 
115  SBThread sb_thread;
116  if (m_exe_ctx_sp) {
117  ThreadSP thread_sp(m_exe_ctx_sp->GetThreadSP());
118  if (thread_sp)
119  sb_thread.SetThread(thread_sp);
120  }
121  return LLDB_RECORD_RESULT(sb_thread);
122 }
123 
126 
127  SBFrame sb_frame;
128  if (m_exe_ctx_sp) {
129  StackFrameSP frame_sp(m_exe_ctx_sp->GetFrameSP());
130  if (frame_sp)
131  sb_frame.SetFrameSP(frame_sp);
132  }
133  return LLDB_RECORD_RESULT(sb_frame);
134 }
135 
136 namespace lldb_private {
137 namespace repro {
138 
139 template <>
143  (const lldb::SBExecutionContext &));
145  (lldb::ExecutionContextRefSP));
151  const lldb::SBExecutionContext &,
152  SBExecutionContext, operator=,(const lldb::SBExecutionContext &));
154  ());
156  ());
158  ());
160 }
161 
162 }
163 }
The registry contains a unique mapping between functions and their ID.
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
#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:108
const SBExecutionContext & operator=(const lldb::SBExecutionContext &rhs)
lldb_private::ExecutionContextRef * get() const
void SetSP(const lldb::TargetSP &target_sp)
Definition: SBTarget.cpp:602
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:600
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
lldb::ProcessSP GetSP() const
Definition: SBProcess.cpp:106
Execution context objects refer to objects in the execution of the program that is being debugged...
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)