本文整理汇总了C++中Unwind类的典型用法代码示例。如果您正苦于以下问题:C++ Unwind类的具体用法?C++ Unwind怎么用?C++ Unwind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Unwind类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: process_sp
lldb::RegisterContextSP
ThreadMachCore::CreateRegisterContextForFrame (StackFrame *frame)
{
lldb::RegisterContextSP reg_ctx_sp;
uint32_t concrete_frame_idx = 0;
if (frame)
concrete_frame_idx = frame->GetConcreteFrameIndex ();
if (concrete_frame_idx == 0)
{
if (!m_thread_reg_ctx_sp)
{
ProcessSP process_sp (GetProcess());
ObjectFile *core_objfile = static_cast<ProcessMachCore *>(process_sp.get())->GetCoreObjectFile ();
if (core_objfile)
m_thread_reg_ctx_sp = core_objfile->GetThreadContextAtIndex (GetID(), *this);
}
reg_ctx_sp = m_thread_reg_ctx_sp;
}
else
{
Unwind *unwinder = GetUnwinder ();
if (unwinder)
reg_ctx_sp = unwinder->CreateRegisterContextForFrame (frame);
}
return reg_ctx_sp;
}
开发者ID:Keno,项目名称:lldb,代码行数:29,代码来源:ThreadMachCore.cpp
示例2: process_sp
lldb::RegisterContextSP
ThreadGDBRemote::CreateRegisterContextForFrame(StackFrame *frame) {
lldb::RegisterContextSP reg_ctx_sp;
uint32_t concrete_frame_idx = 0;
if (frame)
concrete_frame_idx = frame->GetConcreteFrameIndex();
if (concrete_frame_idx == 0) {
ProcessSP process_sp(GetProcess());
if (process_sp) {
ProcessGDBRemote *gdb_process =
static_cast<ProcessGDBRemote *>(process_sp.get());
// read_all_registers_at_once will be true if 'p' packet is not
// supported.
bool read_all_registers_at_once =
!gdb_process->GetGDBRemote().GetpPacketSupported(GetID());
reg_ctx_sp = std::make_shared<GDBRemoteRegisterContext>(
*this, concrete_frame_idx, gdb_process->m_register_info,
read_all_registers_at_once);
}
} else {
Unwind *unwinder = GetUnwinder();
if (unwinder != nullptr)
reg_ctx_sp = unwinder->CreateRegisterContextForFrame(frame);
}
return reg_ctx_sp;
}
开发者ID:llvm-project,项目名称:lldb,代码行数:28,代码来源:ThreadGDBRemote.cpp
示例3: process_sp
lldb::RegisterContextSP
ThreadGDBRemote::CreateRegisterContextForFrame (StackFrame *frame)
{
lldb::RegisterContextSP reg_ctx_sp;
const bool read_all_registers_at_once = false;
uint32_t concrete_frame_idx = 0;
if (frame)
concrete_frame_idx = frame->GetConcreteFrameIndex ();
if (concrete_frame_idx == 0)
{
ProcessSP process_sp (GetProcess());
if (process_sp)
{
ProcessGDBRemote *gdb_process = static_cast<ProcessGDBRemote *>(process_sp.get());
reg_ctx_sp.reset (new GDBRemoteRegisterContext (*this, concrete_frame_idx, gdb_process->m_register_info, read_all_registers_at_once));
}
}
else
{
Unwind *unwinder = GetUnwinder ();
if (unwinder)
reg_ctx_sp = unwinder->CreateRegisterContextForFrame (frame);
}
return reg_ctx_sp;
}
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:28,代码来源:ThreadGDBRemote.cpp
示例4: GetUnwinder
void
ThreadElfCore::ClearStackFrames ()
{
Unwind *unwinder = GetUnwinder ();
if (unwinder)
unwinder->Clear();
Thread::ClearStackFrames();
}
开发者ID:AAZemlyanukhin,项目名称:freebsd,代码行数:8,代码来源:ThreadElfCore.cpp
示例5: GetUnwinder
void
ThreadGDBRemote::ClearStackFrames ()
{
Unwind *unwinder = GetUnwinder ();
if (unwinder)
unwinder->Clear();
Thread::ClearStackFrames();
}
开发者ID:eightcien,项目名称:lldb,代码行数:8,代码来源:ThreadGDBRemote.cpp
示例6: GetRegisterContext
RegisterContextSP
ThreadMemory::CreateRegisterContextForFrame(StackFrame *frame) {
RegisterContextSP reg_ctx_sp;
uint32_t concrete_frame_idx = 0;
if (frame)
concrete_frame_idx = frame->GetConcreteFrameIndex();
if (concrete_frame_idx == 0) {
reg_ctx_sp = GetRegisterContext();
} else {
Unwind *unwinder = GetUnwinder();
if (unwinder)
reg_ctx_sp = unwinder->CreateRegisterContextForFrame(frame);
}
return reg_ctx_sp;
}
开发者ID:CodaFi,项目名称:swift-lldb,代码行数:17,代码来源:ThreadMemory.cpp
示例7: process_sp
lldb::RegisterContextSP
ThreadKDP::CreateRegisterContextForFrame (StackFrame *frame)
{
lldb::RegisterContextSP reg_ctx_sp;
uint32_t concrete_frame_idx = 0;
if (frame)
concrete_frame_idx = frame->GetConcreteFrameIndex ();
if (concrete_frame_idx == 0)
{
ProcessSP process_sp (CalculateProcess());
if (process_sp)
{
switch (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().GetCPUType())
{
case llvm::MachO::CPU_TYPE_ARM:
reg_ctx_sp.reset (new RegisterContextKDP_arm (*this, concrete_frame_idx));
break;
case llvm::MachO::CPU_TYPE_ARM64:
reg_ctx_sp.reset (new RegisterContextKDP_arm64 (*this, concrete_frame_idx));
break;
case llvm::MachO::CPU_TYPE_I386:
reg_ctx_sp.reset (new RegisterContextKDP_i386 (*this, concrete_frame_idx));
break;
case llvm::MachO::CPU_TYPE_X86_64:
reg_ctx_sp.reset (new RegisterContextKDP_x86_64 (*this, concrete_frame_idx));
break;
default:
assert (!"Add CPU type support in KDP");
break;
}
}
}
else
{
Unwind *unwinder = GetUnwinder ();
if (unwinder)
reg_ctx_sp = unwinder->CreateRegisterContextForFrame (frame);
}
return reg_ctx_sp;
}
开发者ID:Rutuja15,项目名称:lldb-310.2.36,代码行数:42,代码来源:ThreadKDP.cpp
示例8: guard
StackFrameSP StackFrameList::GetFrameAtIndex(uint32_t idx) {
StackFrameSP frame_sp;
std::lock_guard<std::recursive_mutex> guard(m_mutex);
uint32_t original_idx = idx;
uint32_t inlined_depth = GetCurrentInlinedDepth();
if (inlined_depth != UINT32_MAX)
idx += inlined_depth;
if (idx < m_frames.size())
frame_sp = m_frames[idx];
if (frame_sp)
return frame_sp;
// GetFramesUpTo will fill m_frames with as many frames as you asked for,
// if there are that many. If there weren't then you asked for too many
// frames.
GetFramesUpTo(idx);
if (idx < m_frames.size()) {
if (m_show_inlined_frames) {
// When inline frames are enabled we actually create all the frames in
// GetFramesUpTo.
frame_sp = m_frames[idx];
} else {
Unwind *unwinder = m_thread.GetUnwinder();
if (unwinder) {
addr_t pc, cfa;
if (unwinder->GetFrameInfoAtIndex(idx, cfa, pc)) {
const bool cfa_is_valid = true;
const bool stop_id_is_valid = false;
const bool is_history_frame = false;
frame_sp.reset(new StackFrame(
m_thread.shared_from_this(), idx, idx, cfa, cfa_is_valid, pc, 0,
stop_id_is_valid, is_history_frame, nullptr));
Function *function =
frame_sp->GetSymbolContext(eSymbolContextFunction).function;
if (function) {
// When we aren't showing inline functions we always use
// the top most function block as the scope.
frame_sp->SetSymbolContextScope(&function->GetBlock(false));
} else {
// Set the symbol scope from the symbol regardless if it is nullptr
// or valid.
frame_sp->SetSymbolContextScope(
frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol);
}
SetFrameAtIndex(idx, frame_sp);
}
}
}
} else if (original_idx == 0) {
// There should ALWAYS be a frame at index 0. If something went wrong with
// the CurrentInlinedDepth such that
// there weren't as many frames as we thought taking that into account, then
// reset the current inlined depth
// and return the real zeroth frame.
if (m_frames.empty()) {
// Why do we have a thread with zero frames, that should not ever
// happen...
if (m_thread.IsValid())
assert("A valid thread has no frames.");
} else {
ResetCurrentInlinedDepth();
frame_sp = m_frames[original_idx];
}
}
return frame_sp;
}
开发者ID:CodaFi,项目名称:swift-lldb,代码行数:71,代码来源:StackFrameList.cpp
示例9: 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
//.........这里部分代码省略.........
开发者ID:CodaFi,项目名称:swift-lldb,代码行数:101,代码来源:StackFrameList.cpp
注:本文中的Unwind类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论