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