1 //===-- 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 
10 #include "lldb/API/SBFrame.h"
11 
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"
19 #include "lldb/Core/Log.h"
20 #include "lldb/Core/Stream.h"
21 #include "lldb/Core/StreamFile.h"
22 #include "lldb/Core/ValueObjectRegister.h"
23 #include "lldb/Core/ValueObjectVariable.h"
24 #include "lldb/Expression/ClangUserExpression.h"
25 #include "lldb/Symbol/Block.h"
26 #include "lldb/Symbol/SymbolContext.h"
27 #include "lldb/Symbol/VariableList.h"
28 #include "lldb/Symbol/Variable.h"
29 #include "lldb/Target/ExecutionContext.h"
30 #include "lldb/Target/Target.h"
31 #include "lldb/Target/Process.h"
32 #include "lldb/Target/RegisterContext.h"
33 #include "lldb/Target/StackFrame.h"
34 #include "lldb/Target/Thread.h"
35 
36 #include "lldb/API/SBDebugger.h"
37 #include "lldb/API/SBValue.h"
38 #include "lldb/API/SBAddress.h"
39 #include "lldb/API/SBStream.h"
40 #include "lldb/API/SBSymbolContext.h"
41 #include "lldb/API/SBThread.h"
42 
43 using namespace lldb;
44 using namespace lldb_private;
45 
46 SBFrame::SBFrame () :
47     m_opaque_sp ()
48 {
49 }
50 
51 SBFrame::SBFrame (const StackFrameSP &lldb_object_sp) :
52     m_opaque_sp (lldb_object_sp)
53 {
54     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
55 
56     if (log)
57     {
58         SBStream sstr;
59         GetDescription (sstr);
60         log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s",
61                      lldb_object_sp.get(), m_opaque_sp.get(), sstr.GetData());
62 
63     }
64 }
65 
66 SBFrame::SBFrame(const SBFrame &rhs) :
67     m_opaque_sp (rhs.m_opaque_sp)
68 {
69 }
70 
71 const SBFrame &
72 SBFrame::operator = (const SBFrame &rhs)
73 {
74     if (this != &rhs)
75         m_opaque_sp = rhs.m_opaque_sp;
76     return *this;
77 }
78 
79 SBFrame::~SBFrame()
80 {
81 }
82 
83 
84 void
85 SBFrame::SetFrame (const StackFrameSP &lldb_object_sp)
86 {
87     void *old_ptr = m_opaque_sp.get();
88     m_opaque_sp = lldb_object_sp;
89     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
90 
91     if (log)
92     {
93         log->Printf ("SBFrame(%p)::SetFrame(sp=%p) := SBFrame(%p)",
94                      old_ptr, lldb_object_sp.get(), m_opaque_sp.get());
95     }
96 
97 }
98 
99 
100 bool
101 SBFrame::IsValid() const
102 {
103     return (m_opaque_sp.get() != NULL);
104 }
105 
106 SBSymbolContext
107 SBFrame::GetSymbolContext (uint32_t resolve_scope) const
108 {
109 
110     SBSymbolContext sb_sym_ctx;
111     if (m_opaque_sp)
112     {
113         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
114         sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope));
115     }
116 
117     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
118     if (log)
119         log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)",
120                      m_opaque_sp.get(), resolve_scope, sb_sym_ctx.get());
121 
122     return sb_sym_ctx;
123 }
124 
125 SBModule
126 SBFrame::GetModule () const
127 {
128     SBModule sb_module;
129     if (m_opaque_sp)
130     {
131         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
132         *sb_module = m_opaque_sp->GetSymbolContext (eSymbolContextModule).module_sp;
133     }
134 
135     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
136     if (log)
137         log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)",
138                      m_opaque_sp.get(), sb_module.get());
139 
140     return sb_module;
141 }
142 
143 SBCompileUnit
144 SBFrame::GetCompileUnit () const
145 {
146     SBCompileUnit sb_comp_unit;
147     if (m_opaque_sp)
148     {
149         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
150         sb_comp_unit.reset (m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit);
151     }
152     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
153     if (log)
154         log->Printf ("SBFrame(%p)::GetModule () => SBCompileUnit(%p)",
155                      m_opaque_sp.get(), sb_comp_unit.get());
156 
157     return sb_comp_unit;
158 }
159 
160 SBFunction
161 SBFrame::GetFunction () const
162 {
163     SBFunction sb_function;
164     if (m_opaque_sp)
165     {
166         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
167         sb_function.reset(m_opaque_sp->GetSymbolContext (eSymbolContextFunction).function);
168     }
169     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
170     if (log)
171         log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)",
172                      m_opaque_sp.get(), sb_function.get());
173 
174     return sb_function;
175 }
176 
177 SBSymbol
178 SBFrame::GetSymbol () const
179 {
180     SBSymbol sb_symbol;
181     if (m_opaque_sp)
182     {
183         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
184         sb_symbol.reset(m_opaque_sp->GetSymbolContext (eSymbolContextSymbol).symbol);
185     }
186     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
187     if (log)
188         log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)",
189                      m_opaque_sp.get(), sb_symbol.get());
190     return sb_symbol;
191 }
192 
193 SBBlock
194 SBFrame::GetBlock () const
195 {
196     SBBlock sb_block;
197     if (m_opaque_sp)
198     {
199         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
200         sb_block.reset (m_opaque_sp->GetSymbolContext (eSymbolContextBlock).block);
201     }
202     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
203     if (log)
204         log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)",
205                      m_opaque_sp.get(), sb_block.get());
206     return sb_block;
207 }
208 
209 SBBlock
210 SBFrame::GetFrameBlock () const
211 {
212     SBBlock sb_block;
213     if (m_opaque_sp)
214     {
215         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
216         sb_block.reset(m_opaque_sp->GetFrameBlock ());
217     }
218     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
219     if (log)
220         log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)",
221                      m_opaque_sp.get(), sb_block.get());
222     return sb_block;
223 }
224 
225 SBLineEntry
226 SBFrame::GetLineEntry () const
227 {
228     SBLineEntry sb_line_entry;
229     if (m_opaque_sp)
230     {
231         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
232         sb_line_entry.SetLineEntry (m_opaque_sp->GetSymbolContext (eSymbolContextLineEntry).line_entry);
233     }
234     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
235     if (log)
236         log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)",
237                      m_opaque_sp.get(), sb_line_entry.get());
238     return sb_line_entry;
239 }
240 
241 uint32_t
242 SBFrame::GetFrameID () const
243 {
244     uint32_t frame_idx = m_opaque_sp ? m_opaque_sp->GetFrameIndex () : UINT32_MAX;
245 
246     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
247     if (log)
248         log->Printf ("SBFrame(%p)::GetFrameID () => %u",
249                      m_opaque_sp.get(), frame_idx);
250     return frame_idx;
251 }
252 
253 addr_t
254 SBFrame::GetPC () const
255 {
256     addr_t addr = LLDB_INVALID_ADDRESS;
257     if (m_opaque_sp)
258     {
259         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
260         addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget());
261     }
262 
263     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
264     if (log)
265         log->Printf ("SBFrame(%p)::GetPC () => 0x%llx", m_opaque_sp.get(), addr);
266 
267     return addr;
268 }
269 
270 bool
271 SBFrame::SetPC (addr_t new_pc)
272 {
273     bool ret_val = false;
274     if (m_opaque_sp)
275     {
276         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
277         ret_val = m_opaque_sp->GetRegisterContext()->SetPC (new_pc);
278     }
279 
280     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
281     if (log)
282         log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%llx) => %i",
283                      m_opaque_sp.get(), new_pc, ret_val);
284 
285     return ret_val;
286 }
287 
288 addr_t
289 SBFrame::GetSP () const
290 {
291     addr_t addr = LLDB_INVALID_ADDRESS;
292     if (m_opaque_sp)
293     {
294         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
295         addr = m_opaque_sp->GetRegisterContext()->GetSP();
296     }
297     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
298     if (log)
299         log->Printf ("SBFrame(%p)::GetSP () => 0x%llx", m_opaque_sp.get(), addr);
300 
301     return addr;
302 }
303 
304 
305 addr_t
306 SBFrame::GetFP () const
307 {
308     addr_t addr = LLDB_INVALID_ADDRESS;
309     if (m_opaque_sp)
310     {
311         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
312         addr = m_opaque_sp->GetRegisterContext()->GetFP();
313     }
314 
315     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
316     if (log)
317         log->Printf ("SBFrame(%p)::GetFP () => 0x%llx", m_opaque_sp.get(), addr);
318     return addr;
319 }
320 
321 
322 SBAddress
323 SBFrame::GetPCAddress () const
324 {
325     SBAddress sb_addr;
326     if (m_opaque_sp)
327     {
328         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
329         sb_addr.SetAddress (&m_opaque_sp->GetFrameCodeAddress());
330     }
331     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
332     if (log)
333         log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", m_opaque_sp.get(), sb_addr.get());
334     return sb_addr;
335 }
336 
337 void
338 SBFrame::Clear()
339 {
340     m_opaque_sp.reset();
341 }
342 
343 SBValue
344 SBFrame::FindVariable (const char *name)
345 {
346     VariableSP var_sp;
347     if (m_opaque_sp && name && name[0])
348     {
349         VariableList variable_list;
350         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
351         SymbolContext sc (m_opaque_sp->GetSymbolContext (eSymbolContextBlock));
352 
353         if (sc.block)
354         {
355             const bool can_create = true;
356             const bool get_parent_variables = true;
357             const bool stop_if_block_is_inlined_function = true;
358 
359             if (sc.block->AppendVariables (can_create,
360                                            get_parent_variables,
361                                            stop_if_block_is_inlined_function,
362                                            &variable_list))
363             {
364                 var_sp = variable_list.FindVariable (ConstString(name));
365             }
366         }
367     }
368 
369     SBValue sb_value;
370 
371     if (var_sp)
372         *sb_value = ValueObjectSP (new ValueObjectVariable (m_opaque_sp.get(), var_sp));
373 
374     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
375     if (log)
376         log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
377                      m_opaque_sp.get(), name, sb_value.get());
378 
379     return sb_value;
380 }
381 
382 SBValue
383 SBFrame::FindValue (const char *name, ValueType value_type)
384 {
385     SBValue sb_value;
386     if (m_opaque_sp && name && name[0])
387     {
388         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
389 
390         switch (value_type)
391         {
392         case eValueTypeVariableGlobal:      // global variable
393         case eValueTypeVariableStatic:      // static variable
394         case eValueTypeVariableArgument:    // function argument variables
395         case eValueTypeVariableLocal:       // function local variables
396             {
397                 VariableList *variable_list = m_opaque_sp->GetVariableList(true);
398 
399                 SymbolContext sc (m_opaque_sp->GetSymbolContext (eSymbolContextBlock));
400 
401                 const bool can_create = true;
402                 const bool get_parent_variables = true;
403                 const bool stop_if_block_is_inlined_function = true;
404 
405                 if (sc.block && sc.block->AppendVariables (can_create,
406                                                            get_parent_variables,
407                                                            stop_if_block_is_inlined_function,
408                                                            variable_list))
409                 {
410                     ConstString const_name(name);
411                     const uint32_t num_variables = variable_list->GetSize();
412                     for (uint32_t i = 0; i < num_variables; ++i)
413                     {
414                         VariableSP variable_sp (variable_list->GetVariableAtIndex(i));
415                         if (variable_sp &&
416                             variable_sp->GetScope() == value_type &&
417                             variable_sp->GetName() == const_name)
418                         {
419                             *sb_value = ValueObjectSP (new ValueObjectVariable (m_opaque_sp.get(), variable_sp));
420                             break;
421                         }
422                     }
423                 }
424             }
425             break;
426 
427         case eValueTypeRegister:            // stack frame register value
428             {
429                 RegisterContextSP reg_ctx (m_opaque_sp->GetRegisterContext());
430                 if (reg_ctx)
431                 {
432                     const uint32_t num_regs = reg_ctx->GetRegisterCount();
433                     for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx)
434                     {
435                         const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex (reg_idx);
436                         if (reg_info &&
437                             ((reg_info->name && strcasecmp (reg_info->name, name) == 0) ||
438                              (reg_info->alt_name && strcasecmp (reg_info->alt_name, name) == 0)))
439                         {
440                             *sb_value = ValueObjectSP (new ValueObjectRegister (m_opaque_sp.get(), reg_ctx, reg_idx));
441                         }
442                     }
443                 }
444             }
445             break;
446 
447         case eValueTypeRegisterSet:         // A collection of stack frame register values
448             {
449                 RegisterContextSP reg_ctx (m_opaque_sp->GetRegisterContext());
450                 if (reg_ctx)
451                 {
452                     const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
453                     for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx)
454                     {
455                         const RegisterSet *reg_set = reg_ctx->GetRegisterSet (set_idx);
456                         if (reg_set &&
457                             ((reg_set->name && strcasecmp (reg_set->name, name) == 0) ||
458                              (reg_set->short_name && strcasecmp (reg_set->short_name, name) == 0)))
459                         {
460                             *sb_value = ValueObjectSP (new ValueObjectRegisterSet (m_opaque_sp.get(), reg_ctx, set_idx));
461                         }
462                     }
463                 }
464             }
465             break;
466 
467         case eValueTypeConstResult:         // constant result variables
468             {
469                 ConstString const_name(name);
470                 ClangExpressionVariableSP expr_var_sp (m_opaque_sp->GetThread().GetProcess().GetTarget().GetPersistentVariables().GetVariable (const_name));
471                 if (expr_var_sp)
472                     *sb_value = expr_var_sp->GetValueObject();
473             }
474             break;
475 
476         default:
477             break;
478         }
479     }
480 
481     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
482     if (log)
483         log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)",
484                      m_opaque_sp.get(), name, value_type, sb_value.get());
485 
486 
487     return sb_value;
488 }
489 
490 bool
491 SBFrame::operator == (const SBFrame &rhs) const
492 {
493     return m_opaque_sp.get() == rhs.m_opaque_sp.get();
494 }
495 
496 bool
497 SBFrame::operator != (const SBFrame &rhs) const
498 {
499     return m_opaque_sp.get() != rhs.m_opaque_sp.get();
500 }
501 
502 lldb_private::StackFrame *
503 SBFrame::operator->() const
504 {
505     return m_opaque_sp.get();
506 }
507 
508 lldb_private::StackFrame *
509 SBFrame::get() const
510 {
511     return m_opaque_sp.get();
512 }
513 
514 const lldb::StackFrameSP &
515 SBFrame::get_sp() const
516 {
517     return m_opaque_sp;
518 }
519 
520 SBThread
521 SBFrame::GetThread () const
522 {
523     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
524 
525     SBThread sb_thread;
526     if (m_opaque_sp)
527     {
528         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
529         sb_thread.SetThread (m_opaque_sp->GetThread().GetSP());
530     }
531 
532     if (log)
533     {
534         SBStream sstr;
535         sb_thread.GetDescription (sstr);
536         log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s", m_opaque_sp.get(),
537                      sb_thread.get(), sstr.GetData());
538     }
539 
540     return sb_thread;
541 }
542 
543 const char *
544 SBFrame::Disassemble () const
545 {
546     const char *disassembly = NULL;
547     if (m_opaque_sp)
548     {
549         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
550         disassembly = m_opaque_sp->Disassemble();
551     }
552     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
553 
554     if (log)
555         log->Printf ("SBFrame(%p)::Disassemble () => %s", m_opaque_sp.get(), disassembly);
556 
557     return disassembly;
558 }
559 
560 
561 SBValueList
562 SBFrame::GetVariables (bool arguments,
563                        bool locals,
564                        bool statics,
565                        bool in_scope_only)
566 {
567     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
568 
569     if (log)
570         log->Printf ("SBFrame(%p)::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)",
571                      m_opaque_sp.get(),
572                      arguments,
573                      locals,
574                      statics,
575                      in_scope_only);
576 
577     SBValueList value_list;
578     if (m_opaque_sp)
579     {
580 
581         size_t i;
582         VariableList *variable_list = NULL;
583         // Scope for locker
584         {
585             Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
586             variable_list = m_opaque_sp->GetVariableList(true);
587         }
588         if (variable_list)
589         {
590             const size_t num_variables = variable_list->GetSize();
591             if (num_variables)
592             {
593                 for (i = 0; i < num_variables; ++i)
594                 {
595                     VariableSP variable_sp (variable_list->GetVariableAtIndex(i));
596                     if (variable_sp)
597                     {
598                         bool add_variable = false;
599                         switch (variable_sp->GetScope())
600                         {
601                         case eValueTypeVariableGlobal:
602                         case eValueTypeVariableStatic:
603                             add_variable = statics;
604                             break;
605 
606                         case eValueTypeVariableArgument:
607                             add_variable = arguments;
608                             break;
609 
610                         case eValueTypeVariableLocal:
611                             add_variable = locals;
612                             break;
613 
614                         default:
615                             break;
616                         }
617                         if (add_variable)
618                         {
619                             if (in_scope_only && !variable_sp->IsInScope(m_opaque_sp.get()))
620                                 continue;
621 
622                             value_list.Append(m_opaque_sp->GetValueObjectForFrameVariable (variable_sp));
623                         }
624                     }
625                 }
626             }
627         }
628     }
629 
630     if (log)
631     {
632         log->Printf ("SBFrame(%p)::GetVariables (...) => SBValueList(%p)", m_opaque_sp.get(),
633                      value_list.get());
634     }
635 
636     return value_list;
637 }
638 
639 SBValueList
640 SBFrame::GetRegisters ()
641 {
642     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
643 
644     SBValueList value_list;
645     if (m_opaque_sp)
646     {
647         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
648         RegisterContextSP reg_ctx (m_opaque_sp->GetRegisterContext());
649         if (reg_ctx)
650         {
651             const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
652             for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx)
653             {
654                 value_list.Append(ValueObjectSP (new ValueObjectRegisterSet (m_opaque_sp.get(), reg_ctx, set_idx)));
655             }
656         }
657     }
658 
659     if (log)
660         log->Printf ("SBFrame(%p)::Registers () => SBValueList(%p)", m_opaque_sp.get(), value_list.get());
661 
662     return value_list;
663 }
664 
665 bool
666 SBFrame::GetDescription (SBStream &description)
667 {
668     if (m_opaque_sp)
669     {
670         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
671         Stream &s = description.ref();
672         m_opaque_sp->DumpUsingSettingsFormat (&s);
673     }
674     else
675         description.Printf ("No value");
676 
677     return true;
678 }
679 
680 SBValue
681 SBFrame::EvaluateExpression (const char *expr)
682 {
683     Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
684 
685     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
686 
687     LogSP expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
688 
689     SBValue expr_result;
690     if (log)
691         log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\")...", m_opaque_sp.get(), expr);
692 
693     if (m_opaque_sp)
694     {
695         ExecutionResults exe_results;
696         const bool unwind_on_error = true;
697         const bool keep_in_memory = false;
698 
699         exe_results = m_opaque_sp->GetThread().GetProcess().GetTarget().EvaluateExpression(expr, m_opaque_sp.get(), unwind_on_error, keep_in_memory, *expr_result);
700     }
701 
702     if (expr_log)
703         expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **", expr_result.GetValue(*this), expr_result.GetSummary(*this));
704 
705     if (log)
706         log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p)", m_opaque_sp.get(), expr, expr_result.get());
707 
708     return expr_result;
709 }
710