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