本文整理汇总了C++中ActRec::resumed方法的典型用法代码示例。如果您正苦于以下问题:C++ ActRec::resumed方法的具体用法?C++ ActRec::resumed怎么用?C++ ActRec::resumed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActRec
的用法示例。
在下文中一共展示了ActRec::resumed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getStackTrace
// stack trace helper
static ProfileStackTrace getStackTrace() {
ProfileStackTrace trace;
if (g_context.isNull()) return trace;
VMRegAnchor _;
ActRec *fp = vmfp();
if (!fp) return trace;
PC pc = vmpc();
const Func *f = fp->m_func;
Unit *u = f->unit();
Offset off = pc - u->entry();
for (;;) {
trace.push_back({ f, off, fp->resumed() });
fp = g_context->getPrevVMStateUNSAFE(fp, &off);
if (!fp) break;
f = fp->m_func;
}
return trace;
}
示例2: createBacktrace
Array createBacktrace(const BacktraceArgs& btArgs) {
Array bt = Array::Create();
// If there is a parser frame, put it at the beginning of
// the backtrace
if (btArgs.m_parserFrame) {
bt.append(
make_map_array(
s_file, btArgs.m_parserFrame->filename,
s_line, btArgs.m_parserFrame->lineNumber
)
);
}
VMRegAnchor _;
if (!vmfp()) {
// If there are no VM frames, we're done
return bt;
}
int depth = 0;
ActRec* fp = nullptr;
Offset pc = 0;
// Get the fp and pc of the top frame (possibly skipping one frame)
{
if (btArgs.m_skipTop) {
fp = g_context->getPrevVMState(vmfp(), &pc);
if (!fp) {
// We skipped over the only VM frame, we're done
return bt;
}
} else {
fp = vmfp();
Unit *unit = vmfp()->m_func->unit();
assert(unit);
pc = unit->offsetOf(vmpc());
}
// Handle the top frame
if (btArgs.m_withSelf) {
// Builtins don't have a file and line number
if (!fp->m_func->isBuiltin()) {
Unit* unit = fp->m_func->unit();
assert(unit);
const char* filename = fp->m_func->filename()->data();
Offset off = pc;
ArrayInit frame(btArgs.m_parserFrame ? 4 : 2, ArrayInit::Map{});
frame.set(s_file, filename);
frame.set(s_line, unit->getLineNumber(off));
if (btArgs.m_parserFrame) {
frame.set(s_function, s_include);
frame.set(s_args, Array::Create(btArgs.m_parserFrame->filename));
}
bt.append(frame.toVariant());
depth++;
}
}
}
// Handle the subsequent VM frames
Offset prevPc = 0;
for (ActRec* prevFp = g_context->getPrevVMState(fp, &prevPc);
fp != nullptr && (btArgs.m_limit == 0 || depth < btArgs.m_limit);
fp = prevFp, pc = prevPc,
prevFp = g_context->getPrevVMState(fp, &prevPc)) {
// do not capture frame for HPHP only functions
if (fp->m_func->isNoInjection()) {
continue;
}
ArrayInit frame(7, ArrayInit::Map{});
auto const curUnit = fp->m_func->unit();
auto const curOp = *reinterpret_cast<const Op*>(curUnit->at(pc));
auto const isReturning =
curOp == Op::RetC || curOp == Op::RetV ||
curOp == Op::CreateCont || curOp == Op::Await ||
fp->localsDecRefd();
// Builtins and generators don't have a file and line number
if (prevFp && !prevFp->m_func->isBuiltin() && !fp->resumed()) {
auto const prevUnit = prevFp->m_func->unit();
auto prevFile = prevUnit->filepath();
if (prevFp->m_func->originalFilename()) {
prevFile = prevFp->m_func->originalFilename();
}
assert(prevFile);
frame.set(s_file, const_cast<StringData*>(prevFile));
// In the normal method case, the "saved pc" for line number printing is
// pointing at the cell conversion (Unbox/Pop) instruction, not the call
// itself. For multi-line calls, this instruction is associated with the
// subsequent line which results in an off-by-n. We're subtracting one
// in order to look up the line associated with the FCall/FCallArray
// instruction. Exception handling and the other opcodes (ex. BoxR)
// already do the right thing. The emitter associates object access with
// the subsequent expression and this would be difficult to modify.
auto const opAtPrevPc =
*reinterpret_cast<const Op*>(prevUnit->at(prevPc));
//.........这里部分代码省略.........