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::DILMode mode) {
368 LLDB_INSTRUMENT_VA(this, var_path);
369
370 SBValue sb_value;
371 llvm::Expected<StoppedExecutionContext> exe_ctx =
373 if (!exe_ctx) {
374 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
375 return sb_value;
376 }
377
378 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
379 lldb::DynamicValueType use_dynamic =
380 frame->CalculateTarget()->GetPreferDynamicValue();
381 sb_value = GetValueForVariablePath(var_path, use_dynamic, mode);
382 }
383 return sb_value;
384}
385
387 DynamicValueType use_dynamic,
388 lldb::DILMode mode) {
389 LLDB_INSTRUMENT_VA(this, var_path, use_dynamic);
390
391 SBValue sb_value;
392 if (var_path == nullptr || var_path[0] == '\0') {
393 return sb_value;
394 }
395
396 llvm::Expected<StoppedExecutionContext> exe_ctx =
398 if (!exe_ctx) {
399 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
400 return sb_value;
401 }
402
403 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
404 VariableSP var_sp;
406 ValueObjectSP value_sp(frame->GetValueForVariableExpressionPath(
407 var_path, eNoDynamicValues,
410 var_sp, error, mode));
411 sb_value.SetSP(value_sp, use_dynamic);
412 }
413 return sb_value;
414}
415
417 LLDB_INSTRUMENT_VA(this, name);
418
419 llvm::Expected<StoppedExecutionContext> exe_ctx =
421 if (!exe_ctx) {
422 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
423 return SBValue();
424 }
425
426 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
427 lldb::DynamicValueType use_dynamic =
428 frame->CalculateTarget()->GetPreferDynamicValue();
429 return FindVariable(name, use_dynamic);
430 }
431 return SBValue();
432}
433
435 lldb::DynamicValueType use_dynamic) {
436 LLDB_INSTRUMENT_VA(this, name, use_dynamic);
437
438 VariableSP var_sp;
439 SBValue sb_value;
440
441 if (name == nullptr || name[0] == '\0') {
442 return sb_value;
443 }
444
445 llvm::Expected<StoppedExecutionContext> exe_ctx =
447 if (!exe_ctx) {
448 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
449 return sb_value;
450 }
451
452 if (StackFrame *frame = exe_ctx->GetFramePtr())
453 if (ValueObjectSP value_sp = frame->FindVariable(ConstString(name)))
454 sb_value.SetSP(value_sp, use_dynamic);
455
456 return sb_value;
457}
458
459SBValue SBFrame::FindValue(const char *name, ValueType value_type) {
460 LLDB_INSTRUMENT_VA(this, name, value_type);
461
462 SBValue value;
463 llvm::Expected<StoppedExecutionContext> exe_ctx =
465 if (!exe_ctx) {
466 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
467 return value;
468 }
469
470 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
471 lldb::DynamicValueType use_dynamic =
472 frame->CalculateTarget()->GetPreferDynamicValue();
473 value = FindValue(name, value_type, use_dynamic);
474 }
475 return value;
476}
477
478SBValue SBFrame::FindValue(const char *name, ValueType value_type,
479 lldb::DynamicValueType use_dynamic) {
480 LLDB_INSTRUMENT_VA(this, name, value_type, use_dynamic);
481
482 SBValue sb_value;
483
484 if (name == nullptr || name[0] == '\0') {
485 return sb_value;
486 }
487
488 ValueObjectSP value_sp;
489 llvm::Expected<StoppedExecutionContext> exe_ctx =
491
492 if (!exe_ctx) {
493 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
494 return value_sp;
495 }
496
497 StackFrame *frame = exe_ctx->GetFramePtr();
498 if (!frame)
499 return value_sp;
500
501 VariableList variable_list;
502
503 switch (value_type) {
504 case eValueTypeVariableGlobal: // global variable
505 case eValueTypeVariableStatic: // static variable
506 case eValueTypeVariableArgument: // function argument variables
507 case eValueTypeVariableLocal: // function local variables
508 case eValueTypeVariableThreadLocal: { // thread local variables
509 SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
510
511 const bool can_create = true;
512 const bool get_parent_variables = true;
513 const bool stop_if_block_is_inlined_function = true;
514
515 if (sc.block)
517 can_create, get_parent_variables, stop_if_block_is_inlined_function,
518 [frame](Variable *v) { return v->IsInScope(frame); }, &variable_list);
519 if (value_type == eValueTypeVariableGlobal ||
520 value_type == eValueTypeVariableStatic) {
521 const bool get_file_globals = true;
522 VariableList *frame_vars =
523 frame->GetVariableList(get_file_globals, nullptr);
524 if (frame_vars)
525 frame_vars->AppendVariablesIfUnique(variable_list);
526 }
527 ConstString const_name(name);
528 VariableSP variable_sp(variable_list.FindVariable(const_name, value_type));
529 if (variable_sp) {
530 value_sp =
532 sb_value.SetSP(value_sp, use_dynamic);
533 }
534 } break;
535
536 case eValueTypeRegister: { // stack frame register value
537 if (RegisterContextSP reg_ctx = frame->GetRegisterContext()) {
538 if (const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name)) {
539 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info);
540 sb_value.SetSP(value_sp);
541 }
542 }
543 } break;
544
545 case eValueTypeRegisterSet: { // A collection of stack frame register
546 // values
547 if (RegisterContextSP reg_ctx = frame->GetRegisterContext()) {
548 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
549 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
550 const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
551 if (reg_set &&
552 (llvm::StringRef(reg_set->name).equals_insensitive(name) ||
553 llvm::StringRef(reg_set->short_name).equals_insensitive(name))) {
554 value_sp = ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx);
555 sb_value.SetSP(value_sp);
556 break;
557 }
558 }
559 }
560 } break;
561
562 case eValueTypeConstResult: { // constant result variables
563 ConstString const_name(name);
564 Target *target = exe_ctx->GetTargetPtr();
565 ExpressionVariableSP expr_var_sp(target->GetPersistentVariable(const_name));
566 if (expr_var_sp) {
567 value_sp = expr_var_sp->GetValueObject();
568 sb_value.SetSP(value_sp, use_dynamic);
569 }
570 } break;
571
572 default:
573 break;
574 }
575
576 return sb_value;
577}
578
579bool SBFrame::IsEqual(const SBFrame &that) const {
580 LLDB_INSTRUMENT_VA(this, that);
581
582 lldb::StackFrameSP this_sp = GetFrameSP();
583 lldb::StackFrameSP that_sp = that.GetFrameSP();
584 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
585}
586
587bool SBFrame::operator==(const SBFrame &rhs) const {
588 LLDB_INSTRUMENT_VA(this, rhs);
589
590 return IsEqual(rhs);
591}
592
593bool SBFrame::operator!=(const SBFrame &rhs) const {
594 LLDB_INSTRUMENT_VA(this, rhs);
595
596 return !IsEqual(rhs);
597}
598
600 LLDB_INSTRUMENT_VA(this);
601
602 llvm::Expected<StoppedExecutionContext> exe_ctx =
604 if (!exe_ctx) {
605 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
606 return SBThread();
607 }
608
609 ThreadSP thread_sp(exe_ctx->GetThreadSP());
610 SBThread sb_thread(thread_sp);
611
612 return sb_thread;
613}
614
615const char *SBFrame::Disassemble() const {
616 LLDB_INSTRUMENT_VA(this);
617
618 llvm::Expected<StoppedExecutionContext> exe_ctx =
620 if (!exe_ctx) {
621 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
622 return nullptr;
623 }
624
625 if (auto *frame = exe_ctx->GetFramePtr())
626 return ConstString(frame->Disassemble()).GetCString();
627
628 return nullptr;
629}
630
631SBValueList SBFrame::GetVariables(bool arguments, bool locals, bool statics,
632 bool in_scope_only) {
633 LLDB_INSTRUMENT_VA(this, arguments, locals, statics, in_scope_only);
634
635 SBValueList value_list;
636 llvm::Expected<StoppedExecutionContext> exe_ctx =
638 if (!exe_ctx) {
639 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
640 return value_list;
641 }
642
643 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
644 Target *target = exe_ctx->GetTargetPtr();
645 lldb::DynamicValueType use_dynamic =
646 frame->CalculateTarget()->GetPreferDynamicValue();
647 const bool include_runtime_support_values =
649
650 SBVariablesOptions options;
651 options.SetIncludeArguments(arguments);
652 options.SetIncludeLocals(locals);
653 options.SetIncludeStatics(statics);
654 options.SetInScopeOnly(in_scope_only);
655 options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
656 options.SetUseDynamic(use_dynamic);
657
658 value_list = GetVariables(options);
659 }
660 return value_list;
661}
662
663lldb::SBValueList SBFrame::GetVariables(bool arguments, bool locals,
664 bool statics, bool in_scope_only,
665 lldb::DynamicValueType use_dynamic) {
666 LLDB_INSTRUMENT_VA(this, arguments, locals, statics, in_scope_only,
667 use_dynamic);
668
669 llvm::Expected<StoppedExecutionContext> exe_ctx =
671 if (!exe_ctx) {
672 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
673 return SBValueList();
674 }
675
676 Target *target = exe_ctx->GetTargetPtr();
677 const bool include_runtime_support_values =
679 SBVariablesOptions options;
680 options.SetIncludeArguments(arguments);
681 options.SetIncludeLocals(locals);
682 options.SetIncludeStatics(statics);
683 options.SetInScopeOnly(in_scope_only);
684 options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
685 options.SetUseDynamic(use_dynamic);
686 return GetVariables(options);
687}
688
689/// Returns true if the variable is in any of the requested scopes.
690static bool IsInRequestedScope(bool statics, bool arguments, bool locals,
691 Variable &var) {
692 switch (var.GetScope()) {
696 return statics;
697
699 return arguments;
700
702 return locals;
703
704 default:
705 break;
706 }
707 return false;
708}
709
711
712/// Populates `value_list` with the variables from `frame` according to
713/// `options`. This method checks whether the Debugger received an interrupt
714/// before processing every variable, returning `WasInterrupted::yes` in that
715/// case.
716static std::pair<WasInterrupted, Status> FetchVariablesUnlessInterrupted(
717 const lldb::SBVariablesOptions &options, StackFrame &frame,
718 SBValueList &value_list, Debugger &dbg,
719 std::function<SBValue(ValueObjectSP, bool)> to_sbvalue) {
720 const bool statics = options.GetIncludeStatics();
721 const bool arguments = options.GetIncludeArguments();
722 const bool locals = options.GetIncludeLocals();
723 const bool in_scope_only = options.GetInScopeOnly();
724 const bool include_runtime_support_values =
726 const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
727
728 Status var_error;
729 VariableList *variable_list = frame.GetVariableList(true, &var_error);
730
731 std::set<VariableSP> variable_set;
732
733 if (!variable_list)
734 return {WasInterrupted::No, std::move(var_error)};
735 const size_t num_variables = variable_list->GetSize();
736 size_t num_produced = 0;
737 for (const VariableSP &variable_sp : *variable_list) {
738 if (!variable_sp ||
739 !IsInRequestedScope(statics, arguments, locals, *variable_sp))
740 continue;
741
743 dbg,
744 "Interrupted getting frame variables with {0} of {1} "
745 "produced.",
746 num_produced, num_variables))
747 return {WasInterrupted::Yes, std::move(var_error)};
748
749 // Only add variables once so we don't end up with duplicates
750 if (variable_set.insert(variable_sp).second == false)
751 continue;
752 if (in_scope_only && !variable_sp->IsInScope(&frame))
753 continue;
754
755 ValueObjectSP valobj_sp(
757
758 if (!include_runtime_support_values && valobj_sp != nullptr &&
759 valobj_sp->IsRuntimeSupportValue())
760 continue;
761
762 value_list.Append(to_sbvalue(valobj_sp, use_dynamic));
763 }
764 num_produced++;
765
766 return {WasInterrupted::No, std::move(var_error)};
767}
768
769/// Populates `value_list` with recognized arguments of `frame` according to
770/// `options`.
771static llvm::SmallVector<ValueObjectSP>
773 SBTarget target) {
774 if (!options.GetIncludeRecognizedArguments(target))
775 return {};
776 RecognizedStackFrameSP recognized_frame = frame.GetRecognizedFrame();
777 if (!recognized_frame)
778 return {};
779
780 ValueObjectListSP recognized_arg_list =
781 recognized_frame->GetRecognizedArguments();
782 if (!recognized_arg_list)
783 return {};
784
785 return llvm::to_vector(recognized_arg_list->GetObjects());
786}
787
789 LLDB_INSTRUMENT_VA(this, options);
790
791 llvm::Expected<StoppedExecutionContext> exe_ctx =
793 if (!exe_ctx) {
794 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
795 return SBValueList();
796 }
797
798 StackFrame *frame = exe_ctx->GetFramePtr();
799 if (!frame)
800 return SBValueList();
801
802 auto valobj_to_sbvalue = [](ValueObjectSP valobj, bool use_dynamic) {
803 SBValue value_sb;
804 value_sb.SetSP(valobj, use_dynamic);
805 return value_sb;
806 };
807 SBValueList value_list;
808 std::pair<WasInterrupted, Status> fetch_result =
809 FetchVariablesUnlessInterrupted(options, *frame, value_list,
810 exe_ctx->GetTargetPtr()->GetDebugger(),
811 valobj_to_sbvalue);
812 if (fetch_result.second.Fail())
813 value_list.SetError(std::move(fetch_result.second));
814
815 if (fetch_result.first == WasInterrupted::Yes)
816 return value_list;
817
818 const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
819 llvm::SmallVector<ValueObjectSP> args = FetchRecognizedArguments(
820 options, *frame, SBTarget(exe_ctx->GetTargetSP()));
821 for (ValueObjectSP arg : args) {
822 SBValue value_sb;
823 value_sb.SetSP(arg, use_dynamic);
824 value_list.Append(value_sb);
825 }
826 return value_list;
827}
828
830 LLDB_INSTRUMENT_VA(this);
831
832 llvm::Expected<StoppedExecutionContext> exe_ctx =
834 if (!exe_ctx) {
835 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
836 return SBValueList();
837 }
838
839 StackFrame *frame = exe_ctx->GetFramePtr();
840 if (!frame)
841 return SBValueList();
842
843 RegisterContextSP reg_ctx(frame->GetRegisterContext());
844 if (!reg_ctx)
845 return SBValueList();
846
847 SBValueList value_list;
848 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
849 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx)
850 value_list.Append(ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx));
851
852 return value_list;
853}
854
856 LLDB_INSTRUMENT_VA(this, name);
857
858 ValueObjectSP value_sp;
859 llvm::Expected<StoppedExecutionContext> exe_ctx =
861 if (!exe_ctx) {
862 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
863 return SBValue();
864 }
865
866 StackFrame *frame = exe_ctx->GetFramePtr();
867 if (!frame)
868 return SBValue();
869
870 RegisterContextSP reg_ctx(frame->GetRegisterContext());
871 if (!reg_ctx)
872 return SBValue();
873
874 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name);
875 if (!reg_info)
876 return SBValue();
877
878 SBValue result;
879 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info);
880 result.SetSP(value_sp);
881
882 return result;
883}
884
886 SBStream &output) {
887 Stream &strm = output.ref();
888
889 llvm::Expected<StoppedExecutionContext> exe_ctx =
891 if (!exe_ctx)
892 return Status::FromError(exe_ctx.takeError());
893
895
896 if (!format) {
897 error.SetErrorString("The provided SBFormat object is invalid");
898 return error;
899 }
900
901 if (StackFrame *frame = exe_ctx->GetFramePtr();
902 frame && frame->DumpUsingFormat(strm, format.GetFormatEntrySP().get()))
903 return error;
904 error.SetErrorStringWithFormat(
905 "It was not possible to generate a frame "
906 "description with the given format string '%s'",
907 format.GetFormatEntrySP()->string.c_str());
908 return error;
909}
910
912 LLDB_INSTRUMENT_VA(this, description);
913
914 Stream &strm = description.ref();
915
916 llvm::Expected<StoppedExecutionContext> exe_ctx =
918 if (!exe_ctx) {
919 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
920 strm.PutCString("Error: process is not stopped.");
921 return true;
922 }
923
924 if (StackFrame *frame = exe_ctx->GetFramePtr())
925 frame->DumpUsingSettingsFormat(&strm);
926
927 return true;
928}
929
931 LLDB_INSTRUMENT_VA(this, expr);
932
933 llvm::Expected<StoppedExecutionContext> exe_ctx =
935 if (!exe_ctx) {
936 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
938 }
939
940 SBExpressionOptions options;
941 StackFrame *frame = exe_ctx->GetFramePtr();
942 if (frame) {
943 lldb::DynamicValueType fetch_dynamic_value =
944 frame->CalculateTarget()->GetPreferDynamicValue();
945 options.SetFetchDynamicValue(fetch_dynamic_value);
946 }
947 options.SetUnwindOnError(true);
948 options.SetIgnoreBreakpoints(true);
949 Target *target = exe_ctx->GetTargetPtr();
950 SourceLanguage language = target->GetLanguage();
951 if (!language && frame)
952 language = frame->GetLanguage();
953 options.SetLanguage((SBSourceLanguageName)language.name, language.version);
954 return EvaluateExpression(expr, options);
955}
956
959 lldb::DynamicValueType fetch_dynamic_value) {
960 LLDB_INSTRUMENT_VA(this, expr, fetch_dynamic_value);
961
962 SBExpressionOptions options;
963 options.SetFetchDynamicValue(fetch_dynamic_value);
964 options.SetUnwindOnError(true);
965 options.SetIgnoreBreakpoints(true);
966 llvm::Expected<StoppedExecutionContext> exe_ctx =
968 if (!exe_ctx) {
969 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
971 }
972
973 StackFrame *frame = exe_ctx->GetFramePtr();
974 Target *target = exe_ctx->GetTargetPtr();
975 SourceLanguage language = target->GetLanguage();
976 if (!language && frame)
977 language = frame->GetLanguage();
978 options.SetLanguage((SBSourceLanguageName)language.name, language.version);
979 return EvaluateExpression(expr, options);
980}
981
983 lldb::DynamicValueType fetch_dynamic_value,
984 bool unwind_on_error) {
985 LLDB_INSTRUMENT_VA(this, expr, fetch_dynamic_value, unwind_on_error);
986
987 SBExpressionOptions options;
988 llvm::Expected<StoppedExecutionContext> exe_ctx =
990 if (!exe_ctx) {
991 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
993 }
994
995 options.SetFetchDynamicValue(fetch_dynamic_value);
996 options.SetUnwindOnError(unwind_on_error);
997 options.SetIgnoreBreakpoints(true);
998 StackFrame *frame = exe_ctx->GetFramePtr();
999 Target *target = exe_ctx->GetTargetPtr();
1000 SourceLanguage language = target->GetLanguage();
1001 if (!language && frame)
1002 language = frame->GetLanguage();
1003 options.SetLanguage((SBSourceLanguageName)language.name, language.version);
1004 return EvaluateExpression(expr, options);
1005}
1006
1008 auto error = Status::FromErrorString("can't evaluate expressions when the "
1009 "process is running.");
1010 ValueObjectSP expr_value_sp =
1011 ValueObjectConstResult::Create(nullptr, std::move(error));
1012 SBValue expr_result;
1013 expr_result.SetSP(expr_value_sp, false);
1014 return expr_result;
1015}
1016
1018 const SBExpressionOptions &options) {
1019 LLDB_INSTRUMENT_VA(this, expr, options);
1020
1021 auto LogResult = [](SBValue expr_result) {
1022 Log *expr_log = GetLog(LLDBLog::Expressions);
1023 if (expr_result.GetError().Success())
1024 LLDB_LOGF(expr_log,
1025 "** [SBFrame::EvaluateExpression] Expression result is "
1026 "%s, summary %s **",
1027 expr_result.GetValue(), expr_result.GetSummary());
1028 else
1029 LLDB_LOGF(
1030 expr_log,
1031 "** [SBFrame::EvaluateExpression] Expression evaluation failed: "
1032 "%s **",
1033 expr_result.GetError().GetCString());
1034 };
1035
1036 if (expr == nullptr || expr[0] == '\0') {
1037 return SBValue();
1038 }
1039
1040 llvm::Expected<StoppedExecutionContext> exe_ctx =
1042 if (!exe_ctx) {
1043 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1045 LogResult(error_result);
1046 return error_result;
1047 }
1048
1049 StackFrame *frame = exe_ctx->GetFramePtr();
1050 if (!frame)
1051 return SBValue();
1052
1053 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1054 Target *target = exe_ctx->GetTargetPtr();
1055 if (target->GetDisplayExpressionsInCrashlogs()) {
1056 StreamString frame_description;
1057 frame->DumpUsingSettingsFormat(&frame_description);
1058 stack_trace = std::make_unique<llvm::PrettyStackTraceFormat>(
1059 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1060 "= %u) %s",
1061 expr, options.GetFetchDynamicValue(), frame_description.GetData());
1062 }
1063
1064 ValueObjectSP expr_value_sp;
1065 target->EvaluateExpression(expr, frame, expr_value_sp, options.ref());
1066
1067 SBValue expr_result;
1068 expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
1069 LogResult(expr_result);
1070
1071 return expr_result;
1072}
1073
1075 LLDB_INSTRUMENT_VA(this);
1076
1077 SBStructuredData sb_data;
1078 llvm::Expected<StoppedExecutionContext> exe_ctx =
1080 if (!exe_ctx) {
1081 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1082 return sb_data;
1083 }
1084 StackFrame *frame = exe_ctx->GetFramePtr();
1085 if (!frame)
1086 return sb_data;
1087
1089 sb_data.m_impl_up->SetObjectSP(data);
1090 return sb_data;
1091}
1092
1094 LLDB_INSTRUMENT_VA(this);
1095
1096 return static_cast<const SBFrame *>(this)->IsInlined();
1097}
1098
1100 LLDB_INSTRUMENT_VA(this);
1101
1102 llvm::Expected<StoppedExecutionContext> exe_ctx =
1104 if (!exe_ctx) {
1105 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1106 return false;
1107 }
1108
1109 if (StackFrame *frame = exe_ctx->GetFramePtr())
1110 return frame->IsInlined();
1111 return false;
1112}
1113
1115 LLDB_INSTRUMENT_VA(this);
1116
1117 return static_cast<const SBFrame *>(this)->IsArtificial();
1118}
1119
1121 LLDB_INSTRUMENT_VA(this);
1122
1123 llvm::Expected<StoppedExecutionContext> exe_ctx =
1125 if (!exe_ctx) {
1126 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1127 return false;
1128 }
1129
1130 if (StackFrame *frame = exe_ctx->GetFramePtr())
1131 return frame->IsArtificial();
1132
1133 return false;
1134}
1135
1137 LLDB_INSTRUMENT_VA(this);
1138
1139 llvm::Expected<StoppedExecutionContext> exe_ctx =
1141 if (!exe_ctx) {
1142 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1143 return false;
1144 }
1145
1146 if (StackFrame *frame = exe_ctx->GetFramePtr())
1147 return frame->IsSynthetic();
1148
1149 return false;
1150}
1151
1152bool SBFrame::IsHidden() const {
1153 LLDB_INSTRUMENT_VA(this);
1154
1155 llvm::Expected<StoppedExecutionContext> exe_ctx =
1157 if (!exe_ctx) {
1158 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1159 return false;
1160 }
1161
1162 if (StackFrame *frame = exe_ctx->GetFramePtr())
1163 return frame->IsHidden();
1164
1165 return false;
1166}
1167
1169 LLDB_INSTRUMENT_VA(this);
1170
1171 return static_cast<const SBFrame *>(this)->GetFunctionName();
1172}
1173
1175 LLDB_INSTRUMENT_VA(this);
1176
1177 llvm::Expected<StoppedExecutionContext> exe_ctx =
1179 if (!exe_ctx) {
1180 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1181 return eLanguageTypeUnknown;
1182 }
1183
1184 if (StackFrame *frame = exe_ctx->GetFramePtr())
1185 return frame->GuessLanguage().AsLanguageType();
1186 return eLanguageTypeUnknown;
1187}
1188
1189const char *SBFrame::GetFunctionName() const {
1190 LLDB_INSTRUMENT_VA(this);
1191
1192 llvm::Expected<StoppedExecutionContext> exe_ctx =
1194 if (!exe_ctx) {
1195 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1196 return nullptr;
1197 }
1198
1199 if (StackFrame *frame = exe_ctx->GetFramePtr())
1200 return frame->GetFunctionName();
1201 return nullptr;
1202}
1203
1205 LLDB_INSTRUMENT_VA(this);
1206
1207 llvm::Expected<StoppedExecutionContext> exe_ctx =
1209 if (!exe_ctx) {
1210 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1211 return nullptr;
1212 }
1213
1214 if (StackFrame *frame = exe_ctx->GetFramePtr())
1215 return frame->GetDisplayFunctionName();
1216 return nullptr;
1217}
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:474
#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:716
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:690
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:772
WasInterrupted
Definition SBFrame.cpp:710
@ Yes
Definition SBFrame.cpp:710
@ No
Definition SBFrame.cpp:710
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:248
lldb::addr_t GetPC() const
Definition SBFrame.cpp:274
const char * GetFunctionName()
Get the appropriate function name for this frame.
Definition SBFrame.cpp:1168
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:459
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:885
bool IsValid() const
Definition SBFrame.cpp:94
lldb::SBValue FindRegister(const char *name)
Definition SBFrame.cpp:855
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:416
const char * GetDisplayFunctionName()
Definition SBFrame.cpp:1204
bool IsInlined()
Return true if this frame represents an inlined function.
Definition SBFrame.cpp:1093
bool operator==(const lldb::SBFrame &rhs) const
Definition SBFrame.cpp:587
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
lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr, DynamicValueType use_dynamic, lldb::DILMode mode=lldb::eDILModeFull)
Definition SBFrame.cpp:386
static SBValue CreateProcessIsRunningExprEvalError()
Return an SBValue containing an error message that warns the process is not currently stopped.
Definition SBFrame.cpp:1007
lldb::SBLineEntry GetLineEntry() const
Definition SBFrame.cpp:226
friend class SBValue
Definition SBFrame.h:232
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:930
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:231
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:227
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:631
bool IsSynthetic() const
Definition SBFrame.cpp:1136
bool IsEqual(const lldb::SBFrame &that) const
Definition SBFrame.cpp:579
const char * Disassemble() const
Definition SBFrame.cpp:615
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition SBFrame.cpp:90
lldb::SBThread GetThread() const
Definition SBFrame.cpp:599
lldb::SBValueList GetRegisters()
Definition SBFrame.cpp:829
bool IsArtificial()
Definition SBFrame.cpp:1114
lldb::LanguageType GuessLanguage() const
Definition SBFrame.cpp:1174
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:1152
SBStructuredData GetLanguageSpecificData() const
Language plugins can use this API to report language-specific runtime information about this compile ...
Definition SBFrame.cpp:1074
lldb::SBSymbol GetSymbol() const
Definition SBFrame.cpp:181
lldb::SBModule GetModule() const
Definition SBFrame.cpp:129
bool GetDescription(lldb::SBStream &description)
Definition SBFrame.cpp:911
bool operator!=(const lldb::SBFrame &rhs) const
Definition SBFrame.cpp:593
void SetSP(const ModuleSP &module_sp)
Definition SBModule.cpp:218
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:951
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:87
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 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 void DumpUsingSettingsFormat(Stream *strm, bool show_unique=false, const llvm::StringRef frame_marker="")
Print a description for this frame using the frame-format formatter settings.
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:5128
SourceLanguage GetLanguage() const
Definition Target.cpp:5023
bool GetDisplayExpressionsInCrashlogs() const
Definition Target.cpp:5084
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:3001
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:2920
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:2852
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:282
lldb::ValueType GetScope() const
Definition Variable.h:67
#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
DILMode
Data Inspection Language (DIL) evaluation modes.
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:614