You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.8 KiB

/*
* Copyright 2002-2019 Intel Corporation.
*
* This software is provided to you as Sample Source Code as defined in the accompanying
* End User License Agreement for the Intel(R) Software Development Products ("Agreement")
* section 1.L.
*
* This software and the related documents are provided as is, with no express or implied
* warranties, other than those that are expressly stated in the License.
*/
/* ===================================================================== */
/*! @file
This tool is used for testing the "DEBUGGER_ERROR" error code.
*/
/* ===================================================================== */
#include "pin.H"
#include <iostream>
#ifdef TARGET_MAC
#define BAR_FN_NAME "_Bar2"
#else
#define BAR_FN_NAME "Bar2"
#endif
/* ===================================================================== */
void Before( )
{
PIN_ERROR_DEBUGGER( "Debugger error");
}
/* ===================================================================== */
VOID ImageLoad(IMG img, VOID *v)
{
for (SEC sec = IMG_SecHead(img); SEC_Valid(sec); sec = SEC_Next(sec))
{
for (RTN rtn = SEC_RtnHead(sec); RTN_Valid(rtn); rtn = RTN_Next(rtn))
{
if (RTN_Name(rtn) == BAR_FN_NAME)
{
RTN_Open(rtn);
RTN_InsertCall(rtn, IPOINT_BEFORE, AFUNPTR(Before), IARG_END);
RTN_Close(rtn);
}
}
}
}
/* ===================================================================== */
int main(INT32 argc, CHAR *argv[])
{
PIN_InitSymbols();
PIN_Init(argc, argv);
IMG_AddInstrumentFunction(ImageLoad, 0);
PIN_StartProgram();
return 0;
}
/* ===================================================================== */
/* eof */
/* ===================================================================== */