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