LLDB mainline
StackFrameList.cpp
Go to the documentation of this file.
1//===-- StackFrameList.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
12#include "lldb/Core/Debugger.h"
15#include "lldb/Symbol/Block.h"
17#include "lldb/Symbol/Symbol.h"
19#include "lldb/Target/Process.h"
25#include "lldb/Target/Target.h"
26#include "lldb/Target/Thread.h"
27#include "lldb/Target/Unwind.h"
29#include "lldb/Utility/Log.h"
30#include "lldb/Utility/Policy.h"
31#include "llvm/ADT/ScopeExit.h"
32#include "llvm/ADT/SmallPtrSet.h"
33#include "llvm/Support/ConvertUTF.h"
34
35#include <memory>
36
37//#define DEBUG_STACK_FRAMES 1
38
39using namespace lldb;
40using namespace lldb_private;
41
42// StackFrameList constructor
44 const lldb::StackFrameListSP &prev_frames_sp,
45 bool show_inline_frames,
46 lldb::frame_list_id_t provider_id)
47 : m_thread(thread), m_prev_frames_sp(prev_frames_sp), m_frames(),
51 m_show_inlined_frames(show_inline_frames), m_identifier(provider_id) {
52 if (prev_frames_sp) {
53 m_current_inlined_depth = prev_frames_sp->m_current_inlined_depth;
54 m_current_inlined_pc = prev_frames_sp->m_current_inlined_pc;
55 }
56}
57
59 // Call clear since this takes a lock and clears the stack frame list in case
60 // another thread is currently using this stack frame list
61 Clear();
62}
63
65 Thread &thread, lldb::StackFrameListSP input_frames,
66 const lldb::StackFrameListSP &prev_frames_sp, bool show_inline_frames,
67 lldb::SyntheticFrameProviderSP provider_sp, uint64_t provider_id)
68 : StackFrameList(thread, prev_frames_sp, show_inline_frames, provider_id),
69 m_input_frames(std::move(input_frames)),
70 m_provider(std::move(provider_sp)) {}
71
73 uint32_t end_idx, InterruptionControl allow_interrupt) {
74
75 // Use the provider to generate frames lazily.
76 if (m_provider) {
77 // Count how many synthetic frames already exist so we assign unique CFAs
78 // to new ones. This must not be a local initialized to zero — when
79 // FetchFramesUpTo is called incrementally (first for a small range, then
80 // for the full stack), a zero-initialized counter would hand out duplicate
81 // CFA values, creating StackID collisions for PC-less synthetic frames.
82 size_t num_synthetic_frames = 0;
83 for (const auto &f : m_frames) {
84 if (f && f->IsSynthetic())
85 num_synthetic_frames++;
86 }
87
88 // Keep fetching until we reach end_idx or the provider returns an error.
89 for (uint32_t idx = m_frames.size(); idx <= end_idx; idx++) {
90 if (allow_interrupt &&
91 m_thread.GetProcess()->GetTarget().GetDebugger().InterruptRequested())
92 return true;
93
94 // Ensure the provider sees its parent StackFrameList, not the
95 // synthetic list being constructed. In a chain A->B->C, provider C
96 // must consult B's output - using its own list would be nonsensical.
97 // This also applies when the provider runs commands or expressions:
98 // any path that fetches a StackFrameList should transparently get the
99 // parent list. As a side benefit, this avoids circular re-entrancy and
100 // deadlocks on the private state thread.
101 m_thread.PushProviderFrameList(m_input_frames);
102 auto clear_active_frames =
103 llvm::scope_exit([&]() { m_thread.PopProviderFrameList(); });
104 auto frame_or_err = m_provider->GetFrameAtIndex(idx);
105
106 if (!frame_or_err) {
107 // Provider returned error - we've reached the end.
108 LLDB_LOG_ERROR(GetLog(LLDBLog::Thread), frame_or_err.takeError(),
109 "Frame provider reached end at index {1}: {0}", idx);
111 break;
112 }
113 StackFrameSP frame_sp = *frame_or_err;
114 // Synthetic frames can provide a CFA. If they haven't, set it to the
115 // frame index which will at least order the frames on this stop.
116 if (frame_sp->IsSynthetic() && !frame_sp->GetStackID().IsValid())
117 frame_sp->GetStackID().SetCFA(num_synthetic_frames++,
118 GetThread().GetProcess().get());
119 // Set the frame list weak pointer so ExecutionContextRef can resolve
120 // the frame without calling Thread::GetStackFrameList().
121 frame_sp->m_frame_list_id = GetIdentifier();
122 m_frames.push_back(frame_sp);
123 }
124
125 return false; // Not interrupted.
126 }
127
128 // If no provider, fall back to the base implementation.
129 return StackFrameList::FetchFramesUpTo(end_idx, allow_interrupt);
130}
131
133 uint32_t cur_inlined_depth = GetCurrentInlinedDepth();
134 if (cur_inlined_depth == UINT32_MAX) {
136 }
137}
138
140 std::lock_guard<std::mutex> guard(m_inlined_depth_mutex);
142 lldb::addr_t cur_pc = m_thread.GetRegisterContext()->GetPC();
143 if (cur_pc != m_current_inlined_pc) {
148 "GetCurrentInlinedDepth: invalidating current inlined depth.\n");
149 }
151 } else {
152 return UINT32_MAX;
153 }
154}
155
158 return;
159
160 StopInfoSP stop_info_sp = m_thread.GetStopInfo();
161 if (!stop_info_sp)
162 return;
163
164 bool inlined = true;
165 auto inline_depth = stop_info_sp->GetSuggestedStackFrameIndex(inlined);
166 // We're only adjusting the inlined stack here.
167 Log *log = GetLog(LLDBLog::Step);
168 if (inline_depth) {
169 std::lock_guard<std::mutex> guard(m_inlined_depth_mutex);
170 m_current_inlined_depth = *inline_depth;
171 m_current_inlined_pc = m_thread.GetRegisterContext()->GetPC();
172
174 "ResetCurrentInlinedDepth: setting inlined "
175 "depth: %d 0x%" PRIx64 ".\n",
177 } else {
178 std::lock_guard<std::mutex> guard(m_inlined_depth_mutex);
182 log, "ResetCurrentInlinedDepth: Invalidating current inlined depth.\n");
183 }
184}
185
188 uint32_t current_inlined_depth = GetCurrentInlinedDepth();
189 if (current_inlined_depth != UINT32_MAX) {
190 if (current_inlined_depth > 0) {
191 std::lock_guard<std::mutex> guard(m_inlined_depth_mutex);
193 return true;
194 }
195 }
196 }
197 return false;
198}
199
201 std::lock_guard<std::mutex> guard(m_inlined_depth_mutex);
202 m_current_inlined_depth = new_depth;
203 if (new_depth == UINT32_MAX)
205 else
206 m_current_inlined_pc = m_thread.GetRegisterContext()->GetPC();
207}
208
210 llvm::sys::ScopedReader guard(m_list_mutex);
211 return GetAllFramesFetched();
212}
213
214/// A sequence of calls that comprise some portion of a backtrace. Each frame
215/// is represented as a pair of a callee and an address within the callee.
221using CallSequence = std::vector<CallDescriptor>;
222
223/// Find the unique path through the call graph from \p begin (with return PC
224/// \p return_pc) to \p end. On success this path is stored into \p path, and
225/// on failure \p path is unchanged.
226/// This function doesn't currently access StackFrameLists at all, it only looks
227/// at the frame set in the ExecutionContext it passes around.
228static void FindInterveningFrames(Function &begin, Function &end,
229 ExecutionContext &exe_ctx, Target &target,
230 addr_t return_pc, CallSequence &path,
231 ModuleList &images, Log *log) {
232 LLDB_LOG_VERBOSE(log, "Finding frames between {0} and {1}, retn-pc={2:x}",
233 begin.GetDisplayName(), end.GetDisplayName(), return_pc);
234
235 // Find a non-tail calling edge with the correct return PC.
236 if (log)
237 for (const auto &edge : begin.GetCallEdges())
239 "FindInterveningFrames: found call with retn-PC = {0:x}",
240 edge->GetReturnPCAddress(begin, target));
241 CallEdge *first_edge = begin.GetCallEdgeForReturnAddress(return_pc, target);
242 if (!first_edge) {
244 "No call edge outgoing from {0} with retn-PC == {1:x}",
245 begin.GetDisplayName(), return_pc);
246 return;
247 }
248
249 // The first callee may not be resolved, or there may be nothing to fill in.
250 SymbolContext first_callee = first_edge->GetCallee(images, exe_ctx);
251 if (!first_callee.function) {
252 LLDB_LOG_VERBOSE(log, "Could not resolve callee");
253 return;
254 }
255 if (first_callee.function == &end) {
257 log, "Not searching further, first callee is {0} (retn-PC: {1:x})",
258 end.GetDisplayName(), return_pc);
259 return;
260 }
261
262 // Run DFS on the tail-calling edges out of the first callee to find \p end.
263 // Fully explore the set of functions reachable from the first edge via tail
264 // calls in order to detect ambiguous executions.
265 struct DFS {
266 CallSequence active_path = {};
267 CallSequence solution_path = {};
268 llvm::SmallPtrSet<Function *, 2> visited_nodes = {};
269 bool ambiguous = false;
270 Function *end;
271 ModuleList &images;
272 Target &target;
273 ExecutionContext &context;
274
275 DFS(Function *end, ModuleList &images, Target &target,
276 ExecutionContext &context)
277 : end(end), images(images), target(target), context(context) {}
278
279 void search(CallEdge &first_edge, const SymbolContext &first_callee,
280 CallSequence &path) {
281 dfs(first_edge, first_callee);
282 if (!ambiguous)
283 path = std::move(solution_path);
284 }
285
286 void dfs(CallEdge &current_edge, const SymbolContext &callee) {
287 // Found a path to the target function.
288 if (callee.function == end) {
289 if (solution_path.empty())
290 solution_path = active_path;
291 else
292 ambiguous = true;
293 return;
294 }
295
296 // Terminate the search if tail recursion is found, or more generally if
297 // there's more than one way to reach a target. This errs on the side of
298 // caution: it conservatively stops searching when some solutions are
299 // still possible to save time in the average case.
300 if (!visited_nodes.insert(callee.function).second) {
301 ambiguous = true;
302 return;
303 }
304
305 // Search the calls made from this callee.
306 active_path.push_back(CallDescriptor{callee});
307 for (const auto &edge : callee.function->GetTailCallingEdges()) {
308 SymbolContext next_callee = edge->GetCallee(images, context);
309 if (!next_callee.function)
310 continue;
311
312 std::tie(active_path.back().address_type, active_path.back().address) =
313 edge->GetCallerAddress(*callee.function, target);
314
315 dfs(*edge, next_callee);
316 if (ambiguous)
317 return;
318 }
319 active_path.pop_back();
320 }
321 };
322
323 DFS(&end, images, target, exe_ctx).search(*first_edge, first_callee, path);
324}
325
326/// Given that \p next_frame will be appended to the frame list, synthesize
327/// tail call frames between the current end of the list and \p next_frame.
328/// If any frames are added, adjust the frame index of \p next_frame.
329///
330/// --------------
331/// | ... | <- Completed frames.
332/// --------------
333/// | prev_frame |
334/// --------------
335/// | ... | <- Artificial frames inserted here.
336/// --------------
337/// | next_frame |
338/// --------------
339/// | ... | <- Not-yet-visited frames.
340/// --------------
342 // Cannot synthesize tail call frames when the stack is empty (there is no
343 // "previous" frame).
344 if (m_frames.empty())
345 return;
346
347 TargetSP target_sp = next_frame.CalculateTarget();
348 if (!target_sp)
349 return;
350
351 lldb::RegisterContextSP next_reg_ctx_sp = next_frame.GetRegisterContext();
352 if (!next_reg_ctx_sp)
353 return;
354
355 Log *log = GetLog(LLDBLog::Step);
356
357 StackFrame &prev_frame = *m_frames.back().get();
358
359 // Find the functions prev_frame and next_frame are stopped in. The function
360 // objects are needed to search the lazy call graph for intervening frames.
361 Function *prev_func =
362 prev_frame.GetSymbolContext(eSymbolContextFunction).function;
363 if (!prev_func) {
364 LLDB_LOG(log, "SynthesizeTailCallFrames: can't find previous function");
365 return;
366 }
367 Function *next_func =
368 next_frame.GetSymbolContext(eSymbolContextFunction).function;
369 if (!next_func) {
370 LLDB_LOG(log, "SynthesizeTailCallFrames: can't find next function");
371 return;
372 }
373
374 // Try to find the unique sequence of (tail) calls which led from next_frame
375 // to prev_frame.
376 CallSequence path;
377 addr_t return_pc = next_reg_ctx_sp->GetPC();
378 Target &target = *target_sp.get();
379 ModuleList &images = next_frame.CalculateTarget()->GetImages();
380 ExecutionContext exe_ctx(target_sp, /*get_process=*/true);
381 exe_ctx.SetFramePtr(&next_frame);
382 FindInterveningFrames(*next_func, *prev_func, exe_ctx, target, return_pc,
383 path, images, log);
384
385 // Push synthetic tail call frames.
386 for (const auto &calleeInfo : llvm::reverse(path)) {
387 Function *callee = calleeInfo.callee.function;
388 uint32_t frame_idx = m_frames.size();
389 uint32_t concrete_frame_idx = next_frame.GetConcreteFrameIndex();
391 bool cfa_is_valid = false;
392 addr_t pc = calleeInfo.address;
393 // If the callee address refers to the call instruction, we do not want to
394 // subtract 1 from this value.
395 const bool artificial = true;
396 const bool behaves_like_zeroth_frame =
397 calleeInfo.address_type == CallEdge::AddrType::Call;
398 SymbolContext sc;
399 callee->CalculateSymbolContext(&sc);
400 auto synth_frame = std::make_shared<StackFrame>(
401 m_thread.shared_from_this(), frame_idx, concrete_frame_idx, cfa,
402 cfa_is_valid, pc, StackFrame::Kind::Regular, artificial,
403 behaves_like_zeroth_frame, &sc);
404 synth_frame->m_frame_list_id = GetIdentifier();
405 m_frames.push_back(synth_frame);
406 LLDB_LOG(log, "Pushed frame {0} at {1:x}", callee->GetDisplayName(), pc);
407 }
408
409 // If any frames were created, adjust next_frame's index.
410 if (!path.empty())
411 next_frame.SetFrameIndex(m_frames.size());
412}
413
415 addr_t cfa) {
416 SymbolContext unwind_sc =
417 frame_sp->GetSymbolContext(eSymbolContextBlock | eSymbolContextFunction);
418 if (!unwind_sc.block)
419 return 0;
420
421 TargetSP target_sp = m_thread.CalculateTarget();
422 uint32_t concrete_frame_idx = frame_sp->GetConcreteFrameIndex();
423 Address curr_frame_address(frame_sp->GetFrameCodeAddressForSymbolication());
424
425 SymbolContext next_frame_sc;
426 Address next_frame_address;
427 uint32_t num_inlined_frames = 0;
428
429 const bool behaves_like_zeroth_frame = frame_sp->m_behaves_like_zeroth_frame;
430
431 while (unwind_sc.GetParentOfInlinedScope(curr_frame_address, next_frame_sc,
432 next_frame_address)) {
433 next_frame_sc.line_entry.ApplyFileMappings(target_sp);
434 StackFrameSP inline_frame_sp = std::make_shared<StackFrame>(
435 m_thread.shared_from_this(), m_frames.size(), concrete_frame_idx,
436 frame_sp->GetRegisterContextSP(), cfa, next_frame_address,
437 behaves_like_zeroth_frame, &next_frame_sc);
438
439 inline_frame_sp->m_frame_list_id = GetIdentifier();
440 m_frames.push_back(inline_frame_sp);
441 unwind_sc = next_frame_sc;
442 curr_frame_address = next_frame_address;
443 ++num_inlined_frames;
444 }
445
446 return num_inlined_frames;
447}
448
449bool StackFrameList::GetFramesUpTo(uint32_t end_idx,
450 InterruptionControl allow_interrupt) {
451 // GetFramesUpTo is always called with the intent to add frames, so get the
452 // writer lock:
453 llvm::sys::ScopedWriter guard(m_list_mutex);
454 // Now that we have the lock, check to make sure someone didn't get there
455 // ahead of us:
456 if (m_frames.size() > end_idx || GetAllFramesFetched())
457 return false;
458
459 // Do not fetch frames for an invalid thread.
460 bool was_interrupted = false;
461 if (!m_thread.IsValid())
462 return false;
463
464 // lock the writer side of m_list_mutex as we're going to add frames here:
466 if (end_idx < m_concrete_frames_fetched)
467 return false;
468 // We're adding concrete frames now:
469 // FIXME: This should also be interruptible:
471 return false;
472 }
473
474 // We're adding concrete and inlined frames now:
475 was_interrupted = FetchFramesUpTo(end_idx, allow_interrupt);
476
477#if defined(DEBUG_STACK_FRAMES)
478 s.PutCString("\n\nNew frames:\n");
479 Dump(&s);
480 s.EOL();
481#endif
482 return was_interrupted;
483}
484
486 assert(m_thread.IsValid() && "Expected valid thread");
487 assert(m_frames.size() <= end_idx && "Expected there to be frames to fill");
488
489 Unwind &unwinder = m_thread.GetUnwinder();
490
491 if (end_idx < m_concrete_frames_fetched)
492 return;
493
494 uint32_t num_frames = unwinder.GetFramesUpTo(end_idx);
495 if (num_frames <= end_idx + 1) {
496 // Done unwinding.
498 }
499
500 // Don't create the frames eagerly. Defer this work to GetFrameAtIndex,
501 // which can lazily query the unwinder to create frames.
502 m_frames.resize(num_frames);
503}
504
506 InterruptionControl allow_interrupt) {
507 Unwind &unwinder = m_thread.GetUnwinder();
508 bool was_interrupted = false;
509
510#if defined(DEBUG_STACK_FRAMES)
511 StreamFile s(stdout, false);
512#endif
513 // If we are hiding some frames from the outside world, we need to add
514 // those onto the total count of frames to fetch. However, we don't need
515 // to do that if end_idx is 0 since in that case we always get the first
516 // concrete frame and all the inlined frames below it... And of course, if
517 // end_idx is UINT32_MAX that means get all, so just do that...
518
519 uint32_t inlined_depth = 0;
520 if (end_idx > 0 && end_idx != UINT32_MAX) {
521 inlined_depth = GetCurrentInlinedDepth();
522 if (inlined_depth != UINT32_MAX) {
523 if (end_idx > 0)
524 end_idx += inlined_depth;
525 }
526 }
527
528 StackFrameSP unwind_frame_sp;
529 Debugger &dbg = m_thread.GetProcess()->GetTarget().GetDebugger();
530 do {
531 uint32_t idx = m_concrete_frames_fetched++;
534 bool behaves_like_zeroth_frame = (idx == 0);
535 if (idx == 0) {
536 // We might have already created frame zero, only create it if we need
537 // to.
538 if (m_frames.empty()) {
539 RegisterContextSP reg_ctx_sp(m_thread.GetRegisterContext());
540
541 if (reg_ctx_sp) {
542 const bool success = unwinder.GetFrameInfoAtIndex(
543 idx, cfa, pc, behaves_like_zeroth_frame);
544 // There shouldn't be any way not to get the frame info for frame
545 // 0. But if the unwinder can't make one, lets make one by hand
546 // with the SP as the CFA and see if that gets any further.
547 if (!success) {
548 cfa = reg_ctx_sp->GetSP();
549 pc = reg_ctx_sp->GetPC();
550 }
551
552 unwind_frame_sp = std::make_shared<StackFrame>(
553 m_thread.shared_from_this(), m_frames.size(), idx, reg_ctx_sp,
554 cfa, pc, behaves_like_zeroth_frame, nullptr);
555 unwind_frame_sp->m_frame_list_id = GetIdentifier();
556 m_frames.push_back(unwind_frame_sp);
557 }
558 } else {
559 unwind_frame_sp = m_frames.front();
560 cfa = unwind_frame_sp->m_id.GetCallFrameAddressWithoutMetadata();
561 }
562 } else {
563 // Check for interruption when building the frames.
564 // Do the check in idx > 0 so that we'll always create a 0th frame.
565 if (allow_interrupt &&
566 INTERRUPT_REQUESTED(dbg, "Interrupted having fetched {0} frames",
567 m_frames.size())) {
568 was_interrupted = true;
569 break;
570 }
571
572 const bool success =
573 unwinder.GetFrameInfoAtIndex(idx, cfa, pc, behaves_like_zeroth_frame);
574 if (!success) {
575 // We've gotten to the end of the stack.
577 break;
578 }
579 const bool cfa_is_valid = true;
580 unwind_frame_sp = std::make_shared<StackFrame>(
581 m_thread.shared_from_this(), m_frames.size(), idx, cfa, cfa_is_valid,
582 pc, StackFrame::Kind::Regular, false, behaves_like_zeroth_frame,
583 nullptr);
584
585 // Create synthetic tail call frames between the previous frame and the
586 // newly-found frame. The new frame's index may change after this call,
587 // although its concrete index will stay the same.
588 SynthesizeTailCallFrames(*unwind_frame_sp.get());
589
590 unwind_frame_sp->m_frame_list_id = GetIdentifier();
591 m_frames.push_back(unwind_frame_sp);
592 }
593
594 assert(unwind_frame_sp);
595 SynthesizeInlineFrames(unwind_frame_sp, cfa);
596 } while (m_frames.size() - 1 < end_idx);
597
598 // Don't try to merge till you've calculated all the frames in this stack.
600 StackFrameList *prev_frames = m_prev_frames_sp.get();
601 StackFrameList *curr_frames = this;
602
603#if defined(DEBUG_STACK_FRAMES)
604 s.PutCString("\nprev_frames:\n");
605 prev_frames->Dump(&s);
606 s.PutCString("\ncurr_frames:\n");
607 curr_frames->Dump(&s);
608 s.EOL();
609#endif
610 size_t curr_frame_num, prev_frame_num;
611
612 for (curr_frame_num = curr_frames->m_frames.size(),
613 prev_frame_num = prev_frames->m_frames.size();
614 curr_frame_num > 0 && prev_frame_num > 0;
615 --curr_frame_num, --prev_frame_num) {
616 const size_t curr_frame_idx = curr_frame_num - 1;
617 const size_t prev_frame_idx = prev_frame_num - 1;
618 StackFrameSP curr_frame_sp(curr_frames->m_frames[curr_frame_idx]);
619 StackFrameSP prev_frame_sp(prev_frames->m_frames[prev_frame_idx]);
620
621#if defined(DEBUG_STACK_FRAMES)
622 s.Printf("\n\nCurr frame #%u ", curr_frame_idx);
623 if (curr_frame_sp)
624 curr_frame_sp->Dump(&s, true, false);
625 else
626 s.PutCString("NULL");
627 s.Printf("\nPrev frame #%u ", prev_frame_idx);
628 if (prev_frame_sp)
629 prev_frame_sp->Dump(&s, true, false);
630 else
631 s.PutCString("NULL");
632#endif
633
634 StackFrame *curr_frame = curr_frame_sp.get();
635 StackFrame *prev_frame = prev_frame_sp.get();
636
637 if (curr_frame == nullptr || prev_frame == nullptr)
638 break;
639
640 // Check the stack ID to make sure they are equal.
641 if (curr_frame->GetStackID() != prev_frame->GetStackID())
642 break;
643
644 // Never adopt a frame borrowed from another StackFrameList, which only a
645 // provider's SyntheticStackFrameList hands out: it keeps reporting the
646 // index of the frame it borrows, and the update below cannot change
647 // that. Skipping it is safe because the merge only carries cached state
648 // onto a frame this list has already unwound correctly.
649 if (llvm::isa<BorrowedStackFrame>(prev_frame))
650 continue;
651
652 prev_frame->UpdatePreviousFrameFromCurrentFrame(*curr_frame);
653 // Now copy the fixed up previous frame into the current frames so the
654 // pointer doesn't change.
655 prev_frame_sp->m_frame_list_id = GetIdentifier();
656 m_frames[curr_frame_idx] = prev_frame_sp;
657
658#if defined(DEBUG_STACK_FRAMES)
659 s.PutCString("\n Copying previous frame to current frame");
660#endif
661 }
662 // We are done with the old stack frame list, we can release it now.
663 m_prev_frames_sp.reset();
664 }
665 // Don't report interrupted if we happen to have gotten all the frames:
666 if (!GetAllFramesFetched())
667 return was_interrupted;
668 return false;
669}
670
671uint32_t StackFrameList::GetNumFrames(bool can_create) {
672 if (!WereAllFramesFetched() && can_create) {
673 // Don't allow interrupt or we might not return the correct count
675 }
676 uint32_t frame_idx;
677 {
678 llvm::sys::ScopedReader guard(m_list_mutex);
679 frame_idx = GetVisibleStackFrameIndex(m_frames.size());
680 }
681 return frame_idx;
682}
683
685 if (s == nullptr)
686 return;
687
688 llvm::sys::ScopedReader guard(m_list_mutex);
689
690 const_iterator pos, begin = m_frames.begin(), end = m_frames.end();
691 for (pos = begin; pos != end; ++pos) {
692 StackFrame *frame = (*pos).get();
693 s->Printf("%p: ", static_cast<void *>(frame));
694 if (frame) {
695 frame->GetStackID().Dump(s);
696 frame->DumpUsingSettingsFormat(s);
697 } else
698 s->Printf("frame #%u", (uint32_t)std::distance(begin, pos));
699 s->EOL();
700 }
701 s->EOL();
702}
703
705 StackFrameSP frame_sp;
706 uint32_t original_idx = idx;
707
708 // We're going to consult the m_frames.size, but if there are already
709 // enough frames for our request we don't want to block other readers, so
710 // first acquire the shared lock:
711 { // Scope for shared lock:
712 llvm::sys::ScopedReader guard(m_list_mutex);
713
714 uint32_t inlined_depth = GetCurrentInlinedDepth();
715 if (inlined_depth != UINT32_MAX)
716 idx += inlined_depth;
717
718 if (idx < m_frames.size())
719 frame_sp = m_frames[idx];
720
721 if (frame_sp)
722 return frame_sp;
723 } // End of reader lock scope
724
725 // GetFramesUpTo will fill m_frames with as many frames as you asked for, if
726 // there are that many. If there weren't then you asked for too many frames.
727 // GetFramesUpTo returns true if interrupted:
729 Log *log = GetLog(LLDBLog::Thread);
730 LLDB_LOG(log, "GetFrameAtIndex was interrupted");
731 return {};
732 }
733
734 { // Now we're accessing m_frames as a reader, so acquire the reader lock.
735 llvm::sys::ScopedReader guard(m_list_mutex);
736 if (idx < m_frames.size()) {
737 frame_sp = m_frames[idx];
738 } else if (original_idx == 0) {
739 // There should ALWAYS be a frame at index 0. If something went wrong
740 // with the CurrentInlinedDepth such that there weren't as many frames as
741 // we thought taking that into account, then reset the current inlined
742 // depth and return the real zeroth frame.
743 if (m_frames.empty()) {
744 // Why do we have a thread with zero frames, that should not ever
745 // happen...
746 assert(!m_thread.IsValid() && "A valid thread has no frames.");
747 } else {
749 frame_sp = m_frames[original_idx];
750 }
751 }
752 } // End of reader lock scope
753
754 return frame_sp;
755}
756
759 // First try assuming the unwind index is the same as the frame index. The
760 // unwind index is always greater than or equal to the frame index, so it is
761 // a good place to start. If we have inlined frames we might have 5 concrete
762 // frames (frame unwind indexes go from 0-4), but we might have 15 frames
763 // after we make all the inlined frames. Most of the time the unwind frame
764 // index (or the concrete frame index) is the same as the frame index.
765 uint32_t frame_idx = unwind_idx;
766 StackFrameSP frame_sp(GetFrameAtIndex(frame_idx));
767 while (frame_sp) {
768 if (frame_sp->GetFrameIndex() == unwind_idx)
769 break;
770 frame_sp = GetFrameAtIndex(++frame_idx);
771 }
772 return frame_sp;
773}
774
775static bool CompareStackID(const StackFrameSP &stack_sp,
776 const StackID &stack_id) {
777 return stack_sp->GetStackID().IsYoungerThan(stack_id);
778}
779
781 StackFrameSP frame_sp;
782
783 if (stack_id.IsValid()) {
784 uint32_t frame_idx = 0;
785 {
786 // First see if the frame is already realized. This is the scope for
787 // the shared mutex:
788 llvm::sys::ScopedReader guard(m_list_mutex);
789 // Do a binary search in case the stack frame is already in our cache
790 collection::const_iterator pos =
791 llvm::lower_bound(m_frames, stack_id, CompareStackID);
792 if (pos != m_frames.end() && (*pos)->GetStackID() == stack_id)
793 return *pos;
794 }
795 // If we needed to add more frames, we would get to here.
796 do {
797 frame_sp = GetFrameAtIndex(frame_idx);
798 if (frame_sp && frame_sp->GetStackID() == stack_id)
799 break;
800 frame_idx++;
801 } while (frame_sp);
802 }
803 return frame_sp;
804}
805
806bool StackFrameList::SetFrameAtIndex(uint32_t idx, StackFrameSP &frame_sp) {
807 llvm::sys::ScopedWriter guard(m_list_mutex);
808 if (idx >= m_frames.size())
809 m_frames.resize(idx + 1);
810 // Make sure allocation succeeded by checking bounds again
811 if (idx < m_frames.size()) {
812 m_frames[idx] = frame_sp;
813 return true;
814 }
815 return false; // resize failed, out of memory?
816}
817
819 // Don't call into the frame recognizers while evaluating an expression on
820 // the private state thread, as they can cause code to run in the inferior
821 // process, and that can cause deadlocks when fetching stop events for the
822 // expression.
823 Policy policy = PolicyStack::Get().Current();
825 return;
826
827 Log *log = GetLog(LLDBLog::Thread);
828
829 // Only the top frame should be recognized.
830 StackFrameSP frame_sp = GetFrameAtIndex(0);
831 if (!frame_sp) {
832 LLDB_LOG(log, "Failed to construct Frame #0");
833 return;
834 }
835
836 RecognizedStackFrameSP recognized_frame_sp = frame_sp->GetRecognizedFrame();
837
838 if (recognized_frame_sp) {
839 if (StackFrameSP most_relevant_frame_sp =
840 recognized_frame_sp->GetMostRelevantFrame()) {
841 LLDB_LOG(log, "Found most relevant frame at index {0}",
842 most_relevant_frame_sp->GetFrameIndex());
843 SetSelectedFrame(most_relevant_frame_sp.get());
844 return;
845 }
846 }
847 LLDB_LOG(log, "Frame #0 not recognized");
848
849 // If this thread has a non-trivial StopInfo, then let it suggest
850 // a most relevant frame:
851 StopInfoSP stop_info_sp = m_thread.GetStopInfo();
852 uint32_t stack_idx = 0;
853 bool found_relevant = false;
854 if (stop_info_sp) {
855 // Here we're only asking the stop info if it wants to adjust the real stack
856 // index. We have to ask about the m_inlined_stack_depth in
857 // Thread::ShouldStop since the plans need to reason with that info.
858 bool inlined = false;
859 std::optional<uint32_t> stack_opt =
860 stop_info_sp->GetSuggestedStackFrameIndex(inlined);
861 if (stack_opt) {
862 stack_idx = *stack_opt;
863 found_relevant = true;
864 }
865 }
866
867 frame_sp = GetFrameAtIndex(stack_idx);
868 if (!frame_sp)
869 LLDB_LOG(log, "Stop info suggested relevant frame {0} but it didn't exist",
870 stack_idx);
871 else if (found_relevant)
872 LLDB_LOG(log, "Setting selected frame from stop info to {0}", stack_idx);
873 // Note, we don't have to worry about "inlined" frames here, because we've
874 // already calculated the inlined frame in Thread::ShouldStop, and
875 // SetSelectedFrame will take care of that adjustment for us.
876 SetSelectedFrame(frame_sp.get());
877
878 if (!found_relevant)
879 LLDB_LOG(log, "No relevant frame!");
880}
881
882uint32_t
884 std::lock_guard<std::recursive_mutex> guard(m_selected_frame_mutex);
885
886 if (!m_selected_frame_idx && select_most_relevant)
889 // If we aren't selecting the most relevant frame, and the selected frame
890 // isn't set, then don't force a selection here, just return 0.
891 if (!select_most_relevant)
892 return 0;
893 // If the inlined stack frame is set, then use that:
895 }
896 return *m_selected_frame_idx;
897}
898
900 llvm::sys::ScopedReader guard(m_list_mutex);
901 std::lock_guard<std::recursive_mutex> selected_frame_guard(
903
904 const_iterator pos;
905 const_iterator begin = m_frames.begin();
906 const_iterator end = m_frames.end();
908
909 for (pos = begin; pos != end; ++pos) {
910 if (pos->get() == frame) {
911 m_selected_frame_idx = std::distance(begin, pos);
912 uint32_t inlined_depth = GetCurrentInlinedDepth();
913 if (inlined_depth != UINT32_MAX)
915 break;
916 }
917 }
919 return *m_selected_frame_idx;
920}
921
923 StackFrameSP frame_sp(GetFrameAtIndex(idx));
924 if (frame_sp) {
925 SetSelectedFrame(frame_sp.get());
926 return true;
927 } else
928 return false;
929}
930
932 if (m_thread.GetID() ==
933 m_thread.GetProcess()->GetThreadList().GetSelectedThread()->GetID()) {
934 StackFrameSP frame_sp(
936 if (frame_sp) {
937 SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextLineEntry);
938 if (sc.line_entry.GetFile())
939 m_thread.CalculateTarget()->GetSourceManager().SetDefaultFileAndLine(
941 }
942 }
943}
944
945// The thread has been run, reset the number stack frames to zero so we can
946// determine how many frames we have lazily.
947// Note, we don't actually re-use StackFrameLists, we always make a new
948// StackFrameList every time we stop, and then copy frame information frame
949// by frame from the old to the new StackFrameList. So the comment above,
950// does not describe how StackFrameLists are currently used.
951// Clear is currently only used to clear the list in the destructor.
953 llvm::sys::ScopedWriter guard(m_list_mutex);
954 m_frames.clear();
956 std::lock_guard<std::recursive_mutex> selected_frame_guard(
958 m_selected_frame_idx.reset();
959}
960
963 llvm::sys::ScopedReader guard(m_list_mutex);
964 const_iterator pos;
965 const_iterator begin = m_frames.begin();
966 const_iterator end = m_frames.end();
967 lldb::StackFrameSP ret_sp;
968
969 for (pos = begin; pos != end; ++pos) {
970 if (pos->get() == stack_frame_ptr) {
971 ret_sp = (*pos);
972 break;
973 }
974 }
975 return ret_sp;
976}
977
979 uint32_t frame_idx = frame.GetFrameIndex();
980 StackFrameSP frame_sp = GetFrameAtIndex(frame_idx + 1);
981 if (!frame_sp)
982 return false;
983 return frame_sp->IsHidden();
984}
985
987 uint32_t frame_idx = frame.GetFrameIndex();
988 if (frame_idx == 0)
989 return false;
990 StackFrameSP frame_sp = GetFrameAtIndex(frame_idx - 1);
991 if (!frame_sp)
992 return false;
993 return frame_sp->IsHidden();
994}
995
997 lldb::StackFrameSP selected_frame_sp,
998 bool show_hidden_marker) {
999 bool show_unicode_marker = Terminal::SupportsUnicode() && show_hidden_marker;
1000 if (frame_sp == selected_frame_sp)
1001 return show_unicode_marker ? " * " : "* ";
1002 if (!show_unicode_marker)
1003 return " ";
1004 if (IsPreviousFrameHidden(*frame_sp))
1005 return reinterpret_cast<const char *>(u8"﹉ ");
1006 if (IsNextFrameHidden(*frame_sp))
1007 return reinterpret_cast<const char *>(u8"﹍ ");
1008 return " ";
1009}
1010
1011size_t StackFrameList::GetStatus(Stream &strm, uint32_t first_frame,
1012 uint32_t num_frames, bool show_frame_info,
1013 uint32_t num_frames_with_source,
1014 bool show_unique, bool show_hidden,
1015 bool show_hidden_marker,
1016 bool show_selected_frame) {
1017 size_t num_frames_displayed = 0;
1018
1019 if (num_frames == 0)
1020 return 0;
1021
1022 StackFrameSP frame_sp;
1023 uint32_t frame_idx = 0;
1024 uint32_t last_frame;
1025
1026 // Don't let the last frame wrap around...
1027 if (num_frames == UINT32_MAX)
1028 last_frame = UINT32_MAX;
1029 else
1030 last_frame = first_frame + num_frames;
1031
1032 StackFrameSP selected_frame_sp =
1033 m_thread.GetSelectedFrame(DoNoSelectMostRelevantFrame);
1034 std::string marker;
1035 for (frame_idx = first_frame; frame_idx < last_frame; ++frame_idx) {
1036 frame_sp = GetFrameAtIndex(frame_idx);
1037 if (!frame_sp)
1038 break;
1039
1040 if (show_selected_frame)
1041 marker = GetFrameMarker(frame_sp, selected_frame_sp, show_hidden_marker);
1042 else
1043 marker = GetFrameMarker(frame_sp, /*selected_frame_sp=*/nullptr,
1044 show_hidden_marker);
1045
1046 // Hide uninteresting frames unless it's the selected frame.
1047 if (!show_hidden && frame_sp != selected_frame_sp && frame_sp->IsHidden())
1048 continue;
1049
1050 // Check for interruption here. If we're fetching arguments, this loop
1051 // can go slowly:
1052 Debugger &dbg = m_thread.GetProcess()->GetTarget().GetDebugger();
1054 dbg, "Interrupted dumping stack for thread {0:x} with {1} shown.",
1055 m_thread.GetID(), num_frames_displayed))
1056 break;
1057
1058 if (!frame_sp->GetStatus(strm, show_frame_info,
1059 num_frames_with_source > (first_frame - frame_idx),
1060 show_unique, marker))
1061 break;
1062 ++num_frames_displayed;
1063 }
1064
1065 strm.IndentLess();
1066 return num_frames_displayed;
1067}
1068
#define INTERRUPT_REQUESTED(debugger,...)
This handy define will keep you from having to generate a report for the interruption by hand.
Definition Debugger.h:514
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition Log.h:375
#define LLDB_LOGF_VERBOSE(log,...)
Definition Log.h:396
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:405
#define LLDB_LOG_VERBOSE(log,...)
Definition Log.h:382
static void FindInterveningFrames(Function &begin, Function &end, ExecutionContext &exe_ctx, Target &target, addr_t return_pc, CallSequence &path, ModuleList &images, Log *log)
Find the unique path through the call graph from begin (with return PC return_pc) to end.
static bool CompareStackID(const StackFrameSP &stack_sp, const StackID &stack_id)
std::vector< CallDescriptor > CallSequence
A section + offset based address class.
Definition Address.h:62
Represent a call made within a Function.
Definition Function.h:254
virtual SymbolContext GetCallee(ModuleList &images, ExecutionContext &exe_ctx)=0
Get the callee's definition, resolved against images.
A class to manage flag bits.
Definition Debugger.h:100
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void SetFramePtr(StackFrame *frame)
Set accessor to set only the frame shared pointer from a frame pointer.
A class that describes a function.
Definition Function.h:386
CallEdge * GetCallEdgeForReturnAddress(lldb::addr_t return_pc, Target &target)
Get the outgoing call edge from this function which has the given return address return_pc,...
Definition Function.cpp:386
llvm::ArrayRef< std::unique_ptr< CallEdge > > GetCallEdges()
Get the outgoing call edges from this function, sorted by their return PC addresses (in increasing or...
Definition Function.cpp:349
void CalculateSymbolContext(SymbolContext *sc) override
Reconstruct the object's symbol context into sc.
Definition Function.cpp:469
llvm::ArrayRef< std::unique_ptr< CallEdge > > GetTailCallingEdges()
Get the outgoing tail-calling edges from this function.
Definition Function.cpp:379
ConstString GetDisplayName() const
Definition Function.cpp:546
A collection class for Module objects.
Definition ModuleList.h:125
static PolicyStack & Get()
Definition Policy.cpp:21
Policy Current() const
Definition Policy.cpp:26
lldb::frame_list_id_t m_identifier
Unique identifier for this frame list instance.
lldb::frame_list_id_t GetIdentifier() const
Get the unique identifier for this frame list.
StackFrameList(Thread &thread, const lldb::StackFrameListSP &prev_frames_sp, bool show_inline_frames, lldb::frame_list_id_t provider_id=0)
lldb::addr_t m_current_inlined_pc
The program counter value at the currently selected synthetic activation.
collection m_frames
A cache of frames.
lldb::StackFrameSP GetFrameWithStackID(const StackID &stack_id)
Retrieve the stack frame with the given ID stack_id.
lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx)
Get the first concrete frame with index greater than or equal to idx.
bool GetFramesUpTo(uint32_t end_idx, InterruptionControl allow_interrupt)
Ensures that frames up to (and including) end_idx are realized in the StackFrameList.
void ClearSelectedFrameIndex()
Resets the selected frame index of this object.
uint32_t SynthesizeInlineFrames(lldb::StackFrameSP frame_sp, lldb::addr_t cfa)
Synthesize inline frames for frame_sp by walking the inlined scope chain via GetParentOfInlinedScope ...
std::recursive_mutex m_selected_frame_mutex
Protect access to m_selected_frame_idx.
void Clear()
Clear the cache of frames.
lldb::StackFrameSP GetFrameAtIndex(uint32_t idx)
Get the frame at index idx. Invisible frames cannot be indexed.
std::optional< uint32_t > m_selected_frame_idx
The currently selected frame.
lldb::StackFrameListSP m_prev_frames_sp
The old stack frame list.
uint32_t m_concrete_frames_fetched
The number of concrete frames fetched while filling the frame list.
void FetchOnlyConcreteFramesUpTo(uint32_t end_idx)
Thread & m_thread
The thread this frame list describes.
llvm::sys::RWMutex m_list_mutex
A mutex for this frame list.
void SelectMostRelevantFrame()
Calls into the stack frame recognizers and stop info to set the most relevant frame.
const bool m_show_inlined_frames
Whether or not to show synthetic (inline) frames. Immutable.
bool SetFrameAtIndex(uint32_t idx, lldb::StackFrameSP &frame_sp)
Use this API to build a stack frame list (used for scripted threads, for instance....
uint32_t m_current_inlined_depth
The number of synthetic function activations (invisible frames) expanded from the concrete frame #0 a...
void SetDefaultFileAndLineToSelectedFrame()
If the currently selected frame comes from the currently selected thread, point the default file and ...
uint32_t GetVisibleStackFrameIndex(uint32_t idx)
If the current inline depth (i.e the number of invisible frames) is valid, subtract it from idx.
bool IsNextFrameHidden(lldb_private::StackFrame &frame)
Returns true if the next frame is hidden.
uint32_t GetNumFrames(bool can_create=true)
Get the number of visible frames.
virtual bool FetchFramesUpTo(uint32_t end_idx, InterruptionControl allow_interrupt)
Returns true if fetching frames was interrupted, false otherwise.
collection::const_iterator const_iterator
void SynthesizeTailCallFrames(StackFrame &next_frame)
Given that next_frame will be appended to the frame list, synthesize tail call frames between the cur...
std::string GetFrameMarker(lldb::StackFrameSP frame_sp, lldb::StackFrameSP selected_frame_sp, bool show_hidden_marker)
Returns the stack frame marker depending on if frame_sp:
void SetCurrentInlinedDepth(uint32_t new_depth)
Thread & GetThread() const
Get the thread associated with this frame list.
uint32_t GetSelectedFrameIndex(SelectMostRelevant select_most_relevant_frame)
Get the currently selected frame index.
uint32_t SetSelectedFrame(lldb_private::StackFrame *frame)
Mark a stack frame as the currently selected frame and return its index.
size_t GetStatus(Stream &strm, uint32_t first_frame, uint32_t num_frames, bool show_frame_info, uint32_t num_frames_with_source, bool show_unique=false, bool show_hidden=false, bool show_hidden_marker=true, bool show_selected_frame=false)
void CalculateCurrentInlinedDepth()
Calculate and set the current inline depth.
lldb::StackFrameSP GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr)
If stack_frame_ptr is contained in this StackFrameList, return its wrapping shared pointer.
bool WereAllFramesFetched() const
Returns whether we have currently fetched all the frames of a stack.
bool IsPreviousFrameHidden(lldb_private::StackFrame &frame)
Returns true if the previous frame is hidden.
bool SetSelectedFrameByIndex(uint32_t idx)
Mark a stack frame as the currently selected frame using the frame index idx.
This base class provides an interface to stack frames.
Definition StackFrame.h:44
void UpdatePreviousFrameFromCurrentFrame(StackFrame &curr_frame)
void SetFrameIndex(uint32_t index)
Set this frame's frame index.
Definition StackFrame.h:482
virtual uint32_t GetConcreteFrameIndex()
Query this frame to find what frame it is in this Thread's StackFrameList, not counting inlined frame...
Definition StackFrame.h:492
virtual lldb::RegisterContextSP GetRegisterContext()
Get the RegisterContext for this frame, if possible.
@ Regular
A regular stack frame with access to registers and local variables.
Definition StackFrame.h:64
virtual StackID & GetStackID()
virtual const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
virtual uint32_t GetFrameIndex() const
Query this frame to find what frame it is in this Thread's StackFrameList.
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.
lldb::TargetSP CalculateTarget() override
void Dump(Stream *s)
Definition StackID.cpp:37
bool IsValid() const
Definition StackID.h:47
A stream class that can stream formatted output to a file.
Definition Stream.h:28
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
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
Definition Stream.cpp:204
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
bool GetParentOfInlinedScope(const Address &curr_frame_pc, SymbolContext &next_frame_sc, Address &inlined_frame_addr) const
Find the block containing the inlined block that contains this block.
Block * block
The Block for a given query.
LineEntry line_entry
The LineEntry for a given query.
lldb::SyntheticFrameProviderSP m_provider
The provider that transforms the input frames.
bool FetchFramesUpTo(uint32_t end_idx, InterruptionControl allow_interrupt) override
Override FetchFramesUpTo to lazily return frames from the provider or from the actual stack frame lis...
lldb::StackFrameListSP m_input_frames
The input stack frame list that the provider transforms.
SyntheticStackFrameList(Thread &thread, lldb::StackFrameListSP input_frames, const lldb::StackFrameListSP &prev_frames_sp, bool show_inline_frames, lldb::SyntheticFrameProviderSP provider_sp, uint64_t provider_id)
static bool SupportsUnicode()
Returns whether or not the current terminal supports Unicode rendering.
Definition Terminal.cpp:407
bool GetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa, lldb::addr_t &pc, bool &behaves_like_zeroth_frame)
Definition Unwind.h:50
uint32_t GetFramesUpTo(uint32_t end_idx)
Definition Unwind.h:36
#define LLDB_INVALID_ADDRESS
#define UINT32_MAX
@ DoNoSelectMostRelevantFrame
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
std::shared_ptr< lldb_private::SyntheticFrameProvider > SyntheticFrameProviderSP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::RecognizedStackFrame > RecognizedStackFrameSP
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
std::shared_ptr< lldb_private::StackFrameList > StackFrameListSP
uint32_t frame_list_id_t
Definition lldb-types.h:87
A sequence of calls that comprise some portion of a backtrace.
CallEdge::AddrType address_type
SymbolContext callee
uint32_t line
The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line number information.
Definition LineEntry.h:151
const FileSpec & GetFile() const
Helper to access the file.
Definition LineEntry.h:134
SupportFileNSP file_sp
The source file, possibly mapped by the target.source-map setting.
Definition LineEntry.h:144
void ApplyFileMappings(lldb::TargetSP target_sp)
Apply file mappings from target.source-map to the LineEntry's file.
Describes what view of the process a thread should see and what operations it is allowed to perform.
Definition Policy.h:33
Capabilities capabilities
Definition Policy.h:67