static void *MallocProbe(void *(*origMalloc)(size_t), UINT32 mallocNum, size_t size, ADDRINT appTP)
{
#if defined(TARGET_IPF)
    ADDRINT toolTP = IPF_GetTP();
    IPF_SetTP(appTP);
    void *ptr = origMalloc(size);
    IPF_SetTP(toolTP);
#else
    void *ptr = origMalloc(size);
#endif

    PIN_LockClient();
    TraceFile << mallocNum << " malloc(" << size << ") returns " << ptr << std::endl;
    PIN_UnlockClient();

    return ptr;
}
static void *MallocProbe(void *(*origMalloc)(size_t), UINT32 mallocNum, size_t size, ADDRINT appTP)
{
    void *ptr = origMalloc(size);
    PIN_LockClient();
    TraceFile << mallocNum << " malloc(" << size << ") returns " << ptr << std::endl;
    PIN_UnlockClient();

    return ptr;
}