本文整理汇总了C++中Unwind::GetFramesUpTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Unwind::GetFramesUpTo方法的具体用法?C++ Unwind::GetFramesUpTo怎么用?C++ Unwind::GetFramesUpTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unwind
的用法示例。
在下文中一共展示了Unwind::GetFramesUpTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFramesUpTo
void StackFrameList::GetFramesUpTo(uint32_t end_idx) {
// this makes sure we do not fetch frames for an invalid thread
if (!m_thread.IsValid())
return;
// We've already gotten more frames than asked for, or we've already finished
// unwinding, return.
if (m_frames.size() > end_idx || GetAllFramesFetched())
return;
Unwind *unwinder = m_thread.GetUnwinder();
if (m_show_inlined_frames) {
#if defined(DEBUG_STACK_FRAMES)
StreamFile s(stdout, false);
#endif
// If we are hiding some frames from the outside world, we need to add those
// onto the total count of
// frames to fetch. However, we don't need to do that if end_idx is 0 since
// in that case we always
// get the first concrete frame and all the inlined frames below it... And
// of course, if end_idx is
// UINT32_MAX that means get all, so just do that...
uint32_t inlined_depth = 0;
if (end_idx > 0 && end_idx != UINT32_MAX) {
inlined_depth = GetCurrentInlinedDepth();
if (inlined_depth != UINT32_MAX) {
if (end_idx > 0)
end_idx += inlined_depth;
}
}
StackFrameSP unwind_frame_sp;
do {
uint32_t idx = m_concrete_frames_fetched++;
lldb::addr_t pc = LLDB_INVALID_ADDRESS;
lldb::addr_t cfa = LLDB_INVALID_ADDRESS;
if (idx == 0) {
// We might have already created frame zero, only create it
// if we need to
if (m_frames.empty()) {
RegisterContextSP reg_ctx_sp(m_thread.GetRegisterContext());
if (reg_ctx_sp) {
const bool success =
unwinder && unwinder->GetFrameInfoAtIndex(idx, cfa, pc);
// There shouldn't be any way not to get the frame info for frame 0.
// But if the unwinder can't make one, lets make one by hand with
// the
// SP as the CFA and see if that gets any further.
if (!success) {
cfa = reg_ctx_sp->GetSP();
pc = reg_ctx_sp->GetPC();
}
unwind_frame_sp.reset(new StackFrame(m_thread.shared_from_this(),
m_frames.size(), idx,
reg_ctx_sp, cfa, pc, nullptr));
m_frames.push_back(unwind_frame_sp);
}
} else {
unwind_frame_sp = m_frames.front();
cfa = unwind_frame_sp->m_id.GetCallFrameAddress();
}
} else {
const bool success =
unwinder && unwinder->GetFrameInfoAtIndex(idx, cfa, pc);
if (!success) {
// We've gotten to the end of the stack.
SetAllFramesFetched();
break;
}
const bool cfa_is_valid = true;
const bool stop_id_is_valid = false;
const bool is_history_frame = false;
unwind_frame_sp.reset(new StackFrame(
m_thread.shared_from_this(), m_frames.size(), idx, cfa,
cfa_is_valid, pc, 0, stop_id_is_valid, is_history_frame, nullptr));
m_frames.push_back(unwind_frame_sp);
}
assert(unwind_frame_sp);
SymbolContext unwind_sc = unwind_frame_sp->GetSymbolContext(
eSymbolContextBlock | eSymbolContextFunction);
Block *unwind_block = unwind_sc.block;
if (unwind_block) {
Address curr_frame_address(unwind_frame_sp->GetFrameCodeAddress());
TargetSP target_sp = m_thread.CalculateTarget();
// Be sure to adjust the frame address to match the address
// that was used to lookup the symbol context above. If we are
// in the first concrete frame, then we lookup using the current
// address, else we decrement the address by one to get the correct
// location.
if (idx > 0) {
if (curr_frame_address.GetOffset() == 0) {
// If curr_frame_address points to the first address in a section
// then after
// adjustment it will point to an other section. In that case
// resolve the
//.........这里部分代码省略.........