LLDB mainline
SBFrame.cpp
Go to the documentation of this file.
1//===-- SBFrame.cpp -------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include <algorithm>
10#include <set>
11#include <string>
12
13#include "lldb/API/SBFrame.h"
14
15#include "lldb/lldb-types.h"
16
17#include "Utils.h"
18#include "lldb/Core/Address.h"
19#include "lldb/Core/Debugger.h"
22#include "lldb/Host/Host.h"
23#include "lldb/Symbol/Block.h"
25#include "lldb/Symbol/Symbol.h"
30#include "lldb/Target/Process.h"
34#include "lldb/Target/StackID.h"
35#include "lldb/Target/Target.h"
36#include "lldb/Target/Thread.h"
40#include "lldb/Utility/Stream.h"
44
45#include "lldb/API/SBAddress.h"
46#include "lldb/API/SBDebugger.h"
48#include "lldb/API/SBFormat.h"
49#include "lldb/API/SBStream.h"
52#include "lldb/API/SBThread.h"
53#include "lldb/API/SBValue.h"
55
56#include "llvm/Support/PrettyStackTrace.h"
57
58using namespace lldb;
59using namespace lldb_private;
60
64
65SBFrame::SBFrame(const StackFrameSP &lldb_object_sp)
66 : m_opaque_sp(new ExecutionContextRef(lldb_object_sp)) {
67 LLDB_INSTRUMENT_VA(this, lldb_object_sp);
68}
69
71 LLDB_INSTRUMENT_VA(this, rhs);
72
74}
75
76SBFrame::~SBFrame() = default;
77
79 LLDB_INSTRUMENT_VA(this, rhs);
80
81 if (this != &rhs)
83 return *this;
84}
85
87 return (m_opaque_sp ? m_opaque_sp->GetFrameSP() : StackFrameSP());
88}
89
90void SBFrame::SetFrameSP(const StackFrameSP &lldb_object_sp) {
91 return m_opaque_sp->SetFrameSP(lldb_object_sp);
92}
93
94bool SBFrame::IsValid() const {
96 return this->operator bool();
97}
98SBFrame::operator bool() const {
100 llvm::Expected<StoppedExecutionContext> exe_ctx =
102 if (!exe_ctx) {
103 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
104 return false;
105 }
106
107 return GetFrameSP().get() != nullptr;
108}
109
110SBSymbolContext SBFrame::GetSymbolContext(uint32_t resolve_scope) const {
111 LLDB_INSTRUMENT_VA(this, resolve_scope);
112
113 SBSymbolContext sb_sym_ctx;
114
115 llvm::Expected<StoppedExecutionContext> exe_ctx =
117 if (!exe_ctx) {
118 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
119 return sb_sym_ctx;
120 }
121
122 SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
123 if (StackFrame *frame = exe_ctx->GetFramePtr())
124 sb_sym_ctx = frame->GetSymbolContext(scope);
125
126 return sb_sym_ctx;
127}
128
130 LLDB_INSTRUMENT_VA(this);
131
132 llvm::Expected<StoppedExecutionContext> exe_ctx =
134 if (!exe_ctx) {
135 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
136 return SBModule();
137 }
138
139 ModuleSP module_sp;
140 StackFrame *frame = exe_ctx->GetFramePtr();
141 if (!frame)
142 return SBModule();
143
144 SBModule sb_module;
145 module_sp = frame->GetSymbolContext(eSymbolContextModule).module_sp;
146 sb_module.SetSP(module_sp);
147 return sb_module;
148}
149
151 LLDB_INSTRUMENT_VA(this);
152
153 llvm::Expected<StoppedExecutionContext> exe_ctx =
155 if (!exe_ctx) {
156 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
157 return SBCompileUnit();
158 }
159
160 if (StackFrame *frame = exe_ctx->GetFramePtr())
161 return SBCompileUnit(
162 frame->GetSymbolContext(eSymbolContextCompUnit).comp_unit);
163 return SBCompileUnit();
164}
165
167 LLDB_INSTRUMENT_VA(this);
168
169 llvm::Expected<StoppedExecutionContext> exe_ctx =
171 if (!exe_ctx) {
172 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
173 return SBFunction();
174 }
175
176 if (StackFrame *frame = exe_ctx->GetFramePtr())
177 return SBFunction(frame->GetSymbolContext(eSymbolContextFunction).function);
178 return SBFunction();
179}
180
182 LLDB_INSTRUMENT_VA(this);
183
184 llvm::Expected<StoppedExecutionContext> exe_ctx =
186 if (!exe_ctx) {
187 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
188 return SBSymbol();
189 }
190
191 if (StackFrame *frame = exe_ctx->GetFramePtr())
192 return SBSymbol(frame->GetSymbolContext(eSymbolContextSymbol).symbol);
193 return SBSymbol();
194}
195
197 LLDB_INSTRUMENT_VA(this);
198
199 llvm::Expected<StoppedExecutionContext> exe_ctx =
201 if (!exe_ctx) {
202 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
203 return SBBlock();
204 }
205
206 if (StackFrame *frame = exe_ctx->GetFramePtr())
207 return SBBlock(frame->GetSymbolContext(eSymbolContextBlock).block);
208 return SBBlock();
209}
210
212 LLDB_INSTRUMENT_VA(this);
213
214 llvm::Expected<StoppedExecutionContext> exe_ctx =
216 if (!exe_ctx) {
217 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
218 return SBBlock();
219 }
220
221 if (StackFrame *frame = exe_ctx->GetFramePtr())
222 return SBBlock(frame->GetFrameBlock());
223 return SBBlock();
224}
225
227 LLDB_INSTRUMENT_VA(this);
228
229 llvm::Expected<StoppedExecutionContext> exe_ctx =
231 if (!exe_ctx) {
232 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
233 return SBLineEntry();
234 }
235
236 if (StackFrame *frame = exe_ctx->GetFramePtr())
237 return SBLineEntry(
238 &frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
239 return SBLineEntry();
240}
241
242uint32_t SBFrame::GetFrameID() const {
243 LLDB_INSTRUMENT_VA(this);
244
245 constexpr uint32_t error_frame_idx = UINT32_MAX;
246
247 llvm::Expected<StoppedExecutionContext> exe_ctx =
249 if (!exe_ctx) {
250 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
251 return error_frame_idx;
252 }
253
254 if (StackFrame *frame = exe_ctx->GetFramePtr())
255 return frame->GetFrameIndex();
256 return error_frame_idx;
257}
258
260 LLDB_INSTRUMENT_VA(this);
261
262 llvm::Expected<StoppedExecutionContext> exe_ctx =
264 if (!exe_ctx) {
265 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
267 }
268
269 if (StackFrame *frame = exe_ctx->GetFramePtr())
270 return frame->GetStackID().GetCallFrameAddressWithoutMetadata();
272}
273
275 LLDB_INSTRUMENT_VA(this);
276
278 llvm::Expected<StoppedExecutionContext> exe_ctx =
280 if (!exe_ctx) {
281 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
282 return addr;
283 }
284
285 Target *target = exe_ctx->GetTargetPtr();
286 if (StackFrame *frame = exe_ctx->GetFramePtr())
287 return frame->GetFrameCodeAddress().GetOpcodeLoadAddress(
288 target, AddressClass::eCode);
289
290 return addr;
291}
292
293bool SBFrame::SetPC(addr_t new_pc) {
294 LLDB_INSTRUMENT_VA(this, new_pc);
295
296 constexpr bool error_ret_val = false;
297 llvm::Expected<StoppedExecutionContext> exe_ctx =
299 if (!exe_ctx) {
300 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
301 return error_ret_val;
302 }
303
304 if (StackFrame *frame = exe_ctx->GetFramePtr())
305 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext())
306 return reg_ctx_sp->SetPC(new_pc);
307
308 return error_ret_val;
309}
310
312 LLDB_INSTRUMENT_VA(this);
313
314 llvm::Expected<StoppedExecutionContext> exe_ctx =
316 if (!exe_ctx) {
317 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
319 }
320
321 if (StackFrame *frame = exe_ctx->GetFramePtr())
322 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext())
323 return reg_ctx_sp->GetSP();
324
326}
327
329 LLDB_INSTRUMENT_VA(this);
330
331 llvm::Expected<StoppedExecutionContext> exe_ctx =
333 if (!exe_ctx) {
334 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
336 }
337
338 if (StackFrame *frame = exe_ctx->GetFramePtr())
339 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext())
340 return reg_ctx_sp->GetFP();
341
343}
344
346 LLDB_INSTRUMENT_VA(this);
347
348 llvm::Expected<StoppedExecutionContext> exe_ctx =
350 if (!exe_ctx) {
351 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
352 return SBAddress();
353 }
354
355 if (StackFrame *frame = exe_ctx->GetFramePtr())
356 return SBAddress(frame->GetFrameCodeAddress());
357 return SBAddress();
358}
359
361 LLDB_INSTRUMENT_VA(this);
362
363 m_opaque_sp->Clear();
364}
365
367 LLDB_INSTRUMENT_VA(this, var_path);
368
369 SBValue sb_value;
370 llvm::Expected<StoppedExecutionContext> exe_ctx =
372 if (!exe_ctx) {
373 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
374 return sb_value;
375 }
376
377 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
378 lldb::DynamicValueType use_dynamic =
379 frame->CalculateTarget()->GetPreferDynamicValue();
380 sb_value = GetValueForVariablePath(var_path, use_dynamic);
381 }
382 return sb_value;
383}
384
386 DynamicValueType use_dynamic) {
387 LLDB_INSTRUMENT_VA(this, var_path, use_dynamic);
388
389 SBValue sb_value;
390 if (var_path == nullptr || var_path[0] == '\0') {
391 return sb_value;
392 }
393
394 llvm::Expected<StoppedExecutionContext> exe_ctx =
396 if (!exe_ctx) {
397 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
398 return sb_value;
399 }
400
401 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
402 VariableSP var_sp;
404 ValueObjectSP value_sp(frame->GetValueForVariableExpressionPath(
405 var_path, eNoDynamicValues,
408 var_sp, error));
409 sb_value.SetSP(value_sp, use_dynamic);
410 }
411 return sb_value;
412}
413
415 LLDB_INSTRUMENT_VA(this, name);
416
417 llvm::Expected<StoppedExecutionContext> exe_ctx =
419 if (!exe_ctx) {
420 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
421 return SBValue();
422 }
423
424 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
425 lldb::DynamicValueType use_dynamic =
426 frame->CalculateTarget()->GetPreferDynamicValue();
427 return FindVariable(name, use_dynamic);
428 }
429 return SBValue();
430}
431
433 lldb::DynamicValueType use_dynamic) {
434 LLDB_INSTRUMENT_VA(this, name, use_dynamic);
435
436 VariableSP var_sp;
437 SBValue sb_value;
438
439 if (name == nullptr || name[0] == '\0') {
440 return sb_value;
441 }
442
443 llvm::Expected<StoppedExecutionContext> exe_ctx =
445 if (!exe_ctx) {
446 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
447 return sb_value;
448 }
449
450 if (StackFrame *frame = exe_ctx->GetFramePtr())
451 if (ValueObjectSP value_sp = frame->FindVariable(ConstString(name)))
452 sb_value.SetSP(value_sp, use_dynamic);
453
454 return sb_value;
455}
456
457SBValue SBFrame::FindValue(const char *name, ValueType value_type) {
458 LLDB_INSTRUMENT_VA(this, name, value_type);
459
460 SBValue value;
461 llvm::Expected<StoppedExecutionContext> exe_ctx =
463 if (!exe_ctx) {
464 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
465 return value;
466 }
467
468 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
469 lldb::DynamicValueType use_dynamic =
470 frame->CalculateTarget()->GetPreferDynamicValue();
471 value = FindValue(name, value_type, use_dynamic);
472 }
473 return value;
474}
475
476SBValue SBFrame::FindValue(const char *name, ValueType value_type,
477 lldb::DynamicValueType use_dynamic) {
478 LLDB_INSTRUMENT_VA(this, name, value_type, use_dynamic);
479
480 SBValue sb_value;
481
482 if (name == nullptr || name[0] == '\0') {
483 return sb_value;
484 }
485
486 ValueObjectSP value_sp;
487 llvm::Expected<StoppedExecutionContext> exe_ctx =
489
490 if (!exe_ctx) {
491 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
492 return value_sp;
493 }
494
495 StackFrame *frame = exe_ctx->GetFramePtr();
496 if (!frame)
497 return value_sp;
498
499 VariableList variable_list;
500
501 switch (value_type) {
502 case eValueTypeVariableGlobal: // global variable
503 case eValueTypeVariableStatic: // static variable
504 case eValueTypeVariableArgument: // function argument variables
505 case eValueTypeVariableLocal: // function local variables
506 case eValueTypeVariableThreadLocal: { // thread local variables
507 SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
508
509 const bool can_create = true;
510 const bool get_parent_variables = true;
511 const bool stop_if_block_is_inlined_function = true;
512
513 if (sc.block)
515 can_create, get_parent_variables, stop_if_block_is_inlined_function,
516 [frame](Variable *v) { return v->IsInScope(frame); }, &variable_list);
517 if (value_type == eValueTypeVariableGlobal ||
518 value_type == eValueTypeVariableStatic) {
519 const bool get_file_globals = true;
520 VariableList *frame_vars =
521 frame->GetVariableList(get_file_globals, nullptr);
522 if (frame_vars)
523 frame_vars->AppendVariablesIfUnique(variable_list);
524 }
525 ConstString const_name(name);
526 VariableSP variable_sp(variable_list.FindVariable(const_name, value_type));
527 if (variable_sp) {
528 value_sp =
530 sb_value.SetSP(value_sp, use_dynamic);
531 }
532 } break;
533
534 case eValueTypeRegister: { // stack frame register value
535 if (RegisterContextSP reg_ctx = frame->GetRegisterContext()) {
536 if (const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name)) {
537 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info);
538 sb_value.SetSP(value_sp);
539 }
540 }
541 } break;
542
543 case eValueTypeRegisterSet: { // A collection of stack frame register
544 // values
545 if (RegisterContextSP reg_ctx = frame->GetRegisterContext()) {
546 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
547 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
548 const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
549 if (reg_set &&
550 (llvm::StringRef(reg_set->name).equals_insensitive(name) ||
551 llvm::StringRef(reg_set->short_name).equals_insensitive(name))) {
552 value_sp = ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx);
553 sb_value.SetSP(value_sp);
554 break;
555 }
556 }
557 }
558 } break;
559
560 case eValueTypeConstResult: { // constant result variables
561 ConstString const_name(name);
562 Target *target = exe_ctx->GetTargetPtr();
563 ExpressionVariableSP expr_var_sp(target->GetPersistentVariable(const_name));
564 if (expr_var_sp) {
565 value_sp = expr_var_sp->GetValueObject();
566 sb_value.SetSP(value_sp, use_dynamic);
567 }
568 } break;
569
570 default:
571 break;
572 }
573
574 return sb_value;
575}
576
577bool SBFrame::IsEqual(const SBFrame &that) const {
578 LLDB_INSTRUMENT_VA(this, that);
579
580 lldb::StackFrameSP this_sp = GetFrameSP();
581 lldb::StackFrameSP that_sp = that.GetFrameSP();
582 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
583}
584
585bool SBFrame::operator==(const SBFrame &rhs) const {
586 LLDB_INSTRUMENT_VA(this, rhs);
587
588 return IsEqual(rhs);
589}
590
591bool SBFrame::operator!=(const SBFrame &rhs) const {
592 LLDB_INSTRUMENT_VA(this, rhs);
593
594 return !IsEqual(rhs);
595}
596
598 LLDB_INSTRUMENT_VA(this);
599
600 llvm::Expected<StoppedExecutionContext> exe_ctx =
602 if (!exe_ctx) {
603 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
604 return SBThread();
605 }
606
607 ThreadSP thread_sp(exe_ctx->GetThreadSP());
608 SBThread sb_thread(thread_sp);
609
610 return sb_thread;
611}
612
613const char *SBFrame::Disassemble() const {
614 LLDB_INSTRUMENT_VA(this);
615
616 llvm::Expected<StoppedExecutionContext> exe_ctx =
618 if (!exe_ctx) {
619 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
620 return nullptr;
621 }
622
623 if (auto *frame = exe_ctx->GetFramePtr())
624 return ConstString(frame->Disassemble()).GetCString();
625
626 return nullptr;
627}
628
629SBValueList SBFrame::GetVariables(bool arguments, bool locals, bool statics,
630 bool in_scope_only) {
631 LLDB_INSTRUMENT_VA(this, arguments, locals, statics, in_scope_only);
632
633 SBValueList value_list;
634 llvm::Expected<StoppedExecutionContext> exe_ctx =
636 if (!exe_ctx) {
637 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
638 return value_list;
639 }
640
641 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
642 Target *target = exe_ctx->GetTargetPtr();
643 lldb::DynamicValueType use_dynamic =
644 frame->CalculateTarget()->GetPreferDynamicValue();
645 const bool include_runtime_support_values =
647
648 SBVariablesOptions options;
649 options.SetIncludeArguments(arguments);
650 options.SetIncludeLocals(locals);
651 options.SetIncludeStatics(statics);
652 options.SetInScopeOnly(in_scope_only);
653 options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
654 options.SetUseDynamic(use_dynamic);
655
656 value_list = GetVariables(options);
657 }
658 return value_list;
659}
660
661lldb::SBValueList SBFrame::GetVariables(bool arguments, bool locals,
662 bool statics, bool in_scope_only,
663 lldb::DynamicValueType use_dynamic) {
664 LLDB_INSTRUMENT_VA(this, arguments, locals, statics, in_scope_only,
665 use_dynamic);
666
667 llvm::Expected<StoppedExecutionContext> exe_ctx =
669 if (!exe_ctx) {
670 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
671 return SBValueList();
672 }
673
674 Target *target = exe_ctx->GetTargetPtr();
675 const bool include_runtime_support_values =
677 SBVariablesOptions options;
678 options.SetIncludeArguments(arguments);
679 options.SetIncludeLocals(locals);
680 options.SetIncludeStatics(statics);
681 options.SetInScopeOnly(in_scope_only);
682 options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
683 options.SetUseDynamic(use_dynamic);
684 return GetVariables(options);
685}
686
687/// Returns true if the variable is in any of the requested scopes.
688static bool IsInRequestedScope(bool statics, bool arguments, bool locals,
689 Variable &var) {
690 switch (var.GetScope()) {
694 return statics;
695
697 return arguments;
698
700 return locals;
701
702 default:
703 break;
704 }
705 return false;
706}
707
709
710/// Populates `value_list` with the variables from `frame` according to
711/// `options`. This method checks whether the Debugger received an interrupt
712/// before processing every variable, returning `WasInterrupted::yes` in that
713/// case.
714static std::pair<WasInterrupted, Status> FetchVariablesUnlessInterrupted(
715 const lldb::SBVariablesOptions &options, StackFrame &frame,
716 SBValueList &value_list, Debugger &dbg,
717 std::function<SBValue(ValueObjectSP, bool)> to_sbvalue) {
718 const bool statics = options.GetIncludeStatics();
719 const bool arguments = options.GetIncludeArguments();
720 const bool locals = options.GetIncludeLocals();
721 const bool in_scope_only = options.GetInScopeOnly();
722 const bool include_runtime_support_values =
724 const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
725
726 Status var_error;
727 VariableList *variable_list = frame.GetVariableList(true, &var_error);
728
729 std::set<VariableSP> variable_set;
730
731 if (!variable_list)
732 return {WasInterrupted::No, std::move(var_error)};
733 const size_t num_variables = variable_list->GetSize();
734 size_t num_produced = 0;
735 for (const VariableSP &variable_sp : *variable_list) {
736 if (!variable_sp ||
737 !IsInRequestedScope(statics, arguments, locals, *variable_sp))
738 continue;
739
741 dbg,
742 "Interrupted getting frame variables with {0} of {1} "
743 "produced.",
744 num_produced, num_variables))
745 return {WasInterrupted::Yes, std::move(var_error)};
746
747 // Only add variables once so we don't end up with duplicates
748 if (variable_set.insert(variable_sp).second == false)
749 continue;
750 if (in_scope_only && !variable_sp->IsInScope(&frame))
751 continue;
752
753 ValueObjectSP valobj_sp(
755
756 if (!include_runtime_support_values && valobj_sp != nullptr &&
757 valobj_sp->IsRuntimeSupportValue())
758 continue;
759
760 value_list.Append(to_sbvalue(valobj_sp, use_dynamic));
761 }
762 num_produced++;
763
764 return {WasInterrupted::No, std::move(var_error)};
765}
766
767/// Populates `value_list` with recognized arguments of `frame` according to
768/// `options`.
769static llvm::SmallVector<ValueObjectSP>
771 SBTarget target) {
772 if (!options.GetIncludeRecognizedArguments(target))
773 return {};
774 RecognizedStackFrameSP recognized_frame = frame.GetRecognizedFrame();
775 if (!recognized_frame)
776 return {};
777
778 ValueObjectListSP recognized_arg_list =
779 recognized_frame->GetRecognizedArguments();
780 if (!recognized_arg_list)
781 return {};
782
783 return llvm::to_vector(recognized_arg_list->GetObjects());
784}
785
787 LLDB_INSTRUMENT_VA(this, options);
788
789 llvm::Expected<StoppedExecutionContext> exe_ctx =
791 if (!exe_ctx) {
792 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
793 return SBValueList();
794 }
795
796 StackFrame *frame = exe_ctx->GetFramePtr();
797 if (!frame)
798 return SBValueList();
799
800 auto valobj_to_sbvalue = [](ValueObjectSP valobj, bool use_dynamic) {
801 SBValue value_sb;
802 value_sb.SetSP(valobj, use_dynamic);
803 return value_sb;
804 };
805 SBValueList value_list;
806 std::pair<WasInterrupted, Status> fetch_result =
807 FetchVariablesUnlessInterrupted(options, *frame, value_list,
808 exe_ctx->GetTargetPtr()->GetDebugger(),
809 valobj_to_sbvalue);
810 if (fetch_result.second.Fail())
811 value_list.SetError(std::move(fetch_result.second));
812
813 if (fetch_result.first == WasInterrupted::Yes)
814 return value_list;
815
816 const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
817 llvm::SmallVector<ValueObjectSP> args = FetchRecognizedArguments(
818 options, *frame, SBTarget(exe_ctx->GetTargetSP()));
819 for (ValueObjectSP arg : args) {
820 SBValue value_sb;
821 value_sb.SetSP(arg, use_dynamic);
822 value_list.Append(value_sb);
823 }
824 return value_list;
825}
826
828 LLDB_INSTRUMENT_VA(this);
829
830 llvm::Expected<StoppedExecutionContext> exe_ctx =
832 if (!exe_ctx) {
833 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
834 return SBValueList();
835 }
836
837 StackFrame *frame = exe_ctx->GetFramePtr();
838 if (!frame)
839 return SBValueList();
840
841 RegisterContextSP reg_ctx(frame->GetRegisterContext());
842 if (!reg_ctx)
843 return SBValueList();
844
845 SBValueList value_list;
846 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
847 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx)
848 value_list.Append(ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx));
849
850 return value_list;
851}
852
854 LLDB_INSTRUMENT_VA(this, name);
855
856 ValueObjectSP value_sp;
857 llvm::Expected<StoppedExecutionContext> exe_ctx =
859 if (!exe_ctx) {
860 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
861 return SBValue();
862 }
863
864 StackFrame *frame = exe_ctx->GetFramePtr();
865 if (!frame)
866 return SBValue();
867
868 RegisterContextSP reg_ctx(frame->GetRegisterContext());
869 if (!reg_ctx)
870 return SBValue();
871
872 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name);
873 if (!reg_info)
874 return SBValue();
875
876 SBValue result;
877 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info);
878 result.SetSP(value_sp);
879
880 return result;
881}
882
884 SBStream &output) {
885 Stream &strm = output.ref();
886
887 llvm::Expected<StoppedExecutionContext> exe_ctx =
889 if (!exe_ctx)
890 return Status::FromError(exe_ctx.takeError());
891
893
894 if (!format) {
895 error.SetErrorString("The provided SBFormat object is invalid");
896 return error;
897 }
898
899 if (StackFrame *frame = exe_ctx->GetFramePtr();
900 frame && frame->DumpUsingFormat(strm, format.GetFormatEntrySP().get()))
901 return error;
902 error.SetErrorStringWithFormat(
903 "It was not possible to generate a frame "
904 "description with the given format string '%s'",
905 format.GetFormatEntrySP()->string.c_str());
906 return error;
907}
908
910 LLDB_INSTRUMENT_VA(this, description);
911
912 Stream &strm = description.ref();
913
914 llvm::Expected<StoppedExecutionContext> exe_ctx =
916 if (!exe_ctx) {
917 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
918 strm.PutCString("Error: process is not stopped.");
919 return true;
920 }
921
922 if (StackFrame *frame = exe_ctx->GetFramePtr())
923 frame->DumpUsingSettingsFormat(&strm);
924
925 return true;
926}
927
929 LLDB_INSTRUMENT_VA(this, expr);
930
931 llvm::Expected<StoppedExecutionContext> exe_ctx =
933 if (!exe_ctx) {
934 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
936 }
937
938 SBExpressionOptions options;
939 StackFrame *frame = exe_ctx->GetFramePtr();
940 if (frame) {
941 lldb::DynamicValueType fetch_dynamic_value =
942 frame->CalculateTarget()->GetPreferDynamicValue();
943 options.SetFetchDynamicValue(fetch_dynamic_value);
944 }
945 options.SetUnwindOnError(true);
946 options.SetIgnoreBreakpoints(true);
947 Target *target = exe_ctx->GetTargetPtr();
948 SourceLanguage language = target->GetLanguage();
949 if (!language && frame)
950 language = frame->GetLanguage();
951 options.SetLanguage((SBSourceLanguageName)language.name, language.version);
952 return EvaluateExpression(expr, options);
953}
954
957 lldb::DynamicValueType fetch_dynamic_value) {
958 LLDB_INSTRUMENT_VA(this, expr, fetch_dynamic_value);
959
960 SBExpressionOptions options;
961 options.SetFetchDynamicValue(fetch_dynamic_value);
962 options.SetUnwindOnError(true);
963 options.SetIgnoreBreakpoints(true);
964 llvm::Expected<StoppedExecutionContext> exe_ctx =
966 if (!exe_ctx) {
967 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
969 }
970
971 StackFrame *frame = exe_ctx->GetFramePtr();
972 Target *target = exe_ctx->GetTargetPtr();
973 SourceLanguage language = target->GetLanguage();
974 if (!language && frame)
975 language = frame->GetLanguage();
976 options.SetLanguage((SBSourceLanguageName)language.name, language.version);
977 return EvaluateExpression(expr, options);
978}
979
981 lldb::DynamicValueType fetch_dynamic_value,
982 bool unwind_on_error) {
983 LLDB_INSTRUMENT_VA(this, expr, fetch_dynamic_value, unwind_on_error);
984
985 SBExpressionOptions options;
986 llvm::Expected<StoppedExecutionContext> exe_ctx =
988 if (!exe_ctx) {
989 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
991 }
992
993 options.SetFetchDynamicValue(fetch_dynamic_value);
994 options.SetUnwindOnError(unwind_on_error);
995 options.SetIgnoreBreakpoints(true);
996 StackFrame *frame = exe_ctx->GetFramePtr();
997 Target *target = exe_ctx->GetTargetPtr();
998 SourceLanguage language = target->GetLanguage();
999 if (!language && frame)
1000 language = frame->GetLanguage();
1001 options.SetLanguage((SBSourceLanguageName)language.name, language.version);
1002 return EvaluateExpression(expr, options);
1003}
1004
1006 auto error = Status::FromErrorString("can't evaluate expressions when the "
1007 "process is running.");
1008 ValueObjectSP expr_value_sp =
1009 ValueObjectConstResult::Create(nullptr, std::move(error));
1010 SBValue expr_result;
1011 expr_result.SetSP(expr_value_sp, false);
1012 return expr_result;
1013}
1014
1016 const SBExpressionOptions &options) {
1017 LLDB_INSTRUMENT_VA(this, expr, options);
1018
1019 auto LogResult = [](SBValue expr_result) {
1020 Log *expr_log = GetLog(LLDBLog::Expressions);
1021 if (expr_result.GetError().Success())
1022 LLDB_LOGF(expr_log,
1023 "** [SBFrame::EvaluateExpression] Expression result is "
1024 "%s, summary %s **",
1025 expr_result.GetValue(), expr_result.GetSummary());
1026 else
1027 LLDB_LOGF(
1028 expr_log,
1029 "** [SBFrame::EvaluateExpression] Expression evaluation failed: "
1030 "%s **",
1031 expr_result.GetError().GetCString());
1032 };
1033
1034 if (expr == nullptr || expr[0] == '\0') {
1035 return SBValue();
1036 }
1037
1038 llvm::Expected<StoppedExecutionContext> exe_ctx =
1040 if (!exe_ctx) {
1041 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1043 LogResult(error_result);
1044 return error_result;
1045 }
1046
1047 StackFrame *frame = exe_ctx->GetFramePtr();
1048 if (!frame)
1049 return SBValue();
1050
1051 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1052 Target *target = exe_ctx->GetTargetPtr();
1053 if (target->GetDisplayExpressionsInCrashlogs()) {
1054 StreamString frame_description;
1055 frame->DumpUsingSettingsFormat(&frame_description);
1056 stack_trace = std::make_unique<llvm::PrettyStackTraceFormat>(
1057 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1058 "= %u) %s",
1059 expr, options.GetFetchDynamicValue(), frame_description.GetData());
1060 }
1061
1062 ValueObjectSP expr_value_sp;
1063 target->EvaluateExpression(expr, frame, expr_value_sp, options.ref());
1064
1065 SBValue expr_result;
1066 expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
1067 LogResult(expr_result);
1068
1069 return expr_result;
1070}
1071
1073 LLDB_INSTRUMENT_VA(this);
1074
1075 SBStructuredData sb_data;
1076 llvm::Expected<StoppedExecutionContext> exe_ctx =
1078 if (!exe_ctx) {
1079 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1080 return sb_data;
1081 }
1082 StackFrame *frame = exe_ctx->GetFramePtr();
1083 if (!frame)
1084 return sb_data;
1085
1087 sb_data.m_impl_up->SetObjectSP(data);
1088 return sb_data;
1089}
1090
1092 LLDB_INSTRUMENT_VA(this);
1093
1094 return static_cast<const SBFrame *>(this)->IsInlined();
1095}
1096
1098 LLDB_INSTRUMENT_VA(this);
1099
1100 llvm::Expected<StoppedExecutionContext> exe_ctx =
1102 if (!exe_ctx) {
1103 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1104 return false;
1105 }
1106
1107 if (StackFrame *frame = exe_ctx->GetFramePtr())
1108 return frame->IsInlined();
1109 return false;
1110}
1111
1113 LLDB_INSTRUMENT_VA(this);
1114
1115 return static_cast<const SBFrame *>(this)->IsArtificial();
1116}
1117
1119 LLDB_INSTRUMENT_VA(this);
1120
1121 llvm::Expected<StoppedExecutionContext> exe_ctx =
1123 if (!exe_ctx) {
1124 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1125 return false;
1126 }
1127
1128 if (StackFrame *frame = exe_ctx->GetFramePtr())
1129 return frame->IsArtificial();
1130
1131 return false;
1132}
1133
1135 LLDB_INSTRUMENT_VA(this);
1136
1137 llvm::Expected<StoppedExecutionContext> exe_ctx =
1139 if (!exe_ctx) {
1140 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1141 return false;
1142 }
1143
1144 if (StackFrame *frame = exe_ctx->GetFramePtr())
1145 return frame->IsSynthetic();
1146
1147 return false;
1148}
1149
1150bool SBFrame::IsHidden() const {
1151 LLDB_INSTRUMENT_VA(this);
1152
1153 llvm::Expected<StoppedExecutionContext> exe_ctx =
1155 if (!exe_ctx) {
1156 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1157 return false;
1158 }
1159
1160 if (StackFrame *frame = exe_ctx->GetFramePtr())
1161 return frame->IsHidden();
1162
1163 return false;
1164}
1165
1167 LLDB_INSTRUMENT_VA(this);
1168
1169 return static_cast<const SBFrame *>(this)->GetFunctionName();
1170}
1171
1173 LLDB_INSTRUMENT_VA(this);
1174
1175 llvm::Expected<StoppedExecutionContext> exe_ctx =
1177 if (!exe_ctx) {
1178 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1179 return eLanguageTypeUnknown;
1180 }
1181
1182 if (StackFrame *frame = exe_ctx->GetFramePtr())
1183 return frame->GuessLanguage().AsLanguageType();
1184 return eLanguageTypeUnknown;
1185}
1186
1187const char *SBFrame::GetFunctionName() const {
1188 LLDB_INSTRUMENT_VA(this);
1189
1190 llvm::Expected<StoppedExecutionContext> exe_ctx =
1192 if (!exe_ctx) {
1193 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1194 return nullptr;
1195 }
1196
1197 if (StackFrame *frame = exe_ctx->GetFramePtr())
1198 return frame->GetFunctionName();
1199 return nullptr;
1200}
1201
1203 LLDB_INSTRUMENT_VA(this);
1204
1205 llvm::Expected<StoppedExecutionContext> exe_ctx =
1207 if (!exe_ctx) {
1208 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1209 return nullptr;
1210 }
1211
1212 if (StackFrame *frame = exe_ctx->GetFramePtr())
1213 return frame->GetDisplayFunctionName();
1214 return nullptr;
1215}
static llvm::raw_ostream & error(Stream &strm)
#define INTERRUPT_REQUESTED(debugger,...)
This handy define will keep you from having to generate a report for the interruption by hand.
Definition Debugger.h:469
#define LLDB_INSTRUMENT_VA(...)
#define LLDB_LOGF(log,...)
Definition Log.h:376
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:392
static std::pair< WasInterrupted, Status > FetchVariablesUnlessInterrupted(const lldb::SBVariablesOptions &options, StackFrame &frame, SBValueList &value_list, Debugger &dbg, std::function< SBValue(ValueObjectSP, bool)> to_sbvalue)
Populates value_list with the variables from frame according to options.
Definition SBFrame.cpp:714
static bool IsInRequestedScope(bool statics, bool arguments, bool locals, Variable &var)
Returns true if the variable is in any of the requested scopes.
Definition SBFrame.cpp:688
static llvm::SmallVector< ValueObjectSP > FetchRecognizedArguments(const SBVariablesOptions &options, StackFrame &frame, SBTarget target)
Populates value_list with recognized arguments of frame according to options.
Definition SBFrame.cpp:770
WasInterrupted
Definition SBFrame.cpp:708
@ Yes
Definition SBFrame.cpp:708
@ No
Definition SBFrame.cpp:708
void SetFetchDynamicValue(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
void SetLanguage(lldb::LanguageType language)
lldb_private::EvaluateExpressionOptions & ref() const
void SetIgnoreBreakpoints(bool ignore=true)
void SetUnwindOnError(bool unwind=true)
lldb::DynamicValueType GetFetchDynamicValue() const
Class that represents a format string that can be used to generate descriptions of objects like frame...
Definition SBFormat.h:28
lldb::FormatEntrySP GetFormatEntrySP() const
Definition SBFormat.cpp:44
lldb::ExecutionContextRefSP m_opaque_sp
Definition SBFrame.h:244
lldb::addr_t GetPC() const
Definition SBFrame.cpp:274
const char * GetFunctionName()
Get the appropriate function name for this frame.
Definition SBFrame.cpp:1166
lldb::SBValue FindValue(const char *name, ValueType value_type)
Find variables, register sets, registers, or persistent variables using the frame as the scope.
Definition SBFrame.cpp:457
lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr, DynamicValueType use_dynamic)
Definition SBFrame.cpp:385
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const
Definition SBFrame.cpp:110
SBError GetDescriptionWithFormat(const SBFormat &format, SBStream &output)
Similar to GetDescription() but the format of the description can be configured via the format parame...
Definition SBFrame.cpp:883
bool IsValid() const
Definition SBFrame.cpp:94
lldb::SBValue FindRegister(const char *name)
Definition SBFrame.cpp:853
bool SetPC(lldb::addr_t new_pc)
Definition SBFrame.cpp:293
lldb::SBValue FindVariable(const char *var_name)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
Definition SBFrame.cpp:414
const char * GetDisplayFunctionName()
Definition SBFrame.cpp:1202
bool IsInlined()
Return true if this frame represents an inlined function.
Definition SBFrame.cpp:1091
bool operator==(const lldb::SBFrame &rhs) const
Definition SBFrame.cpp:585
lldb::addr_t GetCFA() const
Definition SBFrame.cpp:259
lldb::addr_t GetFP() const
Definition SBFrame.cpp:328
const lldb::SBFrame & operator=(const lldb::SBFrame &rhs)
Definition SBFrame.cpp:78
static SBValue CreateProcessIsRunningExprEvalError()
Return an SBValue containing an error message that warns the process is not currently stopped.
Definition SBFrame.cpp:1005
lldb::SBLineEntry GetLineEntry() const
Definition SBFrame.cpp:226
friend class SBValue
Definition SBFrame.h:228
lldb::SBValue EvaluateExpression(const char *expr)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
Definition SBFrame.cpp:928
lldb::SBCompileUnit GetCompileUnit() const
Definition SBFrame.cpp:150
uint32_t GetFrameID() const
Definition SBFrame.cpp:242
lldb::SBAddress GetPCAddress() const
Definition SBFrame.cpp:345
friend class SBThread
Definition SBFrame.h:227
lldb::SBFunction GetFunction() const
Definition SBFrame.cpp:166
lldb::SBBlock GetBlock() const
Gets the deepest block that contains the frame PC.
Definition SBFrame.cpp:196
friend class SBBlock
Definition SBFrame.h:223
lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics, bool in_scope_only)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
Definition SBFrame.cpp:629
bool IsSynthetic() const
Definition SBFrame.cpp:1134
bool IsEqual(const lldb::SBFrame &that) const
Definition SBFrame.cpp:577
const char * Disassemble() const
Definition SBFrame.cpp:613
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition SBFrame.cpp:90
lldb::SBThread GetThread() const
Definition SBFrame.cpp:597
lldb::SBValueList GetRegisters()
Definition SBFrame.cpp:827
bool IsArtificial()
Definition SBFrame.cpp:1112
lldb::LanguageType GuessLanguage() const
Definition SBFrame.cpp:1172
lldb::SBBlock GetFrameBlock() const
Gets the lexical block that defines the stack frame.
Definition SBFrame.cpp:211
lldb::addr_t GetSP() const
Definition SBFrame.cpp:311
lldb::StackFrameSP GetFrameSP() const
Definition SBFrame.cpp:86
bool IsHidden() const
Return whether a frame recognizer decided this frame should not be displayes in backtraces etc.
Definition SBFrame.cpp:1150
SBStructuredData GetLanguageSpecificData() const
Language plugins can use this API to report language-specific runtime information about this compile ...
Definition SBFrame.cpp:1072
lldb::SBSymbol GetSymbol() const
Definition SBFrame.cpp:181
lldb::SBModule GetModule() const
Definition SBFrame.cpp:129
bool GetDescription(lldb::SBStream &description)
Definition SBFrame.cpp:909
bool operator!=(const lldb::SBFrame &rhs) const
Definition SBFrame.cpp:591
void SetSP(const ModuleSP &module_sp)
Definition SBModule.cpp:211
lldb_private::Stream & ref()
Definition SBStream.cpp:178
StructuredDataImplUP m_impl_up
void Append(const lldb::SBValue &val_obj)
void SetError(lldb_private::Status &&status)
void SetSP(const lldb::ValueObjectSP &sp)
Definition SBValue.cpp:1116
lldb::DynamicValueType GetUseDynamic() const
void SetUseDynamic(lldb::DynamicValueType)
bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const
uint32_t AppendVariables(bool can_create, bool get_parent_variables, bool stop_if_block_is_inlined_function, const std::function< bool(Variable *)> &filter, VariableList *variable_list)
Appends the variables from this block, and optionally from all parent blocks, to variable_list.
Definition Block.cpp:436
A uniqued constant string class.
Definition ConstString.h:40
const char * GetCString() const
Get the string value as a C string.
A class to manage flag bits.
Definition Debugger.h:80
Execution context objects refer to objects in the execution of the program that is being debugged.
This base class provides an interface to stack frames.
Definition StackFrame.h:44
@ eExpressionPathOptionsAllowDirectIVarAccess
Definition StackFrame.h:58
virtual const char * GetFunctionName()
Get the frame's demangled name.
virtual bool IsHidden()
Query whether this frame should be hidden from backtraces.
virtual VariableList * GetVariableList(bool get_file_globals, Status *error_ptr)
Retrieve the list of variables whose scope either:
virtual bool IsSynthetic() const
Query whether this frame is synthetic.
virtual void DumpUsingSettingsFormat(Stream *strm, bool show_unique=false, const char *frame_marker=nullptr)
Print a description for this frame using the frame-format formatter settings.
virtual bool IsInlined()
Query whether this frame is a concrete frame on the call stack, or if it is an inlined frame derived ...
virtual SourceLanguage GuessLanguage()
Similar to GetLanguage(), but is allowed to take a potentially incorrect guess if exact information i...
virtual lldb::RegisterContextSP GetRegisterContext()
Get the RegisterContext for this frame, if possible.
virtual StructuredData::ObjectSP GetLanguageSpecificData()
Language plugins can use this API to report language-specific runtime information about this compile ...
virtual SourceLanguage GetLanguage()
Query this frame to determine what the default language should be when parsing expressions given the ...
virtual lldb::ValueObjectSP GetValueObjectForFrameVariable(const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
Create a ValueObject for a given Variable in this StackFrame.
virtual const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
virtual const char * GetDisplayFunctionName()
Get the frame's demangled display name.
virtual bool IsArtificial() const
Query whether this frame is artificial (e.g a synthesized result of inferring missing tail call frame...
virtual bool DumpUsingFormat(Stream &strm, const lldb_private::FormatEntity::Entry *format, llvm::StringRef frame_marker={})
Print a description of this frame using the provided frame format.
virtual lldb::RecognizedStackFrameSP GetRecognizedFrame()
lldb::TargetSP CalculateTarget() override
An error handling class.
Definition Status.h:118
static Status FromErrorString(const char *str)
Definition Status.h:141
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
Definition Status.cpp:137
const char * GetData() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:65
std::shared_ptr< Object > ObjectSP
Defines a symbol context baton that can be handed other debug core functions.
Block * block
The Block for a given query.
lldb::ModuleSP module_sp
The Module for a given query.
bool GetDisplayRuntimeSupportValues() const
Definition Target.cpp:5113
SourceLanguage GetLanguage() const
Definition Target.cpp:5008
bool GetDisplayExpressionsInCrashlogs() const
Definition Target.cpp:5069
lldb::addr_t GetOpcodeLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as an opcode for this target.
Definition Target.cpp:2999
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:2918
lldb::ExpressionResults EvaluateExpression(llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options=EvaluateExpressionOptions(), std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
Definition Target.cpp:2850
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::RegisterContextSP &reg_ctx_sp, uint32_t set_idx)
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::RegisterContextSP &reg_ctx_sp, const RegisterInfo *reg_info)
lldb::VariableSP FindVariable(ConstString name, bool include_static_members=true)
size_t AppendVariablesIfUnique(VariableList &var_list)
bool IsInScope(StackFrame *frame)
Definition Variable.cpp:274
lldb::ValueType GetScope() const
Definition Variable.h:66
#define LLDB_INVALID_ADDRESS
#define UINT32_MAX
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:332
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
Definition Utils.h:17
llvm::Expected< StoppedExecutionContext > GetStoppedExecutionContext(const ExecutionContextRef *exe_ctx_ref_ptr)
class LLDB_API SBSymbol
Definition SBDefines.h:112
class LLDB_API SBLineEntry
Definition SBDefines.h:86
class LLDB_API SBFunction
Definition SBDefines.h:80
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::RecognizedStackFrame > RecognizedStackFrameSP
class LLDB_API SBValueList
Definition SBDefines.h:136
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
class LLDB_API SBModule
Definition SBDefines.h:90
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
class LLDB_API SBTarget
Definition SBDefines.h:115
std::shared_ptr< lldb_private::ValueObjectList > ValueObjectListSP
std::shared_ptr< lldb_private::Variable > VariableSP
class LLDB_API SBAddress
Definition SBDefines.h:45
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
class LLDB_API SBValue
Definition SBDefines.h:135
std::shared_ptr< lldb_private::Module > ModuleSP
@ eValueTypeVariableGlobal
globals variable
@ eValueTypeConstResult
constant result variables
@ eValueTypeVariableLocal
function local variables
@ eValueTypeVariableArgument
function argument variables
@ eValueTypeRegister
stack frame register value
@ eValueTypeVariableStatic
static variable
@ eValueTypeRegisterSet
A collection of stack frame register values.
@ eValueTypeVariableThreadLocal
thread local storage variable
class LLDB_API SBCompileUnit
Definition SBDefines.h:63
Every register is described in detail including its name, alternate name (optional),...
Registers are grouped into register sets.
const char * name
Name of this register set.
const char * short_name
A short name for this register set.
A type-erased pair of llvm::dwarf::SourceLanguageName and version.
lldb::LanguageType AsLanguageType() const
Definition Language.cpp:618