ALARM_SYMBOL_COUNT
[ALARM]


Classes

class  INSTLIB::ALARM_SYMBOL_COUNT

Functions

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

Detailed Description

Signal an alarm when the specified symbol has been executed n times

The example below can be found in InstLibExamples/alarm_symbol.C

#include <iostream>
#include <string.h>
#include "pin.H"
#include "alarm.H"

INSTLIB::ALARM_SYMBOL_COUNT ialarm;

VOID Handler(VOID * val, CONTEXT * ctxt, VOID * ip, THREADID tid)
{
    INSTLIB::ALARM_SYMBOL_COUNT * al = static_cast<INSTLIB::ALARM_SYMBOL_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("fixup");

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



Function Documentation

VOID INSTLIB::ALARM_SYMBOL_COUNT::Activate const CHAR *  symbol  )  [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_SYMBOL_COUNT::Count THREADID  tid = 0  )  const [inline, inherited]
 

Returns:
Remaining count for this alarm

VOID INSTLIB::ALARM_SYMBOL_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 execute this address before alarm fires
handler Call this function when alarm fires
val Pass this value to the handler when the alarm fires

const CHAR* INSTLIB::ALARM_SYMBOL_COUNT::Symbol  )  const [inline, inherited]
 

Returns:
Label for alarm


Generated on Tue Nov 22 12:28:41 2011 for Pin by  doxygen 1.4.6