1 //===-- SBFrame.cpp ---------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
14 #include "lldb/API/SBFrame.h"
16 #include "lldb/lldb-types.h"
18 #include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
19 #include "lldb/Core/Address.h"
20 #include "lldb/Core/StreamFile.h"
21 #include "lldb/Core/ValueObjectRegister.h"
22 #include "lldb/Core/ValueObjectVariable.h"
23 #include "lldb/Expression/UserExpression.h"
24 #include "lldb/Host/Host.h"
25 #include "lldb/Symbol/Block.h"
26 #include "lldb/Symbol/Function.h"
27 #include "lldb/Symbol/Symbol.h"
28 #include "lldb/Symbol/SymbolContext.h"
29 #include "lldb/Symbol/Variable.h"
30 #include "lldb/Symbol/VariableList.h"
31 #include "lldb/Target/ExecutionContext.h"
32 #include "lldb/Target/Process.h"
33 #include "lldb/Target/RegisterContext.h"
34 #include "lldb/Target/StackFrame.h"
35 #include "lldb/Target/StackFrameRecognizer.h"
36 #include "lldb/Target/StackID.h"
37 #include "lldb/Target/Target.h"
38 #include "lldb/Target/Thread.h"
39 #include "lldb/Utility/ConstString.h"
40 #include "lldb/Utility/Log.h"
41 #include "lldb/Utility/Stream.h"
43 #include "lldb/API/SBAddress.h"
44 #include "lldb/API/SBDebugger.h"
45 #include "lldb/API/SBExpressionOptions.h"
46 #include "lldb/API/SBStream.h"
47 #include "lldb/API/SBSymbolContext.h"
48 #include "lldb/API/SBThread.h"
49 #include "lldb/API/SBValue.h"
50 #include "lldb/API/SBVariablesOptions.h"
52 #include "llvm/Support/PrettyStackTrace.h"
55 using namespace lldb_private;
57 SBFrame::SBFrame() : m_opaque_sp(new ExecutionContextRef()) {}
59 SBFrame::SBFrame(const StackFrameSP &lldb_object_sp)
60 : m_opaque_sp(new ExecutionContextRef(lldb_object_sp)) {
61 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
66 log->Printf("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s",
67 static_cast<void *>(lldb_object_sp.get()),
68 static_cast<void *>(lldb_object_sp.get()), sstr.GetData());
72 SBFrame::SBFrame(const SBFrame &rhs)
73 : m_opaque_sp(new ExecutionContextRef(*rhs.m_opaque_sp)) {}
75 SBFrame::~SBFrame() = default;
77 const SBFrame &SBFrame::operator=(const SBFrame &rhs) {
79 *m_opaque_sp = *rhs.m_opaque_sp;
83 StackFrameSP SBFrame::GetFrameSP() const {
84 return (m_opaque_sp ? m_opaque_sp->GetFrameSP() : StackFrameSP());
87 void SBFrame::SetFrameSP(const StackFrameSP &lldb_object_sp) {
88 return m_opaque_sp->SetFrameSP(lldb_object_sp);
91 bool SBFrame::IsValid() const {
92 std::unique_lock<std::recursive_mutex> lock;
93 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
95 Target *target = exe_ctx.GetTargetPtr();
96 Process *process = exe_ctx.GetProcessPtr();
97 if (target && process) {
98 Process::StopLocker stop_locker;
99 if (stop_locker.TryLock(&process->GetRunLock()))
100 return GetFrameSP().get() != nullptr;
103 // Without a target & process we can't have a valid stack frame.
107 SBSymbolContext SBFrame::GetSymbolContext(uint32_t resolve_scope) const {
108 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
109 SBSymbolContext sb_sym_ctx;
110 std::unique_lock<std::recursive_mutex> lock;
111 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
112 SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
113 StackFrame *frame = nullptr;
114 Target *target = exe_ctx.GetTargetPtr();
115 Process *process = exe_ctx.GetProcessPtr();
116 if (target && process) {
117 Process::StopLocker stop_locker;
118 if (stop_locker.TryLock(&process->GetRunLock())) {
119 frame = exe_ctx.GetFramePtr();
121 sb_sym_ctx.SetSymbolContext(&frame->GetSymbolContext(scope));
124 log->Printf("SBFrame::GetVariables () => error: could not "
125 "reconstruct frame object for this SBFrame.");
130 "SBFrame::GetSymbolContext () => error: process is running");
135 log->Printf("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => "
136 "SBSymbolContext(%p)",
137 static_cast<void *>(frame), resolve_scope,
138 static_cast<void *>(sb_sym_ctx.get()));
143 SBModule SBFrame::GetModule() const {
144 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
147 std::unique_lock<std::recursive_mutex> lock;
148 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
150 StackFrame *frame = nullptr;
151 Target *target = exe_ctx.GetTargetPtr();
152 Process *process = exe_ctx.GetProcessPtr();
153 if (target && process) {
154 Process::StopLocker stop_locker;
155 if (stop_locker.TryLock(&process->GetRunLock())) {
156 frame = exe_ctx.GetFramePtr();
158 module_sp = frame->GetSymbolContext(eSymbolContextModule).module_sp;
159 sb_module.SetSP(module_sp);
162 log->Printf("SBFrame::GetModule () => error: could not reconstruct "
163 "frame object for this SBFrame.");
167 log->Printf("SBFrame::GetModule () => error: process is running");
172 log->Printf("SBFrame(%p)::GetModule () => SBModule(%p)",
173 static_cast<void *>(frame),
174 static_cast<void *>(module_sp.get()));
179 SBCompileUnit SBFrame::GetCompileUnit() const {
180 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
181 SBCompileUnit sb_comp_unit;
182 std::unique_lock<std::recursive_mutex> lock;
183 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
185 StackFrame *frame = nullptr;
186 Target *target = exe_ctx.GetTargetPtr();
187 Process *process = exe_ctx.GetProcessPtr();
188 if (target && process) {
189 Process::StopLocker stop_locker;
190 if (stop_locker.TryLock(&process->GetRunLock())) {
191 frame = exe_ctx.GetFramePtr();
194 frame->GetSymbolContext(eSymbolContextCompUnit).comp_unit);
197 log->Printf("SBFrame::GetCompileUnit () => error: could not "
198 "reconstruct frame object for this SBFrame.");
202 log->Printf("SBFrame::GetCompileUnit () => error: process is running");
206 log->Printf("SBFrame(%p)::GetCompileUnit () => SBCompileUnit(%p)",
207 static_cast<void *>(frame),
208 static_cast<void *>(sb_comp_unit.get()));
213 SBFunction SBFrame::GetFunction() const {
214 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
215 SBFunction sb_function;
216 std::unique_lock<std::recursive_mutex> lock;
217 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
219 StackFrame *frame = nullptr;
220 Target *target = exe_ctx.GetTargetPtr();
221 Process *process = exe_ctx.GetProcessPtr();
222 if (target && process) {
223 Process::StopLocker stop_locker;
224 if (stop_locker.TryLock(&process->GetRunLock())) {
225 frame = exe_ctx.GetFramePtr();
228 frame->GetSymbolContext(eSymbolContextFunction).function);
231 log->Printf("SBFrame::GetFunction () => error: could not reconstruct "
232 "frame object for this SBFrame.");
236 log->Printf("SBFrame::GetFunction () => error: process is running");
240 log->Printf("SBFrame(%p)::GetFunction () => SBFunction(%p)",
241 static_cast<void *>(frame),
242 static_cast<void *>(sb_function.get()));
247 SBSymbol SBFrame::GetSymbol() const {
248 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
250 std::unique_lock<std::recursive_mutex> lock;
251 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
253 StackFrame *frame = nullptr;
254 Target *target = exe_ctx.GetTargetPtr();
255 Process *process = exe_ctx.GetProcessPtr();
256 if (target && process) {
257 Process::StopLocker stop_locker;
258 if (stop_locker.TryLock(&process->GetRunLock())) {
259 frame = exe_ctx.GetFramePtr();
261 sb_symbol.reset(frame->GetSymbolContext(eSymbolContextSymbol).symbol);
264 log->Printf("SBFrame::GetSymbol () => error: could not reconstruct "
265 "frame object for this SBFrame.");
269 log->Printf("SBFrame::GetSymbol () => error: process is running");
273 log->Printf("SBFrame(%p)::GetSymbol () => SBSymbol(%p)",
274 static_cast<void *>(frame),
275 static_cast<void *>(sb_symbol.get()));
279 SBBlock SBFrame::GetBlock() const {
280 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
282 std::unique_lock<std::recursive_mutex> lock;
283 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
285 StackFrame *frame = nullptr;
286 Target *target = exe_ctx.GetTargetPtr();
287 Process *process = exe_ctx.GetProcessPtr();
288 if (target && process) {
289 Process::StopLocker stop_locker;
290 if (stop_locker.TryLock(&process->GetRunLock())) {
291 frame = exe_ctx.GetFramePtr();
293 sb_block.SetPtr(frame->GetSymbolContext(eSymbolContextBlock).block);
296 log->Printf("SBFrame::GetBlock () => error: could not reconstruct "
297 "frame object for this SBFrame.");
301 log->Printf("SBFrame(%p)::GetBlock () => error: process is running",
302 static_cast<void *>(frame));
306 log->Printf("SBFrame(%p)::GetBlock () => SBBlock(%p)",
307 static_cast<void *>(frame),
308 static_cast<void *>(sb_block.GetPtr()));
312 SBBlock SBFrame::GetFrameBlock() const {
314 std::unique_lock<std::recursive_mutex> lock;
315 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
317 StackFrame *frame = nullptr;
318 Target *target = exe_ctx.GetTargetPtr();
319 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
320 Process *process = exe_ctx.GetProcessPtr();
321 if (target && process) {
322 Process::StopLocker stop_locker;
323 if (stop_locker.TryLock(&process->GetRunLock())) {
324 frame = exe_ctx.GetFramePtr();
326 sb_block.SetPtr(frame->GetFrameBlock());
329 log->Printf("SBFrame::GetFrameBlock () => error: could not "
330 "reconstruct frame object for this SBFrame.");
334 log->Printf("SBFrame::GetFrameBlock () => error: process is running");
338 log->Printf("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)",
339 static_cast<void *>(frame),
340 static_cast<void *>(sb_block.GetPtr()));
344 SBLineEntry SBFrame::GetLineEntry() const {
345 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
346 SBLineEntry sb_line_entry;
347 std::unique_lock<std::recursive_mutex> lock;
348 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
350 StackFrame *frame = nullptr;
351 Target *target = exe_ctx.GetTargetPtr();
352 Process *process = exe_ctx.GetProcessPtr();
353 if (target && process) {
354 Process::StopLocker stop_locker;
355 if (stop_locker.TryLock(&process->GetRunLock())) {
356 frame = exe_ctx.GetFramePtr();
358 sb_line_entry.SetLineEntry(
359 frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
362 log->Printf("SBFrame::GetLineEntry () => error: could not "
363 "reconstruct frame object for this SBFrame.");
367 log->Printf("SBFrame::GetLineEntry () => error: process is running");
371 log->Printf("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)",
372 static_cast<void *>(frame),
373 static_cast<void *>(sb_line_entry.get()));
374 return sb_line_entry;
377 uint32_t SBFrame::GetFrameID() const {
378 uint32_t frame_idx = UINT32_MAX;
380 std::unique_lock<std::recursive_mutex> lock;
381 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
383 StackFrame *frame = exe_ctx.GetFramePtr();
385 frame_idx = frame->GetFrameIndex();
387 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
389 log->Printf("SBFrame(%p)::GetFrameID () => %u", static_cast<void *>(frame),
394 lldb::addr_t SBFrame::GetCFA() const {
395 std::unique_lock<std::recursive_mutex> lock;
396 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
398 StackFrame *frame = exe_ctx.GetFramePtr();
400 return frame->GetStackID().GetCallFrameAddress();
401 return LLDB_INVALID_ADDRESS;
404 addr_t SBFrame::GetPC() const {
405 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
406 addr_t addr = LLDB_INVALID_ADDRESS;
407 std::unique_lock<std::recursive_mutex> lock;
408 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
410 StackFrame *frame = nullptr;
411 Target *target = exe_ctx.GetTargetPtr();
412 Process *process = exe_ctx.GetProcessPtr();
413 if (target && process) {
414 Process::StopLocker stop_locker;
415 if (stop_locker.TryLock(&process->GetRunLock())) {
416 frame = exe_ctx.GetFramePtr();
418 addr = frame->GetFrameCodeAddress().GetOpcodeLoadAddress(
419 target, AddressClass::eCode);
422 log->Printf("SBFrame::GetPC () => error: could not reconstruct frame "
423 "object for this SBFrame.");
427 log->Printf("SBFrame::GetPC () => error: process is running");
432 log->Printf("SBFrame(%p)::GetPC () => 0x%" PRIx64,
433 static_cast<void *>(frame), addr);
438 bool SBFrame::SetPC(addr_t new_pc) {
439 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
440 bool ret_val = false;
441 std::unique_lock<std::recursive_mutex> lock;
442 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
444 StackFrame *frame = nullptr;
445 Target *target = exe_ctx.GetTargetPtr();
446 Process *process = exe_ctx.GetProcessPtr();
447 if (target && process) {
448 Process::StopLocker stop_locker;
449 if (stop_locker.TryLock(&process->GetRunLock())) {
450 frame = exe_ctx.GetFramePtr();
452 ret_val = frame->GetRegisterContext()->SetPC(new_pc);
455 log->Printf("SBFrame::SetPC () => error: could not reconstruct frame "
456 "object for this SBFrame.");
460 log->Printf("SBFrame::SetPC () => error: process is running");
465 log->Printf("SBFrame(%p)::SetPC (new_pc=0x%" PRIx64 ") => %i",
466 static_cast<void *>(frame), new_pc, ret_val);
471 addr_t SBFrame::GetSP() const {
472 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
473 addr_t addr = LLDB_INVALID_ADDRESS;
474 std::unique_lock<std::recursive_mutex> lock;
475 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
477 StackFrame *frame = nullptr;
478 Target *target = exe_ctx.GetTargetPtr();
479 Process *process = exe_ctx.GetProcessPtr();
480 if (target && process) {
481 Process::StopLocker stop_locker;
482 if (stop_locker.TryLock(&process->GetRunLock())) {
483 frame = exe_ctx.GetFramePtr();
485 addr = frame->GetRegisterContext()->GetSP();
488 log->Printf("SBFrame::GetSP () => error: could not reconstruct frame "
489 "object for this SBFrame.");
493 log->Printf("SBFrame::GetSP () => error: process is running");
497 log->Printf("SBFrame(%p)::GetSP () => 0x%" PRIx64,
498 static_cast<void *>(frame), addr);
503 addr_t SBFrame::GetFP() const {
504 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
505 addr_t addr = LLDB_INVALID_ADDRESS;
506 std::unique_lock<std::recursive_mutex> lock;
507 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
509 StackFrame *frame = nullptr;
510 Target *target = exe_ctx.GetTargetPtr();
511 Process *process = exe_ctx.GetProcessPtr();
512 if (target && process) {
513 Process::StopLocker stop_locker;
514 if (stop_locker.TryLock(&process->GetRunLock())) {
515 frame = exe_ctx.GetFramePtr();
517 addr = frame->GetRegisterContext()->GetFP();
520 log->Printf("SBFrame::GetFP () => error: could not reconstruct frame "
521 "object for this SBFrame.");
525 log->Printf("SBFrame::GetFP () => error: process is running");
530 log->Printf("SBFrame(%p)::GetFP () => 0x%" PRIx64,
531 static_cast<void *>(frame), addr);
535 SBAddress SBFrame::GetPCAddress() const {
536 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
538 std::unique_lock<std::recursive_mutex> lock;
539 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
541 StackFrame *frame = exe_ctx.GetFramePtr();
542 Target *target = exe_ctx.GetTargetPtr();
543 Process *process = exe_ctx.GetProcessPtr();
544 if (target && process) {
545 Process::StopLocker stop_locker;
546 if (stop_locker.TryLock(&process->GetRunLock())) {
547 frame = exe_ctx.GetFramePtr();
549 sb_addr.SetAddress(&frame->GetFrameCodeAddress());
552 log->Printf("SBFrame::GetPCAddress () => error: could not "
553 "reconstruct frame object for this SBFrame.");
557 log->Printf("SBFrame::GetPCAddress () => error: process is running");
561 log->Printf("SBFrame(%p)::GetPCAddress () => SBAddress(%p)",
562 static_cast<void *>(frame), static_cast<void *>(sb_addr.get()));
566 void SBFrame::Clear() { m_opaque_sp->Clear(); }
568 lldb::SBValue SBFrame::GetValueForVariablePath(const char *var_path) {
570 std::unique_lock<std::recursive_mutex> lock;
571 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
573 StackFrame *frame = exe_ctx.GetFramePtr();
574 Target *target = exe_ctx.GetTargetPtr();
575 if (frame && target) {
576 lldb::DynamicValueType use_dynamic =
577 frame->CalculateTarget()->GetPreferDynamicValue();
578 sb_value = GetValueForVariablePath(var_path, use_dynamic);
583 lldb::SBValue SBFrame::GetValueForVariablePath(const char *var_path,
584 DynamicValueType use_dynamic) {
586 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
587 if (var_path == nullptr || var_path[0] == '\0') {
590 "SBFrame::GetValueForVariablePath called with empty variable path.");
594 std::unique_lock<std::recursive_mutex> lock;
595 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
597 StackFrame *frame = nullptr;
598 Target *target = exe_ctx.GetTargetPtr();
599 Process *process = exe_ctx.GetProcessPtr();
600 if (target && process) {
601 Process::StopLocker stop_locker;
602 if (stop_locker.TryLock(&process->GetRunLock())) {
603 frame = exe_ctx.GetFramePtr();
607 ValueObjectSP value_sp(frame->GetValueForVariableExpressionPath(
608 var_path, eNoDynamicValues,
609 StackFrame::eExpressionPathOptionCheckPtrVsMember |
610 StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,
612 sb_value.SetSP(value_sp, use_dynamic);
615 log->Printf("SBFrame::GetValueForVariablePath () => error: could not "
616 "reconstruct frame object for this SBFrame.");
621 "SBFrame::GetValueForVariablePath () => error: process is running");
627 SBValue SBFrame::FindVariable(const char *name) {
629 std::unique_lock<std::recursive_mutex> lock;
630 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
632 StackFrame *frame = exe_ctx.GetFramePtr();
633 Target *target = exe_ctx.GetTargetPtr();
634 if (frame && target) {
635 lldb::DynamicValueType use_dynamic =
636 frame->CalculateTarget()->GetPreferDynamicValue();
637 value = FindVariable(name, use_dynamic);
642 SBValue SBFrame::FindVariable(const char *name,
643 lldb::DynamicValueType use_dynamic) {
644 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
648 if (name == nullptr || name[0] == '\0') {
650 log->Printf("SBFrame::FindVariable called with empty name");
654 ValueObjectSP value_sp;
655 std::unique_lock<std::recursive_mutex> lock;
656 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
658 StackFrame *frame = nullptr;
659 Target *target = exe_ctx.GetTargetPtr();
660 Process *process = exe_ctx.GetProcessPtr();
661 if (target && process) {
662 Process::StopLocker stop_locker;
663 if (stop_locker.TryLock(&process->GetRunLock())) {
664 frame = exe_ctx.GetFramePtr();
666 value_sp = frame->FindVariable(ConstString(name));
669 sb_value.SetSP(value_sp, use_dynamic);
672 log->Printf("SBFrame::FindVariable () => error: could not "
673 "reconstruct frame object for this SBFrame.");
677 log->Printf("SBFrame::FindVariable () => error: process is running");
682 log->Printf("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
683 static_cast<void *>(frame), name,
684 static_cast<void *>(value_sp.get()));
689 SBValue SBFrame::FindValue(const char *name, ValueType value_type) {
691 std::unique_lock<std::recursive_mutex> lock;
692 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
694 StackFrame *frame = exe_ctx.GetFramePtr();
695 Target *target = exe_ctx.GetTargetPtr();
696 if (frame && target) {
697 lldb::DynamicValueType use_dynamic =
698 frame->CalculateTarget()->GetPreferDynamicValue();
699 value = FindValue(name, value_type, use_dynamic);
704 SBValue SBFrame::FindValue(const char *name, ValueType value_type,
705 lldb::DynamicValueType use_dynamic) {
706 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
709 if (name == nullptr || name[0] == '\0') {
711 log->Printf("SBFrame::FindValue called with empty name.");
715 ValueObjectSP value_sp;
716 std::unique_lock<std::recursive_mutex> lock;
717 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
719 StackFrame *frame = nullptr;
720 Target *target = exe_ctx.GetTargetPtr();
721 Process *process = exe_ctx.GetProcessPtr();
722 if (target && process) {
723 Process::StopLocker stop_locker;
724 if (stop_locker.TryLock(&process->GetRunLock())) {
725 frame = exe_ctx.GetFramePtr();
727 VariableList variable_list;
729 switch (value_type) {
730 case eValueTypeVariableGlobal: // global variable
731 case eValueTypeVariableStatic: // static variable
732 case eValueTypeVariableArgument: // function argument variables
733 case eValueTypeVariableLocal: // function local variables
734 case eValueTypeVariableThreadLocal: // thread local variables
736 SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
738 const bool can_create = true;
739 const bool get_parent_variables = true;
740 const bool stop_if_block_is_inlined_function = true;
743 sc.block->AppendVariables(
744 can_create, get_parent_variables,
745 stop_if_block_is_inlined_function,
746 [frame](Variable *v) { return v->IsInScope(frame); },
748 if (value_type == eValueTypeVariableGlobal) {
749 const bool get_file_globals = true;
750 VariableList *frame_vars = frame->GetVariableList(get_file_globals);
752 frame_vars->AppendVariablesIfUnique(variable_list);
754 ConstString const_name(name);
755 VariableSP variable_sp(
756 variable_list.FindVariable(const_name, value_type));
758 value_sp = frame->GetValueObjectForFrameVariable(variable_sp,
760 sb_value.SetSP(value_sp, use_dynamic);
764 case eValueTypeRegister: // stack frame register value
766 RegisterContextSP reg_ctx(frame->GetRegisterContext());
768 const uint32_t num_regs = reg_ctx->GetRegisterCount();
769 for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
770 const RegisterInfo *reg_info =
771 reg_ctx->GetRegisterInfoAtIndex(reg_idx);
773 ((reg_info->name && strcasecmp(reg_info->name, name) == 0) ||
774 (reg_info->alt_name &&
775 strcasecmp(reg_info->alt_name, name) == 0))) {
776 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx);
777 sb_value.SetSP(value_sp);
784 case eValueTypeRegisterSet: // A collection of stack frame register
787 RegisterContextSP reg_ctx(frame->GetRegisterContext());
789 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
790 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
791 const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
793 ((reg_set->name && strcasecmp(reg_set->name, name) == 0) ||
794 (reg_set->short_name &&
795 strcasecmp(reg_set->short_name, name) == 0))) {
797 ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx);
798 sb_value.SetSP(value_sp);
805 case eValueTypeConstResult: // constant result variables
807 ConstString const_name(name);
808 ExpressionVariableSP expr_var_sp(
809 target->GetPersistentVariable(const_name));
811 value_sp = expr_var_sp->GetValueObject();
812 sb_value.SetSP(value_sp, use_dynamic);
821 log->Printf("SBFrame::FindValue () => error: could not reconstruct "
822 "frame object for this SBFrame.");
826 log->Printf("SBFrame::FindValue () => error: process is running");
831 log->Printf("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) "
833 static_cast<void *>(frame), name, value_type,
834 static_cast<void *>(value_sp.get()));
839 bool SBFrame::IsEqual(const SBFrame &that) const {
840 lldb::StackFrameSP this_sp = GetFrameSP();
841 lldb::StackFrameSP that_sp = that.GetFrameSP();
842 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
845 bool SBFrame::operator==(const SBFrame &rhs) const { return IsEqual(rhs); }
847 bool SBFrame::operator!=(const SBFrame &rhs) const { return !IsEqual(rhs); }
849 SBThread SBFrame::GetThread() const {
850 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
852 std::unique_lock<std::recursive_mutex> lock;
853 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
855 ThreadSP thread_sp(exe_ctx.GetThreadSP());
856 SBThread sb_thread(thread_sp);
860 sb_thread.GetDescription(sstr);
861 log->Printf("SBFrame(%p)::GetThread () => SBThread(%p): %s",
862 static_cast<void *>(exe_ctx.GetFramePtr()),
863 static_cast<void *>(thread_sp.get()), sstr.GetData());
869 const char *SBFrame::Disassemble() const {
870 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
871 const char *disassembly = nullptr;
872 std::unique_lock<std::recursive_mutex> lock;
873 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
875 StackFrame *frame = nullptr;
876 Target *target = exe_ctx.GetTargetPtr();
877 Process *process = exe_ctx.GetProcessPtr();
878 if (target && process) {
879 Process::StopLocker stop_locker;
880 if (stop_locker.TryLock(&process->GetRunLock())) {
881 frame = exe_ctx.GetFramePtr();
883 disassembly = frame->Disassemble();
886 log->Printf("SBFrame::Disassemble () => error: could not reconstruct "
887 "frame object for this SBFrame.");
891 log->Printf("SBFrame::Disassemble () => error: process is running");
896 log->Printf("SBFrame(%p)::Disassemble () => %s", static_cast<void *>(frame),
902 SBValueList SBFrame::GetVariables(bool arguments, bool locals, bool statics,
903 bool in_scope_only) {
904 SBValueList value_list;
905 std::unique_lock<std::recursive_mutex> lock;
906 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
908 StackFrame *frame = exe_ctx.GetFramePtr();
909 Target *target = exe_ctx.GetTargetPtr();
910 if (frame && target) {
911 lldb::DynamicValueType use_dynamic =
912 frame->CalculateTarget()->GetPreferDynamicValue();
913 const bool include_runtime_support_values =
914 target ? target->GetDisplayRuntimeSupportValues() : false;
916 SBVariablesOptions options;
917 options.SetIncludeArguments(arguments);
918 options.SetIncludeLocals(locals);
919 options.SetIncludeStatics(statics);
920 options.SetInScopeOnly(in_scope_only);
921 options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
922 options.SetUseDynamic(use_dynamic);
924 value_list = GetVariables(options);
929 lldb::SBValueList SBFrame::GetVariables(bool arguments, bool locals,
930 bool statics, bool in_scope_only,
931 lldb::DynamicValueType use_dynamic) {
932 std::unique_lock<std::recursive_mutex> lock;
933 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
935 Target *target = exe_ctx.GetTargetPtr();
936 const bool include_runtime_support_values =
937 target ? target->GetDisplayRuntimeSupportValues() : false;
938 SBVariablesOptions options;
939 options.SetIncludeArguments(arguments);
940 options.SetIncludeLocals(locals);
941 options.SetIncludeStatics(statics);
942 options.SetInScopeOnly(in_scope_only);
943 options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
944 options.SetUseDynamic(use_dynamic);
945 return GetVariables(options);
948 SBValueList SBFrame::GetVariables(const lldb::SBVariablesOptions &options) {
949 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
951 SBValueList value_list;
952 std::unique_lock<std::recursive_mutex> lock;
953 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
955 StackFrame *frame = nullptr;
956 Target *target = exe_ctx.GetTargetPtr();
958 const bool statics = options.GetIncludeStatics();
959 const bool arguments = options.GetIncludeArguments();
960 const bool recognized_arguments =
961 options.GetIncludeRecognizedArguments(SBTarget(exe_ctx.GetTargetSP()));
962 const bool locals = options.GetIncludeLocals();
963 const bool in_scope_only = options.GetInScopeOnly();
964 const bool include_runtime_support_values =
965 options.GetIncludeRuntimeSupportValues();
966 const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
970 "SBFrame::GetVariables (arguments=%i, recognized_arguments=%i, "
971 "locals=%i, statics=%i, in_scope_only=%i runtime=%i dynamic=%i)",
972 arguments, recognized_arguments, locals, statics, in_scope_only,
973 include_runtime_support_values, use_dynamic);
975 std::set<VariableSP> variable_set;
976 Process *process = exe_ctx.GetProcessPtr();
977 if (target && process) {
978 Process::StopLocker stop_locker;
979 if (stop_locker.TryLock(&process->GetRunLock())) {
980 frame = exe_ctx.GetFramePtr();
983 VariableList *variable_list = nullptr;
984 variable_list = frame->GetVariableList(true);
986 const size_t num_variables = variable_list->GetSize();
988 for (i = 0; i < num_variables; ++i) {
989 VariableSP variable_sp(variable_list->GetVariableAtIndex(i));
991 bool add_variable = false;
992 switch (variable_sp->GetScope()) {
993 case eValueTypeVariableGlobal:
994 case eValueTypeVariableStatic:
995 case eValueTypeVariableThreadLocal:
996 add_variable = statics;
999 case eValueTypeVariableArgument:
1000 add_variable = arguments;
1003 case eValueTypeVariableLocal:
1004 add_variable = locals;
1011 // Only add variables once so we don't end up with duplicates
1012 if (variable_set.find(variable_sp) == variable_set.end())
1013 variable_set.insert(variable_sp);
1017 if (in_scope_only && !variable_sp->IsInScope(frame))
1020 ValueObjectSP valobj_sp(frame->GetValueObjectForFrameVariable(
1021 variable_sp, eNoDynamicValues));
1023 if (!include_runtime_support_values && valobj_sp != nullptr &&
1024 valobj_sp->IsRuntimeSupportValue())
1028 value_sb.SetSP(valobj_sp, use_dynamic);
1029 value_list.Append(value_sb);
1035 if (recognized_arguments) {
1036 auto recognized_frame = frame->GetRecognizedFrame();
1037 if (recognized_frame) {
1038 ValueObjectListSP recognized_arg_list =
1039 recognized_frame->GetRecognizedArguments();
1040 if (recognized_arg_list) {
1041 for (auto &rec_value_sp : recognized_arg_list->GetObjects()) {
1043 value_sb.SetSP(rec_value_sp, use_dynamic);
1044 value_list.Append(value_sb);
1051 log->Printf("SBFrame::GetVariables () => error: could not "
1052 "reconstruct frame object for this SBFrame.");
1056 log->Printf("SBFrame::GetVariables () => error: process is running");
1061 log->Printf("SBFrame(%p)::GetVariables (...) => SBValueList(%p)",
1062 static_cast<void *>(frame),
1063 static_cast<void *>(value_list.opaque_ptr()));
1068 SBValueList SBFrame::GetRegisters() {
1069 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1071 SBValueList value_list;
1072 std::unique_lock<std::recursive_mutex> lock;
1073 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1075 StackFrame *frame = nullptr;
1076 Target *target = exe_ctx.GetTargetPtr();
1077 Process *process = exe_ctx.GetProcessPtr();
1078 if (target && process) {
1079 Process::StopLocker stop_locker;
1080 if (stop_locker.TryLock(&process->GetRunLock())) {
1081 frame = exe_ctx.GetFramePtr();
1083 RegisterContextSP reg_ctx(frame->GetRegisterContext());
1085 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
1086 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
1088 ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx));
1093 log->Printf("SBFrame::GetRegisters () => error: could not "
1094 "reconstruct frame object for this SBFrame.");
1098 log->Printf("SBFrame::GetRegisters () => error: process is running");
1103 log->Printf("SBFrame(%p)::GetRegisters () => SBValueList(%p)",
1104 static_cast<void *>(frame),
1105 static_cast<void *>(value_list.opaque_ptr()));
1110 SBValue SBFrame::FindRegister(const char *name) {
1111 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1114 ValueObjectSP value_sp;
1115 std::unique_lock<std::recursive_mutex> lock;
1116 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1118 StackFrame *frame = nullptr;
1119 Target *target = exe_ctx.GetTargetPtr();
1120 Process *process = exe_ctx.GetProcessPtr();
1121 if (target && process) {
1122 Process::StopLocker stop_locker;
1123 if (stop_locker.TryLock(&process->GetRunLock())) {
1124 frame = exe_ctx.GetFramePtr();
1126 RegisterContextSP reg_ctx(frame->GetRegisterContext());
1128 const uint32_t num_regs = reg_ctx->GetRegisterCount();
1129 for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
1130 const RegisterInfo *reg_info =
1131 reg_ctx->GetRegisterInfoAtIndex(reg_idx);
1133 ((reg_info->name && strcasecmp(reg_info->name, name) == 0) ||
1134 (reg_info->alt_name &&
1135 strcasecmp(reg_info->alt_name, name) == 0))) {
1136 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx);
1137 result.SetSP(value_sp);
1144 log->Printf("SBFrame::FindRegister () => error: could not "
1145 "reconstruct frame object for this SBFrame.");
1149 log->Printf("SBFrame::FindRegister () => error: process is running");
1154 log->Printf("SBFrame(%p)::FindRegister () => SBValue(%p)",
1155 static_cast<void *>(frame),
1156 static_cast<void *>(value_sp.get()));
1161 bool SBFrame::GetDescription(SBStream &description) {
1162 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1163 Stream &strm = description.ref();
1165 std::unique_lock<std::recursive_mutex> lock;
1166 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1169 Target *target = exe_ctx.GetTargetPtr();
1170 Process *process = exe_ctx.GetProcessPtr();
1171 if (target && process) {
1172 Process::StopLocker stop_locker;
1173 if (stop_locker.TryLock(&process->GetRunLock())) {
1174 frame = exe_ctx.GetFramePtr();
1176 frame->DumpUsingSettingsFormat(&strm);
1179 log->Printf("SBFrame::GetDescription () => error: could not "
1180 "reconstruct frame object for this SBFrame.");
1184 log->Printf("SBFrame::GetDescription () => error: process is running");
1188 strm.PutCString("No value");
1193 SBValue SBFrame::EvaluateExpression(const char *expr) {
1195 std::unique_lock<std::recursive_mutex> lock;
1196 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1198 StackFrame *frame = exe_ctx.GetFramePtr();
1199 Target *target = exe_ctx.GetTargetPtr();
1200 if (frame && target) {
1201 SBExpressionOptions options;
1202 lldb::DynamicValueType fetch_dynamic_value =
1203 frame->CalculateTarget()->GetPreferDynamicValue();
1204 options.SetFetchDynamicValue(fetch_dynamic_value);
1205 options.SetUnwindOnError(true);
1206 options.SetIgnoreBreakpoints(true);
1207 if (target->GetLanguage() != eLanguageTypeUnknown)
1208 options.SetLanguage(target->GetLanguage());
1210 options.SetLanguage(frame->GetLanguage());
1211 return EvaluateExpression(expr, options);
1217 SBFrame::EvaluateExpression(const char *expr,
1218 lldb::DynamicValueType fetch_dynamic_value) {
1219 SBExpressionOptions options;
1220 options.SetFetchDynamicValue(fetch_dynamic_value);
1221 options.SetUnwindOnError(true);
1222 options.SetIgnoreBreakpoints(true);
1223 std::unique_lock<std::recursive_mutex> lock;
1224 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1226 StackFrame *frame = exe_ctx.GetFramePtr();
1227 Target *target = exe_ctx.GetTargetPtr();
1228 if (target && target->GetLanguage() != eLanguageTypeUnknown)
1229 options.SetLanguage(target->GetLanguage());
1231 options.SetLanguage(frame->GetLanguage());
1232 return EvaluateExpression(expr, options);
1235 SBValue SBFrame::EvaluateExpression(const char *expr,
1236 lldb::DynamicValueType fetch_dynamic_value,
1237 bool unwind_on_error) {
1238 SBExpressionOptions options;
1239 std::unique_lock<std::recursive_mutex> lock;
1240 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1242 options.SetFetchDynamicValue(fetch_dynamic_value);
1243 options.SetUnwindOnError(unwind_on_error);
1244 options.SetIgnoreBreakpoints(true);
1245 StackFrame *frame = exe_ctx.GetFramePtr();
1246 Target *target = exe_ctx.GetTargetPtr();
1247 if (target && target->GetLanguage() != eLanguageTypeUnknown)
1248 options.SetLanguage(target->GetLanguage());
1250 options.SetLanguage(frame->GetLanguage());
1251 return EvaluateExpression(expr, options);
1254 lldb::SBValue SBFrame::EvaluateExpression(const char *expr,
1255 const SBExpressionOptions &options) {
1256 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1258 #ifndef LLDB_DISABLE_PYTHON
1259 Log *expr_log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
1262 ExpressionResults exe_results = eExpressionSetupError;
1263 SBValue expr_result;
1265 if (expr == nullptr || expr[0] == '\0') {
1268 "SBFrame::EvaluateExpression called with an empty expression");
1272 ValueObjectSP expr_value_sp;
1274 std::unique_lock<std::recursive_mutex> lock;
1275 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1278 log->Printf("SBFrame()::EvaluateExpression (expr=\"%s\")...", expr);
1280 StackFrame *frame = nullptr;
1281 Target *target = exe_ctx.GetTargetPtr();
1282 Process *process = exe_ctx.GetProcessPtr();
1284 if (target && process) {
1285 Process::StopLocker stop_locker;
1286 if (stop_locker.TryLock(&process->GetRunLock())) {
1287 frame = exe_ctx.GetFramePtr();
1289 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1290 if (target->GetDisplayExpressionsInCrashlogs()) {
1291 StreamString frame_description;
1292 frame->DumpUsingSettingsFormat(&frame_description);
1293 stack_trace = llvm::make_unique<llvm::PrettyStackTraceFormat>(
1294 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1296 expr, options.GetFetchDynamicValue(),
1297 frame_description.GetData());
1300 exe_results = target->EvaluateExpression(expr, frame, expr_value_sp,
1302 expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
1305 log->Printf("SBFrame::EvaluateExpression () => error: could not "
1306 "reconstruct frame object for this SBFrame.");
1311 "SBFrame::EvaluateExpression () => error: process is running");
1315 #ifndef LLDB_DISABLE_PYTHON
1317 expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is "
1318 "%s, summary %s **",
1319 expr_result.GetValue(), expr_result.GetSummary());
1322 log->Printf("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) "
1323 "(execution result=%d)",
1324 static_cast<void *>(frame), expr,
1325 static_cast<void *>(expr_value_sp.get()), exe_results);
1331 bool SBFrame::IsInlined() {
1332 return static_cast<const SBFrame *>(this)->IsInlined();
1335 bool SBFrame::IsInlined() const {
1336 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1337 std::unique_lock<std::recursive_mutex> lock;
1338 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1340 StackFrame *frame = nullptr;
1341 Target *target = exe_ctx.GetTargetPtr();
1342 Process *process = exe_ctx.GetProcessPtr();
1343 if (target && process) {
1344 Process::StopLocker stop_locker;
1345 if (stop_locker.TryLock(&process->GetRunLock())) {
1346 frame = exe_ctx.GetFramePtr();
1349 Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
1351 return block->GetContainingInlinedBlock() != nullptr;
1354 log->Printf("SBFrame::IsInlined () => error: could not reconstruct "
1355 "frame object for this SBFrame.");
1359 log->Printf("SBFrame::IsInlined () => error: process is running");
1365 bool SBFrame::IsArtificial() {
1366 return static_cast<const SBFrame *>(this)->IsArtificial();
1369 bool SBFrame::IsArtificial() const {
1370 std::unique_lock<std::recursive_mutex> lock;
1371 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1373 StackFrame *frame = exe_ctx.GetFramePtr();
1375 return frame->IsArtificial();
1380 const char *SBFrame::GetFunctionName() {
1381 return static_cast<const SBFrame *>(this)->GetFunctionName();
1384 lldb::LanguageType SBFrame::GuessLanguage() const {
1385 std::unique_lock<std::recursive_mutex> lock;
1386 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1388 StackFrame *frame = nullptr;
1389 Target *target = exe_ctx.GetTargetPtr();
1390 Process *process = exe_ctx.GetProcessPtr();
1391 if (target && process) {
1392 Process::StopLocker stop_locker;
1393 if (stop_locker.TryLock(&process->GetRunLock())) {
1394 frame = exe_ctx.GetFramePtr();
1396 return frame->GuessLanguage();
1400 return eLanguageTypeUnknown;
1403 const char *SBFrame::GetFunctionName() const {
1404 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1405 const char *name = nullptr;
1406 std::unique_lock<std::recursive_mutex> lock;
1407 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1409 StackFrame *frame = nullptr;
1410 Target *target = exe_ctx.GetTargetPtr();
1411 Process *process = exe_ctx.GetProcessPtr();
1412 if (target && process) {
1413 Process::StopLocker stop_locker;
1414 if (stop_locker.TryLock(&process->GetRunLock())) {
1415 frame = exe_ctx.GetFramePtr();
1417 SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
1418 eSymbolContextBlock |
1419 eSymbolContextSymbol));
1421 Block *inlined_block = sc.block->GetContainingInlinedBlock();
1422 if (inlined_block) {
1423 const InlineFunctionInfo *inlined_info =
1424 inlined_block->GetInlinedFunctionInfo();
1426 inlined_info->GetName(sc.function->GetLanguage()).AsCString();
1430 if (name == nullptr) {
1432 name = sc.function->GetName().GetCString();
1435 if (name == nullptr) {
1437 name = sc.symbol->GetName().GetCString();
1441 log->Printf("SBFrame::GetFunctionName () => error: could not "
1442 "reconstruct frame object for this SBFrame.");
1446 log->Printf("SBFrame::GetFunctionName() => error: process is running");
1452 const char *SBFrame::GetDisplayFunctionName() {
1453 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1454 const char *name = nullptr;
1456 std::unique_lock<std::recursive_mutex> lock;
1457 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1459 StackFrame *frame = nullptr;
1460 Target *target = exe_ctx.GetTargetPtr();
1461 Process *process = exe_ctx.GetProcessPtr();
1462 if (target && process) {
1463 Process::StopLocker stop_locker;
1464 if (stop_locker.TryLock(&process->GetRunLock())) {
1465 frame = exe_ctx.GetFramePtr();
1467 SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
1468 eSymbolContextBlock |
1469 eSymbolContextSymbol));
1471 Block *inlined_block = sc.block->GetContainingInlinedBlock();
1472 if (inlined_block) {
1473 const InlineFunctionInfo *inlined_info =
1474 inlined_block->GetInlinedFunctionInfo();
1475 name = inlined_info->GetDisplayName(sc.function->GetLanguage())
1480 if (name == nullptr) {
1482 name = sc.function->GetDisplayName().GetCString();
1485 if (name == nullptr) {
1487 name = sc.symbol->GetDisplayName().GetCString();
1491 log->Printf("SBFrame::GetDisplayFunctionName () => error: could not "
1492 "reconstruct frame object for this SBFrame.");
1497 "SBFrame::GetDisplayFunctionName() => error: process is running");