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
17#include "lldb/lldb-types.h"
18
19#include "Utils.h"
20#include "lldb/Core/Address.h"
21#include "lldb/Core/Debugger.h"
24#include "lldb/Host/Host.h"
25#include "lldb/Symbol/Block.h"
27#include "lldb/Symbol/Symbol.h"
32#include "lldb/Target/Process.h"
36#include "lldb/Target/StackID.h"
37#include "lldb/Target/Target.h"
38#include "lldb/Target/Thread.h"
42#include "lldb/Utility/Stream.h"
46
47#include "lldb/API/SBAddress.h"
48#include "lldb/API/SBDebugger.h"
50#include "lldb/API/SBFormat.h"
51#include "lldb/API/SBStream.h"
54#include "lldb/API/SBThread.h"
55#include "lldb/API/SBValue.h"
57
58#include "llvm/Support/PrettyStackTrace.h"
59
60using namespace lldb;
61using namespace lldb_private;
62
66
67SBFrame::SBFrame(const StackFrameSP &lldb_object_sp)
68 : m_opaque_sp(new ExecutionContextRef(lldb_object_sp)) {
69 LLDB_INSTRUMENT_VA(this, lldb_object_sp);
70}
71
73 LLDB_INSTRUMENT_VA(this, rhs);
74
76}
77
78SBFrame::~SBFrame() = default;
79
81 LLDB_INSTRUMENT_VA(this, rhs);
82
83 if (this != &rhs)
85 return *this;
86}
87
89 return (m_opaque_sp ? m_opaque_sp->GetFrameSP() : StackFrameSP());
90}
91
92void SBFrame::SetFrameSP(const StackFrameSP &lldb_object_sp) {
93 return m_opaque_sp->SetFrameSP(lldb_object_sp);
94}
95
96bool SBFrame::IsValid() const {
98 return this->operator bool();
99}
100SBFrame::operator bool() const {
101 LLDB_INSTRUMENT_VA(this);
102 llvm::Expected<StoppedExecutionContext> exe_ctx =
104 if (!exe_ctx) {
105 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
106 return false;
107 }
108
109 return GetFrameSP().get() != nullptr;
110}
111
112SBSymbolContext SBFrame::GetSymbolContext(uint32_t resolve_scope) const {
113 LLDB_INSTRUMENT_VA(this, resolve_scope);
114
115 SBSymbolContext sb_sym_ctx;
116
117 llvm::Expected<StoppedExecutionContext> exe_ctx =
119 if (!exe_ctx) {
120 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
121 return sb_sym_ctx;
122 }
123
124 SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
125 if (StackFrame *frame = exe_ctx->GetFramePtr())
126 sb_sym_ctx = frame->GetSymbolContext(scope);
127
128 return sb_sym_ctx;
129}
130
132 LLDB_INSTRUMENT_VA(this);
133
134 llvm::Expected<StoppedExecutionContext> exe_ctx =
136 if (!exe_ctx) {
137 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
138 return SBModule();
139 }
140
141 ModuleSP module_sp;
142 StackFrame *frame = exe_ctx->GetFramePtr();
143 if (!frame)
144 return SBModule();
145
146 SBModule sb_module;
147 module_sp = frame->GetSymbolContext(eSymbolContextModule).module_sp;
148 sb_module.SetSP(module_sp);
149 return sb_module;
150}
151
153 LLDB_INSTRUMENT_VA(this);
154
155 llvm::Expected<StoppedExecutionContext> exe_ctx =
157 if (!exe_ctx) {
158 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
159 return SBCompileUnit();
160 }
161
162 if (StackFrame *frame = exe_ctx->GetFramePtr())
163 return SBCompileUnit(
164 frame->GetSymbolContext(eSymbolContextCompUnit).comp_unit);
165 return SBCompileUnit();
166}
167
169 LLDB_INSTRUMENT_VA(this);
170
171 llvm::Expected<StoppedExecutionContext> exe_ctx =
173 if (!exe_ctx) {
174 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
175 return SBFunction();
176 }
177
178 if (StackFrame *frame = exe_ctx->GetFramePtr())
179 return SBFunction(frame->GetSymbolContext(eSymbolContextFunction).function);
180 return SBFunction();
181}
182
184 LLDB_INSTRUMENT_VA(this);
185
186 llvm::Expected<StoppedExecutionContext> exe_ctx =
188 if (!exe_ctx) {
189 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
190 return SBSymbol();
191 }
192
193 if (StackFrame *frame = exe_ctx->GetFramePtr())
194 return SBSymbol(frame->GetSymbolContext(eSymbolContextSymbol).symbol);
195 return SBSymbol();
196}
197
199 LLDB_INSTRUMENT_VA(this);
200
201 llvm::Expected<StoppedExecutionContext> exe_ctx =
203 if (!exe_ctx) {
204 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
205 return SBBlock();
206 }
207
208 if (StackFrame *frame = exe_ctx->GetFramePtr())
209 return SBBlock(frame->GetSymbolContext(eSymbolContextBlock).block);
210 return SBBlock();
211}
212
214 LLDB_INSTRUMENT_VA(this);
215
216 llvm::Expected<StoppedExecutionContext> exe_ctx =
218 if (!exe_ctx) {
219 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
220 return SBBlock();
221 }
222
223 if (StackFrame *frame = exe_ctx->GetFramePtr())
224 return SBBlock(frame->GetFrameBlock());
225 return SBBlock();
226}
227
229 LLDB_INSTRUMENT_VA(this);
230
231 llvm::Expected<StoppedExecutionContext> exe_ctx =
233 if (!exe_ctx) {
234 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
235 return SBLineEntry();
236 }
237
238 if (StackFrame *frame = exe_ctx->GetFramePtr())
239 return SBLineEntry(
240 &frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
241 return SBLineEntry();
242}
243
244uint32_t SBFrame::GetFrameID() const {
245 LLDB_INSTRUMENT_VA(this);
246
247 constexpr uint32_t error_frame_idx = UINT32_MAX;
248
249 llvm::Expected<StoppedExecutionContext> exe_ctx =
251 if (!exe_ctx) {
252 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
253 return error_frame_idx;
254 }
255
256 if (StackFrame *frame = exe_ctx->GetFramePtr())
257 return frame->GetFrameIndex();
258 return error_frame_idx;
259}
260
262 LLDB_INSTRUMENT_VA(this);
263
264 llvm::Expected<StoppedExecutionContext> exe_ctx =
266 if (!exe_ctx) {
267 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
269 }
270
271 if (StackFrame *frame = exe_ctx->GetFramePtr())
272 return frame->GetStackID().GetCallFrameAddressWithoutMetadata();
274}
275
277 LLDB_INSTRUMENT_VA(this);
278
280 llvm::Expected<StoppedExecutionContext> exe_ctx =
282 if (!exe_ctx) {
283 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
284 return addr;
285 }
286
287 Target *target = exe_ctx->GetTargetPtr();
288 if (StackFrame *frame = exe_ctx->GetFramePtr())
289 return frame->GetFrameCodeAddress().GetOpcodeLoadAddress(
290 target, AddressClass::eCode);
291
292 return addr;
293}
294
295bool SBFrame::SetPC(addr_t new_pc) {
296 LLDB_INSTRUMENT_VA(this, new_pc);
297
298 constexpr bool error_ret_val = false;
299 llvm::Expected<StoppedExecutionContext> exe_ctx =
301 if (!exe_ctx) {
302 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
303 return error_ret_val;
304 }
305
306 if (StackFrame *frame = exe_ctx->GetFramePtr())
307 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext())
308 return reg_ctx_sp->SetPC(new_pc);
309
310 return error_ret_val;
311}
312
314 LLDB_INSTRUMENT_VA(this);
315
316 llvm::Expected<StoppedExecutionContext> exe_ctx =
318 if (!exe_ctx) {
319 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
321 }
322
323 if (StackFrame *frame = exe_ctx->GetFramePtr())
324 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext())
325 return reg_ctx_sp->GetSP();
326
328}
329
331 LLDB_INSTRUMENT_VA(this);
332
333 llvm::Expected<StoppedExecutionContext> exe_ctx =
335 if (!exe_ctx) {
336 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
338 }
339
340 if (StackFrame *frame = exe_ctx->GetFramePtr())
341 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext())
342 return reg_ctx_sp->GetFP();
343
345}
346
348 LLDB_INSTRUMENT_VA(this);
349
350 llvm::Expected<StoppedExecutionContext> exe_ctx =
352 if (!exe_ctx) {
353 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
354 return SBAddress();
355 }
356
357 if (StackFrame *frame = exe_ctx->GetFramePtr())
358 return SBAddress(frame->GetFrameCodeAddress());
359 return SBAddress();
360}
361
363 LLDB_INSTRUMENT_VA(this);
364
365 m_opaque_sp->Clear();
366}
367
369 lldb::DILMode mode) {
370 LLDB_INSTRUMENT_VA(this, var_path);
371
372 SBValue sb_value;
373 llvm::Expected<StoppedExecutionContext> exe_ctx =
375 if (!exe_ctx) {
376 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
377 return sb_value;
378 }
379
380 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
381 lldb::DynamicValueType use_dynamic =
382 frame->CalculateTarget()->GetPreferDynamicValue();
383 sb_value = GetValueForVariablePath(var_path, use_dynamic, mode);
384 }
385 return sb_value;
386}
387
389 DynamicValueType use_dynamic,
390 lldb::DILMode mode) {
391 LLDB_INSTRUMENT_VA(this, var_path, use_dynamic);
392
393 SBValue sb_value;
394 if (var_path == nullptr || var_path[0] == '\0') {
395 return sb_value;
396 }
397
398 llvm::Expected<StoppedExecutionContext> exe_ctx =
400 if (!exe_ctx) {
401 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
402 return sb_value;
403 }
404
405 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
406 VariableSP var_sp;
408 ValueObjectSP value_sp(frame->GetValueForVariableExpressionPath(
409 var_path, eNoDynamicValues,
412 var_sp, error, mode));
413 sb_value.SetSP(value_sp, use_dynamic);
414 }
415 return sb_value;
416}
417
419 LLDB_INSTRUMENT_VA(this, name);
420
421 llvm::Expected<StoppedExecutionContext> exe_ctx =
423 if (!exe_ctx) {
424 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
425 return SBValue();
426 }
427
428 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
429 lldb::DynamicValueType use_dynamic =
430 frame->CalculateTarget()->GetPreferDynamicValue();
431 return FindVariable(name, use_dynamic);
432 }
433 return SBValue();
434}
435
437 lldb::DynamicValueType use_dynamic) {
438 LLDB_INSTRUMENT_VA(this, name, use_dynamic);
439
440 VariableSP var_sp;
441 SBValue sb_value;
442
443 if (name == nullptr || name[0] == '\0') {
444 return sb_value;
445 }
446
447 llvm::Expected<StoppedExecutionContext> exe_ctx =
449 if (!exe_ctx) {
450 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
451 return sb_value;
452 }
453
454 if (StackFrame *frame = exe_ctx->GetFramePtr())
455 if (ValueObjectSP value_sp = frame->FindVariable(ConstString(name)))
456 sb_value.SetSP(value_sp, use_dynamic);
457
458 return sb_value;
459}
460
461SBValue SBFrame::FindValue(const char *name, ValueType value_type) {
462 LLDB_INSTRUMENT_VA(this, name, value_type);
463
464 SBValue value;
465 llvm::Expected<StoppedExecutionContext> exe_ctx =
467 if (!exe_ctx) {
468 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
469 return value;
470 }
471
472 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
473 lldb::DynamicValueType use_dynamic =
474 frame->CalculateTarget()->GetPreferDynamicValue();
475 value = FindValue(name, value_type, use_dynamic);
476 }
477 return value;
478}
479
480SBValue SBFrame::FindValue(const char *name, ValueType value_type,
481 lldb::DynamicValueType use_dynamic) {
482 LLDB_INSTRUMENT_VA(this, name, value_type, use_dynamic);
483
484 SBValue sb_value;
485
486 if (name == nullptr || name[0] == '\0') {
487 return sb_value;
488 }
489
490 ValueObjectSP value_sp;
491 llvm::Expected<StoppedExecutionContext> exe_ctx =
493
494 if (!exe_ctx) {
495 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
496 return value_sp;
497 }
498
499 StackFrame *frame = exe_ctx->GetFramePtr();
500 if (!frame)
501 return value_sp;
502
503 VariableList variable_list;
504
505 bool include_synthetic_vars = IsSyntheticValueType(value_type);
506 // Switch on the value_type without the mask, but keep it in the value type so
507 // we can use it later when we look for variables in the list.
508 auto base_value_type = GetBaseValueType(value_type);
509 switch (base_value_type) {
510 case eValueTypeVariableGlobal: // global variable
511 case eValueTypeVariableStatic: // static variable
512 case eValueTypeVariableArgument: // function argument variables
513 case eValueTypeVariableLocal: // function local variables
514 case eValueTypeVariableThreadLocal: { // thread local variables
515 SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
516
517 const bool can_create = true;
518 const bool get_parent_variables = true;
519 const bool stop_if_block_is_inlined_function = true;
520
521 if (sc.block)
523 can_create, get_parent_variables, stop_if_block_is_inlined_function,
524 [frame](Variable *v) { return v->IsInScope(frame); }, &variable_list);
525 // Fetch variables from the frame if we need to get
526 // globals/statics/synthetic variables.
527 if (base_value_type == eValueTypeVariableGlobal ||
528 base_value_type == eValueTypeVariableStatic || include_synthetic_vars) {
529 const bool get_file_globals = true;
530 VariableList *frame_vars = frame->GetVariableList(
531 get_file_globals, include_synthetic_vars, nullptr);
532 if (frame_vars)
533 frame_vars->AppendVariablesIfUnique(variable_list);
534 }
535
536 ConstString const_name(name);
537 VariableSP variable_sp(variable_list.FindVariable(const_name, value_type));
538 if (variable_sp) {
539 value_sp =
541 sb_value.SetSP(value_sp, use_dynamic);
542 }
543 } break;
544
545 case eValueTypeRegister: { // stack frame register value
546 if (RegisterContextSP reg_ctx = frame->GetRegisterContext()) {
547 if (const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name)) {
548 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info);
549 sb_value.SetSP(value_sp);
550 }
551 }
552 } break;
553
554 case eValueTypeRegisterSet: { // A collection of stack frame register
555 // values
556 if (RegisterContextSP reg_ctx = frame->GetRegisterContext()) {
557 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
558 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
559 const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
560 if (reg_set &&
561 (llvm::StringRef(reg_set->name).equals_insensitive(name) ||
562 llvm::StringRef(reg_set->short_name).equals_insensitive(name))) {
563 value_sp = ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx);
564 sb_value.SetSP(value_sp);
565 break;
566 }
567 }
568 }
569 } break;
570
571 case eValueTypeConstResult: { // constant result variables
572 ConstString const_name(name);
573 Target *target = exe_ctx->GetTargetPtr();
574 ExpressionVariableSP expr_var_sp(target->GetPersistentVariable(const_name));
575 if (expr_var_sp) {
576 value_sp = expr_var_sp->GetValueObject();
577 sb_value.SetSP(value_sp, use_dynamic);
578 }
579 } break;
580
581 default:
582 break;
583 }
584
585 return sb_value;
586}
587
588bool SBFrame::IsEqual(const SBFrame &that) const {
589 LLDB_INSTRUMENT_VA(this, that);
590
591 lldb::StackFrameSP this_sp = GetFrameSP();
592 lldb::StackFrameSP that_sp = that.GetFrameSP();
593 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
594}
595
596bool SBFrame::operator==(const SBFrame &rhs) const {
597 LLDB_INSTRUMENT_VA(this, rhs);
598
599 return IsEqual(rhs);
600}
601
602bool SBFrame::operator!=(const SBFrame &rhs) const {
603 LLDB_INSTRUMENT_VA(this, rhs);
604
605 return !IsEqual(rhs);
606}
607
609 LLDB_INSTRUMENT_VA(this);
610
611 llvm::Expected<StoppedExecutionContext> exe_ctx =
613 if (!exe_ctx) {
614 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
615 return SBThread();
616 }
617
618 ThreadSP thread_sp(exe_ctx->GetThreadSP());
619 SBThread sb_thread(thread_sp);
620
621 return sb_thread;
622}
623
624const char *SBFrame::Disassemble() const {
625 LLDB_INSTRUMENT_VA(this);
626
627 llvm::Expected<StoppedExecutionContext> exe_ctx =
629 if (!exe_ctx) {
630 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
631 return nullptr;
632 }
633
634 if (auto *frame = exe_ctx->GetFramePtr())
635 return ConstString(frame->Disassemble()).GetCString();
636
637 return nullptr;
638}
639
640SBValueList SBFrame::GetVariables(bool arguments, bool locals, bool statics,
641 bool in_scope_only) {
642 LLDB_INSTRUMENT_VA(this, arguments, locals, statics, in_scope_only);
643
644 SBValueList value_list;
645 llvm::Expected<StoppedExecutionContext> exe_ctx =
647 if (!exe_ctx) {
648 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
649 return value_list;
650 }
651
652 if (StackFrame *frame = exe_ctx->GetFramePtr()) {
653 Target *target = exe_ctx->GetTargetPtr();
654 lldb::DynamicValueType use_dynamic =
655 frame->CalculateTarget()->GetPreferDynamicValue();
656 const bool include_runtime_support_values =
658
659 SBVariablesOptions options;
660 options.SetIncludeArguments(arguments);
661 options.SetIncludeLocals(locals);
662 options.SetIncludeStatics(statics);
663 options.SetInScopeOnly(in_scope_only);
664 options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
665 options.SetUseDynamic(use_dynamic);
666
667 value_list = GetVariables(options);
668 }
669 return value_list;
670}
671
672lldb::SBValueList SBFrame::GetVariables(bool arguments, bool locals,
673 bool statics, bool in_scope_only,
674 lldb::DynamicValueType use_dynamic) {
675 LLDB_INSTRUMENT_VA(this, arguments, locals, statics, in_scope_only,
676 use_dynamic);
677
678 llvm::Expected<StoppedExecutionContext> exe_ctx =
680 if (!exe_ctx) {
681 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
682 return SBValueList();
683 }
684
685 Target *target = exe_ctx->GetTargetPtr();
686 const bool include_runtime_support_values =
688 SBVariablesOptions options;
689 options.SetIncludeArguments(arguments);
690 options.SetIncludeLocals(locals);
691 options.SetIncludeStatics(statics);
692 options.SetInScopeOnly(in_scope_only);
693 options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
694 options.SetUseDynamic(use_dynamic);
695 return GetVariables(options);
696}
697
698/// Returns true if the variable is in any of the requested scopes.
699static bool IsInRequestedScope(bool statics, bool arguments, bool locals,
700 bool synthetic, Variable &var) {
701 auto value_type = var.GetScope();
702 // Check if the variable is synthetic first.
703 bool is_synthetic = IsSyntheticValueType(value_type);
704 if (is_synthetic) {
705 // If the variable is synthetic but we don't want those, then it's
706 // automatically out of scope.
707 if (!synthetic)
708 return false;
709
710 // Get the base value type so the rest of the switch works correctly.
711 value_type = GetBaseValueType(value_type);
712 }
713
714 switch (value_type) {
718 return statics;
719
721 return arguments;
722
724 return locals;
725
726 default:
727 break;
728 }
729
730 // The default for all other value types is is_synthetic. At this point, if
731 // we didn't want synthetic variables we'd have exited by now anyway, so we
732 // must want them. Aside from the modifiers above that should apply equally to
733 // synthetic and normal variables, any other synthetic variable we should
734 // default to showing.
735 return is_synthetic;
736}
737
739
740/// Populates `value_list` with the variables from `frame` according to
741/// `options`. This method checks whether the Debugger received an interrupt
742/// before processing every variable, returning `WasInterrupted::yes` in that
743/// case.
744static std::pair<WasInterrupted, Status> FetchVariablesUnlessInterrupted(
745 const lldb::SBVariablesOptions &options, StackFrame &frame,
746 SBValueList &value_list, Debugger &dbg,
747 std::function<SBValue(ValueObjectSP, bool)> to_sbvalue) {
748 const bool statics = options.GetIncludeStatics();
749 const bool arguments = options.GetIncludeArguments();
750 const bool locals = options.GetIncludeLocals();
751 const bool synthetic = options.GetIncludeSynthetic();
752 const bool in_scope_only = options.GetInScopeOnly();
753 const bool include_runtime_support_values =
755 const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
756
757 Status var_error;
758 // Fetch all variables available and filter them later.
759 VariableList *variable_list = frame.GetVariableList(
760 /*get_file_globals=*/true, /*include_synthetic_vars=*/true, &var_error);
761
762 std::set<VariableSP> variable_set;
763
764 if (!variable_list)
765 return {WasInterrupted::No, std::move(var_error)};
766 const size_t num_variables = variable_list->GetSize();
767 size_t num_produced = 0;
768 for (const VariableSP &variable_sp : *variable_list) {
769 if (!variable_sp || !IsInRequestedScope(statics, arguments, locals,
770 synthetic, *variable_sp))
771 continue;
772
774 dbg,
775 "Interrupted getting frame variables with {0} of {1} "
776 "produced.",
777 num_produced, num_variables))
778 return {WasInterrupted::Yes, std::move(var_error)};
779
780 // Only add variables once so we don't end up with duplicates
781 if (variable_set.insert(variable_sp).second == false)
782 continue;
783 if (in_scope_only && !variable_sp->IsInScope(&frame))
784 continue;
785
786 ValueObjectSP valobj_sp(
788
789 if (!include_runtime_support_values && valobj_sp != nullptr &&
790 valobj_sp->IsRuntimeSupportValue())
791 continue;
792
793 value_list.Append(to_sbvalue(valobj_sp, use_dynamic));
794 }
795 num_produced++;
796
797 return {WasInterrupted::No, std::move(var_error)};
798}
799
800/// Populates `value_list` with recognized arguments of `frame` according to
801/// `options`.
802static llvm::SmallVector<ValueObjectSP>
804 SBTarget target) {
805 if (!options.GetIncludeRecognizedArguments(target))
806 return {};
807 RecognizedStackFrameSP recognized_frame = frame.GetRecognizedFrame();
808 if (!recognized_frame)
809 return {};
810
811 ValueObjectListSP recognized_arg_list =
812 recognized_frame->GetRecognizedArguments();
813 if (!recognized_arg_list)
814 return {};
815
816 return llvm::to_vector(recognized_arg_list->GetObjects());
817}
818
820 LLDB_INSTRUMENT_VA(this, options);
821
822 llvm::Expected<StoppedExecutionContext> exe_ctx =
824 if (!exe_ctx) {
825 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
826 return SBValueList();
827 }
828
829 StackFrame *frame = exe_ctx->GetFramePtr();
830 if (!frame)
831 return SBValueList();
832
833 auto valobj_to_sbvalue = [](ValueObjectSP valobj, bool use_dynamic) {
834 SBValue value_sb;
835 value_sb.SetSP(valobj, use_dynamic);
836 return value_sb;
837 };
838 SBValueList value_list;
839 std::pair<WasInterrupted, Status> fetch_result =
840 FetchVariablesUnlessInterrupted(options, *frame, value_list,
841 exe_ctx->GetTargetPtr()->GetDebugger(),
842 valobj_to_sbvalue);
843 if (fetch_result.second.Fail())
844 value_list.SetError(std::move(fetch_result.second));
845
846 if (fetch_result.first == WasInterrupted::Yes)
847 return value_list;
848
849 const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
850 llvm::SmallVector<ValueObjectSP> args = FetchRecognizedArguments(
851 options, *frame, SBTarget(exe_ctx->GetTargetSP()));
852 for (ValueObjectSP arg : args) {
853 SBValue value_sb;
854 value_sb.SetSP(arg, use_dynamic);
855 value_list.Append(value_sb);
856 }
857 return value_list;
858}
859
861 LLDB_INSTRUMENT_VA(this);
862
863 llvm::Expected<StoppedExecutionContext> exe_ctx =
865 if (!exe_ctx) {
866 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
867 return SBValueList();
868 }
869
870 StackFrame *frame = exe_ctx->GetFramePtr();
871 if (!frame)
872 return SBValueList();
873
874 RegisterContextSP reg_ctx(frame->GetRegisterContext());
875 if (!reg_ctx)
876 return SBValueList();
877
878 SBValueList value_list;
879 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
880 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx)
881 value_list.Append(ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx));
882
883 return value_list;
884}
885
887 LLDB_INSTRUMENT_VA(this, name);
888
889 ValueObjectSP value_sp;
890 llvm::Expected<StoppedExecutionContext> exe_ctx =
892 if (!exe_ctx) {
893 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
894 return SBValue();
895 }
896
897 StackFrame *frame = exe_ctx->GetFramePtr();
898 if (!frame)
899 return SBValue();
900
901 RegisterContextSP reg_ctx(frame->GetRegisterContext());
902 if (!reg_ctx)
903 return SBValue();
904
905 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name);
906 if (!reg_info)
907 return SBValue();
908
909 SBValue result;
910 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info);
911 result.SetSP(value_sp);
912
913 return result;
914}
915
917 SBStream &output) {
918 Stream &strm = output.ref();
919
920 llvm::Expected<StoppedExecutionContext> exe_ctx =
922 if (!exe_ctx)
923 return Status::FromError(exe_ctx.takeError());
924
926
927 if (!format) {
928 error.SetErrorString("The provided SBFormat object is invalid");
929 return error;
930 }
931
932 if (StackFrame *frame = exe_ctx->GetFramePtr();
933 frame && frame->DumpUsingFormat(strm, format.GetFormatEntrySP().get()))
934 return error;
935 error.SetErrorStringWithFormat(
936 "It was not possible to generate a frame "
937 "description with the given format string '%s'",
938 format.GetFormatEntrySP()->string.c_str());
939 return error;
940}
941
943 LLDB_INSTRUMENT_VA(this, description);
944
945 Stream &strm = description.ref();
946
947 llvm::Expected<StoppedExecutionContext> exe_ctx =
949 if (!exe_ctx) {
950 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
951 strm.PutCString("Error: process is not stopped.");
952 return true;
953 }
954
955 if (StackFrame *frame = exe_ctx->GetFramePtr())
956 frame->DumpUsingSettingsFormat(&strm);
957
958 return true;
959}
960
962 LLDB_INSTRUMENT_VA(this, expr);
963
964 llvm::Expected<StoppedExecutionContext> exe_ctx =
966 if (!exe_ctx) {
967 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
969 }
970
971 SBExpressionOptions options;
972 StackFrame *frame = exe_ctx->GetFramePtr();
973 if (frame) {
974 lldb::DynamicValueType fetch_dynamic_value =
975 frame->CalculateTarget()->GetPreferDynamicValue();
976 options.SetFetchDynamicValue(fetch_dynamic_value);
977 }
978 options.SetUnwindOnError(true);
979 options.SetIgnoreBreakpoints(true);
980 Target *target = exe_ctx->GetTargetPtr();
981 SourceLanguage language = target->GetLanguage();
982 if (!language && frame)
983 language = frame->GetLanguage();
984 options.SetLanguage((SBSourceLanguageName)language.name, language.version);
985 return EvaluateExpression(expr, options);
986}
987
990 lldb::DynamicValueType fetch_dynamic_value) {
991 LLDB_INSTRUMENT_VA(this, expr, fetch_dynamic_value);
992
993 SBExpressionOptions options;
994 options.SetFetchDynamicValue(fetch_dynamic_value);
995 options.SetUnwindOnError(true);
996 options.SetIgnoreBreakpoints(true);
997 llvm::Expected<StoppedExecutionContext> exe_ctx =
999 if (!exe_ctx) {
1000 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1002 }
1003
1004 StackFrame *frame = exe_ctx->GetFramePtr();
1005 Target *target = exe_ctx->GetTargetPtr();
1006 SourceLanguage language = target->GetLanguage();
1007 if (!language && frame)
1008 language = frame->GetLanguage();
1009 options.SetLanguage((SBSourceLanguageName)language.name, language.version);
1010 return EvaluateExpression(expr, options);
1011}
1012
1014 lldb::DynamicValueType fetch_dynamic_value,
1015 bool unwind_on_error) {
1016 LLDB_INSTRUMENT_VA(this, expr, fetch_dynamic_value, unwind_on_error);
1017
1018 SBExpressionOptions options;
1019 llvm::Expected<StoppedExecutionContext> exe_ctx =
1021 if (!exe_ctx) {
1022 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1024 }
1025
1026 options.SetFetchDynamicValue(fetch_dynamic_value);
1027 options.SetUnwindOnError(unwind_on_error);
1028 options.SetIgnoreBreakpoints(true);
1029 StackFrame *frame = exe_ctx->GetFramePtr();
1030 Target *target = exe_ctx->GetTargetPtr();
1031 SourceLanguage language = target->GetLanguage();
1032 if (!language && frame)
1033 language = frame->GetLanguage();
1034 options.SetLanguage((SBSourceLanguageName)language.name, language.version);
1035 return EvaluateExpression(expr, options);
1036}
1037
1039 auto error = Status::FromErrorString("can't evaluate expressions when the "
1040 "process is running.");
1041 ValueObjectSP expr_value_sp =
1042 ValueObjectConstResult::Create(nullptr, std::move(error));
1043 SBValue expr_result;
1044 expr_result.SetSP(expr_value_sp, false);
1045 return expr_result;
1046}
1047
1049 const SBExpressionOptions &options) {
1050 LLDB_INSTRUMENT_VA(this, expr, options);
1051
1052 auto LogResult = [](SBValue expr_result) {
1053 Log *expr_log = GetLog(LLDBLog::Expressions);
1054 if (expr_result.GetError().Success())
1055 LLDB_LOGF(expr_log,
1056 "** [SBFrame::EvaluateExpression] Expression result is "
1057 "%s, summary %s **",
1058 expr_result.GetValue(), expr_result.GetSummary());
1059 else
1060 LLDB_LOGF(
1061 expr_log,
1062 "** [SBFrame::EvaluateExpression] Expression evaluation failed: "
1063 "%s **",
1064 expr_result.GetError().GetCString());
1065 };
1066
1067 if (expr == nullptr || expr[0] == '\0') {
1068 return SBValue();
1069 }
1070
1071 llvm::Expected<StoppedExecutionContext> exe_ctx =
1073 if (!exe_ctx) {
1074 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1076 LogResult(error_result);
1077 return error_result;
1078 }
1079
1080 StackFrame *frame = exe_ctx->GetFramePtr();
1081 if (!frame)
1082 return SBValue();
1083
1084 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1085 Target *target = exe_ctx->GetTargetPtr();
1086 if (target->GetDisplayExpressionsInCrashlogs()) {
1087 StreamString frame_description;
1088 frame->DumpUsingSettingsFormat(&frame_description);
1089 stack_trace = std::make_unique<llvm::PrettyStackTraceFormat>(
1090 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1091 "= %u) %s",
1092 expr, options.GetFetchDynamicValue(), frame_description.GetData());
1093 }
1094
1095 ValueObjectSP expr_value_sp;
1096 target->EvaluateExpression(expr, frame, expr_value_sp, options.ref());
1097
1098 SBValue expr_result;
1099 expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
1100 LogResult(expr_result);
1101
1102 return expr_result;
1103}
1104
1106 LLDB_INSTRUMENT_VA(this);
1107
1108 SBStructuredData sb_data;
1109 llvm::Expected<StoppedExecutionContext> exe_ctx =
1111 if (!exe_ctx) {
1112 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1113 return sb_data;
1114 }
1115 StackFrame *frame = exe_ctx->GetFramePtr();
1116 if (!frame)
1117 return sb_data;
1118
1120 sb_data.m_impl_up->SetObjectSP(data);
1121 return sb_data;
1122}
1123
1125 LLDB_INSTRUMENT_VA(this);
1126
1127 return static_cast<const SBFrame *>(this)->IsInlined();
1128}
1129
1131 LLDB_INSTRUMENT_VA(this);
1132
1133 llvm::Expected<StoppedExecutionContext> exe_ctx =
1135 if (!exe_ctx) {
1136 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1137 return false;
1138 }
1139
1140 if (StackFrame *frame = exe_ctx->GetFramePtr())
1141 return frame->IsInlined();
1142 return false;
1143}
1144
1146 LLDB_INSTRUMENT_VA(this);
1147
1148 return static_cast<const SBFrame *>(this)->IsArtificial();
1149}
1150
1152 LLDB_INSTRUMENT_VA(this);
1153
1154 llvm::Expected<StoppedExecutionContext> exe_ctx =
1156 if (!exe_ctx) {
1157 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1158 return false;
1159 }
1160
1161 if (StackFrame *frame = exe_ctx->GetFramePtr())
1162 return frame->IsArtificial();
1163
1164 return false;
1165}
1166
1168 LLDB_INSTRUMENT_VA(this);
1169
1170 llvm::Expected<StoppedExecutionContext> exe_ctx =
1172 if (!exe_ctx) {
1173 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1174 return false;
1175 }
1176
1177 if (StackFrame *frame = exe_ctx->GetFramePtr())
1178 return frame->IsSynthetic();
1179
1180 return false;
1181}
1182
1183bool SBFrame::IsHidden() const {
1184 LLDB_INSTRUMENT_VA(this);
1185
1186 llvm::Expected<StoppedExecutionContext> exe_ctx =
1188 if (!exe_ctx) {
1189 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1190 return false;
1191 }
1192
1193 if (StackFrame *frame = exe_ctx->GetFramePtr())
1194 return frame->IsHidden();
1195
1196 return false;
1197}
1198
1200 LLDB_INSTRUMENT_VA(this);
1201
1202 return static_cast<const SBFrame *>(this)->GetFunctionName();
1203}
1204
1206 LLDB_INSTRUMENT_VA(this);
1207
1208 llvm::Expected<StoppedExecutionContext> exe_ctx =
1210 if (!exe_ctx) {
1211 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1212 return eLanguageTypeUnknown;
1213 }
1214
1215 if (StackFrame *frame = exe_ctx->GetFramePtr())
1216 return frame->GuessLanguage().AsLanguageType();
1217 return eLanguageTypeUnknown;
1218}
1219
1220const char *SBFrame::GetFunctionName() const {
1221 LLDB_INSTRUMENT_VA(this);
1222
1223 llvm::Expected<StoppedExecutionContext> exe_ctx =
1225 if (!exe_ctx) {
1226 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1227 return nullptr;
1228 }
1229
1230 if (StackFrame *frame = exe_ctx->GetFramePtr())
1231 return frame->GetFunctionName();
1232 return nullptr;
1233}
1234
1236 LLDB_INSTRUMENT_VA(this);
1237
1238 llvm::Expected<StoppedExecutionContext> exe_ctx =
1240 if (!exe_ctx) {
1241 LLDB_LOG_ERROR(GetLog(LLDBLog::API), exe_ctx.takeError(), "{0}");
1242 return nullptr;
1243 }
1244
1245 if (StackFrame *frame = exe_ctx->GetFramePtr())
1246 return frame->GetDisplayFunctionName();
1247 return nullptr;
1248}
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:494
#define LLDB_INSTRUMENT_VA(...)
#define LLDB_LOGF(log,...)
Definition Log.h:378
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:394
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:744
static bool IsInRequestedScope(bool statics, bool arguments, bool locals, bool synthetic, Variable &var)
Returns true if the variable is in any of the requested scopes.
Definition SBFrame.cpp:699
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:803
WasInterrupted
Definition SBFrame.cpp:738
@ Yes
Definition SBFrame.cpp:738
@ No
Definition SBFrame.cpp:738
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:276
const char * GetFunctionName()
Get the appropriate function name for this frame.
Definition SBFrame.cpp:1199
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:461
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const
Definition SBFrame.cpp:112
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:916
bool IsValid() const
Definition SBFrame.cpp:96
lldb::SBValue FindRegister(const char *name)
Definition SBFrame.cpp:886
bool SetPC(lldb::addr_t new_pc)
Definition SBFrame.cpp:295
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:418
const char * GetDisplayFunctionName()
Definition SBFrame.cpp:1235
bool IsInlined()
Return true if this frame represents an inlined function.
Definition SBFrame.cpp:1124
bool operator==(const lldb::SBFrame &rhs) const
Definition SBFrame.cpp:596
lldb::addr_t GetCFA() const
Definition SBFrame.cpp:261
lldb::addr_t GetFP() const
Definition SBFrame.cpp:330
const lldb::SBFrame & operator=(const lldb::SBFrame &rhs)
Definition SBFrame.cpp:80
lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr, DynamicValueType use_dynamic, lldb::DILMode mode=lldb::eDILModeFull)
Definition SBFrame.cpp:388
static SBValue CreateProcessIsRunningExprEvalError()
Return an SBValue containing an error message that warns the process is not currently stopped.
Definition SBFrame.cpp:1038
lldb::SBLineEntry GetLineEntry() const
Definition SBFrame.cpp:228
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:961
lldb::SBCompileUnit GetCompileUnit() const
Definition SBFrame.cpp:152
uint32_t GetFrameID() const
Definition SBFrame.cpp:244
lldb::SBAddress GetPCAddress() const
Definition SBFrame.cpp:347
friend class SBThread
Definition SBFrame.h:231
lldb::SBFunction GetFunction() const
Definition SBFrame.cpp:168
lldb::SBBlock GetBlock() const
Gets the deepest block that contains the frame PC.
Definition SBFrame.cpp:198
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:640
bool IsSynthetic() const
Definition SBFrame.cpp:1167
bool IsEqual(const lldb::SBFrame &that) const
Definition SBFrame.cpp:588
const char * Disassemble() const
Definition SBFrame.cpp:624
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition SBFrame.cpp:92
lldb::SBThread GetThread() const
Definition SBFrame.cpp:608
lldb::SBValueList GetRegisters()
Definition SBFrame.cpp:860
bool IsArtificial()
Definition SBFrame.cpp:1145
lldb::LanguageType GuessLanguage() const
Definition SBFrame.cpp:1205
lldb::SBBlock GetFrameBlock() const
Gets the lexical block that defines the stack frame.
Definition SBFrame.cpp:213
lldb::addr_t GetSP() const
Definition SBFrame.cpp:313
lldb::StackFrameSP GetFrameSP() const
Definition SBFrame.cpp:88
bool IsHidden() const
Return whether a frame recognizer decided this frame should not be displayes in backtraces etc.
Definition SBFrame.cpp:1183
SBStructuredData GetLanguageSpecificData() const
Language plugins can use this API to report language-specific runtime information about this compile ...
Definition SBFrame.cpp:1105
lldb::SBSymbol GetSymbol() const
Definition SBFrame.cpp:183
lldb::SBModule GetModule() const
Definition SBFrame.cpp:131
bool GetDescription(lldb::SBStream &description)
Definition SBFrame.cpp:942
bool operator!=(const lldb::SBFrame &rhs) const
Definition SBFrame.cpp:602
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:968
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:100
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:56
virtual const char * GetFunctionName()
Get the frame's demangled name.
virtual bool IsHidden()
Query whether this frame should be hidden from backtraces.
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 VariableList * GetVariableList(bool get_file_globals, bool include_synthetic_vars, Status *error_ptr)
Retrieve the list of variables whose scope either:
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:136
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:63
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:5650
SourceLanguage GetLanguage() const
Definition Target.cpp:5539
bool GetDisplayExpressionsInCrashlogs() const
Definition Target.cpp:5600
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:3003
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:2922
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:2844
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS, ValueObjectManager *manager=nullptr)
These routines create ValueObjectConstResult ValueObjects from various data sources.
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) const
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:327
constexpr bool IsSyntheticValueType(lldb::ValueType vt)
Return true if vt represents a synthetic value, false if not.
Definition ValueType.h:27
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
Definition Utils.h:17
constexpr lldb::ValueType GetBaseValueType(lldb::ValueType vt)
Get the base value type - for when we don't care if the value is synthetic or not,...
Definition ValueType.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
@ 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
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
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