ALARM_IMAGE_OFFSET_COUNT
[ALARM]


Classes

class  INSTLIB::ALARM_IMAGE_OFFSET_COUNT

Functions

ADDRINT INSTLIB::ALARM_IMAGE_OFFSET_COUNT::Count (THREADID tid=0) const
VOID INSTLIB::ALARM_IMAGE_OFFSET_COUNT::SetAlarm (UINT64 count, ALARM_HANDLER handler, VOID *val, THREADID tid=0, BOOL rearm=FALSE, BOOL always_armed=FALSE)
VOID INSTLIB::ALARM_IMAGE_OFFSET_COUNT::Activate (const CHAR *image_name, UINT64 offset)

Detailed Description

Signal an alarm when the specified offset in the specified image has been executed n times

The example below can be found in InstLibExamples/alarm_image_offset.cpp

#include <iostream>

#include "pin.H"
#include "alarm.H"

INSTLIB::ALARM_IMAGE_OFFSET_COUNT ialarm;

VOID Handler(VOID * val, CONTEXT * ctxt, VOID * ip, THREADID tid)
{
    INSTLIB::ALARM_IMAGE_OFFSET_COUNT * al = static_cast<INSTLIB::ALARM_IMAGE_OFFSET_COUNT *>(val);
    
    std::cout << "Alarm fired, resetting" << endl;
    al->SetAlarm(10, Handler, al);
}
    
// argc, argv are the entire command line, including pin -t <toolname> -- ...
int main(int argc, char * argv[])
{
    // Initialize pin
    PIN_InitSymbols();
    PIN_Init(argc, argv);

    // Activate alarm, must be done before PIN_StartProgram
    ialarm.Activate("/lib/tls/libc.so.6", 0x1563a);

    ialarm.SetAlarm(1, Handler, &ialarm);
    
    // Start the program, never returns
    PIN_StartProgram();
    
    return 0;
}



Function Documentation

VOID INSTLIB::ALARM_IMAGE_OFFSET_COUNT::Activate const CHAR *  image_name,
UINT64  offset
[inline, inherited]
 

This function initializes an alarm and must be called before PIN_StartProgram. It does turn the alarm on. Use SetAlarm.

Parameters:
symbol Name of symbol

ADDRINT INSTLIB::ALARM_IMAGE_OFFSET_COUNT::Count THREADID  tid = 0  )  const [inline, inherited]
 

Returns:
Remaining count for this alarm

VOID INSTLIB::ALARM_IMAGE_OFFSET_COUNT::SetAlarm UINT64  count,
ALARM_HANDLER  handler,
VOID *  val,
THREADID  tid = 0,
BOOL  rearm = FALSE,
BOOL  always_armed = FALSE
[inline, inherited]
 

Turn on an alarm. You should call Activate for this alarm before PIN_StartProgram

Parameters:
count Number of times to execution address before alarm fires
handler Call this function when alarm fires
val Pass this value to the handler when the alarm fires


Generated on Thu May 15 03:23:41 2008 for Pin by  doxygen 1.4.6