blob: 1d1a68fd334e74d3bd9ab8793e86e0bbbbef2368 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- StackFrame.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
Chris Lattner30fdc8d2010-06-08 16:52:24 +000010// C Includes
11// C++ Includes
12// Other libraries and framework includes
13// Project includes
Eugene Zelenkod70a6e72016-02-18 18:52:47 +000014#include "lldb/Target/StackFrame.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000015#include "lldb/Core/Module.h"
Greg Clayton0603aa92010-10-04 01:05:56 +000016#include "lldb/Core/Debugger.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000017#include "lldb/Core/Disassembler.h"
Greg Clayton554f68d2015-02-04 22:00:53 +000018#include "lldb/Core/FormatEntity.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000019#include "lldb/Core/Value.h"
Greg Clayton288bdf92010-09-02 02:59:18 +000020#include "lldb/Core/ValueObjectVariable.h"
Greg Clayton54979cd2010-12-15 05:08:08 +000021#include "lldb/Core/ValueObjectConstResult.h"
Greg Clayton1f746072012-08-29 21:13:06 +000022#include "lldb/Symbol/CompileUnit.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000023#include "lldb/Symbol/Function.h"
Greg Clayton1f746072012-08-29 21:13:06 +000024#include "lldb/Symbol/Symbol.h"
25#include "lldb/Symbol/SymbolContextScope.h"
Enrico Granata46252392015-11-19 22:28:58 +000026#include "lldb/Symbol/Type.h"
Greg Clayton288bdf92010-09-02 02:59:18 +000027#include "lldb/Symbol/VariableList.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000028#include "lldb/Target/ExecutionContext.h"
29#include "lldb/Target/Process.h"
30#include "lldb/Target/RegisterContext.h"
31#include "lldb/Target/Target.h"
32#include "lldb/Target/Thread.h"
33
34using namespace lldb;
35using namespace lldb_private;
36
37// The first bits in the flags are reserved for the SymbolContext::Scope bits
38// so we know if we have tried to look up information in our internal symbol
39// context (m_sc) already.
Greg Clayton59e8fc1c2010-08-30 18:11:35 +000040#define RESOLVED_FRAME_CODE_ADDR (uint32_t(eSymbolContextEverything + 1))
Greg Clayton6dadd502010-09-02 21:44:10 +000041#define RESOLVED_FRAME_ID_SYMBOL_SCOPE (RESOLVED_FRAME_CODE_ADDR << 1)
Greg Clayton59e8fc1c2010-08-30 18:11:35 +000042#define GOT_FRAME_BASE (RESOLVED_FRAME_ID_SYMBOL_SCOPE << 1)
43#define RESOLVED_VARIABLES (GOT_FRAME_BASE << 1)
Sean Callanan7c0962d2010-11-01 04:38:59 +000044#define RESOLVED_GLOBAL_VARIABLES (RESOLVED_VARIABLES << 1)
Chris Lattner30fdc8d2010-06-08 16:52:24 +000045
Greg Claytond9e416c2012-02-18 05:35:26 +000046StackFrame::StackFrame (const ThreadSP &thread_sp,
47 user_id_t frame_idx,
Greg Clayton8f7180b2011-09-26 07:11:27 +000048 user_id_t unwind_frame_index,
Greg Clayton8f7180b2011-09-26 07:11:27 +000049 addr_t cfa,
Jason Molenda99618472013-11-04 11:02:52 +000050 bool cfa_is_valid,
Greg Clayton8f7180b2011-09-26 07:11:27 +000051 addr_t pc,
Jason Molenda99618472013-11-04 11:02:52 +000052 uint32_t stop_id,
53 bool stop_id_is_valid,
54 bool is_history_frame,
Greg Clayton8f7180b2011-09-26 07:11:27 +000055 const SymbolContext *sc_ptr) :
Greg Claytond9e416c2012-02-18 05:35:26 +000056 m_thread_wp (thread_sp),
Greg Clayton1b72fcb2010-08-24 00:45:41 +000057 m_frame_index (frame_idx),
Greg Clayton5ccbd292011-01-06 22:15:06 +000058 m_concrete_frame_index (unwind_frame_index),
Greg Clayton1b72fcb2010-08-24 00:45:41 +000059 m_reg_context_sp (),
Eugene Zelenkod70a6e72016-02-18 18:52:47 +000060 m_id(pc, cfa, nullptr),
Greg Claytone72dfb32012-02-24 01:59:29 +000061 m_frame_code_addr (pc),
Greg Clayton1b72fcb2010-08-24 00:45:41 +000062 m_sc (),
63 m_flags (),
64 m_frame_base (),
65 m_frame_base_error (),
Jason Molenda99618472013-11-04 11:02:52 +000066 m_cfa_is_valid (cfa_is_valid),
67 m_stop_id (stop_id),
68 m_stop_id_is_valid (stop_id_is_valid),
69 m_is_history_frame (is_history_frame),
Chris Lattner30fdc8d2010-06-08 16:52:24 +000070 m_variable_list_sp (),
Greg Clayton1a65ae12011-01-25 23:55:37 +000071 m_variable_list_value_objects (),
Jason Molenda6a354702014-10-02 01:08:16 +000072 m_disassembly (),
73 m_mutex (Mutex::eMutexTypeRecursive)
Chris Lattner30fdc8d2010-06-08 16:52:24 +000074{
Jason Molenda99618472013-11-04 11:02:52 +000075 // If we don't have a CFA value, use the frame index for our StackID so that recursive
76 // functions properly aren't confused with one another on a history stack.
Eugene Zelenkod70a6e72016-02-18 18:52:47 +000077 if (m_is_history_frame && !m_cfa_is_valid)
Jason Molenda99618472013-11-04 11:02:52 +000078 {
79 m_id.SetCFA (m_frame_index);
80 }
81
Eugene Zelenkod70a6e72016-02-18 18:52:47 +000082 if (sc_ptr != nullptr)
Greg Clayton1b72fcb2010-08-24 00:45:41 +000083 {
Chris Lattner30fdc8d2010-06-08 16:52:24 +000084 m_sc = *sc_ptr;
Greg Clayton1b72fcb2010-08-24 00:45:41 +000085 m_flags.Set(m_sc.GetResolvedMask ());
86 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +000087}
88
Greg Claytond9e416c2012-02-18 05:35:26 +000089StackFrame::StackFrame (const ThreadSP &thread_sp,
90 user_id_t frame_idx,
Greg Clayton8f7180b2011-09-26 07:11:27 +000091 user_id_t unwind_frame_index,
Greg Clayton8f7180b2011-09-26 07:11:27 +000092 const RegisterContextSP &reg_context_sp,
93 addr_t cfa,
94 addr_t pc,
95 const SymbolContext *sc_ptr) :
Greg Claytond9e416c2012-02-18 05:35:26 +000096 m_thread_wp (thread_sp),
Greg Clayton1b72fcb2010-08-24 00:45:41 +000097 m_frame_index (frame_idx),
Greg Clayton5ccbd292011-01-06 22:15:06 +000098 m_concrete_frame_index (unwind_frame_index),
Greg Clayton1b72fcb2010-08-24 00:45:41 +000099 m_reg_context_sp (reg_context_sp),
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000100 m_id(pc, cfa, nullptr),
Greg Claytone72dfb32012-02-24 01:59:29 +0000101 m_frame_code_addr (pc),
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000102 m_sc (),
103 m_flags (),
104 m_frame_base (),
105 m_frame_base_error (),
Jason Molenda99618472013-11-04 11:02:52 +0000106 m_cfa_is_valid (true),
107 m_stop_id (0),
108 m_stop_id_is_valid (false),
109 m_is_history_frame (false),
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000110 m_variable_list_sp (),
Greg Clayton1a65ae12011-01-25 23:55:37 +0000111 m_variable_list_value_objects (),
Jason Molenda6a354702014-10-02 01:08:16 +0000112 m_disassembly (),
113 m_mutex (Mutex::eMutexTypeRecursive)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000114{
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000115 if (sc_ptr != nullptr)
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000116 {
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000117 m_sc = *sc_ptr;
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000118 m_flags.Set(m_sc.GetResolvedMask ());
119 }
120
121 if (reg_context_sp && !m_sc.target_sp)
122 {
Greg Claytond9e416c2012-02-18 05:35:26 +0000123 m_sc.target_sp = reg_context_sp->CalculateTarget();
124 if (m_sc.target_sp)
125 m_flags.Set (eSymbolContextTarget);
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000126 }
127}
128
Greg Claytond9e416c2012-02-18 05:35:26 +0000129StackFrame::StackFrame (const ThreadSP &thread_sp,
130 user_id_t frame_idx,
Greg Clayton8f7180b2011-09-26 07:11:27 +0000131 user_id_t unwind_frame_index,
Greg Clayton8f7180b2011-09-26 07:11:27 +0000132 const RegisterContextSP &reg_context_sp,
133 addr_t cfa,
134 const Address& pc_addr,
135 const SymbolContext *sc_ptr) :
Greg Claytond9e416c2012-02-18 05:35:26 +0000136 m_thread_wp (thread_sp),
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000137 m_frame_index (frame_idx),
Greg Clayton5ccbd292011-01-06 22:15:06 +0000138 m_concrete_frame_index (unwind_frame_index),
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000139 m_reg_context_sp (reg_context_sp),
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000140 m_id(pc_addr.GetLoadAddress(thread_sp->CalculateTarget().get()), cfa, nullptr),
Greg Clayton12fc3e02010-08-26 22:05:43 +0000141 m_frame_code_addr (pc_addr),
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000142 m_sc (),
143 m_flags (),
144 m_frame_base (),
145 m_frame_base_error (),
Jason Molenda99618472013-11-04 11:02:52 +0000146 m_cfa_is_valid (true),
147 m_stop_id (0),
148 m_stop_id_is_valid (false),
149 m_is_history_frame (false),
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000150 m_variable_list_sp (),
Greg Clayton1a65ae12011-01-25 23:55:37 +0000151 m_variable_list_value_objects (),
Jason Molenda6a354702014-10-02 01:08:16 +0000152 m_disassembly (),
153 m_mutex (Mutex::eMutexTypeRecursive)
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000154{
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000155 if (sc_ptr != nullptr)
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000156 {
157 m_sc = *sc_ptr;
158 m_flags.Set(m_sc.GetResolvedMask ());
159 }
160
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000161 if (!m_sc.target_sp && reg_context_sp)
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000162 {
Greg Claytond9e416c2012-02-18 05:35:26 +0000163 m_sc.target_sp = reg_context_sp->CalculateTarget();
164 if (m_sc.target_sp)
165 m_flags.Set (eSymbolContextTarget);
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000166 }
167
Greg Claytone72dfb32012-02-24 01:59:29 +0000168 ModuleSP pc_module_sp (pc_addr.GetModule());
169 if (!m_sc.module_sp || m_sc.module_sp != pc_module_sp)
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000170 {
Greg Claytone72dfb32012-02-24 01:59:29 +0000171 if (pc_module_sp)
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000172 {
Greg Claytone72dfb32012-02-24 01:59:29 +0000173 m_sc.module_sp = pc_module_sp;
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000174 m_flags.Set (eSymbolContextModule);
175 }
Greg Claytonffc1d662010-09-13 04:34:30 +0000176 else
177 {
178 m_sc.module_sp.reset();
179 }
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000180 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000181}
182
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000183StackFrame::~StackFrame() = default;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000184
185StackID&
186StackFrame::GetStackID()
187{
Jason Molenda6a354702014-10-02 01:08:16 +0000188 Mutex::Locker locker(m_mutex);
Greg Clayton6dadd502010-09-02 21:44:10 +0000189 // Make sure we have resolved the StackID object's symbol context scope if
190 // we already haven't looked it up.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000191
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000192 if (m_flags.IsClear (RESOLVED_FRAME_ID_SYMBOL_SCOPE))
193 {
Greg Clayton2cad65a2010-09-03 17:10:42 +0000194 if (m_id.GetSymbolContextScope ())
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000195 {
Greg Clayton95897c62010-09-07 04:20:48 +0000196 // We already have a symbol context scope, we just don't have our
197 // flag bit set.
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000198 m_flags.Set (RESOLVED_FRAME_ID_SYMBOL_SCOPE);
199 }
200 else
201 {
Greg Clayton95897c62010-09-07 04:20:48 +0000202 // Calculate the frame block and use this for the stack ID symbol
203 // context scope if we have one.
204 SymbolContextScope *scope = GetFrameBlock ();
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000205 if (scope == nullptr)
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000206 {
Greg Clayton95897c62010-09-07 04:20:48 +0000207 // We don't have a block, so use the symbol
208 if (m_flags.IsClear (eSymbolContextSymbol))
209 GetSymbolContext (eSymbolContextSymbol);
210
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000211 // It is ok if m_sc.symbol is nullptr here
Greg Clayton95897c62010-09-07 04:20:48 +0000212 scope = m_sc.symbol;
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000213 }
Greg Clayton95897c62010-09-07 04:20:48 +0000214 // Set the symbol context scope (the accessor will set the
215 // RESOLVED_FRAME_ID_SYMBOL_SCOPE bit in m_flags).
216 SetSymbolContextScope (scope);
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000217 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000218 }
219 return m_id;
220}
221
Jim Ingham513c6bb2012-09-01 01:02:41 +0000222uint32_t
223StackFrame::GetFrameIndex () const
224{
225 ThreadSP thread_sp = GetThread();
226 if (thread_sp)
Jason Molendab57e4a12013-11-04 09:33:30 +0000227 return thread_sp->GetStackFrameList()->GetVisibleStackFrameIndex(m_frame_index);
Jim Ingham513c6bb2012-09-01 01:02:41 +0000228 else
229 return m_frame_index;
230}
231
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000232void
233StackFrame::SetSymbolContextScope (SymbolContextScope *symbol_scope)
234{
Jason Molenda6a354702014-10-02 01:08:16 +0000235 Mutex::Locker locker(m_mutex);
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000236 m_flags.Set (RESOLVED_FRAME_ID_SYMBOL_SCOPE);
237 m_id.SetSymbolContextScope (symbol_scope);
238}
239
Greg Clayton34132752011-07-06 04:07:21 +0000240const Address&
Greg Clayton9da7bd02010-08-24 21:05:24 +0000241StackFrame::GetFrameCodeAddress()
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000242{
Jason Molenda6a354702014-10-02 01:08:16 +0000243 Mutex::Locker locker(m_mutex);
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000244 if (m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR) && !m_frame_code_addr.IsSectionOffset())
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000245 {
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000246 m_flags.Set (RESOLVED_FRAME_CODE_ADDR);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000247
248 // Resolve the PC into a temporary address because if ResolveLoadAddress
249 // fails to resolve the address, it will clear the address object...
Greg Claytond9e416c2012-02-18 05:35:26 +0000250 ThreadSP thread_sp (GetThread());
251 if (thread_sp)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000252 {
Greg Claytond9e416c2012-02-18 05:35:26 +0000253 TargetSP target_sp (thread_sp->CalculateTarget());
254 if (target_sp)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000255 {
Tamas Berghammer25b9f7e2015-09-07 09:58:09 +0000256 if (m_frame_code_addr.SetOpcodeLoadAddress (m_frame_code_addr.GetOffset(), target_sp.get(), eAddressClassCode))
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000257 {
Greg Claytone72dfb32012-02-24 01:59:29 +0000258 ModuleSP module_sp (m_frame_code_addr.GetModule());
259 if (module_sp)
Greg Claytond9e416c2012-02-18 05:35:26 +0000260 {
Greg Claytone72dfb32012-02-24 01:59:29 +0000261 m_sc.module_sp = module_sp;
262 m_flags.Set(eSymbolContextModule);
Greg Claytond9e416c2012-02-18 05:35:26 +0000263 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000264 }
265 }
266 }
267 }
Greg Clayton12fc3e02010-08-26 22:05:43 +0000268 return m_frame_code_addr;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000269}
270
Jason Molenda99618472013-11-04 11:02:52 +0000271bool
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000272StackFrame::ChangePC (addr_t pc)
273{
Jason Molenda6a354702014-10-02 01:08:16 +0000274 Mutex::Locker locker(m_mutex);
Jason Molenda99618472013-11-04 11:02:52 +0000275 // We can't change the pc value of a history stack frame - it is immutable.
276 if (m_is_history_frame)
277 return false;
Greg Claytone72dfb32012-02-24 01:59:29 +0000278 m_frame_code_addr.SetRawAddress(pc);
Greg Clayton72310352013-02-23 04:12:47 +0000279 m_sc.Clear(false);
Greg Clayton73b472d2010-10-27 03:32:59 +0000280 m_flags.Reset(0);
Greg Claytond9e416c2012-02-18 05:35:26 +0000281 ThreadSP thread_sp (GetThread());
282 if (thread_sp)
283 thread_sp->ClearStackFrames ();
Jason Molenda99618472013-11-04 11:02:52 +0000284 return true;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000285}
286
287const char *
288StackFrame::Disassemble ()
289{
Jason Molenda6a354702014-10-02 01:08:16 +0000290 Mutex::Locker locker(m_mutex);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000291 if (m_disassembly.GetSize() == 0)
292 {
Greg Claytond9e416c2012-02-18 05:35:26 +0000293 ExecutionContext exe_ctx (shared_from_this());
294 Target *target = exe_ctx.GetTargetPtr();
295 if (target)
296 {
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000297 const char *plugin_name = nullptr;
298 const char *flavor = nullptr;
Greg Claytond9e416c2012-02-18 05:35:26 +0000299 Disassembler::Disassemble (target->GetDebugger(),
300 target->GetArchitecture(),
Jim Ingham0f063ba2013-03-02 00:26:47 +0000301 plugin_name,
302 flavor,
Greg Claytond9e416c2012-02-18 05:35:26 +0000303 exe_ctx,
304 0,
305 0,
306 0,
307 m_disassembly);
308 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000309 if (m_disassembly.GetSize() == 0)
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000310 return nullptr;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000311 }
312 return m_disassembly.GetData();
313}
314
Greg Clayton95897c62010-09-07 04:20:48 +0000315Block *
316StackFrame::GetFrameBlock ()
317{
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000318 if (m_sc.block == nullptr && m_flags.IsClear(eSymbolContextBlock))
Greg Clayton95897c62010-09-07 04:20:48 +0000319 GetSymbolContext (eSymbolContextBlock);
320
321 if (m_sc.block)
322 {
323 Block *inline_block = m_sc.block->GetContainingInlinedBlock();
324 if (inline_block)
325 {
326 // Use the block with the inlined function info
327 // as the frame block we want this frame to have only the variables
328 // for the inlined function and its non-inlined block child blocks.
329 return inline_block;
330 }
331 else
332 {
333 // This block is not contained withing any inlined function blocks
334 // with so we want to use the top most function block.
335 return &m_sc.function->GetBlock (false);
336 }
337 }
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000338 return nullptr;
Greg Clayton95897c62010-09-07 04:20:48 +0000339}
340
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000341//----------------------------------------------------------------------
342// Get the symbol context if we already haven't done so by resolving the
343// PC address as much as possible. This way when we pass around a
344// StackFrame object, everyone will have as much information as
345// possible and no one will ever have to look things up manually.
346//----------------------------------------------------------------------
347const SymbolContext&
348StackFrame::GetSymbolContext (uint32_t resolve_scope)
349{
Jason Molenda6a354702014-10-02 01:08:16 +0000350 Mutex::Locker locker(m_mutex);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000351 // Copy our internal symbol context into "sc".
Greg Clayton73b472d2010-10-27 03:32:59 +0000352 if ((m_flags.Get() & resolve_scope) != resolve_scope)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000353 {
Greg Clayton75a03332012-11-29 00:53:06 +0000354 uint32_t resolved = 0;
355
356 // If the target was requested add that:
357 if (!m_sc.target_sp)
358 {
359 m_sc.target_sp = CalculateTarget();
360 if (m_sc.target_sp)
361 resolved |= eSymbolContextTarget;
362 }
363
Bruce Mitcheneraaa0ba32014-07-08 18:05:41 +0000364 // Resolve our PC to section offset if we haven't already done so
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000365 // and if we don't have a module. The resolved address section will
366 // contain the module to which it belongs
Greg Clayton59e8fc1c2010-08-30 18:11:35 +0000367 if (!m_sc.module_sp && m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR))
Greg Clayton9da7bd02010-08-24 21:05:24 +0000368 GetFrameCodeAddress();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000369
370 // If this is not frame zero, then we need to subtract 1 from the PC
371 // value when doing address lookups since the PC will be on the
372 // instruction following the function call instruction...
373
Greg Clayton9da7bd02010-08-24 21:05:24 +0000374 Address lookup_addr(GetFrameCodeAddress());
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000375 if (m_frame_index > 0 && lookup_addr.IsValid())
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000376 {
377 addr_t offset = lookup_addr.GetOffset();
378 if (offset > 0)
Jason Molendacf296752014-11-08 05:38:17 +0000379 {
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000380 lookup_addr.SetOffset(offset - 1);
Jason Molendacf296752014-11-08 05:38:17 +0000381
382 }
383 else
384 {
385 // lookup_addr is the start of a section. We need
386 // do the math on the actual load address and re-compute
387 // the section. We're working with a 'noreturn' function
388 // at the end of a section.
389 ThreadSP thread_sp (GetThread());
390 if (thread_sp)
391 {
392 TargetSP target_sp (thread_sp->CalculateTarget());
393 if (target_sp)
394 {
395 addr_t addr_minus_one = lookup_addr.GetLoadAddress(target_sp.get()) - 1;
396 lookup_addr.SetLoadAddress (addr_minus_one, target_sp.get());
397 }
398 else
399 {
400 lookup_addr.SetOffset(offset - 1);
401 }
402 }
403 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000404 }
405
406 if (m_sc.module_sp)
407 {
408 // We have something in our stack frame symbol context, lets check
409 // if we haven't already tried to lookup one of those things. If we
410 // haven't then we will do the query.
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000411
412 uint32_t actual_resolve_scope = 0;
413
414 if (resolve_scope & eSymbolContextCompUnit)
415 {
416 if (m_flags.IsClear (eSymbolContextCompUnit))
417 {
418 if (m_sc.comp_unit)
Greg Clayton9da7bd02010-08-24 21:05:24 +0000419 resolved |= eSymbolContextCompUnit;
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000420 else
421 actual_resolve_scope |= eSymbolContextCompUnit;
422 }
423 }
424
425 if (resolve_scope & eSymbolContextFunction)
426 {
427 if (m_flags.IsClear (eSymbolContextFunction))
428 {
429 if (m_sc.function)
Greg Clayton9da7bd02010-08-24 21:05:24 +0000430 resolved |= eSymbolContextFunction;
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000431 else
432 actual_resolve_scope |= eSymbolContextFunction;
433 }
434 }
435
436 if (resolve_scope & eSymbolContextBlock)
437 {
438 if (m_flags.IsClear (eSymbolContextBlock))
439 {
440 if (m_sc.block)
Greg Clayton9da7bd02010-08-24 21:05:24 +0000441 resolved |= eSymbolContextBlock;
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000442 else
443 actual_resolve_scope |= eSymbolContextBlock;
444 }
445 }
446
447 if (resolve_scope & eSymbolContextSymbol)
448 {
449 if (m_flags.IsClear (eSymbolContextSymbol))
450 {
451 if (m_sc.symbol)
Greg Clayton9da7bd02010-08-24 21:05:24 +0000452 resolved |= eSymbolContextSymbol;
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000453 else
454 actual_resolve_scope |= eSymbolContextSymbol;
455 }
456 }
457
458 if (resolve_scope & eSymbolContextLineEntry)
459 {
460 if (m_flags.IsClear (eSymbolContextLineEntry))
461 {
462 if (m_sc.line_entry.IsValid())
Greg Clayton9da7bd02010-08-24 21:05:24 +0000463 resolved |= eSymbolContextLineEntry;
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000464 else
465 actual_resolve_scope |= eSymbolContextLineEntry;
466 }
467 }
468
469 if (actual_resolve_scope)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000470 {
471 // We might be resolving less information than what is already
472 // in our current symbol context so resolve into a temporary
473 // symbol context "sc" so we don't clear out data we have
474 // already found in "m_sc"
475 SymbolContext sc;
476 // Set flags that indicate what we have tried to resolve
Greg Clayton9da7bd02010-08-24 21:05:24 +0000477 resolved |= m_sc.module_sp->ResolveSymbolContextForAddress (lookup_addr, actual_resolve_scope, sc);
Greg Clayton1b72fcb2010-08-24 00:45:41 +0000478 // Only replace what we didn't already have as we may have
479 // information for an inlined function scope that won't match
480 // what a standard lookup by address would match
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000481 if ((resolved & eSymbolContextCompUnit) && m_sc.comp_unit == nullptr)
Greg Clayton9da7bd02010-08-24 21:05:24 +0000482 m_sc.comp_unit = sc.comp_unit;
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000483 if ((resolved & eSymbolContextFunction) && m_sc.function == nullptr)
Greg Clayton9da7bd02010-08-24 21:05:24 +0000484 m_sc.function = sc.function;
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000485 if ((resolved & eSymbolContextBlock) && m_sc.block == nullptr)
Greg Clayton9da7bd02010-08-24 21:05:24 +0000486 m_sc.block = sc.block;
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000487 if ((resolved & eSymbolContextSymbol) && m_sc.symbol == nullptr)
Greg Clayton9da7bd02010-08-24 21:05:24 +0000488 m_sc.symbol = sc.symbol;
Greg Clayton75a03332012-11-29 00:53:06 +0000489 if ((resolved & eSymbolContextLineEntry) && !m_sc.line_entry.IsValid())
490 {
Greg Clayton9da7bd02010-08-24 21:05:24 +0000491 m_sc.line_entry = sc.line_entry;
Greg Clayton75a03332012-11-29 00:53:06 +0000492 if (m_sc.target_sp)
493 {
494 // Be sure to apply and file remappings to our file and line
495 // entries when handing out a line entry
496 FileSpec new_file_spec;
497 if (m_sc.target_sp->GetSourcePathMap().FindFile (m_sc.line_entry.file, new_file_spec))
498 m_sc.line_entry.file = new_file_spec;
499 }
500 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000501 }
502 }
503 else
504 {
505 // If we don't have a module, then we can't have the compile unit,
506 // function, block, line entry or symbol, so we can safely call
507 // ResolveSymbolContextForAddress with our symbol context member m_sc.
Greg Clayton9da7bd02010-08-24 21:05:24 +0000508 if (m_sc.target_sp)
Sean Callananf4be2272013-02-21 20:54:33 +0000509 {
Greg Clayton75a03332012-11-29 00:53:06 +0000510 resolved |= m_sc.target_sp->GetImages().ResolveSymbolContextForAddress (lookup_addr, resolve_scope, m_sc);
Sean Callananf4be2272013-02-21 20:54:33 +0000511 }
Greg Clayton9da7bd02010-08-24 21:05:24 +0000512 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000513
514 // Update our internal flags so we remember what we have tried to locate so
515 // we don't have to keep trying when more calls to this function are made.
Greg Clayton9da7bd02010-08-24 21:05:24 +0000516 // We might have dug up more information that was requested (for example
517 // if we were asked to only get the block, we will have gotten the
518 // compile unit, and function) so set any additional bits that we resolved
519 m_flags.Set (resolve_scope | resolved);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000520 }
521
522 // Return the symbol context with everything that was possible to resolve
523 // resolved.
524 return m_sc;
525}
526
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000527VariableList *
Greg Clayton288bdf92010-09-02 02:59:18 +0000528StackFrame::GetVariableList (bool get_file_globals)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000529{
Jason Molenda6a354702014-10-02 01:08:16 +0000530 Mutex::Locker locker(m_mutex);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000531 if (m_flags.IsClear(RESOLVED_VARIABLES))
532 {
533 m_flags.Set(RESOLVED_VARIABLES);
534
Greg Clayton95897c62010-09-07 04:20:48 +0000535 Block *frame_block = GetFrameBlock();
536
537 if (frame_block)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000538 {
Greg Clayton95897c62010-09-07 04:20:48 +0000539 const bool get_child_variables = true;
540 const bool can_create = true;
Greg Claytonc662ec82011-06-17 22:10:16 +0000541 const bool stop_if_child_block_is_inlined_function = true;
542 m_variable_list_sp.reset(new VariableList());
Tamas Berghammer72ac8a82016-02-25 12:23:37 +0000543 frame_block->AppendBlockVariables(can_create,
544 get_child_variables,
545 stop_if_child_block_is_inlined_function,
546 [this](Variable* v) { return v->IsInScope(this); },
547 m_variable_list_sp.get());
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000548 }
Sean Callanan7c0962d2010-11-01 04:38:59 +0000549 }
550
551 if (m_flags.IsClear(RESOLVED_GLOBAL_VARIABLES) &&
552 get_file_globals)
553 {
554 m_flags.Set(RESOLVED_GLOBAL_VARIABLES);
Greg Clayton288bdf92010-09-02 02:59:18 +0000555
Sean Callanan7c0962d2010-11-01 04:38:59 +0000556 if (m_flags.IsClear (eSymbolContextCompUnit))
557 GetSymbolContext (eSymbolContextCompUnit);
558
559 if (m_sc.comp_unit)
Greg Clayton288bdf92010-09-02 02:59:18 +0000560 {
Sean Callanan7c0962d2010-11-01 04:38:59 +0000561 VariableListSP global_variable_list_sp (m_sc.comp_unit->GetVariableList(true));
562 if (m_variable_list_sp)
563 m_variable_list_sp->AddVariables (global_variable_list_sp.get());
564 else
565 m_variable_list_sp = global_variable_list_sp;
Greg Clayton288bdf92010-09-02 02:59:18 +0000566 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000567 }
Sean Callanan7c0962d2010-11-01 04:38:59 +0000568
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000569 return m_variable_list_sp.get();
570}
571
Greg Claytond41f0322011-08-02 23:35:43 +0000572VariableListSP
573StackFrame::GetInScopeVariableList (bool get_file_globals)
574{
Jason Molenda6a354702014-10-02 01:08:16 +0000575 Mutex::Locker locker(m_mutex);
Jason Molenda99618472013-11-04 11:02:52 +0000576 // We can't fetch variable information for a history stack frame.
577 if (m_is_history_frame)
578 return VariableListSP();
579
Greg Claytond41f0322011-08-02 23:35:43 +0000580 VariableListSP var_list_sp(new VariableList);
581 GetSymbolContext (eSymbolContextCompUnit | eSymbolContextBlock);
582
583 if (m_sc.block)
584 {
585 const bool can_create = true;
586 const bool get_parent_variables = true;
587 const bool stop_if_block_is_inlined_function = true;
588 m_sc.block->AppendVariables (can_create,
589 get_parent_variables,
590 stop_if_block_is_inlined_function,
Tamas Berghammer72ac8a82016-02-25 12:23:37 +0000591 [this](Variable* v) { return v->IsInScope(this); },
Greg Claytond41f0322011-08-02 23:35:43 +0000592 var_list_sp.get());
593 }
594
Siva Chandrab90168f2016-02-02 23:49:41 +0000595 if (m_sc.comp_unit && get_file_globals)
Greg Claytond41f0322011-08-02 23:35:43 +0000596 {
597 VariableListSP global_variable_list_sp (m_sc.comp_unit->GetVariableList(true));
598 if (global_variable_list_sp)
599 var_list_sp->AddVariables (global_variable_list_sp.get());
600 }
601
602 return var_list_sp;
603}
604
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000605ValueObjectSP
Greg Clayton685c88c2012-07-14 00:53:55 +0000606StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
Greg Clayton4d122c42011-09-17 08:33:22 +0000607 DynamicValueType use_dynamic,
Jim Ingham2837b762011-05-04 03:43:18 +0000608 uint32_t options,
Greg Clayton4d122c42011-09-17 08:33:22 +0000609 VariableSP &var_sp,
Jim Ingham2837b762011-05-04 03:43:18 +0000610 Error &error)
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000611{
Jason Molenda99618472013-11-04 11:02:52 +0000612 // We can't fetch variable information for a history stack frame.
613 if (m_is_history_frame)
614 return ValueObjectSP();
Greg Clayton54979cd2010-12-15 05:08:08 +0000615
616 if (var_expr_cstr && var_expr_cstr[0])
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000617 {
Greg Clayton6d5e68e2011-01-20 19:27:18 +0000618 const bool check_ptr_vs_member = (options & eExpressionPathOptionCheckPtrVsMember) != 0;
619 const bool no_fragile_ivar = (options & eExpressionPathOptionsNoFragileObjcIvar) != 0;
Enrico Granata27b625e2011-08-09 01:04:56 +0000620 const bool no_synth_child = (options & eExpressionPathOptionsNoSyntheticChildren) != 0;
Enrico Granata58ad3342011-08-19 21:56:10 +0000621 //const bool no_synth_array = (options & eExpressionPathOptionsNoSyntheticArrayRange) != 0;
Greg Clayton54979cd2010-12-15 05:08:08 +0000622 error.Clear();
623 bool deref = false;
624 bool address_of = false;
625 ValueObjectSP valobj_sp;
626 const bool get_file_globals = true;
Greg Claytond41f0322011-08-02 23:35:43 +0000627 // When looking up a variable for an expression, we need only consider the
628 // variables that are in scope.
629 VariableListSP var_list_sp (GetInScopeVariableList (get_file_globals));
630 VariableList *variable_list = var_list_sp.get();
Greg Clayton54979cd2010-12-15 05:08:08 +0000631
632 if (variable_list)
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000633 {
Greg Clayton54979cd2010-12-15 05:08:08 +0000634 // If first character is a '*', then show pointer contents
635 const char *var_expr = var_expr_cstr;
636 if (var_expr[0] == '*')
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000637 {
Greg Clayton54979cd2010-12-15 05:08:08 +0000638 deref = true;
639 var_expr++; // Skip the '*'
640 }
641 else if (var_expr[0] == '&')
642 {
643 address_of = true;
644 var_expr++; // Skip the '&'
645 }
646
647 std::string var_path (var_expr);
648 size_t separator_idx = var_path.find_first_of(".-[=+~|&^%#@!/?,<>{}");
649 StreamString var_expr_path_strm;
650
651 ConstString name_const_string;
652 if (separator_idx == std::string::npos)
653 name_const_string.SetCString (var_path.c_str());
654 else
655 name_const_string.SetCStringWithLength (var_path.c_str(), separator_idx);
656
Paul Herman10bc1a42015-08-18 22:46:57 +0000657 var_sp = variable_list->FindVariable(name_const_string, false);
Greg Clayton685c88c2012-07-14 00:53:55 +0000658
659 bool synthetically_added_instance_object = false;
660
661 if (var_sp)
662 {
663 var_path.erase (0, name_const_string.GetLength ());
664 }
Enrico Granata46252392015-11-19 22:28:58 +0000665
666 if (!var_sp && (options & eExpressionPathOptionsAllowDirectIVarAccess))
Greg Clayton685c88c2012-07-14 00:53:55 +0000667 {
668 // Check for direct ivars access which helps us with implicit
669 // access to ivars with the "this->" or "self->"
670 GetSymbolContext(eSymbolContextFunction|eSymbolContextBlock);
671 lldb::LanguageType method_language = eLanguageTypeUnknown;
672 bool is_instance_method = false;
673 ConstString method_object_name;
674 if (m_sc.GetFunctionMethodInfo (method_language, is_instance_method, method_object_name))
675 {
676 if (is_instance_method && method_object_name)
677 {
678 var_sp = variable_list->FindVariable(method_object_name);
679 if (var_sp)
680 {
681 separator_idx = 0;
682 var_path.insert(0, "->");
683 synthetically_added_instance_object = true;
684 }
685 }
686 }
687 }
Enrico Granata46252392015-11-19 22:28:58 +0000688
689 if (!var_sp && (options & eExpressionPathOptionsInspectAnonymousUnions))
690 {
691 // Check if any anonymous unions are there which contain a variable with the name we need
692 for (size_t i = 0;
693 i < variable_list->GetSize();
694 i++)
695 {
696 if (VariableSP variable_sp = variable_list->GetVariableAtIndex(i))
697 {
698 if (variable_sp->GetName().IsEmpty())
699 {
700 if (Type *var_type = variable_sp->GetType())
701 {
702 if (var_type->GetForwardCompilerType().IsAnonymousType())
703 {
704 valobj_sp = GetValueObjectForFrameVariable (variable_sp, use_dynamic);
705 if (!valobj_sp)
706 return valobj_sp;
707 valobj_sp = valobj_sp->GetChildMemberWithName(name_const_string, true);
708 if (valobj_sp)
709 break;
710 }
711 }
712 }
713 }
714 }
715 }
Greg Clayton685c88c2012-07-14 00:53:55 +0000716
Enrico Granata46252392015-11-19 22:28:58 +0000717 if (var_sp && !valobj_sp)
Greg Clayton54979cd2010-12-15 05:08:08 +0000718 {
Jim Ingham2837b762011-05-04 03:43:18 +0000719 valobj_sp = GetValueObjectForFrameVariable (var_sp, use_dynamic);
Jim Ingham78a685a2011-04-16 00:01:13 +0000720 if (!valobj_sp)
721 return valobj_sp;
Enrico Granata46252392015-11-19 22:28:58 +0000722 }
723 if (valobj_sp)
724 {
Greg Clayton54979cd2010-12-15 05:08:08 +0000725 // We are dumping at least one child
726 while (separator_idx != std::string::npos)
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000727 {
Greg Clayton54979cd2010-12-15 05:08:08 +0000728 // Calculate the next separator index ahead of time
729 ValueObjectSP child_valobj_sp;
730 const char separator_type = var_path[0];
731 switch (separator_type)
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000732 {
Greg Clayton54979cd2010-12-15 05:08:08 +0000733 case '-':
734 if (var_path.size() >= 2 && var_path[1] != '>')
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000735 return ValueObjectSP();
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000736
Greg Clayton6d5e68e2011-01-20 19:27:18 +0000737 if (no_fragile_ivar)
738 {
739 // Make sure we aren't trying to deref an objective
740 // C ivar if this is not allowed
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000741 const uint32_t pointer_type_flags = valobj_sp->GetCompilerType().GetTypeInfo(nullptr);
Enrico Granata622be232014-10-21 20:52:14 +0000742 if ((pointer_type_flags & eTypeIsObjC) &&
743 (pointer_type_flags & eTypeIsPointer))
Greg Clayton6d5e68e2011-01-20 19:27:18 +0000744 {
745 // This was an objective C object pointer and
746 // it was requested we skip any fragile ivars
747 // so return nothing here
748 return ValueObjectSP();
749 }
750 }
Greg Clayton54979cd2010-12-15 05:08:08 +0000751 var_path.erase (0, 1); // Remove the '-'
Jason Molenda62e06812016-02-16 04:14:33 +0000752 LLVM_FALLTHROUGH;
Greg Clayton54979cd2010-12-15 05:08:08 +0000753 case '.':
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000754 {
Greg Clayton54979cd2010-12-15 05:08:08 +0000755 const bool expr_is_ptr = var_path[0] == '>';
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000756
Greg Clayton54979cd2010-12-15 05:08:08 +0000757 var_path.erase (0, 1); // Remove the '.' or '>'
758 separator_idx = var_path.find_first_of(".-[");
759 ConstString child_name;
760 if (separator_idx == std::string::npos)
761 child_name.SetCString (var_path.c_str());
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000762 else
Greg Clayton54979cd2010-12-15 05:08:08 +0000763 child_name.SetCStringWithLength(var_path.c_str(), separator_idx);
764
765 if (check_ptr_vs_member)
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000766 {
Greg Clayton54979cd2010-12-15 05:08:08 +0000767 // We either have a pointer type and need to verify
768 // valobj_sp is a pointer, or we have a member of a
769 // class/union/struct being accessed with the . syntax
770 // and need to verify we don't have a pointer.
771 const bool actual_is_ptr = valobj_sp->IsPointerType ();
772
773 if (actual_is_ptr != expr_is_ptr)
774 {
775 // Incorrect use of "." with a pointer, or "->" with
776 // a class/union/struct instance or reference.
Greg Clayton6beaaa62011-01-17 03:46:26 +0000777 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
Greg Clayton54979cd2010-12-15 05:08:08 +0000778 if (actual_is_ptr)
779 error.SetErrorStringWithFormat ("\"%s\" is a pointer and . was used to attempt to access \"%s\". Did you mean \"%s->%s\"?",
780 var_expr_path_strm.GetString().c_str(),
781 child_name.GetCString(),
782 var_expr_path_strm.GetString().c_str(),
783 var_path.c_str());
784 else
785 error.SetErrorStringWithFormat ("\"%s\" is not a pointer and -> was used to attempt to access \"%s\". Did you mean \"%s.%s\"?",
786 var_expr_path_strm.GetString().c_str(),
787 child_name.GetCString(),
788 var_expr_path_strm.GetString().c_str(),
789 var_path.c_str());
790 return ValueObjectSP();
791 }
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000792 }
Greg Clayton54979cd2010-12-15 05:08:08 +0000793 child_valobj_sp = valobj_sp->GetChildMemberWithName (child_name, true);
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000794 if (!child_valobj_sp)
795 {
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000796 if (!no_synth_child)
Enrico Granata86cc9822012-03-19 22:58:49 +0000797 {
798 child_valobj_sp = valobj_sp->GetSyntheticValue();
799 if (child_valobj_sp)
800 child_valobj_sp = child_valobj_sp->GetChildMemberWithName (child_name, true);
801 }
Enrico Granata8c9d3562011-08-11 17:08:01 +0000802
803 if (no_synth_child || !child_valobj_sp)
Greg Clayton54979cd2010-12-15 05:08:08 +0000804 {
Enrico Granata8c9d3562011-08-11 17:08:01 +0000805 // No child member with name "child_name"
Greg Clayton685c88c2012-07-14 00:53:55 +0000806 if (synthetically_added_instance_object)
Enrico Granata8c9d3562011-08-11 17:08:01 +0000807 {
Greg Clayton685c88c2012-07-14 00:53:55 +0000808 // We added a "this->" or "self->" to the beginning of the expression
809 // and this is the first pointer ivar access, so just return the normal
810 // error
811 error.SetErrorStringWithFormat("no variable or instance variable named '%s' found in this frame",
812 name_const_string.GetCString());
Enrico Granata8c9d3562011-08-11 17:08:01 +0000813 }
814 else
815 {
Greg Clayton685c88c2012-07-14 00:53:55 +0000816 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
817 if (child_name)
818 {
819 error.SetErrorStringWithFormat ("\"%s\" is not a member of \"(%s) %s\"",
820 child_name.GetCString(),
821 valobj_sp->GetTypeName().AsCString("<invalid type>"),
822 var_expr_path_strm.GetString().c_str());
823 }
824 else
825 {
826 error.SetErrorStringWithFormat ("incomplete expression path after \"%s\" in \"%s\"",
827 var_expr_path_strm.GetString().c_str(),
828 var_expr_cstr);
829 }
Enrico Granata8c9d3562011-08-11 17:08:01 +0000830 }
831 return ValueObjectSP();
Greg Clayton54979cd2010-12-15 05:08:08 +0000832 }
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000833 }
Greg Clayton685c88c2012-07-14 00:53:55 +0000834 synthetically_added_instance_object = false;
Greg Clayton54979cd2010-12-15 05:08:08 +0000835 // Remove the child name from the path
836 var_path.erase(0, child_name.GetLength());
Greg Clayton4d122c42011-09-17 08:33:22 +0000837 if (use_dynamic != eNoDynamicValues)
Jim Ingham78a685a2011-04-16 00:01:13 +0000838 {
Jim Ingham2837b762011-05-04 03:43:18 +0000839 ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(use_dynamic));
Jim Ingham78a685a2011-04-16 00:01:13 +0000840 if (dynamic_value_sp)
841 child_valobj_sp = dynamic_value_sp;
842 }
Greg Clayton54979cd2010-12-15 05:08:08 +0000843 }
844 break;
Greg Clayton8b2fe6d2010-12-14 02:59:59 +0000845
Greg Clayton54979cd2010-12-15 05:08:08 +0000846 case '[':
847 // Array member access, or treating pointer as an array
848 if (var_path.size() > 2) // Need at least two brackets and a number
849 {
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000850 char *end = nullptr;
Greg Clayton1a65ae12011-01-25 23:55:37 +0000851 long child_index = ::strtol (&var_path[1], &end, 0);
Enrico Granata9fc19442011-07-06 02:13:41 +0000852 if (end && *end == ']'
853 && *(end-1) != '[') // this code forces an error in the case of arr[]. as bitfield[] is not a good syntax we're good to go
Greg Clayton54979cd2010-12-15 05:08:08 +0000854 {
Greg Clayton99558cc42015-08-24 23:46:31 +0000855 if (valobj_sp->GetCompilerType().IsPointerToScalarType() && deref)
Enrico Granata9fc19442011-07-06 02:13:41 +0000856 {
857 // what we have is *ptr[low]. the most similar C++ syntax is to deref ptr
858 // and extract bit low out of it. reading array item low
859 // would be done by saying ptr[low], without a deref * sign
860 Error error;
861 ValueObjectSP temp(valobj_sp->Dereference(error));
862 if (error.Fail())
863 {
864 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
865 error.SetErrorStringWithFormat ("could not dereference \"(%s) %s\"",
866 valobj_sp->GetTypeName().AsCString("<invalid type>"),
867 var_expr_path_strm.GetString().c_str());
868 return ValueObjectSP();
869 }
870 valobj_sp = temp;
871 deref = false;
872 }
Greg Clayton99558cc42015-08-24 23:46:31 +0000873 else if (valobj_sp->GetCompilerType().IsArrayOfScalarType() && deref)
Enrico Granata9fc19442011-07-06 02:13:41 +0000874 {
875 // what we have is *arr[low]. the most similar C++ syntax is to get arr[0]
876 // (an operation that is equivalent to deref-ing arr)
877 // and extract bit low out of it. reading array item low
878 // would be done by saying arr[low], without a deref * sign
879 Error error;
880 ValueObjectSP temp(valobj_sp->GetChildAtIndex (0, true));
881 if (error.Fail())
882 {
883 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
884 error.SetErrorStringWithFormat ("could not get item 0 for \"(%s) %s\"",
885 valobj_sp->GetTypeName().AsCString("<invalid type>"),
886 var_expr_path_strm.GetString().c_str());
887 return ValueObjectSP();
888 }
889 valobj_sp = temp;
890 deref = false;
891 }
892
Greg Clayton4ef877f2012-12-06 02:33:54 +0000893 bool is_incomplete_array = false;
Greg Clayton54979cd2010-12-15 05:08:08 +0000894 if (valobj_sp->IsPointerType ())
895 {
Sean Callanan226b70c2012-03-08 02:39:03 +0000896 bool is_objc_pointer = true;
897
Greg Clayton99558cc42015-08-24 23:46:31 +0000898 if (valobj_sp->GetCompilerType().GetMinimumLanguage() != eLanguageTypeObjC)
Sean Callanan226b70c2012-03-08 02:39:03 +0000899 is_objc_pointer = false;
Greg Clayton99558cc42015-08-24 23:46:31 +0000900 else if (!valobj_sp->GetCompilerType().IsPointerType())
Sean Callanan226b70c2012-03-08 02:39:03 +0000901 is_objc_pointer = false;
902
903 if (no_synth_child && is_objc_pointer)
Greg Clayton54979cd2010-12-15 05:08:08 +0000904 {
Sean Callanan226b70c2012-03-08 02:39:03 +0000905 error.SetErrorStringWithFormat("\"(%s) %s\" is an Objective-C pointer, and cannot be subscripted",
906 valobj_sp->GetTypeName().AsCString("<invalid type>"),
907 var_expr_path_strm.GetString().c_str());
908
909 return ValueObjectSP();
910 }
911 else if (is_objc_pointer)
912 {
Enrico Granata27b625e2011-08-09 01:04:56 +0000913 // dereferencing ObjC variables is not valid.. so let's try and recur to synthetic children
Enrico Granata86cc9822012-03-19 22:58:49 +0000914 ValueObjectSP synthetic = valobj_sp->GetSyntheticValue();
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000915 if (!synthetic /* no synthetic */
Enrico Granata27b625e2011-08-09 01:04:56 +0000916 || synthetic == valobj_sp) /* synthetic is the same as the original object */
917 {
918 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
919 error.SetErrorStringWithFormat ("\"(%s) %s\" is not an array type",
920 valobj_sp->GetTypeName().AsCString("<invalid type>"),
921 var_expr_path_strm.GetString().c_str());
922 }
Saleem Abdulrasool3985c8c2014-04-02 03:51:35 +0000923 else if (static_cast<uint32_t>(child_index) >= synthetic->GetNumChildren() /* synthetic does not have that many values */)
Enrico Granata27b625e2011-08-09 01:04:56 +0000924 {
925 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
Jason Molenda7e589a62011-09-20 00:26:08 +0000926 error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"",
Enrico Granata27b625e2011-08-09 01:04:56 +0000927 child_index,
928 valobj_sp->GetTypeName().AsCString("<invalid type>"),
929 var_expr_path_strm.GetString().c_str());
930 }
931 else
932 {
933 child_valobj_sp = synthetic->GetChildAtIndex(child_index, true);
934 if (!child_valobj_sp)
935 {
936 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
Jason Molenda7e589a62011-09-20 00:26:08 +0000937 error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"",
Enrico Granata27b625e2011-08-09 01:04:56 +0000938 child_index,
939 valobj_sp->GetTypeName().AsCString("<invalid type>"),
940 var_expr_path_strm.GetString().c_str());
941 }
942 }
943 }
944 else
945 {
Bruce Mitchener11d86362015-02-26 23:55:39 +0000946 child_valobj_sp = valobj_sp->GetSyntheticArrayMember (child_index, true);
Enrico Granata27b625e2011-08-09 01:04:56 +0000947 if (!child_valobj_sp)
948 {
949 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
Jason Molenda7e589a62011-09-20 00:26:08 +0000950 error.SetErrorStringWithFormat ("failed to use pointer as array for index %ld for \"(%s) %s\"",
Enrico Granata27b625e2011-08-09 01:04:56 +0000951 child_index,
952 valobj_sp->GetTypeName().AsCString("<invalid type>"),
953 var_expr_path_strm.GetString().c_str());
954 }
Greg Clayton54979cd2010-12-15 05:08:08 +0000955 }
956 }
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000957 else if (valobj_sp->GetCompilerType().IsArrayType(nullptr, nullptr, &is_incomplete_array))
Greg Clayton54979cd2010-12-15 05:08:08 +0000958 {
Jim Ingham78a685a2011-04-16 00:01:13 +0000959 // Pass false to dynamic_value here so we can tell the difference between
960 // no dynamic value and no member of this type...
Greg Clayton54979cd2010-12-15 05:08:08 +0000961 child_valobj_sp = valobj_sp->GetChildAtIndex (child_index, true);
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000962 if (!child_valobj_sp && (is_incomplete_array || !no_synth_child))
Greg Clayton4ef877f2012-12-06 02:33:54 +0000963 child_valobj_sp = valobj_sp->GetSyntheticArrayMember (child_index, true);
964
Greg Clayton54979cd2010-12-15 05:08:08 +0000965 if (!child_valobj_sp)
966 {
Greg Clayton6beaaa62011-01-17 03:46:26 +0000967 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
Jason Molenda7e589a62011-09-20 00:26:08 +0000968 error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"",
Greg Clayton54979cd2010-12-15 05:08:08 +0000969 child_index,
970 valobj_sp->GetTypeName().AsCString("<invalid type>"),
971 var_expr_path_strm.GetString().c_str());
972 }
973 }
Greg Clayton99558cc42015-08-24 23:46:31 +0000974 else if (valobj_sp->GetCompilerType().IsScalarType())
Enrico Granata9fc19442011-07-06 02:13:41 +0000975 {
976 // this is a bitfield asking to display just one bit
977 child_valobj_sp = valobj_sp->GetSyntheticBitFieldChild(child_index, child_index, true);
978 if (!child_valobj_sp)
979 {
980 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
Jason Molenda7e589a62011-09-20 00:26:08 +0000981 error.SetErrorStringWithFormat ("bitfield range %ld-%ld is not valid for \"(%s) %s\"",
Enrico Granata9fc19442011-07-06 02:13:41 +0000982 child_index, child_index,
983 valobj_sp->GetTypeName().AsCString("<invalid type>"),
984 var_expr_path_strm.GetString().c_str());
985 }
986 }
Greg Clayton54979cd2010-12-15 05:08:08 +0000987 else
988 {
Enrico Granata86cc9822012-03-19 22:58:49 +0000989 ValueObjectSP synthetic = valobj_sp->GetSyntheticValue();
Enrico Granata27b625e2011-08-09 01:04:56 +0000990 if (no_synth_child /* synthetic is forbidden */ ||
Eugene Zelenkod70a6e72016-02-18 18:52:47 +0000991 !synthetic /* no synthetic */
Enrico Granata27b625e2011-08-09 01:04:56 +0000992 || synthetic == valobj_sp) /* synthetic is the same as the original object */
993 {
994 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
995 error.SetErrorStringWithFormat ("\"(%s) %s\" is not an array type",
996 valobj_sp->GetTypeName().AsCString("<invalid type>"),
997 var_expr_path_strm.GetString().c_str());
998 }
Saleem Abdulrasool3985c8c2014-04-02 03:51:35 +0000999 else if (static_cast<uint32_t>(child_index) >= synthetic->GetNumChildren() /* synthetic does not have that many values */)
Enrico Granata27b625e2011-08-09 01:04:56 +00001000 {
1001 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
Jason Molenda7e589a62011-09-20 00:26:08 +00001002 error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"",
Enrico Granata27b625e2011-08-09 01:04:56 +00001003 child_index,
1004 valobj_sp->GetTypeName().AsCString("<invalid type>"),
1005 var_expr_path_strm.GetString().c_str());
1006 }
1007 else
1008 {
1009 child_valobj_sp = synthetic->GetChildAtIndex(child_index, true);
1010 if (!child_valobj_sp)
1011 {
1012 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
Jason Molenda7e589a62011-09-20 00:26:08 +00001013 error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"",
Enrico Granata27b625e2011-08-09 01:04:56 +00001014 child_index,
1015 valobj_sp->GetTypeName().AsCString("<invalid type>"),
1016 var_expr_path_strm.GetString().c_str());
1017 }
1018 }
Greg Clayton54979cd2010-12-15 05:08:08 +00001019 }
1020
1021 if (!child_valobj_sp)
1022 {
1023 // Invalid array index...
1024 return ValueObjectSP();
1025 }
1026
1027 // Erase the array member specification '[%i]' where
1028 // %i is the array index
1029 var_path.erase(0, (end - var_path.c_str()) + 1);
1030 separator_idx = var_path.find_first_of(".-[");
Greg Clayton4d122c42011-09-17 08:33:22 +00001031 if (use_dynamic != eNoDynamicValues)
Jim Ingham78a685a2011-04-16 00:01:13 +00001032 {
Jim Ingham2837b762011-05-04 03:43:18 +00001033 ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(use_dynamic));
Jim Ingham78a685a2011-04-16 00:01:13 +00001034 if (dynamic_value_sp)
1035 child_valobj_sp = dynamic_value_sp;
1036 }
Greg Clayton54979cd2010-12-15 05:08:08 +00001037 // Break out early from the switch since we were
1038 // able to find the child member
1039 break;
1040 }
Enrico Granata20edcdb2011-07-19 18:03:25 +00001041 else if (end && *end == '-')
Enrico Granata9fc19442011-07-06 02:13:41 +00001042 {
1043 // this is most probably a BitField, let's take a look
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001044 char *real_end = nullptr;
Enrico Granata9fc19442011-07-06 02:13:41 +00001045 long final_index = ::strtol (end+1, &real_end, 0);
Enrico Granatad64d0bc2011-08-19 21:13:46 +00001046 bool expand_bitfield = true;
Enrico Granata20edcdb2011-07-19 18:03:25 +00001047 if (real_end && *real_end == ']')
Enrico Granata9fc19442011-07-06 02:13:41 +00001048 {
1049 // if the format given is [high-low], swap range
Enrico Granata20edcdb2011-07-19 18:03:25 +00001050 if (child_index > final_index)
Enrico Granata9fc19442011-07-06 02:13:41 +00001051 {
1052 long temp = child_index;
1053 child_index = final_index;
1054 final_index = temp;
1055 }
1056
Greg Clayton99558cc42015-08-24 23:46:31 +00001057 if (valobj_sp->GetCompilerType().IsPointerToScalarType() && deref)
Enrico Granata9fc19442011-07-06 02:13:41 +00001058 {
1059 // what we have is *ptr[low-high]. the most similar C++ syntax is to deref ptr
1060 // and extract bits low thru high out of it. reading array items low thru high
1061 // would be done by saying ptr[low-high], without a deref * sign
1062 Error error;
1063 ValueObjectSP temp(valobj_sp->Dereference(error));
1064 if (error.Fail())
1065 {
1066 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
1067 error.SetErrorStringWithFormat ("could not dereference \"(%s) %s\"",
1068 valobj_sp->GetTypeName().AsCString("<invalid type>"),
1069 var_expr_path_strm.GetString().c_str());
1070 return ValueObjectSP();
1071 }
1072 valobj_sp = temp;
1073 deref = false;
1074 }
Greg Clayton99558cc42015-08-24 23:46:31 +00001075 else if (valobj_sp->GetCompilerType().IsArrayOfScalarType() && deref)
Enrico Granata9fc19442011-07-06 02:13:41 +00001076 {
1077 // what we have is *arr[low-high]. the most similar C++ syntax is to get arr[0]
1078 // (an operation that is equivalent to deref-ing arr)
1079 // and extract bits low thru high out of it. reading array items low thru high
1080 // would be done by saying arr[low-high], without a deref * sign
1081 Error error;
1082 ValueObjectSP temp(valobj_sp->GetChildAtIndex (0, true));
1083 if (error.Fail())
1084 {
1085 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
1086 error.SetErrorStringWithFormat ("could not get item 0 for \"(%s) %s\"",
1087 valobj_sp->GetTypeName().AsCString("<invalid type>"),
1088 var_expr_path_strm.GetString().c_str());
1089 return ValueObjectSP();
1090 }
1091 valobj_sp = temp;
1092 deref = false;
1093 }
Enrico Granatad64d0bc2011-08-19 21:13:46 +00001094 /*else if (valobj_sp->IsArrayType() || valobj_sp->IsPointerType())
Enrico Granata9fc19442011-07-06 02:13:41 +00001095 {
Enrico Granatad64d0bc2011-08-19 21:13:46 +00001096 child_valobj_sp = valobj_sp->GetSyntheticArrayRangeChild(child_index, final_index, true);
1097 expand_bitfield = false;
1098 if (!child_valobj_sp)
1099 {
1100 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
1101 error.SetErrorStringWithFormat ("array range %i-%i is not valid for \"(%s) %s\"",
1102 child_index, final_index,
1103 valobj_sp->GetTypeName().AsCString("<invalid type>"),
1104 var_expr_path_strm.GetString().c_str());
1105 }
1106 }*/
1107
1108 if (expand_bitfield)
1109 {
1110 child_valobj_sp = valobj_sp->GetSyntheticBitFieldChild(child_index, final_index, true);
1111 if (!child_valobj_sp)
1112 {
1113 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
Jason Molenda7e589a62011-09-20 00:26:08 +00001114 error.SetErrorStringWithFormat ("bitfield range %ld-%ld is not valid for \"(%s) %s\"",
Enrico Granatad64d0bc2011-08-19 21:13:46 +00001115 child_index, final_index,
1116 valobj_sp->GetTypeName().AsCString("<invalid type>"),
1117 var_expr_path_strm.GetString().c_str());
1118 }
Enrico Granata9fc19442011-07-06 02:13:41 +00001119 }
1120 }
1121
1122 if (!child_valobj_sp)
1123 {
1124 // Invalid bitfield range...
1125 return ValueObjectSP();
1126 }
1127
1128 // Erase the bitfield member specification '[%i-%i]' where
1129 // %i is the index
1130 var_path.erase(0, (real_end - var_path.c_str()) + 1);
1131 separator_idx = var_path.find_first_of(".-[");
Greg Clayton4d122c42011-09-17 08:33:22 +00001132 if (use_dynamic != eNoDynamicValues)
Enrico Granata9fc19442011-07-06 02:13:41 +00001133 {
1134 ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(use_dynamic));
1135 if (dynamic_value_sp)
1136 child_valobj_sp = dynamic_value_sp;
1137 }
1138 // Break out early from the switch since we were
1139 // able to find the child member
1140 break;
1141
1142 }
1143 }
1144 else
1145 {
1146 error.SetErrorStringWithFormat("invalid square bracket encountered after \"%s\" in \"%s\"",
1147 var_expr_path_strm.GetString().c_str(),
1148 var_path.c_str());
Greg Clayton54979cd2010-12-15 05:08:08 +00001149 }
1150 return ValueObjectSP();
1151
1152 default:
1153 // Failure...
1154 {
Greg Clayton6beaaa62011-01-17 03:46:26 +00001155 valobj_sp->GetExpressionPath (var_expr_path_strm, false);
Greg Clayton54979cd2010-12-15 05:08:08 +00001156 error.SetErrorStringWithFormat ("unexpected char '%c' encountered after \"%s\" in \"%s\"",
1157 separator_type,
1158 var_expr_path_strm.GetString().c_str(),
1159 var_path.c_str());
1160
1161 return ValueObjectSP();
Greg Clayton8b2fe6d2010-12-14 02:59:59 +00001162 }
1163 }
Greg Clayton8b2fe6d2010-12-14 02:59:59 +00001164
Greg Clayton54979cd2010-12-15 05:08:08 +00001165 if (child_valobj_sp)
1166 valobj_sp = child_valobj_sp;
1167
1168 if (var_path.empty())
1169 break;
Greg Clayton8b2fe6d2010-12-14 02:59:59 +00001170 }
Greg Clayton54979cd2010-12-15 05:08:08 +00001171 if (valobj_sp)
1172 {
1173 if (deref)
1174 {
Greg Claytonaf67cec2010-12-20 20:49:23 +00001175 ValueObjectSP deref_valobj_sp (valobj_sp->Dereference(error));
Greg Clayton54979cd2010-12-15 05:08:08 +00001176 valobj_sp = deref_valobj_sp;
1177 }
1178 else if (address_of)
1179 {
1180 ValueObjectSP address_of_valobj_sp (valobj_sp->AddressOf(error));
1181 valobj_sp = address_of_valobj_sp;
1182 }
1183 }
1184 return valobj_sp;
Greg Clayton8b2fe6d2010-12-14 02:59:59 +00001185 }
Greg Clayton54979cd2010-12-15 05:08:08 +00001186 else
Greg Clayton8b2fe6d2010-12-14 02:59:59 +00001187 {
Jim Ingham2837b762011-05-04 03:43:18 +00001188 error.SetErrorStringWithFormat("no variable named '%s' found in this frame",
1189 name_const_string.GetCString());
Greg Clayton8b2fe6d2010-12-14 02:59:59 +00001190 }
Greg Clayton8b2fe6d2010-12-14 02:59:59 +00001191 }
1192 }
Greg Clayton54979cd2010-12-15 05:08:08 +00001193 else
1194 {
1195 error.SetErrorStringWithFormat("invalid variable path '%s'", var_expr_cstr);
1196 }
Greg Clayton8b2fe6d2010-12-14 02:59:59 +00001197 return ValueObjectSP();
1198}
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001199
1200bool
1201StackFrame::GetFrameBaseValue (Scalar &frame_base, Error *error_ptr)
1202{
Jason Molenda6a354702014-10-02 01:08:16 +00001203 Mutex::Locker locker(m_mutex);
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001204 if (!m_cfa_is_valid)
Jason Molenda99618472013-11-04 11:02:52 +00001205 {
1206 m_frame_base_error.SetErrorString("No frame base available for this historical stack frame.");
1207 return false;
1208 }
1209
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001210 if (m_flags.IsClear(GOT_FRAME_BASE))
1211 {
1212 if (m_sc.function)
1213 {
1214 m_frame_base.Clear();
1215 m_frame_base_error.Clear();
1216
1217 m_flags.Set(GOT_FRAME_BASE);
Greg Claytond9e416c2012-02-18 05:35:26 +00001218 ExecutionContext exe_ctx (shared_from_this());
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001219 Value expr_value;
Greg Clayton016a95e2010-09-14 02:20:48 +00001220 addr_t loclist_base_addr = LLDB_INVALID_ADDRESS;
1221 if (m_sc.function->GetFrameBaseExpression().IsLocationList())
Greg Claytond9e416c2012-02-18 05:35:26 +00001222 loclist_base_addr = m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.GetTargetPtr());
Greg Clayton016a95e2010-09-14 02:20:48 +00001223
Tamas Berghammer5b42c7a2016-02-26 14:21:10 +00001224 if (m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx,
1225 nullptr,
1226 nullptr,
1227 nullptr,
1228 loclist_base_addr,
1229 nullptr,
1230 nullptr,
1231 expr_value,
1232 &m_frame_base_error) == false)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001233 {
1234 // We should really have an error if evaluate returns, but in case
1235 // we don't, lets set the error to something at least.
1236 if (m_frame_base_error.Success())
1237 m_frame_base_error.SetErrorString("Evaluation of the frame base expression failed.");
1238 }
1239 else
1240 {
Greg Clayton57ee3062013-07-11 22:46:58 +00001241 m_frame_base = expr_value.ResolveValue(&exe_ctx);
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001242 }
1243 }
1244 else
1245 {
1246 m_frame_base_error.SetErrorString ("No function in symbol context.");
1247 }
1248 }
1249
1250 if (m_frame_base_error.Success())
1251 frame_base = m_frame_base;
1252
1253 if (error_ptr)
1254 *error_ptr = m_frame_base_error;
1255 return m_frame_base_error.Success();
1256}
1257
Greg Clayton5ccbd292011-01-06 22:15:06 +00001258RegisterContextSP
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001259StackFrame::GetRegisterContext ()
1260{
Jason Molenda6a354702014-10-02 01:08:16 +00001261 Mutex::Locker locker(m_mutex);
Greg Clayton5ccbd292011-01-06 22:15:06 +00001262 if (!m_reg_context_sp)
Greg Claytond9e416c2012-02-18 05:35:26 +00001263 {
1264 ThreadSP thread_sp (GetThread());
1265 if (thread_sp)
1266 m_reg_context_sp = thread_sp->CreateRegisterContextForFrame (this);
1267 }
Greg Clayton5ccbd292011-01-06 22:15:06 +00001268 return m_reg_context_sp;
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001269}
1270
1271bool
1272StackFrame::HasDebugInformation ()
1273{
Greg Clayton9da7bd02010-08-24 21:05:24 +00001274 GetSymbolContext (eSymbolContextLineEntry);
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001275 return m_sc.line_entry.IsValid();
1276}
1277
Greg Clayton288bdf92010-09-02 02:59:18 +00001278ValueObjectSP
Greg Clayton4d122c42011-09-17 08:33:22 +00001279StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, DynamicValueType use_dynamic)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001280{
Jason Molenda6a354702014-10-02 01:08:16 +00001281 Mutex::Locker locker(m_mutex);
Greg Clayton288bdf92010-09-02 02:59:18 +00001282 ValueObjectSP valobj_sp;
Jason Molenda99618472013-11-04 11:02:52 +00001283 if (m_is_history_frame)
1284 {
1285 return valobj_sp;
1286 }
Greg Clayton288bdf92010-09-02 02:59:18 +00001287 VariableList *var_list = GetVariableList (true);
1288 if (var_list)
1289 {
1290 // Make sure the variable is a frame variable
1291 const uint32_t var_idx = var_list->FindIndexForVariable (variable_sp.get());
1292 const uint32_t num_variables = var_list->GetSize();
1293 if (var_idx < num_variables)
1294 {
1295 valobj_sp = m_variable_list_value_objects.GetValueObjectAtIndex (var_idx);
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001296 if (!valobj_sp)
Greg Clayton288bdf92010-09-02 02:59:18 +00001297 {
1298 if (m_variable_list_value_objects.GetSize() < num_variables)
1299 m_variable_list_value_objects.Resize(num_variables);
Jim Ingham58b59f92011-04-22 23:53:53 +00001300 valobj_sp = ValueObjectVariable::Create (this, variable_sp);
Greg Clayton288bdf92010-09-02 02:59:18 +00001301 m_variable_list_value_objects.SetValueObjectAtIndex (var_idx, valobj_sp);
1302 }
1303 }
1304 }
Greg Clayton4d122c42011-09-17 08:33:22 +00001305 if (use_dynamic != eNoDynamicValues && valobj_sp)
Jim Ingham78a685a2011-04-16 00:01:13 +00001306 {
Jim Ingham2837b762011-05-04 03:43:18 +00001307 ValueObjectSP dynamic_sp = valobj_sp->GetDynamicValue (use_dynamic);
Jim Ingham78a685a2011-04-16 00:01:13 +00001308 if (dynamic_sp)
1309 return dynamic_sp;
1310 }
Greg Clayton288bdf92010-09-02 02:59:18 +00001311 return valobj_sp;
1312}
1313
1314ValueObjectSP
Greg Clayton4d122c42011-09-17 08:33:22 +00001315StackFrame::TrackGlobalVariable (const VariableSP &variable_sp, DynamicValueType use_dynamic)
Greg Clayton288bdf92010-09-02 02:59:18 +00001316{
Jason Molenda6a354702014-10-02 01:08:16 +00001317 Mutex::Locker locker(m_mutex);
Jason Molenda99618472013-11-04 11:02:52 +00001318 if (m_is_history_frame)
1319 return ValueObjectSP();
1320
Greg Clayton288bdf92010-09-02 02:59:18 +00001321 // Check to make sure we aren't already tracking this variable?
Jim Ingham78a685a2011-04-16 00:01:13 +00001322 ValueObjectSP valobj_sp (GetValueObjectForFrameVariable (variable_sp, use_dynamic));
Greg Clayton288bdf92010-09-02 02:59:18 +00001323 if (!valobj_sp)
1324 {
1325 // We aren't already tracking this global
1326 VariableList *var_list = GetVariableList (true);
1327 // If this frame has no variables, create a new list
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001328 if (var_list == nullptr)
Greg Clayton288bdf92010-09-02 02:59:18 +00001329 m_variable_list_sp.reset (new VariableList());
1330
1331 // Add the global/static variable to this frame
1332 m_variable_list_sp->AddVariable (variable_sp);
1333
1334 // Now make a value object for it so we can track its changes
Jim Ingham78a685a2011-04-16 00:01:13 +00001335 valobj_sp = GetValueObjectForFrameVariable (variable_sp, use_dynamic);
Greg Clayton288bdf92010-09-02 02:59:18 +00001336 }
1337 return valobj_sp;
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001338}
1339
Jim Ingham6b8379c2010-08-26 20:44:45 +00001340bool
1341StackFrame::IsInlined ()
1342{
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001343 if (m_sc.block == nullptr)
Greg Clayton59e8fc1c2010-08-30 18:11:35 +00001344 GetSymbolContext (eSymbolContextBlock);
1345 if (m_sc.block)
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001346 return m_sc.block->GetContainingInlinedBlock() != nullptr;
Greg Clayton59e8fc1c2010-08-30 18:11:35 +00001347 return false;
Jim Ingham6b8379c2010-08-26 20:44:45 +00001348}
1349
Dawn Perchik009d1102015-09-04 01:02:30 +00001350lldb::LanguageType
1351StackFrame::GetLanguage ()
1352{
1353 CompileUnit *cu = GetSymbolContext(eSymbolContextCompUnit).comp_unit;
1354 if (cu)
1355 return cu->GetLanguage();
1356 return lldb::eLanguageTypeUnknown;
1357}
1358
Greg Claytond9e416c2012-02-18 05:35:26 +00001359TargetSP
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001360StackFrame::CalculateTarget ()
1361{
Greg Claytond9e416c2012-02-18 05:35:26 +00001362 TargetSP target_sp;
1363 ThreadSP thread_sp(GetThread());
1364 if (thread_sp)
1365 {
1366 ProcessSP process_sp (thread_sp->CalculateProcess());
1367 if (process_sp)
1368 target_sp = process_sp->CalculateTarget();
1369 }
1370 return target_sp;
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001371}
1372
Greg Claytond9e416c2012-02-18 05:35:26 +00001373ProcessSP
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001374StackFrame::CalculateProcess ()
1375{
Greg Claytond9e416c2012-02-18 05:35:26 +00001376 ProcessSP process_sp;
1377 ThreadSP thread_sp(GetThread());
1378 if (thread_sp)
1379 process_sp = thread_sp->CalculateProcess();
1380 return process_sp;
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001381}
1382
Greg Claytond9e416c2012-02-18 05:35:26 +00001383ThreadSP
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001384StackFrame::CalculateThread ()
1385{
Greg Claytond9e416c2012-02-18 05:35:26 +00001386 return GetThread();
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001387}
1388
Jason Molendab57e4a12013-11-04 09:33:30 +00001389StackFrameSP
1390StackFrame::CalculateStackFrame ()
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001391{
Greg Claytond9e416c2012-02-18 05:35:26 +00001392 return shared_from_this();
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001393}
1394
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001395void
Greg Clayton0603aa92010-10-04 01:05:56 +00001396StackFrame::CalculateExecutionContext (ExecutionContext &exe_ctx)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001397{
Greg Claytond9e416c2012-02-18 05:35:26 +00001398 exe_ctx.SetContext (shared_from_this());
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001399}
1400
1401void
Jim Ingham8ec10ef2013-10-18 17:38:31 +00001402StackFrame::DumpUsingSettingsFormat (Stream *strm, const char *frame_marker)
Greg Clayton0603aa92010-10-04 01:05:56 +00001403{
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001404 if (strm == nullptr)
Greg Clayton0603aa92010-10-04 01:05:56 +00001405 return;
1406
1407 GetSymbolContext(eSymbolContextEverything);
Greg Claytond9e416c2012-02-18 05:35:26 +00001408 ExecutionContext exe_ctx (shared_from_this());
Greg Clayton0603aa92010-10-04 01:05:56 +00001409 StreamString s;
Jim Ingham8ec10ef2013-10-18 17:38:31 +00001410
1411 if (frame_marker)
1412 s.PutCString(frame_marker);
1413
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001414 const FormatEntity::Entry *frame_format = nullptr;
Greg Claytond9e416c2012-02-18 05:35:26 +00001415 Target *target = exe_ctx.GetTargetPtr();
1416 if (target)
1417 frame_format = target->GetDebugger().GetFrameFormat();
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001418 if (frame_format && FormatEntity::Format(*frame_format, s, &m_sc, &exe_ctx, nullptr, nullptr, false, false))
Greg Clayton0603aa92010-10-04 01:05:56 +00001419 {
1420 strm->Write(s.GetData(), s.GetSize());
1421 }
1422 else
1423 {
1424 Dump (strm, true, false);
1425 strm->EOL();
1426 }
1427}
1428
1429void
Greg Clayton6dadd502010-09-02 21:44:10 +00001430StackFrame::Dump (Stream *strm, bool show_frame_index, bool show_fullpaths)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001431{
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001432 if (strm == nullptr)
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001433 return;
1434
1435 if (show_frame_index)
Greg Clayton1b72fcb2010-08-24 00:45:41 +00001436 strm->Printf("frame #%u: ", m_frame_index);
Greg Claytond9e416c2012-02-18 05:35:26 +00001437 ExecutionContext exe_ctx (shared_from_this());
1438 Target *target = exe_ctx.GetTargetPtr();
Daniel Malead01b2952012-11-29 21:49:15 +00001439 strm->Printf("0x%0*" PRIx64 " ",
Greg Claytond9e416c2012-02-18 05:35:26 +00001440 target ? (target->GetArchitecture().GetAddressByteSize() * 2) : 16,
1441 GetFrameCodeAddress().GetLoadAddress(target));
Greg Clayton9da7bd02010-08-24 21:05:24 +00001442 GetSymbolContext(eSymbolContextEverything);
Greg Clayton1b72fcb2010-08-24 00:45:41 +00001443 const bool show_module = true;
1444 const bool show_inline = true;
Jason Molendaaff1b352014-10-10 23:07:36 +00001445 const bool show_function_arguments = true;
Jason Molendac980fa92015-02-13 23:24:21 +00001446 const bool show_function_name = true;
Greg Claytond9e416c2012-02-18 05:35:26 +00001447 m_sc.DumpStopContext (strm,
1448 exe_ctx.GetBestExecutionContextScope(),
1449 GetFrameCodeAddress(),
1450 show_fullpaths,
1451 show_module,
Jason Molendaaff1b352014-10-10 23:07:36 +00001452 show_inline,
Jason Molendac980fa92015-02-13 23:24:21 +00001453 show_function_arguments,
1454 show_function_name);
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001455}
1456
Greg Clayton5082c5f2010-08-27 18:24:16 +00001457void
Jason Molendab57e4a12013-11-04 09:33:30 +00001458StackFrame::UpdateCurrentFrameFromPreviousFrame (StackFrame &prev_frame)
Greg Clayton5082c5f2010-08-27 18:24:16 +00001459{
Jason Molenda6a354702014-10-02 01:08:16 +00001460 Mutex::Locker locker(m_mutex);
Greg Clayton59e8fc1c2010-08-30 18:11:35 +00001461 assert (GetStackID() == prev_frame.GetStackID()); // TODO: remove this after some testing
Jason Molendab57e4a12013-11-04 09:33:30 +00001462 m_variable_list_sp = prev_frame.m_variable_list_sp;
1463 m_variable_list_value_objects.Swap (prev_frame.m_variable_list_value_objects);
1464 if (!m_disassembly.GetString().empty())
1465 m_disassembly.GetString().swap (m_disassembly.GetString());
Greg Clayton5082c5f2010-08-27 18:24:16 +00001466}
Greg Clayton68275d52010-08-27 21:47:54 +00001467
Greg Clayton59e8fc1c2010-08-30 18:11:35 +00001468void
Jason Molendab57e4a12013-11-04 09:33:30 +00001469StackFrame::UpdatePreviousFrameFromCurrentFrame (StackFrame &curr_frame)
Greg Clayton59e8fc1c2010-08-30 18:11:35 +00001470{
Jason Molenda6a354702014-10-02 01:08:16 +00001471 Mutex::Locker locker(m_mutex);
Greg Clayton2cad65a2010-09-03 17:10:42 +00001472 assert (GetStackID() == curr_frame.GetStackID()); // TODO: remove this after some testing
Jason Molendab57e4a12013-11-04 09:33:30 +00001473 m_id.SetPC (curr_frame.m_id.GetPC()); // Update the Stack ID PC value
1474 assert (GetThread() == curr_frame.GetThread());
1475 m_frame_index = curr_frame.m_frame_index;
1476 m_concrete_frame_index = curr_frame.m_concrete_frame_index;
1477 m_reg_context_sp = curr_frame.m_reg_context_sp;
1478 m_frame_code_addr = curr_frame.m_frame_code_addr;
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001479 assert (!m_sc.target_sp || !curr_frame.m_sc.target_sp || m_sc.target_sp.get() == curr_frame.m_sc.target_sp.get());
1480 assert (!m_sc.module_sp || !curr_frame.m_sc.module_sp || m_sc.module_sp.get() == curr_frame.m_sc.module_sp.get());
1481 assert (m_sc.comp_unit == nullptr || curr_frame.m_sc.comp_unit == nullptr || m_sc.comp_unit == curr_frame.m_sc.comp_unit);
1482 assert (m_sc.function == nullptr || curr_frame.m_sc.function == nullptr || m_sc.function == curr_frame.m_sc.function);
Jason Molendab57e4a12013-11-04 09:33:30 +00001483 m_sc = curr_frame.m_sc;
1484 m_flags.Clear(GOT_FRAME_BASE | eSymbolContextEverything);
1485 m_flags.Set (m_sc.GetResolvedMask());
1486 m_frame_base.Clear();
1487 m_frame_base_error.Clear();
Greg Clayton59e8fc1c2010-08-30 18:11:35 +00001488}
1489
Greg Clayton2cad65a2010-09-03 17:10:42 +00001490bool
Jason Molendab57e4a12013-11-04 09:33:30 +00001491StackFrame::HasCachedData () const
1492{
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001493 if (m_variable_list_sp)
Jason Molendab57e4a12013-11-04 09:33:30 +00001494 return true;
1495 if (m_variable_list_value_objects.GetSize() > 0)
1496 return true;
1497 if (!m_disassembly.GetString().empty())
1498 return true;
1499 return false;
1500}
1501
1502bool
Greg Clayton7260f622011-04-18 08:33:37 +00001503StackFrame::GetStatus (Stream& strm,
1504 bool show_frame_info,
Jim Ingham8ec10ef2013-10-18 17:38:31 +00001505 bool show_source,
1506 const char *frame_marker)
Greg Clayton7260f622011-04-18 08:33:37 +00001507{
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001508
Greg Clayton7260f622011-04-18 08:33:37 +00001509 if (show_frame_info)
1510 {
1511 strm.Indent();
Jim Ingham8ec10ef2013-10-18 17:38:31 +00001512 DumpUsingSettingsFormat (&strm, frame_marker);
Greg Clayton7260f622011-04-18 08:33:37 +00001513 }
1514
1515 if (show_source)
1516 {
Greg Claytond9e416c2012-02-18 05:35:26 +00001517 ExecutionContext exe_ctx (shared_from_this());
Mohit K. Bhakkad8be74992015-12-03 04:56:16 +00001518 bool have_source = false, have_debuginfo = false;
Greg Clayton67cc0632012-08-22 17:17:09 +00001519 Debugger::StopDisassemblyType disasm_display = Debugger::eStopDisassemblyTypeNever;
Greg Claytond9e416c2012-02-18 05:35:26 +00001520 Target *target = exe_ctx.GetTargetPtr();
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001521 if (target)
Greg Clayton7260f622011-04-18 08:33:37 +00001522 {
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001523 Debugger &debugger = target->GetDebugger();
1524 const uint32_t source_lines_before = debugger.GetStopSourceLineCount(true);
1525 const uint32_t source_lines_after = debugger.GetStopSourceLineCount(false);
1526 disasm_display = debugger.GetStopDisassemblyDisplay ();
Greg Claytone372b982011-11-21 21:44:34 +00001527
Todd Fiala6d1fbc92014-07-07 20:47:24 +00001528 GetSymbolContext(eSymbolContextCompUnit | eSymbolContextLineEntry);
1529 if (m_sc.comp_unit && m_sc.line_entry.IsValid())
Greg Claytone372b982011-11-21 21:44:34 +00001530 {
Mohit K. Bhakkad8be74992015-12-03 04:56:16 +00001531 have_debuginfo = true;
Todd Fiala6d1fbc92014-07-07 20:47:24 +00001532 if (source_lines_before > 0 || source_lines_after > 0)
Greg Claytone372b982011-11-21 21:44:34 +00001533 {
Mohit K. Bhakkad8be74992015-12-03 04:56:16 +00001534 size_t num_lines = target->GetSourceManager().DisplaySourceLinesWithLineNumbers (m_sc.line_entry.file,
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001535 m_sc.line_entry.line,
1536 source_lines_before,
1537 source_lines_after,
1538 "->",
Jason Molenda7cd81c52013-04-29 09:59:31 +00001539 &strm);
Mohit K. Bhakkad8be74992015-12-03 04:56:16 +00001540 if (num_lines != 0)
1541 have_source = true;
1542 // TODO: Give here a one time warning if source file is missing.
Greg Claytone372b982011-11-21 21:44:34 +00001543 }
1544 }
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001545 switch (disasm_display)
1546 {
Greg Clayton67cc0632012-08-22 17:17:09 +00001547 case Debugger::eStopDisassemblyTypeNever:
Greg Claytone372b982011-11-21 21:44:34 +00001548 break;
Mohit K. Bhakkad8be74992015-12-03 04:56:16 +00001549
1550 case Debugger::eStopDisassemblyTypeNoDebugInfo:
1551 if (have_debuginfo)
1552 break;
Jason Molenda62e06812016-02-16 04:14:33 +00001553 LLVM_FALLTHROUGH;
Mohit K. Bhakkad8be74992015-12-03 04:56:16 +00001554
Greg Clayton67cc0632012-08-22 17:17:09 +00001555 case Debugger::eStopDisassemblyTypeNoSource:
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001556 if (have_source)
1557 break;
Jason Molenda62e06812016-02-16 04:14:33 +00001558 LLVM_FALLTHROUGH;
Mohit K. Bhakkad8be74992015-12-03 04:56:16 +00001559
Greg Clayton67cc0632012-08-22 17:17:09 +00001560 case Debugger::eStopDisassemblyTypeAlways:
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001561 if (target)
Greg Claytone372b982011-11-21 21:44:34 +00001562 {
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001563 const uint32_t disasm_lines = debugger.GetDisassemblyLineCount();
1564 if (disasm_lines > 0)
1565 {
1566 const ArchSpec &target_arch = target->GetArchitecture();
1567 AddressRange pc_range;
1568 pc_range.GetBaseAddress() = GetFrameCodeAddress();
1569 pc_range.SetByteSize(disasm_lines * target_arch.GetMaximumOpcodeByteSize());
Eugene Zelenkod70a6e72016-02-18 18:52:47 +00001570 const char *plugin_name = nullptr;
1571 const char *flavor = nullptr;
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001572 Disassembler::Disassemble (target->GetDebugger(),
1573 target_arch,
Jim Ingham0f063ba2013-03-02 00:26:47 +00001574 plugin_name,
1575 flavor,
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001576 exe_ctx,
1577 pc_range,
1578 disasm_lines,
1579 0,
1580 Disassembler::eOptionMarkPCAddress,
1581 strm);
1582 }
Greg Claytone372b982011-11-21 21:44:34 +00001583 }
Greg Clayton53eb7ad2012-07-11 20:33:48 +00001584 break;
Greg Claytone372b982011-11-21 21:44:34 +00001585 }
Greg Clayton7260f622011-04-18 08:33:37 +00001586 }
1587 }
1588 return true;
1589}