本文整理汇总了C++中BPatch_function::setHandlerFaultAddrAddr方法的典型用法代码示例。如果您正苦于以下问题:C++ BPatch_function::setHandlerFaultAddrAddr方法的具体用法?C++ BPatch_function::setHandlerFaultAddrAddr怎么用?C++ BPatch_function::setHandlerFaultAddrAddr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BPatch_function
的用法示例。
在下文中一共展示了BPatch_function::setHandlerFaultAddrAddr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/* Invoked for every signal handler function, adjusts the value of the saved
* fault address to its unrelocated counterpart in the CONTEXT structure,
* which contains the PC that is used when execution resumes
*/
void HybridAnalysis::signalHandlerEntryCB2(BPatch_point *point, Address excCtxtAddr)
{
mal_printf("\nAt signalHandlerEntry2(%lx , %lx)\n",
point->getAddress(), (Address)excCtxtAddr);
// calculate the offset of the fault address in the EXCEPTION_RECORD
CONTEXT *cont= (CONTEXT*)excCtxtAddr; //bogus pointer, but I won't write to it
Address pcAddr = excCtxtAddr + (Address)(&(cont->Eip)) - (Address)cont;
// set fault address to the unrelocated address of that instruction
// and save the PC address in the CONTEXT structure so the exit handler
// can read it
BPatch_function *func = point->getFunction();
func->setHandlerFaultAddrAddr((Address)pcAddr,true);
handlerFunctions[(Address)func->getBaseAddr()].faultPCaddr = pcAddr;
}
示例2: signalHandlerEntryCB
/* Invoked for every signal handler function, adjusts the value of the saved
* fault address to its unrelocated counterpart in the EXCEPTION_RECORD
*/
void HybridAnalysis::signalHandlerEntryCB(BPatch_point *point, Address excRecAddr)
{
mal_printf("\nAt signalHandlerEntry(%lx , %lx)\n",
point->getAddress(), (Address)excRecAddr);
stats_.exceptions++;
// calculate the offset of the fault address in the EXCEPTION_RECORD
EXCEPTION_RECORD record;
proc()->lowlevel_process()->readDataSpace(
(void*)excRecAddr, sizeof(EXCEPTION_RECORD), &record, true);
Address pcAddr = excRecAddr
+ (Address) &(record.ExceptionAddress)
- (Address) &record;
// set fault address to the unrelocated address of that instruction
BPatch_function *func = point->getFunction();
func->setHandlerFaultAddrAddr((Address)pcAddr,false);
handlerFunctions[(Address)func->getBaseAddr()].isInterrupt =
(record.ExceptionCode == EXCEPTION_BREAKPOINT);
}