blob: 44fc654c44b6a889ba4493be29e9df1dc91b15f5 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- SBFrame.cpp ---------------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Eli Friedman4c5de692010-06-09 07:44:37 +000010#include "lldb/API/SBFrame.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000011
12#include <string>
13#include <algorithm>
14
15#include "lldb/lldb-types.h"
16
17#include "lldb/Core/Address.h"
18#include "lldb/Core/ConstString.h"
Caroline Ticeceb6b132010-10-26 03:11:13 +000019#include "lldb/Core/Log.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000020#include "lldb/Core/Stream.h"
21#include "lldb/Core/StreamFile.h"
22#include "lldb/Core/ValueObjectRegister.h"
23#include "lldb/Core/ValueObjectVariable.h"
Greg Claytonb71f3842010-10-05 03:13:51 +000024#include "lldb/Expression/ClangUserExpression.h"
Greg Clayton1ba7c4d2011-06-25 04:35:01 +000025#include "lldb/Host/Host.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000026#include "lldb/Symbol/Block.h"
Greg Clayton1f746072012-08-29 21:13:06 +000027#include "lldb/Symbol/Function.h"
28#include "lldb/Symbol/Symbol.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000029#include "lldb/Symbol/SymbolContext.h"
30#include "lldb/Symbol/VariableList.h"
31#include "lldb/Symbol/Variable.h"
32#include "lldb/Target/ExecutionContext.h"
33#include "lldb/Target/Target.h"
34#include "lldb/Target/Process.h"
35#include "lldb/Target/RegisterContext.h"
Jason Molendab57e4a12013-11-04 09:33:30 +000036#include "lldb/Target/StackFrame.h"
Greg Claytonb9556ac2012-01-30 07:41:31 +000037#include "lldb/Target/StackID.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000038#include "lldb/Target/Thread.h"
39
Eli Friedman4c5de692010-06-09 07:44:37 +000040#include "lldb/API/SBDebugger.h"
41#include "lldb/API/SBValue.h"
42#include "lldb/API/SBAddress.h"
Jim Ingham35e1bda2012-10-16 21:41:58 +000043#include "lldb/API/SBExpressionOptions.h"
Caroline Ticedde9cff2010-09-20 05:20:02 +000044#include "lldb/API/SBStream.h"
Eli Friedman4c5de692010-06-09 07:44:37 +000045#include "lldb/API/SBSymbolContext.h"
46#include "lldb/API/SBThread.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000047
48using namespace lldb;
49using namespace lldb_private;
50
Greg Claytonb9556ac2012-01-30 07:41:31 +000051
Chris Lattner30fdc8d2010-06-08 16:52:24 +000052SBFrame::SBFrame () :
Greg Clayton7fdf9ef2012-04-05 16:12:35 +000053 m_opaque_sp (new ExecutionContextRef())
Chris Lattner30fdc8d2010-06-08 16:52:24 +000054{
55}
56
Jason Molendab57e4a12013-11-04 09:33:30 +000057SBFrame::SBFrame (const StackFrameSP &lldb_object_sp) :
Greg Clayton7fdf9ef2012-04-05 16:12:35 +000058 m_opaque_sp (new ExecutionContextRef (lldb_object_sp))
Chris Lattner30fdc8d2010-06-08 16:52:24 +000059{
Greg Clayton5160ce52013-03-27 23:08:40 +000060 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Caroline Ticeceb6b132010-10-26 03:11:13 +000061
62 if (log)
63 {
64 SBStream sstr;
65 GetDescription (sstr);
Greg Clayton48381312010-10-30 04:51:46 +000066 log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s",
Greg Claytonb9556ac2012-01-30 07:41:31 +000067 lldb_object_sp.get(), lldb_object_sp.get(), sstr.GetData());
Caroline Tice750cd172010-10-26 23:49:36 +000068
Caroline Ticeceb6b132010-10-26 03:11:13 +000069 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +000070}
71
Greg Claytonefabb122010-11-05 23:17:00 +000072SBFrame::SBFrame(const SBFrame &rhs) :
Greg Clayton7fdf9ef2012-04-05 16:12:35 +000073 m_opaque_sp (new ExecutionContextRef (*rhs.m_opaque_sp))
Greg Claytonefabb122010-11-05 23:17:00 +000074{
75}
76
77const SBFrame &
78SBFrame::operator = (const SBFrame &rhs)
79{
80 if (this != &rhs)
Greg Clayton7fdf9ef2012-04-05 16:12:35 +000081 *m_opaque_sp = *rhs.m_opaque_sp;
Greg Claytonefabb122010-11-05 23:17:00 +000082 return *this;
83}
84
Chris Lattner30fdc8d2010-06-08 16:52:24 +000085SBFrame::~SBFrame()
86{
87}
88
Jason Molendab57e4a12013-11-04 09:33:30 +000089StackFrameSP
Greg Claytonb9556ac2012-01-30 07:41:31 +000090SBFrame::GetFrameSP() const
Chris Lattner30fdc8d2010-06-08 16:52:24 +000091{
Greg Claytonaf2589e2012-04-12 20:58:26 +000092 if (m_opaque_sp)
93 return m_opaque_sp->GetFrameSP();
Jason Molendab57e4a12013-11-04 09:33:30 +000094 return StackFrameSP();
Chris Lattner30fdc8d2010-06-08 16:52:24 +000095}
96
Greg Claytonb9556ac2012-01-30 07:41:31 +000097void
Jason Molendab57e4a12013-11-04 09:33:30 +000098SBFrame::SetFrameSP (const StackFrameSP &lldb_object_sp)
Greg Claytonb9556ac2012-01-30 07:41:31 +000099{
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000100 return m_opaque_sp->SetFrameSP(lldb_object_sp);
Greg Claytonb9556ac2012-01-30 07:41:31 +0000101}
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000102
103bool
104SBFrame::IsValid() const
105{
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000106 return GetFrameSP().get() != NULL;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000107}
108
109SBSymbolContext
110SBFrame::GetSymbolContext (uint32_t resolve_scope) const
111{
Greg Clayton5160ce52013-03-27 23:08:40 +0000112 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000113 SBSymbolContext sb_sym_ctx;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000114 Mutex::Locker api_locker;
115 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
116
Jason Molendab57e4a12013-11-04 09:33:30 +0000117 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000118 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000119 Process *process = exe_ctx.GetProcessPtr();
120 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000121 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000122 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000123 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000124 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000125 frame = exe_ctx.GetFramePtr();
126 if (frame)
127 {
128 sb_sym_ctx.SetSymbolContext(&frame->GetSymbolContext (resolve_scope));
129 }
130 else
131 {
132 if (log)
133 log->Printf ("SBFrame::GetVariables () => error: could not reconstruct frame object for this SBFrame.");
134 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000135 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000136 else
137 {
138 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000139 log->Printf ("SBFrame::GetSymbolContext () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000140 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000141 }
Caroline Ticeceb6b132010-10-26 03:11:13 +0000142
143 if (log)
Greg Clayton48381312010-10-30 04:51:46 +0000144 log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)",
Greg Claytond9e416c2012-02-18 05:35:26 +0000145 frame, resolve_scope, sb_sym_ctx.get());
Caroline Ticeceb6b132010-10-26 03:11:13 +0000146
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000147 return sb_sym_ctx;
148}
149
150SBModule
151SBFrame::GetModule () const
152{
Greg Clayton5160ce52013-03-27 23:08:40 +0000153 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton72eff182010-12-14 04:58:53 +0000154 SBModule sb_module;
Greg Claytonacdbe812012-01-30 09:04:36 +0000155 ModuleSP module_sp;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000156 Mutex::Locker api_locker;
157 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
158
Jason Molendab57e4a12013-11-04 09:33:30 +0000159 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000160 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000161 Process *process = exe_ctx.GetProcessPtr();
162 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000163 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000164 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000165 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000166 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000167 frame = exe_ctx.GetFramePtr();
168 if (frame)
169 {
170 module_sp = frame->GetSymbolContext (eSymbolContextModule).module_sp;
171 sb_module.SetSP (module_sp);
172 }
173 else
174 {
175 if (log)
176 log->Printf ("SBFrame::GetModule () => error: could not reconstruct frame object for this SBFrame.");
177 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000178 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000179 else
180 {
181 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000182 log->Printf ("SBFrame::GetModule () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000183 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000184 }
Greg Clayton72eff182010-12-14 04:58:53 +0000185
Greg Clayton48381312010-10-30 04:51:46 +0000186 if (log)
187 log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)",
Greg Claytond9e416c2012-02-18 05:35:26 +0000188 frame, module_sp.get());
Greg Clayton48381312010-10-30 04:51:46 +0000189
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000190 return sb_module;
191}
192
193SBCompileUnit
194SBFrame::GetCompileUnit () const
195{
Greg Clayton5160ce52013-03-27 23:08:40 +0000196 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton72eff182010-12-14 04:58:53 +0000197 SBCompileUnit sb_comp_unit;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000198 Mutex::Locker api_locker;
199 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
200
Jason Molendab57e4a12013-11-04 09:33:30 +0000201 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000202 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000203 Process *process = exe_ctx.GetProcessPtr();
204 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000205 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000206 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000207 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000208 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000209 frame = exe_ctx.GetFramePtr();
210 if (frame)
211 {
212 sb_comp_unit.reset (frame->GetSymbolContext (eSymbolContextCompUnit).comp_unit);
213 }
214 else
215 {
216 if (log)
217 log->Printf ("SBFrame::GetCompileUnit () => error: could not reconstruct frame object for this SBFrame.");
218 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000219 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000220 else
221 {
222 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000223 log->Printf ("SBFrame::GetCompileUnit () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000224 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000225 }
Caroline Ticeceb6b132010-10-26 03:11:13 +0000226 if (log)
Greg Claytonc9858e42012-04-06 02:17:47 +0000227 log->Printf ("SBFrame(%p)::GetCompileUnit () => SBCompileUnit(%p)",
Greg Claytond9e416c2012-02-18 05:35:26 +0000228 frame, sb_comp_unit.get());
Caroline Ticeceb6b132010-10-26 03:11:13 +0000229
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000230 return sb_comp_unit;
231}
232
233SBFunction
234SBFrame::GetFunction () const
235{
Greg Clayton5160ce52013-03-27 23:08:40 +0000236 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton72eff182010-12-14 04:58:53 +0000237 SBFunction sb_function;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000238 Mutex::Locker api_locker;
239 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
240
Jason Molendab57e4a12013-11-04 09:33:30 +0000241 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000242 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000243 Process *process = exe_ctx.GetProcessPtr();
244 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000245 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000246 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000247 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000248 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000249 frame = exe_ctx.GetFramePtr();
250 if (frame)
251 {
252 sb_function.reset(frame->GetSymbolContext (eSymbolContextFunction).function);
253 }
254 else
255 {
256 if (log)
257 log->Printf ("SBFrame::GetFunction () => error: could not reconstruct frame object for this SBFrame.");
258 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000259 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000260 else
261 {
262 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000263 log->Printf ("SBFrame::GetFunction () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000264 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000265 }
Greg Clayton48381312010-10-30 04:51:46 +0000266 if (log)
267 log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)",
Greg Claytond9e416c2012-02-18 05:35:26 +0000268 frame, sb_function.get());
Greg Clayton48381312010-10-30 04:51:46 +0000269
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000270 return sb_function;
271}
272
Greg Clayton3b065572010-10-04 18:37:52 +0000273SBSymbol
274SBFrame::GetSymbol () const
275{
Greg Clayton5160ce52013-03-27 23:08:40 +0000276 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton72eff182010-12-14 04:58:53 +0000277 SBSymbol sb_symbol;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000278 Mutex::Locker api_locker;
279 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
280
Jason Molendab57e4a12013-11-04 09:33:30 +0000281 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000282 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000283 Process *process = exe_ctx.GetProcessPtr();
284 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000285 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000286 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000287 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000288 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000289 frame = exe_ctx.GetFramePtr();
290 if (frame)
291 {
292 sb_symbol.reset(frame->GetSymbolContext (eSymbolContextSymbol).symbol);
293 }
294 else
295 {
296 if (log)
297 log->Printf ("SBFrame::GetSymbol () => error: could not reconstruct frame object for this SBFrame.");
298 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000299 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000300 else
301 {
302 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000303 log->Printf ("SBFrame::GetSymbol () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000304 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000305 }
Greg Clayton48381312010-10-30 04:51:46 +0000306 if (log)
307 log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)",
Greg Claytond9e416c2012-02-18 05:35:26 +0000308 frame, sb_symbol.get());
Greg Clayton3b065572010-10-04 18:37:52 +0000309 return sb_symbol;
310}
311
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000312SBBlock
313SBFrame::GetBlock () const
314{
Greg Clayton5160ce52013-03-27 23:08:40 +0000315 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton72eff182010-12-14 04:58:53 +0000316 SBBlock sb_block;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000317 Mutex::Locker api_locker;
318 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
319
Jason Molendab57e4a12013-11-04 09:33:30 +0000320 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000321 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000322 Process *process = exe_ctx.GetProcessPtr();
323 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000324 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000325 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000326 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000327 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000328 frame = exe_ctx.GetFramePtr();
329 if (frame)
330 {
331 sb_block.SetPtr (frame->GetSymbolContext (eSymbolContextBlock).block);
332 }
333 else
334 {
335 if (log)
336 log->Printf ("SBFrame::GetBlock () => error: could not reconstruct frame object for this SBFrame.");
337 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000338 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000339 else
340 {
341 if (log)
342 log->Printf ("SBFrame(%p)::GetBlock () => error: process is running", frame);
343 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000344 }
Greg Clayton48381312010-10-30 04:51:46 +0000345 if (log)
346 log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)",
Greg Claytond9e416c2012-02-18 05:35:26 +0000347 frame, sb_block.GetPtr());
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000348 return sb_block;
349}
350
Greg Clayton95897c62010-09-07 04:20:48 +0000351SBBlock
352SBFrame::GetFrameBlock () const
353{
Greg Clayton72eff182010-12-14 04:58:53 +0000354 SBBlock sb_block;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000355 Mutex::Locker api_locker;
356 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
357
Jason Molendab57e4a12013-11-04 09:33:30 +0000358 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000359 Target *target = exe_ctx.GetTargetPtr();
Greg Clayton5160ce52013-03-27 23:08:40 +0000360 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Jim Ingham7730b9a2012-11-29 00:26:19 +0000361 Process *process = exe_ctx.GetProcessPtr();
362 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000363 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000364 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000365 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000366 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000367 frame = exe_ctx.GetFramePtr();
368 if (frame)
369 {
370 sb_block.SetPtr(frame->GetFrameBlock ());
371 }
372 else
373 {
374 if (log)
375 log->Printf ("SBFrame::GetFrameBlock () => error: could not reconstruct frame object for this SBFrame.");
376 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000377 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000378 else
379 {
380 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000381 log->Printf ("SBFrame::GetFrameBlock () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000382 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000383 }
Greg Clayton48381312010-10-30 04:51:46 +0000384 if (log)
385 log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)",
Greg Claytond9e416c2012-02-18 05:35:26 +0000386 frame, sb_block.GetPtr());
Greg Clayton95897c62010-09-07 04:20:48 +0000387 return sb_block;
388}
389
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000390SBLineEntry
391SBFrame::GetLineEntry () const
392{
Greg Clayton5160ce52013-03-27 23:08:40 +0000393 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton72eff182010-12-14 04:58:53 +0000394 SBLineEntry sb_line_entry;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000395 Mutex::Locker api_locker;
396 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
397
Jason Molendab57e4a12013-11-04 09:33:30 +0000398 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000399 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000400 Process *process = exe_ctx.GetProcessPtr();
401 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000402 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000403 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000404 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000405 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000406 frame = exe_ctx.GetFramePtr();
407 if (frame)
408 {
409 sb_line_entry.SetLineEntry (frame->GetSymbolContext (eSymbolContextLineEntry).line_entry);
410 }
411 else
412 {
413 if (log)
414 log->Printf ("SBFrame::GetLineEntry () => error: could not reconstruct frame object for this SBFrame.");
415 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000416 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000417 else
418 {
419 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000420 log->Printf ("SBFrame::GetLineEntry () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000421 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000422 }
Greg Clayton48381312010-10-30 04:51:46 +0000423 if (log)
424 log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)",
Greg Claytond9e416c2012-02-18 05:35:26 +0000425 frame, sb_line_entry.get());
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000426 return sb_line_entry;
427}
428
429uint32_t
430SBFrame::GetFrameID () const
431{
Greg Claytonb9556ac2012-01-30 07:41:31 +0000432 uint32_t frame_idx = UINT32_MAX;
433
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000434 ExecutionContext exe_ctx(m_opaque_sp.get());
Jason Molendab57e4a12013-11-04 09:33:30 +0000435 StackFrame *frame = exe_ctx.GetFramePtr();
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000436 if (frame)
Greg Claytond9e416c2012-02-18 05:35:26 +0000437 frame_idx = frame->GetFrameIndex ();
Greg Clayton48381312010-10-30 04:51:46 +0000438
Greg Clayton5160ce52013-03-27 23:08:40 +0000439 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton48381312010-10-30 04:51:46 +0000440 if (log)
441 log->Printf ("SBFrame(%p)::GetFrameID () => %u",
Greg Claytond9e416c2012-02-18 05:35:26 +0000442 frame, frame_idx);
Greg Clayton48381312010-10-30 04:51:46 +0000443 return frame_idx;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000444}
445
Greg Clayton69b582f2010-12-14 18:39:31 +0000446addr_t
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000447SBFrame::GetPC () const
448{
Greg Clayton5160ce52013-03-27 23:08:40 +0000449 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton69b582f2010-12-14 18:39:31 +0000450 addr_t addr = LLDB_INVALID_ADDRESS;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000451 Mutex::Locker api_locker;
452 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
453
Jason Molendab57e4a12013-11-04 09:33:30 +0000454 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000455 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000456 Process *process = exe_ctx.GetProcessPtr();
457 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000458 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000459 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000460 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000461 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000462 frame = exe_ctx.GetFramePtr();
463 if (frame)
464 {
465 addr = frame->GetFrameCodeAddress().GetOpcodeLoadAddress (target);
466 }
467 else
468 {
469 if (log)
470 log->Printf ("SBFrame::GetPC () => error: could not reconstruct frame object for this SBFrame.");
471 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000472 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000473 else
474 {
475 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000476 log->Printf ("SBFrame::GetPC () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000477 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000478 }
Caroline Ticeceb6b132010-10-26 03:11:13 +0000479
480 if (log)
Daniel Malead01b2952012-11-29 21:49:15 +0000481 log->Printf ("SBFrame(%p)::GetPC () => 0x%" PRIx64, frame, addr);
Caroline Ticeceb6b132010-10-26 03:11:13 +0000482
483 return addr;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000484}
485
486bool
Greg Clayton69b582f2010-12-14 18:39:31 +0000487SBFrame::SetPC (addr_t new_pc)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000488{
Greg Clayton5160ce52013-03-27 23:08:40 +0000489 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Caroline Ticeceb6b132010-10-26 03:11:13 +0000490 bool ret_val = false;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000491 Mutex::Locker api_locker;
492 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
493
Jason Molendab57e4a12013-11-04 09:33:30 +0000494 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000495 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000496 Process *process = exe_ctx.GetProcessPtr();
497 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000498 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000499 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000500 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000501 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000502 frame = exe_ctx.GetFramePtr();
503 if (frame)
504 {
505 ret_val = frame->GetRegisterContext()->SetPC (new_pc);
506 }
507 else
508 {
509 if (log)
510 log->Printf ("SBFrame::SetPC () => error: could not reconstruct frame object for this SBFrame.");
511 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000512 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000513 else
514 {
515 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000516 log->Printf ("SBFrame::SetPC () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000517 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000518 }
Caroline Ticeceb6b132010-10-26 03:11:13 +0000519
520 if (log)
Daniel Malead01b2952012-11-29 21:49:15 +0000521 log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%" PRIx64 ") => %i",
Greg Claytond9e416c2012-02-18 05:35:26 +0000522 frame, new_pc, ret_val);
Caroline Ticeceb6b132010-10-26 03:11:13 +0000523
524 return ret_val;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000525}
526
Greg Clayton69b582f2010-12-14 18:39:31 +0000527addr_t
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000528SBFrame::GetSP () const
529{
Greg Clayton5160ce52013-03-27 23:08:40 +0000530 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton48381312010-10-30 04:51:46 +0000531 addr_t addr = LLDB_INVALID_ADDRESS;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000532 Mutex::Locker api_locker;
533 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
534
Jason Molendab57e4a12013-11-04 09:33:30 +0000535 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000536 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000537 Process *process = exe_ctx.GetProcessPtr();
538 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000539 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000540 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000541 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000542 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000543 frame = exe_ctx.GetFramePtr();
544 if (frame)
545 {
546 addr = frame->GetRegisterContext()->GetSP();
547 }
548 else
549 {
550 if (log)
551 log->Printf ("SBFrame::GetSP () => error: could not reconstruct frame object for this SBFrame.");
552 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000553 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000554 else
555 {
556 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000557 log->Printf ("SBFrame::GetSP () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000558 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000559 }
Greg Clayton48381312010-10-30 04:51:46 +0000560 if (log)
Daniel Malead01b2952012-11-29 21:49:15 +0000561 log->Printf ("SBFrame(%p)::GetSP () => 0x%" PRIx64, frame, addr);
Greg Clayton48381312010-10-30 04:51:46 +0000562
563 return addr;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000564}
565
566
Greg Clayton69b582f2010-12-14 18:39:31 +0000567addr_t
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000568SBFrame::GetFP () const
569{
Greg Clayton5160ce52013-03-27 23:08:40 +0000570 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton69b582f2010-12-14 18:39:31 +0000571 addr_t addr = LLDB_INVALID_ADDRESS;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000572 Mutex::Locker api_locker;
573 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
574
Jason Molendab57e4a12013-11-04 09:33:30 +0000575 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000576 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000577 Process *process = exe_ctx.GetProcessPtr();
578 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000579 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000580 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000581 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000582 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000583 frame = exe_ctx.GetFramePtr();
584 if (frame)
585 {
586 addr = frame->GetRegisterContext()->GetFP();
587 }
588 else
589 {
590 if (log)
591 log->Printf ("SBFrame::GetFP () => error: could not reconstruct frame object for this SBFrame.");
592 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000593 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000594 else
595 {
596 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000597 log->Printf ("SBFrame::GetFP () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000598 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000599 }
Caroline Ticeceb6b132010-10-26 03:11:13 +0000600
601 if (log)
Daniel Malead01b2952012-11-29 21:49:15 +0000602 log->Printf ("SBFrame(%p)::GetFP () => 0x%" PRIx64, frame, addr);
Caroline Ticeceb6b132010-10-26 03:11:13 +0000603 return addr;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000604}
605
606
607SBAddress
608SBFrame::GetPCAddress () const
609{
Greg Clayton5160ce52013-03-27 23:08:40 +0000610 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000611 SBAddress sb_addr;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000612 Mutex::Locker api_locker;
613 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
614
Jason Molendab57e4a12013-11-04 09:33:30 +0000615 StackFrame *frame = exe_ctx.GetFramePtr();
Greg Claytond9e416c2012-02-18 05:35:26 +0000616 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000617 Process *process = exe_ctx.GetProcessPtr();
618 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +0000619 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000620 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000621 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000622 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000623 frame = exe_ctx.GetFramePtr();
624 if (frame)
625 {
626 sb_addr.SetAddress (&frame->GetFrameCodeAddress());
627 }
628 else
629 {
630 if (log)
631 log->Printf ("SBFrame::GetPCAddress () => error: could not reconstruct frame object for this SBFrame.");
632 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000633 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000634 else
635 {
636 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000637 log->Printf ("SBFrame::GetPCAddress () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000638 }
Greg Claytonaf67cec2010-12-20 20:49:23 +0000639 }
Greg Clayton48381312010-10-30 04:51:46 +0000640 if (log)
Greg Claytond9e416c2012-02-18 05:35:26 +0000641 log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", frame, sb_addr.get());
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000642 return sb_addr;
643}
644
645void
646SBFrame::Clear()
647{
Greg Claytonaf2589e2012-04-12 20:58:26 +0000648 m_opaque_sp->Clear();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000649}
650
Greg Clayton7edbdfc2012-02-03 07:02:37 +0000651lldb::SBValue
652SBFrame::GetValueForVariablePath (const char *var_path)
653{
654 SBValue sb_value;
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000655 ExecutionContext exe_ctx(m_opaque_sp.get());
Jason Molendab57e4a12013-11-04 09:33:30 +0000656 StackFrame *frame = exe_ctx.GetFramePtr();
Greg Claytond9e416c2012-02-18 05:35:26 +0000657 Target *target = exe_ctx.GetTargetPtr();
658 if (frame && target)
Greg Clayton7edbdfc2012-02-03 07:02:37 +0000659 {
Greg Claytonc9858e42012-04-06 02:17:47 +0000660 lldb::DynamicValueType use_dynamic = frame->CalculateTarget()->GetPreferDynamicValue();
661 sb_value = GetValueForVariablePath (var_path, use_dynamic);
Greg Clayton7edbdfc2012-02-03 07:02:37 +0000662 }
663 return sb_value;
664}
665
666lldb::SBValue
667SBFrame::GetValueForVariablePath (const char *var_path, DynamicValueType use_dynamic)
668{
669 SBValue sb_value;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000670 Mutex::Locker api_locker;
Greg Clayton5160ce52013-03-27 23:08:40 +0000671 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Jim Ingham7730b9a2012-11-29 00:26:19 +0000672 if (var_path == NULL || var_path[0] == '\0')
673 {
674 if (log)
675 log->Printf ("SBFrame::GetValueForVariablePath called with empty variable path.");
676 return sb_value;
677 }
678
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000679 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
680
Jason Molendab57e4a12013-11-04 09:33:30 +0000681 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000682 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000683 Process *process = exe_ctx.GetProcessPtr();
684 if (target && process)
Greg Clayton7edbdfc2012-02-03 07:02:37 +0000685 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000686 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000687 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000688 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000689 frame = exe_ctx.GetFramePtr();
690 if (frame)
691 {
692 VariableSP var_sp;
693 Error error;
694 ValueObjectSP value_sp (frame->GetValueForVariableExpressionPath (var_path,
695 eNoDynamicValues,
Jason Molendab57e4a12013-11-04 09:33:30 +0000696 StackFrame::eExpressionPathOptionCheckPtrVsMember | StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,
Jim Ingham7730b9a2012-11-29 00:26:19 +0000697 var_sp,
698 error));
699 sb_value.SetSP(value_sp, use_dynamic);
700 }
701 else
702 {
703 if (log)
704 log->Printf ("SBFrame::GetValueForVariablePath () => error: could not reconstruct frame object for this SBFrame.");
705 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000706 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000707 else
708 {
Greg Claytonc9858e42012-04-06 02:17:47 +0000709 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000710 log->Printf ("SBFrame::GetValueForVariablePath () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000711 }
Greg Clayton7edbdfc2012-02-03 07:02:37 +0000712 }
713 return sb_value;
714}
715
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000716SBValue
Greg Clayton69b582f2010-12-14 18:39:31 +0000717SBFrame::FindVariable (const char *name)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000718{
Greg Clayton316d4982011-06-18 20:06:08 +0000719 SBValue value;
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000720 ExecutionContext exe_ctx(m_opaque_sp.get());
Jason Molendab57e4a12013-11-04 09:33:30 +0000721 StackFrame *frame = exe_ctx.GetFramePtr();
Greg Claytond9e416c2012-02-18 05:35:26 +0000722 Target *target = exe_ctx.GetTargetPtr();
723 if (frame && target)
Greg Clayton316d4982011-06-18 20:06:08 +0000724 {
Greg Claytond9e416c2012-02-18 05:35:26 +0000725 lldb::DynamicValueType use_dynamic = frame->CalculateTarget()->GetPreferDynamicValue();
Greg Clayton316d4982011-06-18 20:06:08 +0000726 value = FindVariable (name, use_dynamic);
727 }
728 return value;
Jim Ingham78a685a2011-04-16 00:01:13 +0000729}
Greg Clayton7edbdfc2012-02-03 07:02:37 +0000730
Jim Ingham78a685a2011-04-16 00:01:13 +0000731
732SBValue
Jim Ingham2837b762011-05-04 03:43:18 +0000733SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
Jim Ingham78a685a2011-04-16 00:01:13 +0000734{
Greg Clayton5160ce52013-03-27 23:08:40 +0000735 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton69b582f2010-12-14 18:39:31 +0000736 VariableSP var_sp;
Jim Ingham58b59f92011-04-22 23:53:53 +0000737 SBValue sb_value;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000738
739 if (name == NULL || name[0] == '\0')
740 {
741 if (log)
742 log->Printf ("SBFrame::FindVariable called with empty name");
743 return sb_value;
744 }
745
Greg Clayton81e871e2012-02-04 02:27:34 +0000746 ValueObjectSP value_sp;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000747 Mutex::Locker api_locker;
748 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
749
Jason Molendab57e4a12013-11-04 09:33:30 +0000750 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000751 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000752 Process *process = exe_ctx.GetProcessPtr();
753 if (target && process)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000754 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000755 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000756 if (stop_locker.TryLock(&process->GetRunLock()))
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000757 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000758 frame = exe_ctx.GetFramePtr();
759 if (frame)
Greg Clayton72eff182010-12-14 04:58:53 +0000760 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000761 VariableList variable_list;
762 SymbolContext sc (frame->GetSymbolContext (eSymbolContextBlock));
763
764 if (sc.block)
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000765 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000766 const bool can_create = true;
767 const bool get_parent_variables = true;
768 const bool stop_if_block_is_inlined_function = true;
769
770 if (sc.block->AppendVariables (can_create,
771 get_parent_variables,
772 stop_if_block_is_inlined_function,
773 &variable_list))
774 {
775 var_sp = variable_list.FindVariable (ConstString(name));
776 }
777 }
778
779 if (var_sp)
780 {
781 value_sp = frame->GetValueObjectForFrameVariable(var_sp, eNoDynamicValues);
782 sb_value.SetSP(value_sp, use_dynamic);
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000783 }
784 }
Jim Ingham7730b9a2012-11-29 00:26:19 +0000785 else
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000786 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000787 if (log)
788 log->Printf ("SBFrame::FindVariable () => error: could not reconstruct frame object for this SBFrame.");
Greg Clayton72eff182010-12-14 04:58:53 +0000789 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000790 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000791 else
792 {
793 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000794 log->Printf ("SBFrame::FindVariable () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000795 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000796 }
Caroline Ticedde9cff2010-09-20 05:20:02 +0000797
Greg Clayton48381312010-10-30 04:51:46 +0000798 if (log)
Greg Clayton69b582f2010-12-14 18:39:31 +0000799 log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
Greg Claytond9e416c2012-02-18 05:35:26 +0000800 frame, name, value_sp.get());
Greg Clayton48381312010-10-30 04:51:46 +0000801
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000802 return sb_value;
803}
804
805SBValue
Greg Clayton69b582f2010-12-14 18:39:31 +0000806SBFrame::FindValue (const char *name, ValueType value_type)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000807{
Greg Clayton316d4982011-06-18 20:06:08 +0000808 SBValue value;
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000809 ExecutionContext exe_ctx(m_opaque_sp.get());
Jason Molendab57e4a12013-11-04 09:33:30 +0000810 StackFrame *frame = exe_ctx.GetFramePtr();
Greg Claytond9e416c2012-02-18 05:35:26 +0000811 Target *target = exe_ctx.GetTargetPtr();
812 if (frame && target)
Greg Clayton316d4982011-06-18 20:06:08 +0000813 {
Greg Claytond9e416c2012-02-18 05:35:26 +0000814 lldb::DynamicValueType use_dynamic = frame->CalculateTarget()->GetPreferDynamicValue();
Greg Clayton316d4982011-06-18 20:06:08 +0000815 value = FindValue (name, value_type, use_dynamic);
816 }
817 return value;
Jim Ingham78a685a2011-04-16 00:01:13 +0000818}
819
820SBValue
Jim Ingham2837b762011-05-04 03:43:18 +0000821SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic)
Jim Ingham78a685a2011-04-16 00:01:13 +0000822{
Greg Clayton5160ce52013-03-27 23:08:40 +0000823 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton69b582f2010-12-14 18:39:31 +0000824 SBValue sb_value;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000825
826 if (name == NULL || name[0] == '\0')
827 {
828 if (log)
829 log->Printf ("SBFrame::FindValue called with empty name.");
830 return sb_value;
831 }
832
Greg Clayton81e871e2012-02-04 02:27:34 +0000833 ValueObjectSP value_sp;
Jim Ingham4fc6cb92012-08-22 21:34:33 +0000834 Mutex::Locker api_locker;
835 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
836
Jason Molendab57e4a12013-11-04 09:33:30 +0000837 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +0000838 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +0000839 Process *process = exe_ctx.GetProcessPtr();
840 if (target && process)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000841 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000842 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000843 if (stop_locker.TryLock(&process->GetRunLock()))
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000844 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000845 frame = exe_ctx.GetFramePtr();
846 if (frame)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000847 {
Enrico Granata8a2a0df2014-02-19 19:35:13 +0000848 VariableList variable_list;
849
Jim Ingham7730b9a2012-11-29 00:26:19 +0000850 switch (value_type)
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000851 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000852 case eValueTypeVariableGlobal: // global variable
853 case eValueTypeVariableStatic: // static variable
854 case eValueTypeVariableArgument: // function argument variables
855 case eValueTypeVariableLocal: // function local variables
856 {
Enrico Granata8a2a0df2014-02-19 19:35:13 +0000857
Jim Ingham7730b9a2012-11-29 00:26:19 +0000858 SymbolContext sc (frame->GetSymbolContext (eSymbolContextBlock));
Greg Clayton69b582f2010-12-14 18:39:31 +0000859
Jim Ingham7730b9a2012-11-29 00:26:19 +0000860 const bool can_create = true;
861 const bool get_parent_variables = true;
862 const bool stop_if_block_is_inlined_function = true;
Greg Clayton69b582f2010-12-14 18:39:31 +0000863
Jim Ingham7730b9a2012-11-29 00:26:19 +0000864 if (sc.block && sc.block->AppendVariables (can_create,
865 get_parent_variables,
866 stop_if_block_is_inlined_function,
Enrico Granata08a04322014-02-18 23:48:11 +0000867 &variable_list))
Jim Ingham7730b9a2012-11-29 00:26:19 +0000868 {
Enrico Granata8a2a0df2014-02-19 19:35:13 +0000869 if (value_type == eValueTypeVariableGlobal)
870 {
871 const bool get_file_globals = true;
872 VariableList* frame_vars = frame->GetVariableList(get_file_globals);
873 if (frame_vars)
874 frame_vars->AppendVariablesIfUnique(variable_list);
875 }
Jim Ingham7730b9a2012-11-29 00:26:19 +0000876 ConstString const_name(name);
Enrico Granata08a04322014-02-18 23:48:11 +0000877 VariableSP variable_sp(variable_list.FindVariable(const_name,value_type));
878 if (variable_sp)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000879 {
Enrico Granata08a04322014-02-18 23:48:11 +0000880 value_sp = frame->GetValueObjectForFrameVariable (variable_sp, eNoDynamicValues);
881 sb_value.SetSP (value_sp, use_dynamic);
882 break;
Jim Ingham7730b9a2012-11-29 00:26:19 +0000883 }
884 }
885 }
886 break;
887
888 case eValueTypeRegister: // stack frame register value
889 {
890 RegisterContextSP reg_ctx (frame->GetRegisterContext());
891 if (reg_ctx)
892 {
893 const uint32_t num_regs = reg_ctx->GetRegisterCount();
894 for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx)
895 {
896 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex (reg_idx);
897 if (reg_info &&
898 ((reg_info->name && strcasecmp (reg_info->name, name) == 0) ||
899 (reg_info->alt_name && strcasecmp (reg_info->alt_name, name) == 0)))
900 {
901 value_sp = ValueObjectRegister::Create (frame, reg_ctx, reg_idx);
902 sb_value.SetSP (value_sp);
903 break;
904 }
905 }
906 }
907 }
908 break;
909
910 case eValueTypeRegisterSet: // A collection of stack frame register values
911 {
912 RegisterContextSP reg_ctx (frame->GetRegisterContext());
913 if (reg_ctx)
914 {
915 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
916 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx)
917 {
918 const RegisterSet *reg_set = reg_ctx->GetRegisterSet (set_idx);
919 if (reg_set &&
920 ((reg_set->name && strcasecmp (reg_set->name, name) == 0) ||
921 (reg_set->short_name && strcasecmp (reg_set->short_name, name) == 0)))
922 {
923 value_sp = ValueObjectRegisterSet::Create (frame, reg_ctx, set_idx);
924 sb_value.SetSP (value_sp);
925 break;
926 }
927 }
928 }
929 }
930 break;
931
932 case eValueTypeConstResult: // constant result variables
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000933 {
934 ConstString const_name(name);
Jim Ingham7730b9a2012-11-29 00:26:19 +0000935 ClangExpressionVariableSP expr_var_sp (target->GetPersistentVariables().GetVariable (const_name));
936 if (expr_var_sp)
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000937 {
Jim Ingham7730b9a2012-11-29 00:26:19 +0000938 value_sp = expr_var_sp->GetValueObject();
939 sb_value.SetSP (value_sp, use_dynamic);
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000940 }
941 }
Jim Ingham7730b9a2012-11-29 00:26:19 +0000942 break;
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000943
Jim Ingham7730b9a2012-11-29 00:26:19 +0000944 default:
945 break;
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000946 }
Jim Ingham7730b9a2012-11-29 00:26:19 +0000947 }
948 else
949 {
950 if (log)
951 log->Printf ("SBFrame::FindValue () => error: could not reconstruct frame object for this SBFrame.");
Greg Clayton69b582f2010-12-14 18:39:31 +0000952 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000953 }
Greg Claytonc9858e42012-04-06 02:17:47 +0000954 else
955 {
956 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +0000957 log->Printf ("SBFrame::FindValue () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +0000958 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000959 }
Caroline Ticedde9cff2010-09-20 05:20:02 +0000960
Greg Clayton48381312010-10-30 04:51:46 +0000961 if (log)
Greg Clayton69b582f2010-12-14 18:39:31 +0000962 log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)",
Greg Claytond9e416c2012-02-18 05:35:26 +0000963 frame, name, value_type, value_sp.get());
Greg Clayton48381312010-10-30 04:51:46 +0000964
965
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000966 return sb_value;
967}
968
969bool
Johnny Chen35e2ab62012-03-05 19:53:24 +0000970SBFrame::IsEqual (const SBFrame &that) const
971{
Jason Molendab57e4a12013-11-04 09:33:30 +0000972 lldb::StackFrameSP this_sp = GetFrameSP();
973 lldb::StackFrameSP that_sp = that.GetFrameSP();
Johnny Chen35e2ab62012-03-05 19:53:24 +0000974 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
975}
976
977bool
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000978SBFrame::operator == (const SBFrame &rhs) const
979{
Johnny Chen35e2ab62012-03-05 19:53:24 +0000980 return IsEqual(rhs);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000981}
982
983bool
984SBFrame::operator != (const SBFrame &rhs) const
985{
Johnny Chen35e2ab62012-03-05 19:53:24 +0000986 return !IsEqual(rhs);
Greg Clayton481cef22011-01-21 06:11:58 +0000987}
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000988
989SBThread
990SBFrame::GetThread () const
991{
Greg Clayton5160ce52013-03-27 23:08:40 +0000992 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Caroline Ticeceb6b132010-10-26 03:11:13 +0000993
Greg Clayton7fdf9ef2012-04-05 16:12:35 +0000994 ExecutionContext exe_ctx(m_opaque_sp.get());
Greg Claytond9e416c2012-02-18 05:35:26 +0000995 ThreadSP thread_sp (exe_ctx.GetThreadSP());
996 SBThread sb_thread (thread_sp);
Caroline Ticeceb6b132010-10-26 03:11:13 +0000997
998 if (log)
Caroline Tice750cd172010-10-26 23:49:36 +0000999 {
1000 SBStream sstr;
1001 sb_thread.GetDescription (sstr);
Greg Claytond9e416c2012-02-18 05:35:26 +00001002 log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s",
1003 exe_ctx.GetFramePtr(),
1004 thread_sp.get(),
1005 sstr.GetData());
Caroline Tice750cd172010-10-26 23:49:36 +00001006 }
Caroline Ticeceb6b132010-10-26 03:11:13 +00001007
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001008 return sb_thread;
1009}
1010
1011const char *
1012SBFrame::Disassemble () const
1013{
Greg Clayton5160ce52013-03-27 23:08:40 +00001014 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton48381312010-10-30 04:51:46 +00001015 const char *disassembly = NULL;
Jim Ingham4fc6cb92012-08-22 21:34:33 +00001016 Mutex::Locker api_locker;
1017 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
1018
Jason Molendab57e4a12013-11-04 09:33:30 +00001019 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +00001020 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +00001021 Process *process = exe_ctx.GetProcessPtr();
1022 if (target && process)
Greg Claytonaf67cec2010-12-20 20:49:23 +00001023 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001024 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +00001025 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001026 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001027 frame = exe_ctx.GetFramePtr();
1028 if (frame)
1029 {
1030 disassembly = frame->Disassemble();
1031 }
1032 else
1033 {
1034 if (log)
1035 log->Printf ("SBFrame::Disassemble () => error: could not reconstruct frame object for this SBFrame.");
1036 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001037 }
Greg Claytonc9858e42012-04-06 02:17:47 +00001038 else
1039 {
1040 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +00001041 log->Printf ("SBFrame::Disassemble () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +00001042 }
Greg Claytonaf67cec2010-12-20 20:49:23 +00001043 }
Greg Clayton48381312010-10-30 04:51:46 +00001044
1045 if (log)
Greg Claytond9e416c2012-02-18 05:35:26 +00001046 log->Printf ("SBFrame(%p)::Disassemble () => %s", frame, disassembly);
Greg Clayton48381312010-10-30 04:51:46 +00001047
1048 return disassembly;
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001049}
1050
1051
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001052SBValueList
1053SBFrame::GetVariables (bool arguments,
1054 bool locals,
1055 bool statics,
1056 bool in_scope_only)
1057{
Greg Clayton316d4982011-06-18 20:06:08 +00001058 SBValueList value_list;
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001059 ExecutionContext exe_ctx(m_opaque_sp.get());
Jason Molendab57e4a12013-11-04 09:33:30 +00001060 StackFrame *frame = exe_ctx.GetFramePtr();
Greg Claytond9e416c2012-02-18 05:35:26 +00001061 Target *target = exe_ctx.GetTargetPtr();
1062 if (frame && target)
Greg Clayton316d4982011-06-18 20:06:08 +00001063 {
Greg Claytond9e416c2012-02-18 05:35:26 +00001064 lldb::DynamicValueType use_dynamic = frame->CalculateTarget()->GetPreferDynamicValue();
Greg Clayton316d4982011-06-18 20:06:08 +00001065 value_list = GetVariables (arguments, locals, statics, in_scope_only, use_dynamic);
1066 }
1067 return value_list;
Jim Ingham78a685a2011-04-16 00:01:13 +00001068}
1069
1070SBValueList
1071SBFrame::GetVariables (bool arguments,
1072 bool locals,
1073 bool statics,
1074 bool in_scope_only,
Jim Ingham2837b762011-05-04 03:43:18 +00001075 lldb::DynamicValueType use_dynamic)
Jim Ingham78a685a2011-04-16 00:01:13 +00001076{
Greg Clayton5160ce52013-03-27 23:08:40 +00001077 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Caroline Ticeceb6b132010-10-26 03:11:13 +00001078
Greg Claytonb9556ac2012-01-30 07:41:31 +00001079 SBValueList value_list;
Jim Ingham4fc6cb92012-08-22 21:34:33 +00001080 Mutex::Locker api_locker;
1081 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
1082
Jason Molendab57e4a12013-11-04 09:33:30 +00001083 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +00001084 Target *target = exe_ctx.GetTargetPtr();
Greg Claytonb9556ac2012-01-30 07:41:31 +00001085
Caroline Ticeceb6b132010-10-26 03:11:13 +00001086 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +00001087 log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)",
Greg Clayton48381312010-10-30 04:51:46 +00001088 arguments,
1089 locals,
1090 statics,
1091 in_scope_only);
Greg Claytonb9556ac2012-01-30 07:41:31 +00001092
Jim Ingham7730b9a2012-11-29 00:26:19 +00001093 Process *process = exe_ctx.GetProcessPtr();
1094 if (target && process)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001095 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001096 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +00001097 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001098 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001099 frame = exe_ctx.GetFramePtr();
1100 if (frame)
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001101 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001102 size_t i;
1103 VariableList *variable_list = NULL;
1104 variable_list = frame->GetVariableList(true);
1105 if (variable_list)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001106 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001107 const size_t num_variables = variable_list->GetSize();
1108 if (num_variables)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001109 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001110 for (i = 0; i < num_variables; ++i)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001111 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001112 VariableSP variable_sp (variable_list->GetVariableAtIndex(i));
1113 if (variable_sp)
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001114 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001115 bool add_variable = false;
1116 switch (variable_sp->GetScope())
1117 {
1118 case eValueTypeVariableGlobal:
1119 case eValueTypeVariableStatic:
1120 add_variable = statics;
1121 break;
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001122
Jim Ingham7730b9a2012-11-29 00:26:19 +00001123 case eValueTypeVariableArgument:
1124 add_variable = arguments;
1125 break;
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001126
Jim Ingham7730b9a2012-11-29 00:26:19 +00001127 case eValueTypeVariableLocal:
1128 add_variable = locals;
1129 break;
Greg Claytonc982c762010-07-09 20:39:50 +00001130
Jim Ingham7730b9a2012-11-29 00:26:19 +00001131 default:
1132 break;
1133 }
1134 if (add_variable)
1135 {
1136 if (in_scope_only && !variable_sp->IsInScope(frame))
1137 continue;
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001138
Jim Ingham7730b9a2012-11-29 00:26:19 +00001139 ValueObjectSP valobj_sp(frame->GetValueObjectForFrameVariable (variable_sp, eNoDynamicValues));
1140 SBValue value_sb;
1141 value_sb.SetSP(valobj_sp,use_dynamic);
1142 value_list.Append(value_sb);
1143 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001144 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001145 }
1146 }
1147 }
1148 }
Jim Ingham7730b9a2012-11-29 00:26:19 +00001149 else
1150 {
1151 if (log)
1152 log->Printf ("SBFrame::GetVariables () => error: could not reconstruct frame object for this SBFrame.");
1153 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001154 }
Greg Claytonc9858e42012-04-06 02:17:47 +00001155 else
1156 {
1157 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +00001158 log->Printf ("SBFrame::GetVariables () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +00001159 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001160 }
Caroline Ticeceb6b132010-10-26 03:11:13 +00001161
1162 if (log)
1163 {
Enrico Granata08ec0b62013-02-07 22:57:46 +00001164 log->Printf ("SBFrame(%p)::GetVariables (...) => SBValueList(%p)", frame, value_list.opaque_ptr());
Caroline Ticeceb6b132010-10-26 03:11:13 +00001165 }
1166
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001167 return value_list;
1168}
1169
Greg Clayton69b582f2010-12-14 18:39:31 +00001170SBValueList
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001171SBFrame::GetRegisters ()
1172{
Greg Clayton5160ce52013-03-27 23:08:40 +00001173 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Caroline Ticeceb6b132010-10-26 03:11:13 +00001174
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001175 SBValueList value_list;
Jim Ingham4fc6cb92012-08-22 21:34:33 +00001176 Mutex::Locker api_locker;
1177 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
1178
Jason Molendab57e4a12013-11-04 09:33:30 +00001179 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +00001180 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +00001181 Process *process = exe_ctx.GetProcessPtr();
1182 if (target && process)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001183 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001184 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +00001185 if (stop_locker.TryLock(&process->GetRunLock()))
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001186 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001187 frame = exe_ctx.GetFramePtr();
1188 if (frame)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001189 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001190 RegisterContextSP reg_ctx (frame->GetRegisterContext());
1191 if (reg_ctx)
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001192 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001193 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
1194 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx)
1195 {
1196 value_list.Append(ValueObjectRegisterSet::Create (frame, reg_ctx, set_idx));
1197 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001198 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001199 }
Jim Ingham7730b9a2012-11-29 00:26:19 +00001200 else
1201 {
1202 if (log)
1203 log->Printf ("SBFrame::GetRegisters () => error: could not reconstruct frame object for this SBFrame.");
1204 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001205 }
Greg Claytonc9858e42012-04-06 02:17:47 +00001206 else
1207 {
1208 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +00001209 log->Printf ("SBFrame::GetRegisters () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +00001210 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001211 }
Caroline Ticeceb6b132010-10-26 03:11:13 +00001212
1213 if (log)
Enrico Granata08ec0b62013-02-07 22:57:46 +00001214 log->Printf ("SBFrame(%p)::GetRegisters () => SBValueList(%p)", frame, value_list.opaque_ptr());
Caroline Ticeceb6b132010-10-26 03:11:13 +00001215
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001216 return value_list;
1217}
1218
Jason Molendaad9a53c2013-07-26 02:08:48 +00001219SBValue
1220SBFrame::FindRegister (const char *name)
1221{
1222 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
1223
1224 SBValue result;
1225 ValueObjectSP value_sp;
1226 Mutex::Locker api_locker;
1227 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
1228
Jason Molendab57e4a12013-11-04 09:33:30 +00001229 StackFrame *frame = NULL;
Jason Molendaad9a53c2013-07-26 02:08:48 +00001230 Target *target = exe_ctx.GetTargetPtr();
1231 Process *process = exe_ctx.GetProcessPtr();
1232 if (target && process)
1233 {
1234 Process::StopLocker stop_locker;
1235 if (stop_locker.TryLock(&process->GetRunLock()))
1236 {
1237 frame = exe_ctx.GetFramePtr();
1238 if (frame)
1239 {
1240 RegisterContextSP reg_ctx (frame->GetRegisterContext());
1241 if (reg_ctx)
1242 {
1243 const uint32_t num_regs = reg_ctx->GetRegisterCount();
1244 for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx)
1245 {
1246 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex (reg_idx);
1247 if (reg_info &&
1248 ((reg_info->name && strcasecmp (reg_info->name, name) == 0) ||
1249 (reg_info->alt_name && strcasecmp (reg_info->alt_name, name) == 0)))
1250 {
1251 value_sp = ValueObjectRegister::Create (frame, reg_ctx, reg_idx);
1252 result.SetSP (value_sp);
1253 break;
1254 }
1255 }
1256 }
1257 }
1258 else
1259 {
1260 if (log)
Jason Molenda5d353842013-07-26 22:52:30 +00001261 log->Printf ("SBFrame::FindRegister () => error: could not reconstruct frame object for this SBFrame.");
Jason Molendaad9a53c2013-07-26 02:08:48 +00001262 }
1263 }
1264 else
1265 {
1266 if (log)
Jason Molenda5d353842013-07-26 22:52:30 +00001267 log->Printf ("SBFrame::FindRegister () => error: process is running");
Jason Molendaad9a53c2013-07-26 02:08:48 +00001268 }
1269 }
1270
1271 if (log)
Jason Molenda5d353842013-07-26 22:52:30 +00001272 log->Printf ("SBFrame(%p)::FindRegister () => SBValue(%p)", frame, value_sp.get());
Jason Molendaad9a53c2013-07-26 02:08:48 +00001273
1274 return result;
1275}
1276
Caroline Ticedde9cff2010-09-20 05:20:02 +00001277bool
1278SBFrame::GetDescription (SBStream &description)
1279{
Greg Clayton5160ce52013-03-27 23:08:40 +00001280 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Claytonda7bc7d2011-11-13 06:57:31 +00001281 Stream &strm = description.ref();
1282
Jim Ingham4fc6cb92012-08-22 21:34:33 +00001283 Mutex::Locker api_locker;
1284 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
1285
Jason Molendab57e4a12013-11-04 09:33:30 +00001286 StackFrame *frame;
Greg Claytond9e416c2012-02-18 05:35:26 +00001287 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +00001288 Process *process = exe_ctx.GetProcessPtr();
1289 if (target && process)
Caroline Ticedde9cff2010-09-20 05:20:02 +00001290 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001291 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +00001292 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001293 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001294 frame = exe_ctx.GetFramePtr();
1295 if (frame)
1296 {
1297 frame->DumpUsingSettingsFormat (&strm);
1298 }
1299 else
1300 {
1301 if (log)
1302 log->Printf ("SBFrame::GetDescription () => error: could not reconstruct frame object for this SBFrame.");
1303 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001304 }
Greg Claytonc9858e42012-04-06 02:17:47 +00001305 else
1306 {
Greg Claytonc9858e42012-04-06 02:17:47 +00001307 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +00001308 log->Printf ("SBFrame::GetDescription () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +00001309 }
1310
Caroline Ticedde9cff2010-09-20 05:20:02 +00001311 }
1312 else
Greg Claytonda7bc7d2011-11-13 06:57:31 +00001313 strm.PutCString ("No value");
Caroline Ticedde9cff2010-09-20 05:20:02 +00001314
1315 return true;
1316}
Greg Clayton1d3afba2010-10-05 00:00:42 +00001317
Greg Clayton69b582f2010-12-14 18:39:31 +00001318SBValue
Greg Clayton1d3afba2010-10-05 00:00:42 +00001319SBFrame::EvaluateExpression (const char *expr)
1320{
Greg Clayton316d4982011-06-18 20:06:08 +00001321 SBValue result;
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001322 ExecutionContext exe_ctx(m_opaque_sp.get());
Jason Molendab57e4a12013-11-04 09:33:30 +00001323 StackFrame *frame = exe_ctx.GetFramePtr();
Greg Claytond9e416c2012-02-18 05:35:26 +00001324 Target *target = exe_ctx.GetTargetPtr();
1325 if (frame && target)
Greg Clayton316d4982011-06-18 20:06:08 +00001326 {
Jim Ingham35e1bda2012-10-16 21:41:58 +00001327 SBExpressionOptions options;
1328 lldb::DynamicValueType fetch_dynamic_value = frame->CalculateTarget()->GetPreferDynamicValue();
Greg Claytoncced1562012-10-16 22:58:25 +00001329 options.SetFetchDynamicValue (fetch_dynamic_value);
Jim Ingham35e1bda2012-10-16 21:41:58 +00001330 options.SetUnwindOnError (true);
1331 return EvaluateExpression (expr, options);
Greg Clayton316d4982011-06-18 20:06:08 +00001332 }
1333 return result;
Jim Ingham78a685a2011-04-16 00:01:13 +00001334}
1335
1336SBValue
Jim Ingham2837b762011-05-04 03:43:18 +00001337SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dynamic_value)
Jim Ingham78a685a2011-04-16 00:01:13 +00001338{
Jim Ingham35e1bda2012-10-16 21:41:58 +00001339 SBExpressionOptions options;
Greg Claytoncced1562012-10-16 22:58:25 +00001340 options.SetFetchDynamicValue (fetch_dynamic_value);
Jim Ingham35e1bda2012-10-16 21:41:58 +00001341 options.SetUnwindOnError (true);
1342 return EvaluateExpression (expr, options);
Jim Ingham7ba6e992012-05-11 23:47:32 +00001343}
1344
1345SBValue
1346SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dynamic_value, bool unwind_on_error)
1347{
Jim Ingham35e1bda2012-10-16 21:41:58 +00001348 SBExpressionOptions options;
Greg Claytoncced1562012-10-16 22:58:25 +00001349 options.SetFetchDynamicValue (fetch_dynamic_value);
Jim Ingham35e1bda2012-10-16 21:41:58 +00001350 options.SetUnwindOnError (unwind_on_error);
1351 return EvaluateExpression (expr, options);
1352}
1353
1354lldb::SBValue
1355SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &options)
1356{
Greg Clayton5160ce52013-03-27 23:08:40 +00001357 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Sean Callanana162eba2010-12-07 22:55:01 +00001358
Greg Clayton5160ce52013-03-27 23:08:40 +00001359 Log *expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
Greg Clayton48381312010-10-30 04:51:46 +00001360
Greg Clayton23f59502012-07-17 03:23:13 +00001361 ExecutionResults exe_results = eExecutionSetupError;
Greg Clayton69b582f2010-12-14 18:39:31 +00001362 SBValue expr_result;
Jim Ingham7730b9a2012-11-29 00:26:19 +00001363
1364 if (expr == NULL || expr[0] == '\0')
1365 {
1366 if (log)
1367 log->Printf ("SBFrame::EvaluateExpression called with an empty expression");
1368 return expr_result;
1369 }
1370
Greg Clayton81e871e2012-02-04 02:27:34 +00001371 ValueObjectSP expr_value_sp;
Greg Clayton48381312010-10-30 04:51:46 +00001372
Jim Ingham4fc6cb92012-08-22 21:34:33 +00001373 Mutex::Locker api_locker;
1374 ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
1375
Greg Claytonb9556ac2012-01-30 07:41:31 +00001376 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +00001377 log->Printf ("SBFrame()::EvaluateExpression (expr=\"%s\")...", expr);
Greg Claytonb9556ac2012-01-30 07:41:31 +00001378
Jason Molendab57e4a12013-11-04 09:33:30 +00001379 StackFrame *frame = NULL;
Jim Ingham7730b9a2012-11-29 00:26:19 +00001380 Target *target = exe_ctx.GetTargetPtr();
1381 Process *process = exe_ctx.GetProcessPtr();
1382
1383 if (target && process)
1384 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001385 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +00001386 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001387 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001388 frame = exe_ctx.GetFramePtr();
1389 if (frame)
1390 {
Greg Claytonfb6621e2013-12-06 21:59:52 +00001391 if (target->GetDisplayExpressionsInCrashlogs())
1392 {
1393 StreamString frame_description;
1394 frame->DumpUsingSettingsFormat (&frame_description);
1395 Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s",
1396 expr, options.GetFetchDynamicValue(), frame_description.GetString().c_str());
1397 }
1398
1399 exe_results = target->EvaluateExpression (expr,
Jim Ingham7730b9a2012-11-29 00:26:19 +00001400 frame,
1401 expr_value_sp,
1402 options.ref());
1403 expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
Greg Claytonfb6621e2013-12-06 21:59:52 +00001404
1405 if (target->GetDisplayExpressionsInCrashlogs())
1406 Host::SetCrashDescription (NULL);
Jim Ingham7730b9a2012-11-29 00:26:19 +00001407 }
1408 else
1409 {
1410 if (log)
1411 log->Printf ("SBFrame::EvaluateExpression () => error: could not reconstruct frame object for this SBFrame.");
1412 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001413 }
Greg Claytonc9858e42012-04-06 02:17:47 +00001414 else
1415 {
1416 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +00001417 log->Printf ("SBFrame::EvaluateExpression () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +00001418 }
Greg Clayton1d3afba2010-10-05 00:00:42 +00001419 }
Jason Molendacf7e2dc2012-02-21 05:33:55 +00001420
1421#ifndef LLDB_DISABLE_PYTHON
Sean Callanana162eba2010-12-07 22:55:01 +00001422 if (expr_log)
Jim Ingham78a685a2011-04-16 00:01:13 +00001423 expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **",
Greg Claytonfe42ac42011-08-03 22:57:10 +00001424 expr_result.GetValue(),
1425 expr_result.GetSummary());
Sean Callanana162eba2010-12-07 22:55:01 +00001426
Greg Clayton48381312010-10-30 04:51:46 +00001427 if (log)
Greg Claytond9e416c2012-02-18 05:35:26 +00001428 log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)",
1429 frame,
Jim Ingham78a685a2011-04-16 00:01:13 +00001430 expr,
Greg Clayton81e871e2012-02-04 02:27:34 +00001431 expr_value_sp.get(),
Johnny Chen25f3a3c2011-08-10 22:06:24 +00001432 exe_results);
Jason Molendacf7e2dc2012-02-21 05:33:55 +00001433#endif
Greg Clayton48381312010-10-30 04:51:46 +00001434
Greg Claytoncfd1ace2010-10-31 03:01:06 +00001435 return expr_result;
Greg Clayton1d3afba2010-10-05 00:00:42 +00001436}
Greg Clayton316d4982011-06-18 20:06:08 +00001437
1438bool
1439SBFrame::IsInlined()
1440{
Greg Clayton5160ce52013-03-27 23:08:40 +00001441 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001442 ExecutionContext exe_ctx(m_opaque_sp.get());
Jason Molendab57e4a12013-11-04 09:33:30 +00001443 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +00001444 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +00001445 Process *process = exe_ctx.GetProcessPtr();
1446 if (target && process)
Greg Clayton316d4982011-06-18 20:06:08 +00001447 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001448 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +00001449 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001450 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001451 frame = exe_ctx.GetFramePtr();
1452 if (frame)
1453 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001454
Jim Ingham7730b9a2012-11-29 00:26:19 +00001455 Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
1456 if (block)
1457 return block->GetContainingInlinedBlock () != NULL;
1458 }
1459 else
1460 {
1461 if (log)
1462 log->Printf ("SBFrame::IsInlined () => error: could not reconstruct frame object for this SBFrame.");
1463 }
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001464 }
Greg Claytonc9858e42012-04-06 02:17:47 +00001465 else
1466 {
Greg Claytonc9858e42012-04-06 02:17:47 +00001467 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +00001468 log->Printf ("SBFrame::IsInlined () => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +00001469 }
1470
Greg Clayton316d4982011-06-18 20:06:08 +00001471 }
1472 return false;
1473}
1474
1475const char *
1476SBFrame::GetFunctionName()
1477{
Greg Clayton5160ce52013-03-27 23:08:40 +00001478 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Greg Clayton316d4982011-06-18 20:06:08 +00001479 const char *name = NULL;
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001480 ExecutionContext exe_ctx(m_opaque_sp.get());
Jason Molendab57e4a12013-11-04 09:33:30 +00001481 StackFrame *frame = NULL;
Greg Claytond9e416c2012-02-18 05:35:26 +00001482 Target *target = exe_ctx.GetTargetPtr();
Jim Ingham7730b9a2012-11-29 00:26:19 +00001483 Process *process = exe_ctx.GetProcessPtr();
1484 if (target && process)
Greg Clayton316d4982011-06-18 20:06:08 +00001485 {
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001486 Process::StopLocker stop_locker;
Jim Ingham7730b9a2012-11-29 00:26:19 +00001487 if (stop_locker.TryLock(&process->GetRunLock()))
Greg Clayton316d4982011-06-18 20:06:08 +00001488 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001489 frame = exe_ctx.GetFramePtr();
1490 if (frame)
Greg Clayton316d4982011-06-18 20:06:08 +00001491 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001492 SymbolContext sc (frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextBlock | eSymbolContextSymbol));
1493 if (sc.block)
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001494 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001495 Block *inlined_block = sc.block->GetContainingInlinedBlock ();
1496 if (inlined_block)
1497 {
1498 const InlineFunctionInfo* inlined_info = inlined_block->GetInlinedFunctionInfo();
1499 name = inlined_info->GetName().AsCString();
1500 }
1501 }
1502
1503 if (name == NULL)
1504 {
1505 if (sc.function)
1506 name = sc.function->GetName().GetCString();
1507 }
1508
1509 if (name == NULL)
1510 {
1511 if (sc.symbol)
1512 name = sc.symbol->GetName().GetCString();
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001513 }
Greg Clayton316d4982011-06-18 20:06:08 +00001514 }
Jim Ingham7730b9a2012-11-29 00:26:19 +00001515 else
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001516 {
Jim Ingham7730b9a2012-11-29 00:26:19 +00001517 if (log)
1518 log->Printf ("SBFrame::GetFunctionName () => error: could not reconstruct frame object for this SBFrame.");
Greg Clayton7fdf9ef2012-04-05 16:12:35 +00001519 }
Greg Clayton316d4982011-06-18 20:06:08 +00001520 }
Greg Claytonc9858e42012-04-06 02:17:47 +00001521 else
1522 {
Greg Claytonc9858e42012-04-06 02:17:47 +00001523 if (log)
Jim Ingham7730b9a2012-11-29 00:26:19 +00001524 log->Printf ("SBFrame::GetFunctionName() => error: process is running");
Greg Claytonc9858e42012-04-06 02:17:47 +00001525
1526 }
Greg Clayton316d4982011-06-18 20:06:08 +00001527 }
1528 return name;
1529}
1530