[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / source / API / SBFrame.cpp
blobaf42be9ac75e5b9a11d1eb9c5a33e0a376baf5d5
1 //===-- SBFrame.cpp ---------------------------------------------*- C++ -*-===//
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 //===----------------------------------------------------------------------===//
9 #include <algorithm>
10 #include <set>
11 #include <string>
13 #include "lldb/API/SBFrame.h"
15 #include "lldb/lldb-types.h"
17 #include "SBReproducerPrivate.h"
18 #include "Utils.h"
19 #include "lldb/Core/Address.h"
20 #include "lldb/Core/StreamFile.h"
21 #include "lldb/Core/ValueObjectRegister.h"
22 #include "lldb/Core/ValueObjectVariable.h"
23 #include "lldb/Expression/ExpressionVariable.h"
24 #include "lldb/Expression/UserExpression.h"
25 #include "lldb/Host/Host.h"
26 #include "lldb/Symbol/Block.h"
27 #include "lldb/Symbol/Function.h"
28 #include "lldb/Symbol/Symbol.h"
29 #include "lldb/Symbol/SymbolContext.h"
30 #include "lldb/Symbol/Variable.h"
31 #include "lldb/Symbol/VariableList.h"
32 #include "lldb/Target/ExecutionContext.h"
33 #include "lldb/Target/Process.h"
34 #include "lldb/Target/RegisterContext.h"
35 #include "lldb/Target/StackFrame.h"
36 #include "lldb/Target/StackFrameRecognizer.h"
37 #include "lldb/Target/StackID.h"
38 #include "lldb/Target/Target.h"
39 #include "lldb/Target/Thread.h"
40 #include "lldb/Utility/ConstString.h"
41 #include "lldb/Utility/Stream.h"
43 #include "lldb/API/SBAddress.h"
44 #include "lldb/API/SBDebugger.h"
45 #include "lldb/API/SBExpressionOptions.h"
46 #include "lldb/API/SBStream.h"
47 #include "lldb/API/SBSymbolContext.h"
48 #include "lldb/API/SBThread.h"
49 #include "lldb/API/SBValue.h"
50 #include "lldb/API/SBVariablesOptions.h"
52 #include "llvm/Support/PrettyStackTrace.h"
54 using namespace lldb;
55 using namespace lldb_private;
57 SBFrame::SBFrame() : m_opaque_sp(new ExecutionContextRef()) {
58 LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBFrame);
61 SBFrame::SBFrame(const StackFrameSP &lldb_object_sp)
62 : m_opaque_sp(new ExecutionContextRef(lldb_object_sp)) {
63 LLDB_RECORD_CONSTRUCTOR(SBFrame, (const lldb::StackFrameSP &),
64 lldb_object_sp);
67 SBFrame::SBFrame(const SBFrame &rhs) : m_opaque_sp() {
68 LLDB_RECORD_CONSTRUCTOR(SBFrame, (const lldb::SBFrame &), rhs);
70 m_opaque_sp = clone(rhs.m_opaque_sp);
73 SBFrame::~SBFrame() = default;
75 const SBFrame &SBFrame::operator=(const SBFrame &rhs) {
76 LLDB_RECORD_METHOD(const lldb::SBFrame &,
77 SBFrame, operator=,(const lldb::SBFrame &), rhs);
79 if (this != &rhs)
80 m_opaque_sp = clone(rhs.m_opaque_sp);
81 return LLDB_RECORD_RESULT(*this);
84 StackFrameSP SBFrame::GetFrameSP() const {
85 return (m_opaque_sp ? m_opaque_sp->GetFrameSP() : StackFrameSP());
88 void SBFrame::SetFrameSP(const StackFrameSP &lldb_object_sp) {
89 return m_opaque_sp->SetFrameSP(lldb_object_sp);
92 bool SBFrame::IsValid() const {
93 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFrame, IsValid);
94 return this->operator bool();
96 SBFrame::operator bool() const {
97 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFrame, operator bool);
99 std::unique_lock<std::recursive_mutex> lock;
100 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
102 Target *target = exe_ctx.GetTargetPtr();
103 Process *process = exe_ctx.GetProcessPtr();
104 if (target && process) {
105 Process::StopLocker stop_locker;
106 if (stop_locker.TryLock(&process->GetRunLock()))
107 return GetFrameSP().get() != nullptr;
110 // Without a target & process we can't have a valid stack frame.
111 return false;
114 SBSymbolContext SBFrame::GetSymbolContext(uint32_t resolve_scope) const {
115 LLDB_RECORD_METHOD_CONST(lldb::SBSymbolContext, SBFrame, GetSymbolContext,
116 (uint32_t), resolve_scope);
118 SBSymbolContext sb_sym_ctx;
119 std::unique_lock<std::recursive_mutex> lock;
120 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
121 SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
122 StackFrame *frame = nullptr;
123 Target *target = exe_ctx.GetTargetPtr();
124 Process *process = exe_ctx.GetProcessPtr();
125 if (target && process) {
126 Process::StopLocker stop_locker;
127 if (stop_locker.TryLock(&process->GetRunLock())) {
128 frame = exe_ctx.GetFramePtr();
129 if (frame)
130 sb_sym_ctx.SetSymbolContext(&frame->GetSymbolContext(scope));
134 return LLDB_RECORD_RESULT(sb_sym_ctx);
137 SBModule SBFrame::GetModule() const {
138 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBModule, SBFrame, GetModule);
140 SBModule sb_module;
141 ModuleSP module_sp;
142 std::unique_lock<std::recursive_mutex> lock;
143 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
145 StackFrame *frame = nullptr;
146 Target *target = exe_ctx.GetTargetPtr();
147 Process *process = exe_ctx.GetProcessPtr();
148 if (target && process) {
149 Process::StopLocker stop_locker;
150 if (stop_locker.TryLock(&process->GetRunLock())) {
151 frame = exe_ctx.GetFramePtr();
152 if (frame) {
153 module_sp = frame->GetSymbolContext(eSymbolContextModule).module_sp;
154 sb_module.SetSP(module_sp);
159 return LLDB_RECORD_RESULT(sb_module);
162 SBCompileUnit SBFrame::GetCompileUnit() const {
163 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBCompileUnit, SBFrame,
164 GetCompileUnit);
166 SBCompileUnit sb_comp_unit;
167 std::unique_lock<std::recursive_mutex> lock;
168 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
170 StackFrame *frame = nullptr;
171 Target *target = exe_ctx.GetTargetPtr();
172 Process *process = exe_ctx.GetProcessPtr();
173 if (target && process) {
174 Process::StopLocker stop_locker;
175 if (stop_locker.TryLock(&process->GetRunLock())) {
176 frame = exe_ctx.GetFramePtr();
177 if (frame) {
178 sb_comp_unit.reset(
179 frame->GetSymbolContext(eSymbolContextCompUnit).comp_unit);
184 return LLDB_RECORD_RESULT(sb_comp_unit);
187 SBFunction SBFrame::GetFunction() const {
188 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFunction, SBFrame, GetFunction);
190 SBFunction sb_function;
191 std::unique_lock<std::recursive_mutex> lock;
192 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
194 StackFrame *frame = nullptr;
195 Target *target = exe_ctx.GetTargetPtr();
196 Process *process = exe_ctx.GetProcessPtr();
197 if (target && process) {
198 Process::StopLocker stop_locker;
199 if (stop_locker.TryLock(&process->GetRunLock())) {
200 frame = exe_ctx.GetFramePtr();
201 if (frame) {
202 sb_function.reset(
203 frame->GetSymbolContext(eSymbolContextFunction).function);
208 return LLDB_RECORD_RESULT(sb_function);
211 SBSymbol SBFrame::GetSymbol() const {
212 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBSymbol, SBFrame, GetSymbol);
214 SBSymbol sb_symbol;
215 std::unique_lock<std::recursive_mutex> lock;
216 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
218 StackFrame *frame = nullptr;
219 Target *target = exe_ctx.GetTargetPtr();
220 Process *process = exe_ctx.GetProcessPtr();
221 if (target && process) {
222 Process::StopLocker stop_locker;
223 if (stop_locker.TryLock(&process->GetRunLock())) {
224 frame = exe_ctx.GetFramePtr();
225 if (frame) {
226 sb_symbol.reset(frame->GetSymbolContext(eSymbolContextSymbol).symbol);
231 return LLDB_RECORD_RESULT(sb_symbol);
234 SBBlock SBFrame::GetBlock() const {
235 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBBlock, SBFrame, GetBlock);
237 SBBlock sb_block;
238 std::unique_lock<std::recursive_mutex> lock;
239 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
241 StackFrame *frame = nullptr;
242 Target *target = exe_ctx.GetTargetPtr();
243 Process *process = exe_ctx.GetProcessPtr();
244 if (target && process) {
245 Process::StopLocker stop_locker;
246 if (stop_locker.TryLock(&process->GetRunLock())) {
247 frame = exe_ctx.GetFramePtr();
248 if (frame)
249 sb_block.SetPtr(frame->GetSymbolContext(eSymbolContextBlock).block);
252 return LLDB_RECORD_RESULT(sb_block);
255 SBBlock SBFrame::GetFrameBlock() const {
256 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBBlock, SBFrame, GetFrameBlock);
258 SBBlock sb_block;
259 std::unique_lock<std::recursive_mutex> lock;
260 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
262 StackFrame *frame = nullptr;
263 Target *target = exe_ctx.GetTargetPtr();
264 Process *process = exe_ctx.GetProcessPtr();
265 if (target && process) {
266 Process::StopLocker stop_locker;
267 if (stop_locker.TryLock(&process->GetRunLock())) {
268 frame = exe_ctx.GetFramePtr();
269 if (frame)
270 sb_block.SetPtr(frame->GetFrameBlock());
273 return LLDB_RECORD_RESULT(sb_block);
276 SBLineEntry SBFrame::GetLineEntry() const {
277 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBLineEntry, SBFrame, GetLineEntry);
279 SBLineEntry sb_line_entry;
280 std::unique_lock<std::recursive_mutex> lock;
281 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
283 StackFrame *frame = nullptr;
284 Target *target = exe_ctx.GetTargetPtr();
285 Process *process = exe_ctx.GetProcessPtr();
286 if (target && process) {
287 Process::StopLocker stop_locker;
288 if (stop_locker.TryLock(&process->GetRunLock())) {
289 frame = exe_ctx.GetFramePtr();
290 if (frame) {
291 sb_line_entry.SetLineEntry(
292 frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
296 return LLDB_RECORD_RESULT(sb_line_entry);
299 uint32_t SBFrame::GetFrameID() const {
300 LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBFrame, GetFrameID);
302 uint32_t frame_idx = UINT32_MAX;
304 std::unique_lock<std::recursive_mutex> lock;
305 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
307 StackFrame *frame = exe_ctx.GetFramePtr();
308 if (frame)
309 frame_idx = frame->GetFrameIndex();
311 return frame_idx;
314 lldb::addr_t SBFrame::GetCFA() const {
315 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::addr_t, SBFrame, GetCFA);
317 std::unique_lock<std::recursive_mutex> lock;
318 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
320 StackFrame *frame = exe_ctx.GetFramePtr();
321 if (frame)
322 return frame->GetStackID().GetCallFrameAddress();
323 return LLDB_INVALID_ADDRESS;
326 addr_t SBFrame::GetPC() const {
327 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::addr_t, SBFrame, GetPC);
329 addr_t addr = LLDB_INVALID_ADDRESS;
330 std::unique_lock<std::recursive_mutex> lock;
331 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
333 StackFrame *frame = nullptr;
334 Target *target = exe_ctx.GetTargetPtr();
335 Process *process = exe_ctx.GetProcessPtr();
336 if (target && process) {
337 Process::StopLocker stop_locker;
338 if (stop_locker.TryLock(&process->GetRunLock())) {
339 frame = exe_ctx.GetFramePtr();
340 if (frame) {
341 addr = frame->GetFrameCodeAddress().GetOpcodeLoadAddress(
342 target, AddressClass::eCode);
347 return addr;
350 bool SBFrame::SetPC(addr_t new_pc) {
351 LLDB_RECORD_METHOD(bool, SBFrame, SetPC, (lldb::addr_t), new_pc);
353 bool ret_val = false;
354 std::unique_lock<std::recursive_mutex> lock;
355 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
357 StackFrame *frame = nullptr;
358 Target *target = exe_ctx.GetTargetPtr();
359 Process *process = exe_ctx.GetProcessPtr();
360 if (target && process) {
361 Process::StopLocker stop_locker;
362 if (stop_locker.TryLock(&process->GetRunLock())) {
363 frame = exe_ctx.GetFramePtr();
364 if (frame) {
365 ret_val = frame->GetRegisterContext()->SetPC(new_pc);
370 return ret_val;
373 addr_t SBFrame::GetSP() const {
374 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::addr_t, SBFrame, GetSP);
376 addr_t addr = LLDB_INVALID_ADDRESS;
377 std::unique_lock<std::recursive_mutex> lock;
378 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
380 StackFrame *frame = nullptr;
381 Target *target = exe_ctx.GetTargetPtr();
382 Process *process = exe_ctx.GetProcessPtr();
383 if (target && process) {
384 Process::StopLocker stop_locker;
385 if (stop_locker.TryLock(&process->GetRunLock())) {
386 frame = exe_ctx.GetFramePtr();
387 if (frame) {
388 addr = frame->GetRegisterContext()->GetSP();
393 return addr;
396 addr_t SBFrame::GetFP() const {
397 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::addr_t, SBFrame, GetFP);
399 addr_t addr = LLDB_INVALID_ADDRESS;
400 std::unique_lock<std::recursive_mutex> lock;
401 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
403 StackFrame *frame = nullptr;
404 Target *target = exe_ctx.GetTargetPtr();
405 Process *process = exe_ctx.GetProcessPtr();
406 if (target && process) {
407 Process::StopLocker stop_locker;
408 if (stop_locker.TryLock(&process->GetRunLock())) {
409 frame = exe_ctx.GetFramePtr();
410 if (frame)
411 addr = frame->GetRegisterContext()->GetFP();
415 return addr;
418 SBAddress SBFrame::GetPCAddress() const {
419 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress, SBFrame, GetPCAddress);
421 SBAddress sb_addr;
422 std::unique_lock<std::recursive_mutex> lock;
423 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
425 StackFrame *frame = exe_ctx.GetFramePtr();
426 Target *target = exe_ctx.GetTargetPtr();
427 Process *process = exe_ctx.GetProcessPtr();
428 if (target && process) {
429 Process::StopLocker stop_locker;
430 if (stop_locker.TryLock(&process->GetRunLock())) {
431 frame = exe_ctx.GetFramePtr();
432 if (frame)
433 sb_addr.SetAddress(&frame->GetFrameCodeAddress());
436 return LLDB_RECORD_RESULT(sb_addr);
439 void SBFrame::Clear() {
440 LLDB_RECORD_METHOD_NO_ARGS(void, SBFrame, Clear);
442 m_opaque_sp->Clear();
445 lldb::SBValue SBFrame::GetValueForVariablePath(const char *var_path) {
446 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, GetValueForVariablePath,
447 (const char *), var_path);
449 SBValue sb_value;
450 std::unique_lock<std::recursive_mutex> lock;
451 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
453 StackFrame *frame = exe_ctx.GetFramePtr();
454 Target *target = exe_ctx.GetTargetPtr();
455 if (frame && target) {
456 lldb::DynamicValueType use_dynamic =
457 frame->CalculateTarget()->GetPreferDynamicValue();
458 sb_value = GetValueForVariablePath(var_path, use_dynamic);
460 return LLDB_RECORD_RESULT(sb_value);
463 lldb::SBValue SBFrame::GetValueForVariablePath(const char *var_path,
464 DynamicValueType use_dynamic) {
465 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, GetValueForVariablePath,
466 (const char *, lldb::DynamicValueType), var_path,
467 use_dynamic);
469 SBValue sb_value;
470 if (var_path == nullptr || var_path[0] == '\0') {
471 return LLDB_RECORD_RESULT(sb_value);
474 std::unique_lock<std::recursive_mutex> lock;
475 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
477 StackFrame *frame = nullptr;
478 Target *target = exe_ctx.GetTargetPtr();
479 Process *process = exe_ctx.GetProcessPtr();
480 if (target && process) {
481 Process::StopLocker stop_locker;
482 if (stop_locker.TryLock(&process->GetRunLock())) {
483 frame = exe_ctx.GetFramePtr();
484 if (frame) {
485 VariableSP var_sp;
486 Status error;
487 ValueObjectSP value_sp(frame->GetValueForVariableExpressionPath(
488 var_path, eNoDynamicValues,
489 StackFrame::eExpressionPathOptionCheckPtrVsMember |
490 StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,
491 var_sp, error));
492 sb_value.SetSP(value_sp, use_dynamic);
496 return LLDB_RECORD_RESULT(sb_value);
499 SBValue SBFrame::FindVariable(const char *name) {
500 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, FindVariable, (const char *),
501 name);
503 SBValue value;
504 std::unique_lock<std::recursive_mutex> lock;
505 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
507 StackFrame *frame = exe_ctx.GetFramePtr();
508 Target *target = exe_ctx.GetTargetPtr();
509 if (frame && target) {
510 lldb::DynamicValueType use_dynamic =
511 frame->CalculateTarget()->GetPreferDynamicValue();
512 value = FindVariable(name, use_dynamic);
514 return LLDB_RECORD_RESULT(value);
517 SBValue SBFrame::FindVariable(const char *name,
518 lldb::DynamicValueType use_dynamic) {
519 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, FindVariable,
520 (const char *, lldb::DynamicValueType), name, use_dynamic);
522 VariableSP var_sp;
523 SBValue sb_value;
525 if (name == nullptr || name[0] == '\0') {
526 return LLDB_RECORD_RESULT(sb_value);
529 ValueObjectSP value_sp;
530 std::unique_lock<std::recursive_mutex> lock;
531 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
533 StackFrame *frame = nullptr;
534 Target *target = exe_ctx.GetTargetPtr();
535 Process *process = exe_ctx.GetProcessPtr();
536 if (target && process) {
537 Process::StopLocker stop_locker;
538 if (stop_locker.TryLock(&process->GetRunLock())) {
539 frame = exe_ctx.GetFramePtr();
540 if (frame) {
541 value_sp = frame->FindVariable(ConstString(name));
543 if (value_sp)
544 sb_value.SetSP(value_sp, use_dynamic);
549 return LLDB_RECORD_RESULT(sb_value);
552 SBValue SBFrame::FindValue(const char *name, ValueType value_type) {
553 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, FindValue,
554 (const char *, lldb::ValueType), name, value_type);
556 SBValue value;
557 std::unique_lock<std::recursive_mutex> lock;
558 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
560 StackFrame *frame = exe_ctx.GetFramePtr();
561 Target *target = exe_ctx.GetTargetPtr();
562 if (frame && target) {
563 lldb::DynamicValueType use_dynamic =
564 frame->CalculateTarget()->GetPreferDynamicValue();
565 value = FindValue(name, value_type, use_dynamic);
567 return LLDB_RECORD_RESULT(value);
570 SBValue SBFrame::FindValue(const char *name, ValueType value_type,
571 lldb::DynamicValueType use_dynamic) {
572 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, FindValue,
573 (const char *, lldb::ValueType, lldb::DynamicValueType),
574 name, value_type, use_dynamic);
576 SBValue sb_value;
578 if (name == nullptr || name[0] == '\0') {
579 return LLDB_RECORD_RESULT(sb_value);
582 ValueObjectSP value_sp;
583 std::unique_lock<std::recursive_mutex> lock;
584 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
586 StackFrame *frame = nullptr;
587 Target *target = exe_ctx.GetTargetPtr();
588 Process *process = exe_ctx.GetProcessPtr();
589 if (target && process) {
590 Process::StopLocker stop_locker;
591 if (stop_locker.TryLock(&process->GetRunLock())) {
592 frame = exe_ctx.GetFramePtr();
593 if (frame) {
594 VariableList variable_list;
596 switch (value_type) {
597 case eValueTypeVariableGlobal: // global variable
598 case eValueTypeVariableStatic: // static variable
599 case eValueTypeVariableArgument: // function argument variables
600 case eValueTypeVariableLocal: // function local variables
601 case eValueTypeVariableThreadLocal: // thread local variables
603 SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
605 const bool can_create = true;
606 const bool get_parent_variables = true;
607 const bool stop_if_block_is_inlined_function = true;
609 if (sc.block)
610 sc.block->AppendVariables(
611 can_create, get_parent_variables,
612 stop_if_block_is_inlined_function,
613 [frame](Variable *v) { return v->IsInScope(frame); },
614 &variable_list);
615 if (value_type == eValueTypeVariableGlobal) {
616 const bool get_file_globals = true;
617 VariableList *frame_vars = frame->GetVariableList(get_file_globals);
618 if (frame_vars)
619 frame_vars->AppendVariablesIfUnique(variable_list);
621 ConstString const_name(name);
622 VariableSP variable_sp(
623 variable_list.FindVariable(const_name, value_type));
624 if (variable_sp) {
625 value_sp = frame->GetValueObjectForFrameVariable(variable_sp,
626 eNoDynamicValues);
627 sb_value.SetSP(value_sp, use_dynamic);
629 } break;
631 case eValueTypeRegister: // stack frame register value
633 RegisterContextSP reg_ctx(frame->GetRegisterContext());
634 if (reg_ctx) {
635 const uint32_t num_regs = reg_ctx->GetRegisterCount();
636 for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
637 const RegisterInfo *reg_info =
638 reg_ctx->GetRegisterInfoAtIndex(reg_idx);
639 if (reg_info &&
640 ((reg_info->name && strcasecmp(reg_info->name, name) == 0) ||
641 (reg_info->alt_name &&
642 strcasecmp(reg_info->alt_name, name) == 0))) {
643 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx);
644 sb_value.SetSP(value_sp);
645 break;
649 } break;
651 case eValueTypeRegisterSet: // A collection of stack frame register
652 // values
654 RegisterContextSP reg_ctx(frame->GetRegisterContext());
655 if (reg_ctx) {
656 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
657 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
658 const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
659 if (reg_set &&
660 ((reg_set->name && strcasecmp(reg_set->name, name) == 0) ||
661 (reg_set->short_name &&
662 strcasecmp(reg_set->short_name, name) == 0))) {
663 value_sp =
664 ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx);
665 sb_value.SetSP(value_sp);
666 break;
670 } break;
672 case eValueTypeConstResult: // constant result variables
674 ConstString const_name(name);
675 ExpressionVariableSP expr_var_sp(
676 target->GetPersistentVariable(const_name));
677 if (expr_var_sp) {
678 value_sp = expr_var_sp->GetValueObject();
679 sb_value.SetSP(value_sp, use_dynamic);
681 } break;
683 default:
684 break;
690 return LLDB_RECORD_RESULT(sb_value);
693 bool SBFrame::IsEqual(const SBFrame &that) const {
694 LLDB_RECORD_METHOD_CONST(bool, SBFrame, IsEqual, (const lldb::SBFrame &),
695 that);
697 lldb::StackFrameSP this_sp = GetFrameSP();
698 lldb::StackFrameSP that_sp = that.GetFrameSP();
699 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
702 bool SBFrame::operator==(const SBFrame &rhs) const {
703 LLDB_RECORD_METHOD_CONST(bool, SBFrame, operator==,(const lldb::SBFrame &),
704 rhs);
706 return IsEqual(rhs);
709 bool SBFrame::operator!=(const SBFrame &rhs) const {
710 LLDB_RECORD_METHOD_CONST(bool, SBFrame, operator!=,(const lldb::SBFrame &),
711 rhs);
713 return !IsEqual(rhs);
716 SBThread SBFrame::GetThread() const {
717 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBThread, SBFrame, GetThread);
719 std::unique_lock<std::recursive_mutex> lock;
720 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
722 ThreadSP thread_sp(exe_ctx.GetThreadSP());
723 SBThread sb_thread(thread_sp);
725 return LLDB_RECORD_RESULT(sb_thread);
728 const char *SBFrame::Disassemble() const {
729 LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBFrame, Disassemble);
731 const char *disassembly = nullptr;
732 std::unique_lock<std::recursive_mutex> lock;
733 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
735 StackFrame *frame = nullptr;
736 Target *target = exe_ctx.GetTargetPtr();
737 Process *process = exe_ctx.GetProcessPtr();
738 if (target && process) {
739 Process::StopLocker stop_locker;
740 if (stop_locker.TryLock(&process->GetRunLock())) {
741 frame = exe_ctx.GetFramePtr();
742 if (frame) {
743 disassembly = frame->Disassemble();
748 return disassembly;
751 SBValueList SBFrame::GetVariables(bool arguments, bool locals, bool statics,
752 bool in_scope_only) {
753 LLDB_RECORD_METHOD(lldb::SBValueList, SBFrame, GetVariables,
754 (bool, bool, bool, bool), arguments, locals, statics,
755 in_scope_only);
757 SBValueList value_list;
758 std::unique_lock<std::recursive_mutex> lock;
759 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
761 StackFrame *frame = exe_ctx.GetFramePtr();
762 Target *target = exe_ctx.GetTargetPtr();
763 if (frame && target) {
764 lldb::DynamicValueType use_dynamic =
765 frame->CalculateTarget()->GetPreferDynamicValue();
766 const bool include_runtime_support_values =
767 target ? target->GetDisplayRuntimeSupportValues() : false;
769 SBVariablesOptions options;
770 options.SetIncludeArguments(arguments);
771 options.SetIncludeLocals(locals);
772 options.SetIncludeStatics(statics);
773 options.SetInScopeOnly(in_scope_only);
774 options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
775 options.SetUseDynamic(use_dynamic);
777 value_list = GetVariables(options);
779 return LLDB_RECORD_RESULT(value_list);
782 lldb::SBValueList SBFrame::GetVariables(bool arguments, bool locals,
783 bool statics, bool in_scope_only,
784 lldb::DynamicValueType use_dynamic) {
785 LLDB_RECORD_METHOD(lldb::SBValueList, SBFrame, GetVariables,
786 (bool, bool, bool, bool, lldb::DynamicValueType),
787 arguments, locals, statics, in_scope_only, use_dynamic);
789 std::unique_lock<std::recursive_mutex> lock;
790 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
792 Target *target = exe_ctx.GetTargetPtr();
793 const bool include_runtime_support_values =
794 target ? target->GetDisplayRuntimeSupportValues() : false;
795 SBVariablesOptions options;
796 options.SetIncludeArguments(arguments);
797 options.SetIncludeLocals(locals);
798 options.SetIncludeStatics(statics);
799 options.SetInScopeOnly(in_scope_only);
800 options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
801 options.SetUseDynamic(use_dynamic);
802 return LLDB_RECORD_RESULT(GetVariables(options));
805 SBValueList SBFrame::GetVariables(const lldb::SBVariablesOptions &options) {
806 LLDB_RECORD_METHOD(lldb::SBValueList, SBFrame, GetVariables,
807 (const lldb::SBVariablesOptions &), options);
809 SBValueList value_list;
810 std::unique_lock<std::recursive_mutex> lock;
811 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
813 StackFrame *frame = nullptr;
814 Target *target = exe_ctx.GetTargetPtr();
816 const bool statics = options.GetIncludeStatics();
817 const bool arguments = options.GetIncludeArguments();
818 const bool recognized_arguments =
819 options.GetIncludeRecognizedArguments(SBTarget(exe_ctx.GetTargetSP()));
820 const bool locals = options.GetIncludeLocals();
821 const bool in_scope_only = options.GetInScopeOnly();
822 const bool include_runtime_support_values =
823 options.GetIncludeRuntimeSupportValues();
824 const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
827 std::set<VariableSP> variable_set;
828 Process *process = exe_ctx.GetProcessPtr();
829 if (target && process) {
830 Process::StopLocker stop_locker;
831 if (stop_locker.TryLock(&process->GetRunLock())) {
832 frame = exe_ctx.GetFramePtr();
833 if (frame) {
834 VariableList *variable_list = nullptr;
835 variable_list = frame->GetVariableList(true);
836 if (variable_list) {
837 const size_t num_variables = variable_list->GetSize();
838 if (num_variables) {
839 for (const VariableSP &variable_sp : *variable_list) {
840 if (variable_sp) {
841 bool add_variable = false;
842 switch (variable_sp->GetScope()) {
843 case eValueTypeVariableGlobal:
844 case eValueTypeVariableStatic:
845 case eValueTypeVariableThreadLocal:
846 add_variable = statics;
847 break;
849 case eValueTypeVariableArgument:
850 add_variable = arguments;
851 break;
853 case eValueTypeVariableLocal:
854 add_variable = locals;
855 break;
857 default:
858 break;
860 if (add_variable) {
861 // Only add variables once so we don't end up with duplicates
862 if (variable_set.find(variable_sp) == variable_set.end())
863 variable_set.insert(variable_sp);
864 else
865 continue;
867 if (in_scope_only && !variable_sp->IsInScope(frame))
868 continue;
870 ValueObjectSP valobj_sp(frame->GetValueObjectForFrameVariable(
871 variable_sp, eNoDynamicValues));
873 if (!include_runtime_support_values && valobj_sp != nullptr &&
874 valobj_sp->IsRuntimeSupportValue())
875 continue;
877 SBValue value_sb;
878 value_sb.SetSP(valobj_sp, use_dynamic);
879 value_list.Append(value_sb);
885 if (recognized_arguments) {
886 auto recognized_frame = frame->GetRecognizedFrame();
887 if (recognized_frame) {
888 ValueObjectListSP recognized_arg_list =
889 recognized_frame->GetRecognizedArguments();
890 if (recognized_arg_list) {
891 for (auto &rec_value_sp : recognized_arg_list->GetObjects()) {
892 SBValue value_sb;
893 value_sb.SetSP(rec_value_sp, use_dynamic);
894 value_list.Append(value_sb);
903 return LLDB_RECORD_RESULT(value_list);
906 SBValueList SBFrame::GetRegisters() {
907 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValueList, SBFrame, GetRegisters);
909 SBValueList value_list;
910 std::unique_lock<std::recursive_mutex> lock;
911 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
913 StackFrame *frame = nullptr;
914 Target *target = exe_ctx.GetTargetPtr();
915 Process *process = exe_ctx.GetProcessPtr();
916 if (target && process) {
917 Process::StopLocker stop_locker;
918 if (stop_locker.TryLock(&process->GetRunLock())) {
919 frame = exe_ctx.GetFramePtr();
920 if (frame) {
921 RegisterContextSP reg_ctx(frame->GetRegisterContext());
922 if (reg_ctx) {
923 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
924 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
925 value_list.Append(
926 ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx));
933 return LLDB_RECORD_RESULT(value_list);
936 SBValue SBFrame::FindRegister(const char *name) {
937 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, FindRegister, (const char *),
938 name);
940 SBValue result;
941 ValueObjectSP value_sp;
942 std::unique_lock<std::recursive_mutex> lock;
943 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
945 StackFrame *frame = nullptr;
946 Target *target = exe_ctx.GetTargetPtr();
947 Process *process = exe_ctx.GetProcessPtr();
948 if (target && process) {
949 Process::StopLocker stop_locker;
950 if (stop_locker.TryLock(&process->GetRunLock())) {
951 frame = exe_ctx.GetFramePtr();
952 if (frame) {
953 RegisterContextSP reg_ctx(frame->GetRegisterContext());
954 if (reg_ctx) {
955 const uint32_t num_regs = reg_ctx->GetRegisterCount();
956 for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
957 const RegisterInfo *reg_info =
958 reg_ctx->GetRegisterInfoAtIndex(reg_idx);
959 if (reg_info &&
960 ((reg_info->name && strcasecmp(reg_info->name, name) == 0) ||
961 (reg_info->alt_name &&
962 strcasecmp(reg_info->alt_name, name) == 0))) {
963 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx);
964 result.SetSP(value_sp);
965 break;
973 return LLDB_RECORD_RESULT(result);
976 bool SBFrame::GetDescription(SBStream &description) {
977 LLDB_RECORD_METHOD(bool, SBFrame, GetDescription, (lldb::SBStream &),
978 description);
980 Stream &strm = description.ref();
982 std::unique_lock<std::recursive_mutex> lock;
983 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
985 StackFrame *frame;
986 Target *target = exe_ctx.GetTargetPtr();
987 Process *process = exe_ctx.GetProcessPtr();
988 if (target && process) {
989 Process::StopLocker stop_locker;
990 if (stop_locker.TryLock(&process->GetRunLock())) {
991 frame = exe_ctx.GetFramePtr();
992 if (frame) {
993 frame->DumpUsingSettingsFormat(&strm);
997 } else
998 strm.PutCString("No value");
1000 return true;
1003 SBValue SBFrame::EvaluateExpression(const char *expr) {
1004 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, EvaluateExpression, (const char *),
1005 expr);
1007 SBValue result;
1008 std::unique_lock<std::recursive_mutex> lock;
1009 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1011 StackFrame *frame = exe_ctx.GetFramePtr();
1012 Target *target = exe_ctx.GetTargetPtr();
1013 if (frame && target) {
1014 SBExpressionOptions options;
1015 lldb::DynamicValueType fetch_dynamic_value =
1016 frame->CalculateTarget()->GetPreferDynamicValue();
1017 options.SetFetchDynamicValue(fetch_dynamic_value);
1018 options.SetUnwindOnError(true);
1019 options.SetIgnoreBreakpoints(true);
1020 if (target->GetLanguage() != eLanguageTypeUnknown)
1021 options.SetLanguage(target->GetLanguage());
1022 else
1023 options.SetLanguage(frame->GetLanguage());
1024 return LLDB_RECORD_RESULT(EvaluateExpression(expr, options));
1026 return LLDB_RECORD_RESULT(result);
1029 SBValue
1030 SBFrame::EvaluateExpression(const char *expr,
1031 lldb::DynamicValueType fetch_dynamic_value) {
1032 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
1033 (const char *, lldb::DynamicValueType), expr,
1034 fetch_dynamic_value);
1036 SBExpressionOptions options;
1037 options.SetFetchDynamicValue(fetch_dynamic_value);
1038 options.SetUnwindOnError(true);
1039 options.SetIgnoreBreakpoints(true);
1040 std::unique_lock<std::recursive_mutex> lock;
1041 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1043 StackFrame *frame = exe_ctx.GetFramePtr();
1044 Target *target = exe_ctx.GetTargetPtr();
1045 if (target && target->GetLanguage() != eLanguageTypeUnknown)
1046 options.SetLanguage(target->GetLanguage());
1047 else if (frame)
1048 options.SetLanguage(frame->GetLanguage());
1049 return LLDB_RECORD_RESULT(EvaluateExpression(expr, options));
1052 SBValue SBFrame::EvaluateExpression(const char *expr,
1053 lldb::DynamicValueType fetch_dynamic_value,
1054 bool unwind_on_error) {
1055 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
1056 (const char *, lldb::DynamicValueType, bool), expr,
1057 fetch_dynamic_value, unwind_on_error);
1059 SBExpressionOptions options;
1060 std::unique_lock<std::recursive_mutex> lock;
1061 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1063 options.SetFetchDynamicValue(fetch_dynamic_value);
1064 options.SetUnwindOnError(unwind_on_error);
1065 options.SetIgnoreBreakpoints(true);
1066 StackFrame *frame = exe_ctx.GetFramePtr();
1067 Target *target = exe_ctx.GetTargetPtr();
1068 if (target && target->GetLanguage() != eLanguageTypeUnknown)
1069 options.SetLanguage(target->GetLanguage());
1070 else if (frame)
1071 options.SetLanguage(frame->GetLanguage());
1072 return LLDB_RECORD_RESULT(EvaluateExpression(expr, options));
1075 lldb::SBValue SBFrame::EvaluateExpression(const char *expr,
1076 const SBExpressionOptions &options) {
1077 LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
1078 (const char *, const lldb::SBExpressionOptions &), expr,
1079 options);
1081 Log *expr_log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
1083 SBValue expr_result;
1085 if (expr == nullptr || expr[0] == '\0') {
1086 return LLDB_RECORD_RESULT(expr_result);
1089 ValueObjectSP expr_value_sp;
1091 std::unique_lock<std::recursive_mutex> lock;
1092 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1095 StackFrame *frame = nullptr;
1096 Target *target = exe_ctx.GetTargetPtr();
1097 Process *process = exe_ctx.GetProcessPtr();
1099 if (target && process) {
1100 Process::StopLocker stop_locker;
1101 if (stop_locker.TryLock(&process->GetRunLock())) {
1102 frame = exe_ctx.GetFramePtr();
1103 if (frame) {
1104 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1105 if (target->GetDisplayExpressionsInCrashlogs()) {
1106 StreamString frame_description;
1107 frame->DumpUsingSettingsFormat(&frame_description);
1108 stack_trace = std::make_unique<llvm::PrettyStackTraceFormat>(
1109 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1110 "= %u) %s",
1111 expr, options.GetFetchDynamicValue(),
1112 frame_description.GetData());
1115 target->EvaluateExpression(expr, frame, expr_value_sp, options.ref());
1116 expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
1121 LLDB_LOGF(expr_log,
1122 "** [SBFrame::EvaluateExpression] Expression result is "
1123 "%s, summary %s **",
1124 expr_result.GetValue(), expr_result.GetSummary());
1126 return LLDB_RECORD_RESULT(expr_result);
1129 bool SBFrame::IsInlined() {
1130 LLDB_RECORD_METHOD_NO_ARGS(bool, SBFrame, IsInlined);
1132 return static_cast<const SBFrame *>(this)->IsInlined();
1135 bool SBFrame::IsInlined() const {
1136 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFrame, IsInlined);
1138 std::unique_lock<std::recursive_mutex> lock;
1139 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1141 StackFrame *frame = nullptr;
1142 Target *target = exe_ctx.GetTargetPtr();
1143 Process *process = exe_ctx.GetProcessPtr();
1144 if (target && process) {
1145 Process::StopLocker stop_locker;
1146 if (stop_locker.TryLock(&process->GetRunLock())) {
1147 frame = exe_ctx.GetFramePtr();
1148 if (frame) {
1150 Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
1151 if (block)
1152 return block->GetContainingInlinedBlock() != nullptr;
1156 return false;
1159 bool SBFrame::IsArtificial() {
1160 LLDB_RECORD_METHOD_NO_ARGS(bool, SBFrame, IsArtificial);
1162 return static_cast<const SBFrame *>(this)->IsArtificial();
1165 bool SBFrame::IsArtificial() const {
1166 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFrame, IsArtificial);
1168 std::unique_lock<std::recursive_mutex> lock;
1169 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1171 StackFrame *frame = exe_ctx.GetFramePtr();
1172 if (frame)
1173 return frame->IsArtificial();
1175 return false;
1178 const char *SBFrame::GetFunctionName() {
1179 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBFrame, GetFunctionName);
1181 return static_cast<const SBFrame *>(this)->GetFunctionName();
1184 lldb::LanguageType SBFrame::GuessLanguage() const {
1185 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::LanguageType, SBFrame, GuessLanguage);
1187 std::unique_lock<std::recursive_mutex> lock;
1188 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1190 StackFrame *frame = nullptr;
1191 Target *target = exe_ctx.GetTargetPtr();
1192 Process *process = exe_ctx.GetProcessPtr();
1193 if (target && process) {
1194 Process::StopLocker stop_locker;
1195 if (stop_locker.TryLock(&process->GetRunLock())) {
1196 frame = exe_ctx.GetFramePtr();
1197 if (frame) {
1198 return frame->GuessLanguage();
1202 return eLanguageTypeUnknown;
1205 const char *SBFrame::GetFunctionName() const {
1206 LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBFrame, GetFunctionName);
1208 const char *name = nullptr;
1209 std::unique_lock<std::recursive_mutex> lock;
1210 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1212 StackFrame *frame = nullptr;
1213 Target *target = exe_ctx.GetTargetPtr();
1214 Process *process = exe_ctx.GetProcessPtr();
1215 if (target && process) {
1216 Process::StopLocker stop_locker;
1217 if (stop_locker.TryLock(&process->GetRunLock())) {
1218 frame = exe_ctx.GetFramePtr();
1219 if (frame) {
1220 SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
1221 eSymbolContextBlock |
1222 eSymbolContextSymbol));
1223 if (sc.block) {
1224 Block *inlined_block = sc.block->GetContainingInlinedBlock();
1225 if (inlined_block) {
1226 const InlineFunctionInfo *inlined_info =
1227 inlined_block->GetInlinedFunctionInfo();
1228 name =
1229 inlined_info->GetName(sc.function->GetLanguage()).AsCString();
1233 if (name == nullptr) {
1234 if (sc.function)
1235 name = sc.function->GetName().GetCString();
1238 if (name == nullptr) {
1239 if (sc.symbol)
1240 name = sc.symbol->GetName().GetCString();
1245 return name;
1248 const char *SBFrame::GetDisplayFunctionName() {
1249 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBFrame, GetDisplayFunctionName);
1251 const char *name = nullptr;
1253 std::unique_lock<std::recursive_mutex> lock;
1254 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1256 StackFrame *frame = nullptr;
1257 Target *target = exe_ctx.GetTargetPtr();
1258 Process *process = exe_ctx.GetProcessPtr();
1259 if (target && process) {
1260 Process::StopLocker stop_locker;
1261 if (stop_locker.TryLock(&process->GetRunLock())) {
1262 frame = exe_ctx.GetFramePtr();
1263 if (frame) {
1264 SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
1265 eSymbolContextBlock |
1266 eSymbolContextSymbol));
1267 if (sc.block) {
1268 Block *inlined_block = sc.block->GetContainingInlinedBlock();
1269 if (inlined_block) {
1270 const InlineFunctionInfo *inlined_info =
1271 inlined_block->GetInlinedFunctionInfo();
1272 name = inlined_info->GetDisplayName(sc.function->GetLanguage())
1273 .AsCString();
1277 if (name == nullptr) {
1278 if (sc.function)
1279 name = sc.function->GetDisplayName().GetCString();
1282 if (name == nullptr) {
1283 if (sc.symbol)
1284 name = sc.symbol->GetDisplayName().GetCString();
1289 return name;
1292 namespace lldb_private {
1293 namespace repro {
1295 template <>
1296 void RegisterMethods<SBFrame>(Registry &R) {
1297 LLDB_REGISTER_CONSTRUCTOR(SBFrame, ());
1298 LLDB_REGISTER_CONSTRUCTOR(SBFrame, (const lldb::StackFrameSP &));
1299 LLDB_REGISTER_CONSTRUCTOR(SBFrame, (const lldb::SBFrame &));
1300 LLDB_REGISTER_METHOD(const lldb::SBFrame &,
1301 SBFrame, operator=,(const lldb::SBFrame &));
1302 LLDB_REGISTER_METHOD_CONST(bool, SBFrame, IsValid, ());
1303 LLDB_REGISTER_METHOD_CONST(bool, SBFrame, operator bool, ());
1304 LLDB_REGISTER_METHOD_CONST(lldb::SBSymbolContext, SBFrame, GetSymbolContext,
1305 (uint32_t));
1306 LLDB_REGISTER_METHOD_CONST(lldb::SBModule, SBFrame, GetModule, ());
1307 LLDB_REGISTER_METHOD_CONST(lldb::SBCompileUnit, SBFrame, GetCompileUnit,
1308 ());
1309 LLDB_REGISTER_METHOD_CONST(lldb::SBFunction, SBFrame, GetFunction, ());
1310 LLDB_REGISTER_METHOD_CONST(lldb::SBSymbol, SBFrame, GetSymbol, ());
1311 LLDB_REGISTER_METHOD_CONST(lldb::SBBlock, SBFrame, GetBlock, ());
1312 LLDB_REGISTER_METHOD_CONST(lldb::SBBlock, SBFrame, GetFrameBlock, ());
1313 LLDB_REGISTER_METHOD_CONST(lldb::SBLineEntry, SBFrame, GetLineEntry, ());
1314 LLDB_REGISTER_METHOD_CONST(uint32_t, SBFrame, GetFrameID, ());
1315 LLDB_REGISTER_METHOD_CONST(lldb::addr_t, SBFrame, GetCFA, ());
1316 LLDB_REGISTER_METHOD_CONST(lldb::addr_t, SBFrame, GetPC, ());
1317 LLDB_REGISTER_METHOD(bool, SBFrame, SetPC, (lldb::addr_t));
1318 LLDB_REGISTER_METHOD_CONST(lldb::addr_t, SBFrame, GetSP, ());
1319 LLDB_REGISTER_METHOD_CONST(lldb::addr_t, SBFrame, GetFP, ());
1320 LLDB_REGISTER_METHOD_CONST(lldb::SBAddress, SBFrame, GetPCAddress, ());
1321 LLDB_REGISTER_METHOD(void, SBFrame, Clear, ());
1322 LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, GetValueForVariablePath,
1323 (const char *));
1324 LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, GetValueForVariablePath,
1325 (const char *, lldb::DynamicValueType));
1326 LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, FindVariable, (const char *));
1327 LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, FindVariable,
1328 (const char *, lldb::DynamicValueType));
1329 LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, FindValue,
1330 (const char *, lldb::ValueType));
1331 LLDB_REGISTER_METHOD(
1332 lldb::SBValue, SBFrame, FindValue,
1333 (const char *, lldb::ValueType, lldb::DynamicValueType));
1334 LLDB_REGISTER_METHOD_CONST(bool, SBFrame, IsEqual, (const lldb::SBFrame &));
1335 LLDB_REGISTER_METHOD_CONST(bool,
1336 SBFrame, operator==,(const lldb::SBFrame &));
1337 LLDB_REGISTER_METHOD_CONST(bool,
1338 SBFrame, operator!=,(const lldb::SBFrame &));
1339 LLDB_REGISTER_METHOD_CONST(lldb::SBThread, SBFrame, GetThread, ());
1340 LLDB_REGISTER_METHOD_CONST(const char *, SBFrame, Disassemble, ());
1341 LLDB_REGISTER_METHOD(lldb::SBValueList, SBFrame, GetVariables,
1342 (bool, bool, bool, bool));
1343 LLDB_REGISTER_METHOD(lldb::SBValueList, SBFrame, GetVariables,
1344 (bool, bool, bool, bool, lldb::DynamicValueType));
1345 LLDB_REGISTER_METHOD(lldb::SBValueList, SBFrame, GetVariables,
1346 (const lldb::SBVariablesOptions &));
1347 LLDB_REGISTER_METHOD(lldb::SBValueList, SBFrame, GetRegisters, ());
1348 LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, FindRegister, (const char *));
1349 LLDB_REGISTER_METHOD(bool, SBFrame, GetDescription, (lldb::SBStream &));
1350 LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
1351 (const char *));
1352 LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
1353 (const char *, lldb::DynamicValueType));
1354 LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
1355 (const char *, lldb::DynamicValueType, bool));
1356 LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
1357 (const char *, const lldb::SBExpressionOptions &));
1358 LLDB_REGISTER_METHOD(bool, SBFrame, IsInlined, ());
1359 LLDB_REGISTER_METHOD_CONST(bool, SBFrame, IsInlined, ());
1360 LLDB_REGISTER_METHOD(bool, SBFrame, IsArtificial, ());
1361 LLDB_REGISTER_METHOD_CONST(bool, SBFrame, IsArtificial, ());
1362 LLDB_REGISTER_METHOD(const char *, SBFrame, GetFunctionName, ());
1363 LLDB_REGISTER_METHOD_CONST(lldb::LanguageType, SBFrame, GuessLanguage, ());
1364 LLDB_REGISTER_METHOD_CONST(const char *, SBFrame, GetFunctionName, ());
1365 LLDB_REGISTER_METHOD(const char *, SBFrame, GetDisplayFunctionName, ());