LLDB mainline
StackFrame.cpp
Go to the documentation of this file.
1//===-- StackFrame.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
10#include "lldb/Core/Debugger.h"
13#include "lldb/Core/Mangled.h"
14#include "lldb/Core/Module.h"
15#include "lldb/Core/Value.h"
18#include "lldb/Symbol/Symbol.h"
21#include "lldb/Symbol/Type.h"
23#include "lldb/Target/ABI.h"
27#include "lldb/Target/Process.h"
30#include "lldb/Target/Target.h"
31#include "lldb/Target/Thread.h"
33#include "lldb/Utility/Log.h"
41
43
44#include <memory>
45
46using namespace lldb;
47using namespace lldb_private;
48
49// LLVM RTTI support.
51
52// The first bits in the flags are reserved for the SymbolContext::Scope bits
53// so we know if we have tried to look up information in our internal symbol
54// context (m_sc) already.
55#define RESOLVED_FRAME_CODE_ADDR (uint32_t(eSymbolContextLastItem) << 1)
56#define RESOLVED_FRAME_ID_SYMBOL_SCOPE (RESOLVED_FRAME_CODE_ADDR << 1)
57#define GOT_FRAME_BASE (RESOLVED_FRAME_ID_SYMBOL_SCOPE << 1)
58#define RESOLVED_VARIABLES (GOT_FRAME_BASE << 1)
59#define RESOLVED_GLOBAL_VARIABLES (RESOLVED_VARIABLES << 1)
60
61StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx,
62 user_id_t unwind_frame_index, addr_t cfa,
63 bool cfa_is_valid, addr_t pc, StackFrame::Kind kind,
64 bool artificial, bool behaves_like_zeroth_frame,
65 const SymbolContext *sc_ptr)
66 : m_thread_wp(thread_sp), m_frame_index(frame_idx),
67 m_concrete_frame_index(unwind_frame_index), m_reg_context_sp(),
68 m_id(pc, cfa, nullptr, thread_sp->GetProcess().get()),
70 m_frame_base_error(), m_cfa_is_valid(cfa_is_valid),
71 m_stack_frame_kind(kind), m_artificial(artificial),
72 m_behaves_like_zeroth_frame(behaves_like_zeroth_frame),
75 // If we don't have a CFA value, use the frame index for our StackID so that
76 // recursive functions properly aren't confused with one another on a history
77 // stack.
78 if (IsHistorical() && !m_cfa_is_valid) {
79 m_id.SetCFA(m_frame_index, thread_sp->GetProcess().get());
80 }
81
82 if (sc_ptr != nullptr) {
83 m_sc = *sc_ptr;
84 m_flags.Set(m_sc.GetResolvedMask());
85 }
86}
87
88StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx,
89 user_id_t unwind_frame_index,
90 const RegisterContextSP &reg_context_sp, addr_t cfa,
91 addr_t pc, bool behaves_like_zeroth_frame,
92 const SymbolContext *sc_ptr)
93 : m_thread_wp(thread_sp), m_frame_index(frame_idx),
94 m_concrete_frame_index(unwind_frame_index),
95 m_reg_context_sp(reg_context_sp),
96 m_id(pc, cfa, nullptr, thread_sp->GetProcess().get()),
100 m_behaves_like_zeroth_frame(behaves_like_zeroth_frame),
103 if (sc_ptr != nullptr) {
104 m_sc = *sc_ptr;
105 m_flags.Set(m_sc.GetResolvedMask());
106 }
107
108 if (reg_context_sp && !m_sc.target_sp) {
109 m_sc.target_sp = reg_context_sp->CalculateTarget();
110 if (m_sc.target_sp)
111 m_flags.Set(eSymbolContextTarget);
112 }
113}
114
115StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx,
116 user_id_t unwind_frame_index,
117 const RegisterContextSP &reg_context_sp, addr_t cfa,
118 const Address &pc_addr, bool behaves_like_zeroth_frame,
119 const SymbolContext *sc_ptr)
120 : m_thread_wp(thread_sp), m_frame_index(frame_idx),
121 m_concrete_frame_index(unwind_frame_index),
122 m_reg_context_sp(reg_context_sp),
123 m_id(pc_addr.GetLoadAddress(thread_sp->CalculateTarget().get()), cfa,
124 nullptr, thread_sp->GetProcess().get()),
125 m_frame_code_addr(pc_addr), m_sc(), m_flags(), m_frame_base(),
128 m_behaves_like_zeroth_frame(behaves_like_zeroth_frame),
131 if (sc_ptr != nullptr) {
132 m_sc = *sc_ptr;
133 m_flags.Set(m_sc.GetResolvedMask());
134 }
135
136 if (!m_sc.target_sp && reg_context_sp) {
137 m_sc.target_sp = reg_context_sp->CalculateTarget();
138 if (m_sc.target_sp)
139 m_flags.Set(eSymbolContextTarget);
140 }
141
142 ModuleSP pc_module_sp(pc_addr.GetModule());
143 if (!m_sc.module_sp || m_sc.module_sp != pc_module_sp) {
144 if (pc_module_sp) {
145 m_sc.module_sp = pc_module_sp;
146 m_flags.Set(eSymbolContextModule);
147 } else {
148 m_sc.module_sp.reset();
149 }
150 }
151}
152
153StackFrame::~StackFrame() = default;
154
156 std::lock_guard<std::recursive_mutex> guard(m_mutex);
157 // Make sure we have resolved the StackID object's symbol context scope if we
158 // already haven't looked it up.
159
161 if (m_id.GetSymbolContextScope()) {
162 // We already have a symbol context scope, we just don't have our flag
163 // bit set.
165 } else {
166 // Calculate the frame block and use this for the stack ID symbol context
167 // scope if we have one.
169 if (scope == nullptr) {
170 // We don't have a block, so use the symbol
171 if (m_flags.IsClear(eSymbolContextSymbol))
172 GetSymbolContext(eSymbolContextSymbol);
173
174 // It is ok if m_sc.symbol is nullptr here
175 scope = m_sc.symbol;
176 }
177 // Set the symbol context scope (the accessor will set the
178 // RESOLVED_FRAME_ID_SYMBOL_SCOPE bit in m_flags).
180 }
181 }
182 return m_id;
183}
184
186 ThreadSP thread_sp = GetThread();
187 if (thread_sp)
188 return thread_sp->GetStackFrameList()->GetVisibleStackFrameIndex(
190 else
191 return m_frame_index;
192}
193
195 std::lock_guard<std::recursive_mutex> guard(m_mutex);
197 m_id.SetSymbolContextScope(symbol_scope);
198}
199
201 std::lock_guard<std::recursive_mutex> guard(m_mutex);
202 if (m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR) &&
203 !m_frame_code_addr.IsSectionOffset()) {
205
206 // Resolve the PC into a temporary address because if ResolveLoadAddress
207 // fails to resolve the address, it will clear the address object...
208 ThreadSP thread_sp(GetThread());
209 if (thread_sp) {
210 TargetSP target_sp(thread_sp->CalculateTarget());
211 if (target_sp) {
212 const bool allow_section_end = true;
213 if (m_frame_code_addr.SetOpcodeLoadAddress(
214 m_frame_code_addr.GetOffset(), target_sp.get(),
215 AddressClass::eCode, allow_section_end)) {
216 ModuleSP module_sp(m_frame_code_addr.GetModule());
217 if (module_sp) {
218 m_sc.module_sp = module_sp;
219 m_flags.Set(eSymbolContextModule);
220 }
221 }
222 }
223 }
224 }
225 return m_frame_code_addr;
226}
227
228// This can't be rewritten into a call to
229// RegisterContext::GetPCForSymbolication because this
230// StackFrame may have been constructed with a special pc,
231// e.g. tail-call artificial frames.
233 Address lookup_addr(GetFrameCodeAddress());
234 if (!lookup_addr.IsValid())
235 return lookup_addr;
237 return lookup_addr;
238
239 addr_t offset = lookup_addr.GetOffset();
240 if (offset > 0) {
241 lookup_addr.Slide(-1);
242 } else {
243 // lookup_addr is the start of a section. We need do the math on the
244 // actual load address and re-compute the section. We're working with
245 // a 'noreturn' function at the end of a section.
246 TargetSP target_sp = CalculateTarget();
247 if (target_sp) {
248 addr_t addr_minus_one = lookup_addr.GetOpcodeLoadAddress(
249 target_sp.get(), AddressClass::eCode) -
250 1;
251 lookup_addr.SetOpcodeLoadAddress(addr_minus_one, target_sp.get());
252 }
253 }
254 return lookup_addr;
255}
256
258 std::lock_guard<std::recursive_mutex> guard(m_mutex);
259 // We can't change the pc value of a history stack frame - it is immutable.
260 if (IsHistorical())
261 return false;
262 m_frame_code_addr.SetRawAddress(pc);
263 m_sc.Clear(false);
264 m_flags.Reset(0);
265 ThreadSP thread_sp(GetThread());
266 if (thread_sp)
267 thread_sp->ClearStackFrames();
268 return true;
269}
270
272 std::lock_guard<std::recursive_mutex> guard(m_mutex);
273
274 if (!m_disassembly.Empty())
275 return m_disassembly.GetData();
276
277 ExecutionContext exe_ctx(shared_from_this());
278 if (Target *target = exe_ctx.GetTargetPtr()) {
279 Disassembler::Disassemble(target->GetDebugger(), target->GetArchitecture(),
280 *this, m_disassembly);
281 }
282
283 return m_disassembly.Empty() ? nullptr : m_disassembly.GetData();
284}
285
287 if (m_sc.block == nullptr && m_flags.IsClear(eSymbolContextBlock))
288 GetSymbolContext(eSymbolContextBlock);
289
290 if (m_sc.block) {
291 Block *inline_block = m_sc.block->GetContainingInlinedBlock();
292 if (inline_block) {
293 // Use the block with the inlined function info as the frame block we
294 // want this frame to have only the variables for the inlined function
295 // and its non-inlined block child blocks.
296 return inline_block;
297 } else {
298 // This block is not contained within any inlined function blocks with so
299 // we want to use the top most function block.
300 return &m_sc.function->GetBlock(false);
301 }
302 }
303 return nullptr;
304}
305
307 Block *frame_block = GetFrameBlock();
308 Block *addr_block = addr.CalculateSymbolContextBlock();
309 if (!frame_block || !addr_block)
310 return false;
311 // Do they represent the same concrete function?
312 if (addr_block->CalculateSymbolContextFunction() !=
313 frame_block->CalculateSymbolContextFunction())
314 return false;
315
316 // Do they represent the same inlined function?
317 return addr_block->GetContainingInlinedBlock() ==
318 frame_block->GetContainingInlinedBlock();
319}
320
321// Get the symbol context if we already haven't done so by resolving the
322// PC address as much as possible. This way when we pass around a
323// StackFrame object, everyone will have as much information as possible and no
324// one will ever have to look things up manually.
325const SymbolContext &
326StackFrame::GetSymbolContext(SymbolContextItem resolve_scope) {
327 std::lock_guard<std::recursive_mutex> guard(m_mutex);
328 // Copy our internal symbol context into "sc".
329 if ((m_flags.Get() & resolve_scope) != resolve_scope) {
330 uint32_t resolved = 0;
331
332 // If the target was requested add that:
333 if (!m_sc.target_sp) {
334 m_sc.target_sp = CalculateTarget();
335 if (m_sc.target_sp)
336 resolved |= eSymbolContextTarget;
337 }
338
339 // Resolve our PC to section offset if we haven't already done so and if we
340 // don't have a module. The resolved address section will contain the
341 // module to which it belongs
342 if (!m_sc.module_sp && m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR))
344
345 // If this is not frame zero, then we need to subtract 1 from the PC value
346 // when doing address lookups since the PC will be on the instruction
347 // following the function call instruction...
349
350 // For PC-less frames (e.g., scripted frames), skip PC-based symbol
351 // resolution and preserve any already-populated SymbolContext fields.
352 if (!lookup_addr.IsValid()) {
353 m_flags.Set(resolve_scope | resolved);
354 return m_sc;
355 }
356
357 if (m_sc.module_sp) {
358 // We have something in our stack frame symbol context, lets check if we
359 // haven't already tried to lookup one of those things. If we haven't
360 // then we will do the query.
361
362 SymbolContextItem actual_resolve_scope = SymbolContextItem(0);
363
364 if (resolve_scope & eSymbolContextCompUnit) {
365 if (m_flags.IsClear(eSymbolContextCompUnit)) {
366 if (m_sc.comp_unit)
367 resolved |= eSymbolContextCompUnit;
368 else
369 actual_resolve_scope |= eSymbolContextCompUnit;
370 }
371 }
372
373 if (resolve_scope & eSymbolContextFunction) {
374 if (m_flags.IsClear(eSymbolContextFunction)) {
375 if (m_sc.function)
376 resolved |= eSymbolContextFunction;
377 else
378 actual_resolve_scope |= eSymbolContextFunction;
379 }
380 }
381
382 if (resolve_scope & eSymbolContextBlock) {
383 if (m_flags.IsClear(eSymbolContextBlock)) {
384 if (m_sc.block)
385 resolved |= eSymbolContextBlock;
386 else
387 actual_resolve_scope |= eSymbolContextBlock;
388 }
389 }
390
391 if (resolve_scope & eSymbolContextSymbol) {
392 if (m_flags.IsClear(eSymbolContextSymbol)) {
393 if (m_sc.symbol)
394 resolved |= eSymbolContextSymbol;
395 else
396 actual_resolve_scope |= eSymbolContextSymbol;
397 }
398 }
399
400 if (resolve_scope & eSymbolContextLineEntry) {
401 if (m_flags.IsClear(eSymbolContextLineEntry)) {
402 if (m_sc.line_entry.IsValid())
403 resolved |= eSymbolContextLineEntry;
404 else
405 actual_resolve_scope |= eSymbolContextLineEntry;
406 }
407 }
408
409 if (actual_resolve_scope) {
410 // We might be resolving less information than what is already in our
411 // current symbol context so resolve into a temporary symbol context
412 // "sc" so we don't clear out data we have already found in "m_sc"
413 SymbolContext sc;
414 // Set flags that indicate what we have tried to resolve
415 resolved |= m_sc.module_sp->ResolveSymbolContextForAddress(
416 lookup_addr, actual_resolve_scope, sc);
417 // Only replace what we didn't already have as we may have information
418 // for an inlined function scope that won't match what a standard
419 // lookup by address would match
420 if ((resolved & eSymbolContextCompUnit) && m_sc.comp_unit == nullptr)
421 m_sc.comp_unit = sc.comp_unit;
422 if ((resolved & eSymbolContextFunction) && m_sc.function == nullptr)
423 m_sc.function = sc.function;
424 if ((resolved & eSymbolContextBlock) && m_sc.block == nullptr)
425 m_sc.block = sc.block;
426 if ((resolved & eSymbolContextSymbol) && m_sc.symbol == nullptr)
427 m_sc.symbol = sc.symbol;
428 if ((resolved & eSymbolContextLineEntry) &&
429 !m_sc.line_entry.IsValid()) {
430 m_sc.line_entry = sc.line_entry;
431 m_sc.line_entry.ApplyFileMappings(m_sc.target_sp);
432 }
433 }
434 } else {
435 // If we don't have a module, then we can't have the compile unit,
436 // function, block, line entry or symbol, so we can safely call
437 // ResolveSymbolContextForAddress with our symbol context member m_sc.
438 if (m_sc.target_sp) {
439 resolved |= m_sc.target_sp->GetImages().ResolveSymbolContextForAddress(
440 lookup_addr, resolve_scope, m_sc);
441 }
442 }
443
444 // Update our internal flags so we remember what we have tried to locate so
445 // we don't have to keep trying when more calls to this function are made.
446 // We might have dug up more information that was requested (for example if
447 // we were asked to only get the block, we will have gotten the compile
448 // unit, and function) so set any additional bits that we resolved
449 m_flags.Set(resolve_scope | resolved);
450 }
451
452 // Return the symbol context with everything that was possible to resolve
453 // resolved.
454 return m_sc;
455}
456
458 bool include_synthetic_vars,
459 Status *error_ptr) {
460 // We don't have 'synthetic variables' in the base stack frame.
461 (void)include_synthetic_vars;
462
463 std::lock_guard<std::recursive_mutex> guard(m_mutex);
464 if (m_flags.IsClear(RESOLVED_VARIABLES)) {
466 m_variable_list_sp = std::make_shared<VariableList>();
467
468 Block *frame_block = GetFrameBlock();
469
470 if (frame_block) {
471 const bool get_child_variables = true;
472 const bool can_create = true;
473 const bool stop_if_child_block_is_inlined_function = true;
474 frame_block->AppendBlockVariables(
475 can_create, get_child_variables,
476 stop_if_child_block_is_inlined_function,
477 [](Variable *v) { return true; }, m_variable_list_sp.get());
478 }
479 }
480
481 if (m_flags.IsClear(RESOLVED_GLOBAL_VARIABLES) && get_file_globals) {
483
484 if (m_flags.IsClear(eSymbolContextCompUnit))
485 GetSymbolContext(eSymbolContextCompUnit);
486
487 if (m_sc.comp_unit) {
488 VariableListSP global_variable_list_sp(
489 m_sc.comp_unit->GetVariableList(true));
491 m_variable_list_sp->AddVariables(global_variable_list_sp.get());
492 else
493 m_variable_list_sp = global_variable_list_sp;
494 }
495 }
496
497 if (error_ptr && m_variable_list_sp->GetSize() == 0) {
498 // Check with the symbol file to check if there is an error for why we
499 // don't have variables that the user might need to know about.
500 GetSymbolContext(eSymbolContextEverything);
501 if (m_sc.module_sp) {
502 SymbolFile *sym_file = m_sc.module_sp->GetSymbolFile();
503 if (sym_file)
504 *error_ptr = sym_file->GetFrameVariableError(*this);
505 }
506 }
507
508 return m_variable_list_sp.get();
509}
510
513 bool include_synthetic_vars,
514 bool must_have_valid_location) {
515 // We don't have synthetic variables in the base stack frame.
516 (void)include_synthetic_vars;
517
518 std::lock_guard<std::recursive_mutex> guard(m_mutex);
519 // We can't fetch variable information for a history stack frame.
520 if (IsHistorical())
521 return VariableListSP();
522
523 VariableListSP var_list_sp(new VariableList);
524 GetSymbolContext(eSymbolContextCompUnit | eSymbolContextBlock);
525
526 if (m_sc.block) {
527 const bool can_create = true;
528 const bool get_parent_variables = true;
529 const bool stop_if_block_is_inlined_function = true;
530 m_sc.block->AppendVariables(
531 can_create, get_parent_variables, stop_if_block_is_inlined_function,
532 [this, must_have_valid_location](Variable *v) {
533 return v->IsInScope(this) && (!must_have_valid_location ||
534 v->LocationIsValidForFrame(this));
535 },
536 var_list_sp.get());
537 }
538
539 if (m_sc.comp_unit && get_file_globals) {
540 VariableListSP global_variable_list_sp(
541 m_sc.comp_unit->GetVariableList(true));
542 if (global_variable_list_sp)
543 var_list_sp->AddVariables(global_variable_list_sp.get());
544 }
545
546 return var_list_sp;
547}
548
550 llvm::StringRef var_expr, DynamicValueType use_dynamic, uint32_t options,
551 VariableSP &var_sp, Status &error, lldb::DILMode mode) {
552 error.Clear();
553
554 // Lex the expression.
555 auto lex_or_err = dil::DILLexer::Create(var_expr, mode);
556 if (!lex_or_err) {
557 error = Status::FromError(lex_or_err.takeError());
558 return ValueObjectConstResult::Create(nullptr, error.Clone());
559 }
560
561 // Parse the expression.
562 ExecutionContext exe_ctx;
564 auto tree_or_error = dil::DILParser::Parse(
565 exe_ctx, var_expr, std::move(*lex_or_err), use_dynamic, mode);
566 if (!tree_or_error) {
567 error = Status::FromError(tree_or_error.takeError());
568 return ValueObjectConstResult::Create(nullptr, error.Clone());
569 }
570
571 // Evaluate the parsed expression.
572 dil::Interpreter interpreter(exe_ctx, var_expr, use_dynamic, options);
573
574 auto valobj_or_error = interpreter.EvaluateTree(*tree_or_error);
575 if (!valobj_or_error) {
576 error = Status::FromError(valobj_or_error.takeError());
577 return ValueObjectConstResult::Create(nullptr, error.Clone());
578 }
579
580 var_sp = (*valobj_or_error)->GetVariable();
581 return *valobj_or_error;
582}
583
584llvm::Error StackFrame::GetFrameBaseValue(Scalar &frame_base) {
585 std::lock_guard<std::recursive_mutex> guard(m_mutex);
586 if (!m_cfa_is_valid) {
588 "No frame base available for this historical stack frame.");
589 return m_frame_base_error.ToError();
590 }
591
592 if (m_flags.IsClear(GOT_FRAME_BASE)) {
593 if (m_sc.function) {
594 m_frame_base.Clear();
595 m_frame_base_error.Clear();
596
598 ExecutionContext exe_ctx(shared_from_this());
599 addr_t loclist_base_addr = LLDB_INVALID_ADDRESS;
600 if (!m_sc.function->GetFrameBaseExpression().IsAlwaysValidSingleExpr())
601 loclist_base_addr =
602 m_sc.function->GetAddress().GetLoadAddress(exe_ctx.GetTargetPtr());
603
604 llvm::Expected<Value> expr_value =
605 m_sc.function->GetFrameBaseExpression().Evaluate(
606 &exe_ctx, nullptr, loclist_base_addr, nullptr, nullptr);
607 if (!expr_value)
608 m_frame_base_error = Status::FromError(expr_value.takeError());
609 else
610 m_frame_base = expr_value->GetScalar();
611 } else {
613 Status::FromErrorString("No function in symbol context.");
614 }
615 }
616
617 if (m_frame_base_error.Fail())
618 return m_frame_base_error.ToError();
619
620 frame_base = m_frame_base;
621 return llvm::Error::success();
622}
623
625 if (!m_sc.function) {
626 if (error_ptr) {
627 *error_ptr = Status::FromErrorString("No function in symbol context.");
628 }
629 return nullptr;
630 }
631
632 return &m_sc.function->GetFrameBaseExpression();
633}
634
636 std::lock_guard<std::recursive_mutex> guard(m_mutex);
637 if (!m_reg_context_sp) {
638 ThreadSP thread_sp(GetThread());
639 if (thread_sp)
640 m_reg_context_sp = thread_sp->CreateRegisterContextForFrame(this);
641 }
642 return m_reg_context_sp;
643}
644
646 GetSymbolContext(eSymbolContextLineEntry);
647 return m_sc.line_entry.IsValid();
648}
649
652 DynamicValueType use_dynamic) {
653 ValueObjectSP valobj_sp;
654 { // Scope for stack frame mutex. We need to drop this mutex before we figure
655 // out the dynamic value. That will require converting the StackID in the
656 // VO back to a StackFrame, which will in turn require locking the
657 // StackFrameList. If we still hold the StackFrame mutex, we could suffer
658 // lock inversion against the pattern of getting the StackFrameList and
659 // then the stack frame, which is fairly common.
660 std::lock_guard<std::recursive_mutex> guard(m_mutex);
661 if (IsHistorical()) {
662 return valobj_sp;
663 }
664 VariableList *var_list = GetVariableList(
665 /*get_file_globals=*/true, /*include_synthetic_vars=*/true, nullptr);
666 if (var_list) {
667 // Make sure the variable is a frame variable
668 const uint32_t var_idx =
669 var_list->FindIndexForVariable(variable_sp.get());
670 const uint32_t num_variables = var_list->GetSize();
671 if (var_idx < num_variables) {
672 valobj_sp =
673 m_variable_list_value_objects.GetValueObjectAtIndex(var_idx);
674 if (!valobj_sp) {
675 if (m_variable_list_value_objects.GetSize() < num_variables)
676 m_variable_list_value_objects.Resize(num_variables);
677 valobj_sp = ValueObjectVariable::Create(this, variable_sp);
678 m_variable_list_value_objects.SetValueObjectAtIndex(var_idx,
679 valobj_sp);
680 }
681 }
682 }
683 } // End of StackFrame mutex scope.
684 if (use_dynamic != eNoDynamicValues && valobj_sp) {
685 ValueObjectSP dynamic_sp = valobj_sp->GetDynamicValue(use_dynamic);
686 if (dynamic_sp)
687 return dynamic_sp;
688 }
689 return valobj_sp;
690}
691
693 if (m_sc.block == nullptr)
694 GetSymbolContext(eSymbolContextBlock);
695 if (m_sc.block)
696 return m_sc.block->GetContainingInlinedBlock() != nullptr;
697 return false;
698}
699
703
707
709
711 if (auto recognized_frame_sp = GetRecognizedFrame())
712 return recognized_frame_sp->ShouldHide();
713 return false;
714}
715
717 auto process_sp = CalculateProcess();
718 SourceLanguage language = GetLanguage();
719 if (!language)
720 return {};
721 if (auto runtime_sp =
722 process_sp->GetLanguageRuntime(language.AsLanguageType()))
723 return runtime_sp->GetLanguageSpecificData(
724 GetSymbolContext(eSymbolContextFunction));
725 return {};
726}
727
729 const char *name = nullptr;
731 eSymbolContextFunction | eSymbolContextBlock | eSymbolContextSymbol);
732 if (sc.block) {
733 Block *inlined_block = sc.block->GetContainingInlinedBlock();
734 if (inlined_block) {
735 const InlineFunctionInfo *inlined_info =
736 inlined_block->GetInlinedFunctionInfo();
737 if (inlined_info)
738 name = inlined_info->GetName().AsCString(nullptr);
739 }
740 }
741
742 if (name == nullptr) {
743 if (sc.function)
744 name = sc.function->GetName().GetCString();
745 }
746
747 if (name == nullptr) {
748 if (sc.symbol)
749 name = sc.symbol->GetName().GetCString();
750 }
751
752 return name;
753}
754
756 const char *name = nullptr;
758 eSymbolContextFunction | eSymbolContextBlock | eSymbolContextSymbol);
759 if (sc.block) {
760 Block *inlined_block = sc.block->GetContainingInlinedBlock();
761 if (inlined_block) {
762 const InlineFunctionInfo *inlined_info =
763 inlined_block->GetInlinedFunctionInfo();
764 if (inlined_info)
765 name = inlined_info->GetDisplayName().AsCString(nullptr);
766 }
767 }
768
769 if (name == nullptr) {
770 if (sc.function)
771 name = sc.function->GetDisplayName().GetCString();
772 }
773
774 if (name == nullptr) {
775 if (sc.symbol)
776 name = sc.symbol->GetDisplayName().GetCString();
777 }
778 return name;
779}
780
782 CompileUnit *cu = GetSymbolContext(eSymbolContextCompUnit).comp_unit;
783 if (cu)
784 return SourceLanguage{cu->GetLanguage()};
785 return {};
786}
787
788std::string StackFrame::GetMissingVariableDiagnostic(llvm::StringRef name) {
789 Language *language = Language::FindPlugin(GetLanguage().AsLanguageType());
790 if (!language)
791 return {};
792 return language->GetMissingVariableDiagnostic(
793 name, GetSymbolContext(eSymbolContextModule | eSymbolContextFunction));
794}
795
797 SourceLanguage lang_type = GetLanguage();
798
799 if (!lang_type) {
800 SymbolContext sc =
801 GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol);
802 if (sc.function)
803 lang_type = SourceLanguage(sc.function->GetMangled().GuessLanguage());
804 else if (sc.symbol)
805 lang_type = SourceLanguage(sc.symbol->GetMangled().GuessLanguage());
806 }
807
808 return lang_type;
809}
810
811namespace {
812std::pair<const Instruction::Operand *, int64_t>
813GetBaseExplainingValue(const Instruction::Operand &operand,
814 RegisterContext &register_context, lldb::addr_t value) {
815 switch (operand.m_type) {
820 // These are not currently interesting
821 return std::make_pair(nullptr, 0);
823 const Instruction::Operand *immediate_child = nullptr;
824 const Instruction::Operand *variable_child = nullptr;
825 if (operand.m_children[0].m_type == Instruction::Operand::Type::Immediate) {
826 immediate_child = &operand.m_children[0];
827 variable_child = &operand.m_children[1];
828 } else if (operand.m_children[1].m_type ==
830 immediate_child = &operand.m_children[1];
831 variable_child = &operand.m_children[0];
832 }
833 if (!immediate_child) {
834 return std::make_pair(nullptr, 0);
835 }
836 lldb::addr_t adjusted_value = value;
837 if (immediate_child->m_negative) {
838 adjusted_value += immediate_child->m_immediate;
839 } else {
840 adjusted_value -= immediate_child->m_immediate;
841 }
842 std::pair<const Instruction::Operand *, int64_t> base_and_offset =
843 GetBaseExplainingValue(*variable_child, register_context,
844 adjusted_value);
845 if (!base_and_offset.first) {
846 return std::make_pair(nullptr, 0);
847 }
848 if (immediate_child->m_negative) {
849 base_and_offset.second -= immediate_child->m_immediate;
850 } else {
851 base_and_offset.second += immediate_child->m_immediate;
852 }
853 return base_and_offset;
854 }
856 const RegisterInfo *info =
857 register_context.GetRegisterInfoByName(operand.m_register);
858 if (!info) {
859 return std::make_pair(nullptr, 0);
860 }
861 RegisterValue reg_value;
862 if (!register_context.ReadRegister(info, reg_value)) {
863 return std::make_pair(nullptr, 0);
864 }
865 if (reg_value.GetAsUInt64() == value) {
866 return std::make_pair(&operand, 0);
867 } else {
868 return std::make_pair(nullptr, 0);
869 }
870 }
871 }
872 return std::make_pair(nullptr, 0);
873}
874
875std::pair<const Instruction::Operand *, int64_t>
876GetBaseExplainingDereference(const Instruction::Operand &operand,
877 RegisterContext &register_context,
878 lldb::addr_t addr) {
880 return GetBaseExplainingValue(operand.m_children[0], register_context,
881 addr);
882 }
883 return std::make_pair(nullptr, 0);
884}
885} // namespace
886
888 TargetSP target_sp = CalculateTarget();
889
890 const ArchSpec &target_arch = target_sp->GetArchitecture();
891
892 AddressRange pc_range;
893 pc_range.GetBaseAddress() = GetFrameCodeAddress();
894 pc_range.SetByteSize(target_arch.GetMaximumOpcodeByteSize());
895
896 const char *plugin_name = nullptr;
897 const char *flavor = nullptr;
898 const char *cpu = nullptr;
899 const char *features = nullptr;
900 const bool force_live_memory = true;
901
903 target_arch, plugin_name, flavor, cpu, features, *target_sp, pc_range,
904 force_live_memory);
905
906 if (!disassembler_sp || !disassembler_sp->GetInstructionList().GetSize()) {
907 return ValueObjectSP();
908 }
909
910 InstructionSP instruction_sp =
911 disassembler_sp->GetInstructionList().GetInstructionAtIndex(0);
912
913 llvm::SmallVector<Instruction::Operand, 3> operands;
914
915 if (!instruction_sp->ParseOperands(operands)) {
916 return ValueObjectSP();
917 }
918
919 RegisterContextSP register_context_sp = GetRegisterContext();
920
921 if (!register_context_sp) {
922 return ValueObjectSP();
923 }
924
925 for (const Instruction::Operand &operand : operands) {
926 std::pair<const Instruction::Operand *, int64_t> base_and_offset =
927 GetBaseExplainingDereference(operand, *register_context_sp, addr);
928
929 if (!base_and_offset.first) {
930 continue;
931 }
932
933 switch (base_and_offset.first->m_type) {
936 if (target_sp->ResolveLoadAddress(base_and_offset.first->m_immediate +
937 base_and_offset.second,
938 addr)) {
939 auto c_type_system_or_err =
940 target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC);
941 if (auto err = c_type_system_or_err.takeError()) {
942 LLDB_LOG_ERROR(GetLog(LLDBLog::Thread), std::move(err),
943 "Unable to guess value for given address: {0}");
944 return ValueObjectSP();
945 } else {
946 auto ts = *c_type_system_or_err;
947 if (!ts)
948 return {};
949 CompilerType void_ptr_type =
952 return ValueObjectMemory::Create(this, "", addr, void_ptr_type);
953 }
954 } else {
955 return ValueObjectSP();
956 }
957 break;
958 }
960 return GuessValueForRegisterAndOffset(base_and_offset.first->m_register,
961 base_and_offset.second);
962 }
963 default:
964 return ValueObjectSP();
965 }
966 }
967
968 return ValueObjectSP();
969}
970
971namespace {
972ValueObjectSP GetValueForOffset(StackFrame &frame, ValueObjectSP &parent,
973 int64_t offset) {
974 if (offset < 0 ||
975 uint64_t(offset) >=
976 llvm::expectedToOptional(parent->GetByteSize()).value_or(0)) {
977 return ValueObjectSP();
978 }
979
980 if (parent->IsPointerOrReferenceType()) {
981 return parent;
982 }
983
984 for (int ci = 0, ce = parent->GetNumChildrenIgnoringErrors(); ci != ce;
985 ++ci) {
986 ValueObjectSP child_sp = parent->GetChildAtIndex(ci);
987
988 if (!child_sp) {
989 return ValueObjectSP();
990 }
991
992 int64_t child_offset = child_sp->GetByteOffset();
993 int64_t child_size =
994 llvm::expectedToOptional(child_sp->GetByteSize()).value_or(0);
995
996 if (offset >= child_offset && offset < (child_offset + child_size)) {
997 return GetValueForOffset(frame, child_sp, offset - child_offset);
998 }
999 }
1000
1001 if (offset == 0) {
1002 return parent;
1003 } else {
1004 return ValueObjectSP();
1005 }
1006}
1007
1008ValueObjectSP GetValueForDereferincingOffset(StackFrame &frame,
1009 ValueObjectSP &base,
1010 int64_t offset) {
1011 // base is a pointer to something
1012 // offset is the thing to add to the pointer We return the most sensible
1013 // ValueObject for the result of *(base+offset)
1014
1015 if (!base->IsPointerOrReferenceType()) {
1016 return ValueObjectSP();
1017 }
1018
1019 Status error;
1020 ValueObjectSP pointee = base->Dereference(error);
1021
1022 if (!pointee) {
1023 return ValueObjectSP();
1024 }
1025
1026 if (offset >= 0 &&
1027 uint64_t(offset) >=
1028 llvm::expectedToOptional(pointee->GetByteSize()).value_or(0)) {
1029 uint64_t size =
1030 llvm::expectedToOptional(pointee->GetByteSize()).value_or(1);
1031 int64_t index = offset / size;
1032 offset = offset % size;
1033 const bool can_create = true;
1034 pointee = base->GetSyntheticArrayMember(index, can_create);
1035 }
1036
1037 if (!pointee || error.Fail()) {
1038 return ValueObjectSP();
1039 }
1040
1041 return GetValueForOffset(frame, pointee, offset);
1042}
1043
1044/// Attempt to reconstruct the ValueObject for the address contained in a
1045/// given register plus an offset.
1046///
1047/// \param [in] frame
1048/// The current stack frame.
1049///
1050/// \param [in] reg
1051/// The register.
1052///
1053/// \param [in] offset
1054/// The offset from the register.
1055///
1056/// \param [in] disassembler
1057/// A disassembler containing instructions valid up to the current PC.
1058///
1059/// \param [in] variables
1060/// The variable list from the current frame,
1061///
1062/// \param [in] pc
1063/// The program counter for the instruction considered the 'user'.
1064///
1065/// \return
1066/// A string describing the base for the ExpressionPath. This could be a
1067/// variable, a register value, an argument, or a function return value.
1068/// The ValueObject if found. If valid, it has a valid ExpressionPath.
1069lldb::ValueObjectSP DoGuessValueAt(StackFrame &frame, llvm::StringRef reg,
1070 int64_t offset, Disassembler &disassembler,
1071 VariableList &variables, const Address &pc) {
1072 // Example of operation for Intel:
1073 //
1074 // +14: movq -0x8(%rbp), %rdi
1075 // +18: movq 0x8(%rdi), %rdi
1076 // +22: addl 0x4(%rdi), %eax
1077 //
1078 // f, a pointer to a struct, is known to be at -0x8(%rbp).
1079 //
1080 // DoGuessValueAt(frame, rdi, 4, dis, vars, 0x22) finds the instruction at
1081 // +18 that assigns to rdi, and calls itself recursively for that dereference
1082 // DoGuessValueAt(frame, rdi, 8, dis, vars, 0x18) finds the instruction at
1083 // +14 that assigns to rdi, and calls itself recursively for that
1084 // dereference
1085 // DoGuessValueAt(frame, rbp, -8, dis, vars, 0x14) finds "f" in the
1086 // variable list.
1087 // Returns a ValueObject for f. (That's what was stored at rbp-8 at +14)
1088 // Returns a ValueObject for *(f+8) or f->b (That's what was stored at rdi+8
1089 // at +18)
1090 // Returns a ValueObject for *(f->b+4) or f->b->a (That's what was stored at
1091 // rdi+4 at +22)
1092
1093 // First, check the variable list to see if anything is at the specified
1094 // location.
1095
1096 using namespace OperandMatchers;
1097
1098 const RegisterInfo *reg_info =
1099 frame.GetRegisterContext()->GetRegisterInfoByName(reg);
1100 if (!reg_info) {
1101 return ValueObjectSP();
1102 }
1103
1109 : Instruction::Operand::BuildDereference(
1110 Instruction::Operand::BuildRegister(reg));
1111
1112 for (VariableSP var_sp : variables) {
1113 if (var_sp->LocationExpressionList().MatchesOperand(frame, op))
1115 }
1116
1117 const uint32_t current_inst =
1118 disassembler.GetInstructionList().GetIndexOfInstructionAtAddress(pc);
1119 if (current_inst == UINT32_MAX) {
1120 return ValueObjectSP();
1121 }
1122
1123 for (uint32_t ii = current_inst - 1; ii != (uint32_t)-1; --ii) {
1124 // This is not an exact algorithm, and it sacrifices accuracy for
1125 // generality. Recognizing "mov" and "ld" instructions –– and which
1126 // are their source and destination operands -- is something the
1127 // disassembler should do for us.
1128 InstructionSP instruction_sp =
1129 disassembler.GetInstructionList().GetInstructionAtIndex(ii);
1130
1131 if (instruction_sp->IsCall()) {
1132 ABISP abi_sp = frame.CalculateProcess()->GetABI();
1133 if (!abi_sp) {
1134 continue;
1135 }
1136
1137 const char *return_register_name;
1138 if (!abi_sp->GetPointerReturnRegister(return_register_name)) {
1139 continue;
1140 }
1141
1142 const RegisterInfo *return_register_info =
1143 frame.GetRegisterContext()->GetRegisterInfoByName(
1144 return_register_name);
1145 if (!return_register_info) {
1146 continue;
1147 }
1148
1149 int64_t offset = 0;
1150
1152 MatchRegOp(*return_register_info))(op) &&
1153 !MatchUnaryOp(
1156 MatchRegOp(*return_register_info),
1157 FetchImmOp(offset)))(op)) {
1158 continue;
1159 }
1160
1161 llvm::SmallVector<Instruction::Operand, 1> operands;
1162 if (!instruction_sp->ParseOperands(operands) || operands.size() != 1) {
1163 continue;
1164 }
1165
1166 switch (operands[0].m_type) {
1167 default:
1168 break;
1170 SymbolContext sc;
1171 if (!pc.GetModule())
1172 break;
1173 Address address(operands[0].m_immediate,
1174 pc.GetModule()->GetSectionList());
1175 if (!address.IsValid())
1176 break;
1177 frame.CalculateTarget()->GetImages().ResolveSymbolContextForAddress(
1178 address, eSymbolContextFunction, sc);
1179 if (!sc.function) {
1180 break;
1181 }
1182 CompilerType function_type = sc.function->GetCompilerType();
1183 if (!function_type.IsFunctionType()) {
1184 break;
1185 }
1186 CompilerType return_type = function_type.GetFunctionReturnType();
1187 RegisterValue return_value;
1188 if (!frame.GetRegisterContext()->ReadRegister(return_register_info,
1189 return_value)) {
1190 break;
1191 }
1192 std::string name_str(
1193 sc.function->GetName().AsCString("<unknown function>"));
1194 name_str.append("()");
1195 Address return_value_address(return_value.GetAsUInt64());
1196 ValueObjectSP return_value_sp = ValueObjectMemory::Create(
1197 &frame, name_str, return_value_address, return_type);
1198 return GetValueForDereferincingOffset(frame, return_value_sp, offset);
1199 }
1200 }
1201
1202 continue;
1203 }
1204
1205 llvm::SmallVector<Instruction::Operand, 2> operands;
1206 if (!instruction_sp->ParseOperands(operands) || operands.size() != 2) {
1207 continue;
1208 }
1209
1210 Instruction::Operand *origin_operand = nullptr;
1211 auto clobbered_reg_matcher = [reg_info](const Instruction::Operand &op) {
1212 return MatchRegOp(*reg_info)(op) && op.m_clobbered;
1213 };
1214
1215 if (clobbered_reg_matcher(operands[0])) {
1216 origin_operand = &operands[1];
1217 } else if (clobbered_reg_matcher(operands[1])) {
1218 origin_operand = &operands[0];
1219 } else {
1220 continue;
1221 }
1222
1223 // We have an origin operand. Can we track its value down?
1224 ValueObjectSP source_path;
1225 std::string origin_register;
1226 int64_t origin_offset = 0;
1227
1228 if (FetchRegOp(origin_register)(*origin_operand)) {
1229 source_path = DoGuessValueAt(frame, origin_register, 0, disassembler,
1230 variables, instruction_sp->GetAddress());
1231 } else if (MatchUnaryOp(
1233 FetchRegOp(origin_register))(*origin_operand) ||
1237 FetchRegOp(origin_register),
1238 FetchImmOp(origin_offset)))(*origin_operand)) {
1239 source_path =
1240 DoGuessValueAt(frame, origin_register, origin_offset, disassembler,
1241 variables, instruction_sp->GetAddress());
1242 if (!source_path) {
1243 continue;
1244 }
1245 source_path = GetValueForDereferincingOffset(frame, source_path, offset);
1246 }
1247
1248 if (source_path) {
1249 return source_path;
1250 }
1251 }
1252
1253 return ValueObjectSP();
1254}
1255} // namespace
1256
1259 int64_t offset) {
1260 TargetSP target_sp = CalculateTarget();
1261
1262 const ArchSpec &target_arch = target_sp->GetArchitecture();
1263
1264 Block *frame_block = GetFrameBlock();
1265
1266 if (!frame_block) {
1267 return ValueObjectSP();
1268 }
1269
1270 Function *function = frame_block->CalculateSymbolContextFunction();
1271 if (!function) {
1272 return ValueObjectSP();
1273 }
1274
1275 AddressRange unused_range;
1276 if (!function->GetRangeContainingLoadAddress(
1277 GetFrameCodeAddress().GetLoadAddress(target_sp.get()), *target_sp,
1278 unused_range))
1279 return ValueObjectSP();
1280
1281 const char *plugin_name = nullptr;
1282 const char *flavor = nullptr;
1283 const char *cpu = nullptr;
1284 const char *features = nullptr;
1285 const bool force_live_memory = true;
1287 target_arch, plugin_name, flavor, cpu, features, *target_sp,
1288 function->GetAddressRanges(), force_live_memory);
1289
1290 if (!disassembler_sp || !disassembler_sp->GetInstructionList().GetSize()) {
1291 return ValueObjectSP();
1292 }
1293
1294 const bool get_file_globals = false;
1295 // Keep this as 'false' here because if we're inspecting a register, it's
1296 // HIGHLY unlikely that we have an synthetic variable. Indeed, since we're not
1297 // in a synthetic frame, it's probably actually impossible here.
1298 const bool include_synthetic_vars = false;
1299 VariableList *variables =
1300 GetVariableList(get_file_globals, include_synthetic_vars, nullptr);
1301
1302 if (!variables) {
1303 return ValueObjectSP();
1304 }
1305
1306 return DoGuessValueAt(*this, reg, offset, *disassembler_sp, *variables,
1308}
1309
1311 ValueObjectSP value_sp;
1312
1313 if (!name)
1314 return value_sp;
1315
1316 TargetSP target_sp = CalculateTarget();
1317 ProcessSP process_sp = CalculateProcess();
1318
1319 if (!target_sp && !process_sp)
1320 return value_sp;
1321
1322 VariableList variable_list;
1323 VariableSP var_sp;
1324 SymbolContext sc(GetSymbolContext(eSymbolContextBlock));
1325
1326 if (sc.block) {
1327 const bool can_create = true;
1328 const bool get_parent_variables = true;
1329 const bool stop_if_block_is_inlined_function = true;
1330
1331 if (sc.block->AppendVariables(
1332 can_create, get_parent_variables, stop_if_block_is_inlined_function,
1333 [this](Variable *v) { return v->IsInScope(this); },
1334 &variable_list)) {
1335 var_sp = variable_list.FindVariable(name);
1336 }
1337
1338 if (var_sp)
1340 }
1341
1342 return value_sp;
1343}
1344
1346 TargetSP target_sp;
1347 ThreadSP thread_sp(GetThread());
1348 if (thread_sp) {
1349 ProcessSP process_sp(thread_sp->CalculateProcess());
1350 if (process_sp)
1351 target_sp = process_sp->CalculateTarget();
1352 }
1353 return target_sp;
1354}
1355
1357 ProcessSP process_sp;
1358 ThreadSP thread_sp(GetThread());
1359 if (thread_sp)
1360 process_sp = thread_sp->CalculateProcess();
1361 return process_sp;
1362}
1363
1365
1366StackFrameSP StackFrame::CalculateStackFrame() { return shared_from_this(); }
1367
1369 exe_ctx.SetContext(shared_from_this());
1370}
1371
1373 const FormatEntity::Entry *format,
1374 llvm::StringRef frame_marker) {
1375 GetSymbolContext(eSymbolContextEverything);
1376 ExecutionContext exe_ctx(shared_from_this());
1377 StreamString s;
1378 s.PutCString(frame_marker);
1379
1380 if (format && FormatEntity::Formatter(&m_sc, &exe_ctx, nullptr, false, false)
1381 .Format(*format, s)) {
1382 strm.PutCString(s.GetString());
1383 return true;
1384 }
1385 return false;
1386}
1387
1388void StackFrame::DumpUsingSettingsFormat(Stream *strm, bool show_unique,
1389 const llvm::StringRef frame_marker) {
1390 if (strm == nullptr)
1391 return;
1392
1393 ExecutionContext exe_ctx(shared_from_this());
1394
1395 const FormatEntity::Entry *frame_format = nullptr;
1396 FormatEntity::Entry format_entry;
1397 Target *target = exe_ctx.GetTargetPtr();
1398 if (target) {
1399 if (show_unique) {
1400 format_entry = target->GetDebugger().GetFrameFormatUnique();
1401 frame_format = &format_entry;
1402 } else {
1403 format_entry = target->GetDebugger().GetFrameFormat();
1404 frame_format = &format_entry;
1405 }
1406 }
1407 if (!DumpUsingFormat(*strm, frame_format, frame_marker)) {
1408 Dump(strm, true, false);
1409 strm->EOL();
1410 }
1411}
1412
1413void StackFrame::Dump(Stream *strm, bool show_frame_index,
1414 bool show_fullpaths) {
1415 if (strm == nullptr)
1416 return;
1417
1418 if (show_frame_index)
1419 strm->Printf("frame #%u: ", m_frame_index);
1420 ExecutionContext exe_ctx(shared_from_this());
1421 Target *target = exe_ctx.GetTargetPtr();
1422 strm->Printf("0x%0*" PRIx64 " ",
1423 target ? (target->GetArchitecture().GetAddressByteSize() * 2)
1424 : 16,
1425 GetFrameCodeAddress().GetLoadAddress(target));
1426 GetSymbolContext(eSymbolContextEverything);
1427 const bool show_module = true;
1428 const bool show_inline = true;
1429 const bool show_function_arguments = true;
1430 const bool show_function_name = true;
1431 m_sc.DumpStopContext(strm, exe_ctx.GetBestExecutionContextScope(),
1432 GetFrameCodeAddress(), show_fullpaths, show_module,
1433 show_inline, show_function_arguments,
1434 show_function_name);
1435}
1436
1438 std::lock_guard<std::recursive_mutex> guard(m_mutex);
1439 assert(GetStackID() ==
1440 prev_frame.GetStackID()); // TODO: remove this after some testing
1443 if (!m_disassembly.GetString().empty()) {
1444 m_disassembly.Clear();
1445 m_disassembly.PutCString(prev_frame.m_disassembly.GetString());
1446 }
1447}
1448
1450 std::lock_guard<std::recursive_mutex> guard(m_mutex);
1451 assert(GetStackID() ==
1452 curr_frame.GetStackID()); // TODO: remove this after some testing
1453 m_id.SetPC(
1454 curr_frame.m_id.GetPC(),
1455 curr_frame.CalculateProcess().get()); // Update the Stack ID PC value
1456 assert(GetThread() == curr_frame.GetThread());
1457 m_frame_index = curr_frame.m_frame_index;
1462 assert(!m_sc.target_sp || !curr_frame.m_sc.target_sp ||
1463 m_sc.target_sp.get() == curr_frame.m_sc.target_sp.get());
1464 assert(!m_sc.module_sp || !curr_frame.m_sc.module_sp ||
1465 m_sc.module_sp.get() == curr_frame.m_sc.module_sp.get());
1466 assert(m_sc.comp_unit == nullptr || curr_frame.m_sc.comp_unit == nullptr ||
1467 m_sc.comp_unit == curr_frame.m_sc.comp_unit);
1468 assert(m_sc.function == nullptr || curr_frame.m_sc.function == nullptr ||
1469 m_sc.function == curr_frame.m_sc.function);
1470 m_sc = curr_frame.m_sc;
1471 m_flags.Clear(GOT_FRAME_BASE | eSymbolContextEverything);
1472 m_flags.Set(m_sc.GetResolvedMask());
1473 m_frame_base.Clear();
1474 m_frame_base_error.Clear();
1475}
1476
1479 return true;
1480 if (m_variable_list_value_objects.GetSize() > 0)
1481 return true;
1482 if (!m_disassembly.GetString().empty())
1483 return true;
1484 return false;
1485}
1486
1487bool StackFrame::GetStatus(Stream &strm, bool show_frame_info, bool show_source,
1488 bool show_unique,
1489 const llvm::StringRef frame_marker) {
1490 if (show_frame_info) {
1491 strm.Indent();
1492 DumpUsingSettingsFormat(&strm, show_unique, frame_marker);
1493 }
1494
1495 if (show_source) {
1496 ExecutionContext exe_ctx(shared_from_this());
1497 bool have_source = false, have_debuginfo = false;
1499 Target *target = exe_ctx.GetTargetPtr();
1500 if (target) {
1501 Debugger &debugger = target->GetDebugger();
1502 const uint32_t source_lines_before =
1503 debugger.GetStopSourceLineCount(true);
1504 const uint32_t source_lines_after =
1505 debugger.GetStopSourceLineCount(false);
1506 disasm_display = debugger.GetStopDisassemblyDisplay();
1507
1508 GetSymbolContext(eSymbolContextCompUnit | eSymbolContextLineEntry);
1509 if (m_sc.comp_unit || m_sc.line_entry.IsValid()) {
1510 have_debuginfo = true;
1511 if (source_lines_before > 0 || source_lines_after > 0) {
1512 SupportFileNSP source_file_sp = m_sc.line_entry.file_sp;
1513 uint32_t start_line = m_sc.line_entry.line;
1514 if (!start_line && m_sc.function) {
1515 m_sc.function->GetStartLineSourceInfo(source_file_sp, start_line);
1516 }
1517
1518 size_t num_lines =
1520 source_file_sp, start_line, m_sc.line_entry.column,
1521 source_lines_before, source_lines_after, "->", &strm,
1522 /*bp_locs=*/nullptr, GetLanguage().AsLanguageType());
1523 if (num_lines != 0)
1524 have_source = true;
1525 // TODO: Give here a one time warning if source file is missing.
1526 if (!m_sc.line_entry.line)
1527 strm << "note: This address is not associated with a specific line "
1528 "of code. This may be due to compiler optimizations.\n";
1529 }
1530 }
1531 switch (disasm_display) {
1533 break;
1534
1536 if (have_debuginfo)
1537 break;
1538 [[fallthrough]];
1539
1541 if (have_source)
1542 break;
1543 [[fallthrough]];
1544
1546 if (target) {
1547 const uint32_t disasm_lines = debugger.GetDisassemblyLineCount();
1548 if (disasm_lines > 0) {
1549 const ArchSpec &target_arch = target->GetArchitecture();
1550 const char *plugin_name = nullptr;
1551 const char *flavor = nullptr;
1552 const bool mixed_source_and_assembly = false;
1554 target->GetDebugger(), target_arch, plugin_name, flavor,
1555 target->GetDisassemblyCPU(), target->GetDisassemblyFeatures(),
1556 exe_ctx, GetFrameCodeAddress(),
1557 {Disassembler::Limit::Instructions, disasm_lines},
1558 mixed_source_and_assembly, 0,
1560 }
1561 }
1562 break;
1563 }
1564 }
1565 }
1566 return true;
1567}
1568
1570 auto process = GetThread()->GetProcess();
1571 if (!process)
1572 return {};
1573 // If recognizer list has been modified, discard cache.
1574 auto &manager = process->GetTarget().GetFrameRecognizerManager();
1575 auto new_generation = manager.GetGeneration();
1576 if (m_frame_recognizer_generation != new_generation)
1577 m_recognized_frame_sp.reset();
1578 m_frame_recognizer_generation = new_generation;
1579 if (!m_recognized_frame_sp.has_value())
1580 m_recognized_frame_sp = manager.RecognizeFrame(CalculateStackFrame());
1581 return m_recognized_frame_sp.value();
1582}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:405
#define GOT_FRAME_BASE
#define RESOLVED_GLOBAL_VARIABLES
#define RESOLVED_FRAME_ID_SYMBOL_SCOPE
#define RESOLVED_FRAME_CODE_ADDR
#define RESOLVED_VARIABLES
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
void SetByteSize(lldb::addr_t byte_size)
Set accessor for the byte size of this range.
A section + offset based address class.
Definition Address.h:62
lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class=AddressClass::eInvalid) const
Get the load address as an opcode load address.
Definition Address.cpp:360
bool SetOpcodeLoadAddress(lldb::addr_t load_addr, Target *target, AddressClass addr_class=AddressClass::eInvalid, bool allow_section_end=false)
Definition Address.cpp:371
bool Slide(int64_t offset)
Definition Address.h:446
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
Definition Address.cpp:275
lldb::addr_t GetOffset() const
Get the section relative offset value.
Definition Address.h:329
bool IsValid() const
Check if the object state is valid.
Definition Address.h:355
Block * CalculateSymbolContextBlock() const
Definition Address.cpp:874
An architecture specification class.
Definition ArchSpec.h:32
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition ArchSpec.cpp:710
uint32_t GetMaximumOpcodeByteSize() const
A class that describes a single lexical block.
Definition Block.h:41
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
Definition Block.cpp:206
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
Definition Block.h:268
Function * CalculateSymbolContextFunction() override
Definition Block.cpp:150
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:426
uint32_t AppendBlockVariables(bool can_create, bool get_child_block_variables, bool stop_if_child_block_is_inlined_function, const std::function< bool(Variable *)> &filter, VariableList *variable_list)
Get the variable list for this block and optionally all child blocks if get_child_variables is true.
Definition Block.cpp:396
A class that describes a compilation unit.
Definition CompileUnit.h:43
lldb::LanguageType GetLanguage()
Generic representation of a type in a programming language.
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const
Create related types using the current type's AST.
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
CompilerType GetFunctionReturnType() const
A uniqued constant string class.
Definition ConstString.h:40
const char * GetCString() const
Get the string value as a C string.
const char * AsCString(const char *value_if_empty) const
Get the string value as a C string.
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
A class to manage flag bits.
Definition Debugger.h:106
uint64_t GetDisassemblyLineCount() const
Definition Debugger.cpp:770
FormatEntity::Entry GetFrameFormatUnique() const
Definition Debugger.cpp:403
uint64_t GetStopSourceLineCount(bool before) const
Definition Debugger.cpp:756
FormatEntity::Entry GetFrameFormat() const
Definition Debugger.cpp:398
lldb::StopDisassemblyType GetStopDisassemblyDisplay() const
Definition Debugger.cpp:763
static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch, const char *plugin_name, const char *flavor, const char *cpu, const char *features, Target &target, llvm::ArrayRef< AddressRange > disasm_ranges, bool force_live_memory=false)
static bool Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name, const char *flavor, const char *cpu, const char *features, const ExecutionContext &exe_ctx, const Address &start, Limit limit, bool mixed_source_and_assembly, uint32_t num_mixed_context_lines, uint32_t options, Stream &strm)
InstructionList & GetInstructionList()
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
ExecutionContextScope * GetBestExecutionContextScope() const
void SetContext(const lldb::TargetSP &target_sp, bool get_process)
Target * GetTargetPtr() const
Returns a pointer to the target object.
A class that describes a function.
Definition Function.h:386
CompilerType GetCompilerType()
Definition Function.cpp:584
bool GetRangeContainingLoadAddress(lldb::addr_t load_addr, Target &target, AddressRange &range)
Definition Function.h:441
ConstString GetName() const
Definition Function.cpp:723
const Mangled & GetMangled() const
Definition Function.h:541
AddressRanges GetAddressRanges()
Definition Function.h:434
ConstString GetDisplayName() const
Definition Function.cpp:545
A class that describes information for an inlined function.
Definition Function.h:120
ConstString GetDisplayName() const
Definition Function.cpp:99
ConstString GetName() const
Definition Function.cpp:93
lldb::InstructionSP GetInstructionAtIndex(size_t idx) const
static Language * FindPlugin(lldb::LanguageType language)
Definition Language.cpp:61
virtual std::string GetMissingVariableDiagnostic(llvm::StringRef name, const SymbolContext &sc) const
Returns an explanation of why there is no variable named name in sc, for example because sc is a clos...
Definition Language.h:572
lldb::LanguageType GuessLanguage() const
Try to guess the language from the mangling.
Definition Mangled.cpp:344
const RegisterInfo * GetRegisterInfoByName(llvm::StringRef reg_name, uint32_t start_idx=0)
virtual bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value)=0
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
size_t DisplaySourceLinesWithLineNumbers(SupportFileNSP support_file_nsp, uint32_t line, uint32_t column, uint32_t context_before, uint32_t context_after, const char *current_line_cstr, Stream *s, const SymbolContextList *bp_locs=nullptr, lldb::LanguageType language_type=lldb::eLanguageTypeUnknown)
This base class provides an interface to stack frames.
Definition StackFrame.h:44
virtual lldb::ValueObjectSP GetValueForVariableExpressionPath(llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error, lldb::DILMode mode=lldb::eDILModeFull)
Evaluate the Data Inspection Language (DIL) expression var_expr in this frame.
void SetSymbolContextScope(SymbolContextScope *symbol_scope)
uint16_t m_frame_recognizer_generation
Definition StackFrame.h:626
lldb::VariableListSP m_variable_list_sp
Definition StackFrame.h:641
void UpdatePreviousFrameFromCurrentFrame(StackFrame &curr_frame)
bool m_artificial
Is this an artificial stack frame (e.g.
Definition StackFrame.h:633
lldb::ThreadSP GetThread() const
Definition StackFrame.h:135
Address m_frame_code_addr
The frame code address (might not be the same as the actual PC for inlined frames) as a section/offse...
Definition StackFrame.h:621
virtual const char * GetFunctionName()
Get the frame's demangled name.
virtual bool IsHidden()
Query whether this frame should be hidden from backtraces.
virtual lldb::ValueObjectSP GuessValueForRegisterAndOffset(llvm::StringRef reg, int64_t offset)
Attempt to reconstruct the ValueObject for the address contained in a given register plus an offset.
virtual bool IsSynthetic() const
Query whether this frame is synthetic.
virtual DWARFExpressionList * GetFrameBaseExpression(Status *error_ptr)
Get the DWARFExpressionList corresponding to the Canonical Frame Address.
void UpdateCurrentFrameFromPreviousFrame(StackFrame &prev_frame)
ValueObjectList m_variable_list_value_objects
Value objects for each variable in m_variable_list_sp.
Definition StackFrame.h:643
bool m_cfa_is_valid
Does this frame have a CFA? Different from CFA == LLDB_INVALID_ADDRESS.
Definition StackFrame.h:628
virtual llvm::Error GetFrameBaseValue(Scalar &value)
Return the Canonical Frame Address (DWARF term) for this frame.
lldb::ThreadWP m_thread_wp
For StackFrame and derived classes only.
Definition StackFrame.h:612
std::optional< lldb::RecognizedStackFrameSP > m_recognized_frame_sp
Definition StackFrame.h:644
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.
bool IsAddressInFrameScope(const Address &addr)
Let F be this frame's function.
lldb::RegisterContextSP m_reg_context_sp
Definition StackFrame.h:615
static char ID
LLVM RTTI support.
Definition StackFrame.h:48
virtual StructuredData::ObjectSP GetLanguageSpecificData()
Language plugins can use this API to report language-specific runtime information about this compile ...
virtual Address GetFrameCodeAddressForSymbolication()
Get the current code Address suitable for symbolication, may not be the same as GetFrameCodeAddress()...
@ History
A historical stack frame – possibly without CFA or registers or local variables.
Definition StackFrame.h:68
@ Regular
A regular stack frame with access to registers and local variables.
Definition StackFrame.h:64
@ Synthetic
An synthetic stack frame (e.g.
Definition StackFrame.h:72
std::string GetMissingVariableDiagnostic(llvm::StringRef name)
Returns an explanation of why this frame has no variable named name, from the plugin of the frame's l...
bool m_behaves_like_zeroth_frame
Whether this frame behaves like the zeroth frame, in the sense that its pc value might not immediatel...
Definition StackFrame.h:639
virtual StackID & GetStackID()
virtual lldb::ValueObjectSP GuessValueForAddress(lldb::addr_t addr)
Attempt to econstruct the ValueObject for a given raw address touched by the current instruction.
virtual bool GetStatus(Stream &strm, bool show_frame_info, bool show_source, bool show_unique=false, const llvm::StringRef frame_marker="")
Print a description of this stack frame and/or the source context/assembly for this stack frame.
virtual bool ChangePC(lldb::addr_t pc)
Change the pc value for a given thread.
lldb::ThreadSP CalculateThread() override
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:
StreamString m_disassembly
Definition StackFrame.h:645
lldb::StackFrameSP CalculateStackFrame() override
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 IsHistorical() const
Query whether this frame is part of a historical backtrace.
virtual const char * Disassemble()
Return the disassembly for the instructions of this StackFrame's function as a single C string.
virtual bool IsArtificial() const
Query whether this frame is artificial (e.g a synthesized result of inferring missing tail call frame...
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
virtual void Dump(Stream *strm, bool show_frame_index, bool show_fullpaths)
Print a description for this frame using a default format.
virtual uint32_t GetFrameIndex() const
Query this frame to find what frame it is in this Thread's StackFrameList.
virtual bool HasDebugInformation()
Determine whether this StackFrame has debug information available or not.
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 lldb::VariableListSP GetInScopeVariableList(bool get_file_globals, bool include_synthetic_vars=true, bool must_have_valid_location=false)
Retrieve the list of variables that are in scope at this StackFrame's pc.
StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, lldb::addr_t cfa, bool cfa_is_valid, lldb::addr_t pc, Kind frame_kind, bool artificial, bool behaves_like_zeroth_frame, const SymbolContext *sc_ptr)
Construct a StackFrame object without supplying a RegisterContextSP.
virtual Block * GetFrameBlock()
Get the current lexical scope block for this StackFrame, if possible.
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.
lldb::ProcessSP CalculateProcess() override
virtual lldb::RecognizedStackFrameSP GetRecognizedFrame()
std::recursive_mutex m_mutex
Definition StackFrame.h:646
virtual lldb::ValueObjectSP FindVariable(ConstString name)
Attempt to reconstruct the ValueObject for a variable with a given name from within the current Stack...
virtual const Address & GetFrameCodeAddress()
Get an Address for the current pc value in this StackFrame.
lldb::TargetSP CalculateTarget() override
lldb::addr_t GetPC() const
Definition StackID.h:30
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
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition Stream.cpp:157
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:63
size_t EOL()
Output and End of Line character to the stream.
Definition Stream.cpp:155
std::shared_ptr< Object > ObjectSP
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
Block * block
The Block for a given query.
lldb::ModuleSP module_sp
The Module for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
Symbol * symbol
The Symbol for a given query.
lldb::TargetSP target_sp
The Target for a given query.
LineEntry line_entry
The LineEntry for a given query.
Provides public interface for all SymbolFiles.
Definition SymbolFile.h:51
Status GetFrameVariableError(StackFrame &frame)
Get an error that describes why variables might be missing for a given symbol context.
Definition SymbolFile.h:287
Mangled & GetMangled()
Definition Symbol.h:162
ConstString GetName() const
Definition Symbol.cpp:615
ConstString GetDisplayName() const
Definition Symbol.cpp:200
const char * GetDisassemblyFeatures() const
Definition Target.cpp:5534
const char * GetDisassemblyCPU() const
Definition Target.cpp:5527
SourceManager & GetSourceManager()
Definition Target.cpp:3225
Debugger & GetDebugger() const
Definition Target.h:1378
const ArchSpec & GetArchitecture() const
Definition Target.h:1337
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, llvm::StringRef name, const Address &address, lldb::TypeSP &type_sp, ValueObject *parent=nullptr)
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp)
uint32_t FindIndexForVariable(Variable *variable)
lldb::VariableSP FindVariable(ConstString name, bool include_static_members=true) const
bool IsInScope(StackFrame *frame)
Definition Variable.cpp:286
bool LocationIsValidForFrame(StackFrame *frame)
Definition Variable.cpp:228
static llvm::Expected< DILLexer > Create(llvm::StringRef expr, lldb::DILMode mode=lldb::eDILModeFull)
Lexes all the tokens in expr and calls the private constructor with the lexed tokens.
Definition DILLexer.cpp:200
static llvm::Expected< ASTNodeUP > Parse(ExecutionContext &exe_ctx, llvm::StringRef dil_input_expr, DILLexer lexer, lldb::DynamicValueType use_dynamic, lldb::DILMode mode)
Parse the lexed tokens.
Definition DILParser.cpp:92
llvm::Expected< lldb::ValueObjectSP > EvaluateTree(const ASTNodeUP &tree)
Evaluate an ASTNode tree.
Definition DILEval.cpp:522
#define LLDB_INVALID_ADDRESS
#define UINT32_MAX
std::function< bool(const Instruction::Operand &)> FetchRegOp(std::string &reg)
std::function< bool(const Instruction::Operand &)> MatchRegOp(const RegisterInfo &info)
std::function< bool(const Instruction::Operand &)> FetchImmOp(int64_t &imm)
std::function< bool(const Instruction::Operand &)> MatchOpType(Instruction::Operand::Type type)
std::function< bool(const Instruction::Operand &)> MatchBinaryOp(std::function< bool(const Instruction::Operand &)> base, std::function< bool(const Instruction::Operand &)> left, std::function< bool(const Instruction::Operand &)> right)
std::function< bool(const Instruction::Operand &)> MatchUnaryOp(std::function< bool(const Instruction::Operand &)> base, std::function< bool(const Instruction::Operand &)> child)
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:338
NonNullSharedPtr< lldb_private::SupportFile > SupportFileNSP
Definition SupportFile.h:80
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::RecognizedStackFrame > RecognizedStackFrameSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Format
Display format definitions.
@ eLanguageTypeC
Non-standardized C, such as K&R.
std::shared_ptr< lldb_private::Instruction > InstructionSP
std::shared_ptr< lldb_private::Process > ProcessSP
StopDisassemblyType
Used to determine when to show disassembly.
@ eStopDisassemblyTypeNever
@ eStopDisassemblyTypeNoSource
@ eStopDisassemblyTypeAlways
@ eStopDisassemblyTypeNoDebugInfo
std::shared_ptr< lldb_private::Disassembler > DisassemblerSP
std::shared_ptr< lldb_private::VariableList > VariableListSP
std::shared_ptr< lldb_private::Variable > VariableSP
uint64_t user_id_t
Definition lldb-types.h:83
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
DILMode
Data Inspection Language (DIL) evaluation modes.
std::shared_ptr< lldb_private::Module > ModuleSP
enum lldb_private::Instruction::Operand::Type m_type
static Operand BuildImmediate(lldb::addr_t imm, bool neg)
static Operand BuildDereference(const Operand &ref)
std::vector< Operand > m_children
static Operand BuildRegister(llvm::StringRef r)
static Operand BuildSum(const Operand &lhs, const Operand &rhs)
Every register is described in detail including its name, alternate name (optional),...
A type-erased pair of llvm::dwarf::SourceLanguageName and version.
lldb::LanguageType AsLanguageType() const
Definition Language.cpp:619