| Date: | Thu, 28 Feb 2008 11:43:03 +0530 (IST) |
|---|---|
| From: | alok singh <alok_shishir@xxxxxxxxxxx> |
| Subject: | [DynInst_API:] Fw: Not able to get my sample program working |
|
-----Inline Attachment Follows----- #include <iostream.h> #include "/usr/include/dyninst/BPatch.h" #include "/usr/include/dyninst/BPatch_image.h" #include "/usr/include/dyninst/BPatch_thread.h" #include "/usr/include/dyninst/BPatch_Vector.h" #include "/usr/include/dyninst/BPatch_point.h" using namespace std; int main() { BPatch bpatch; BPatch_thread *appThread->bpatch.createProcess("/home/alok/Documents/Dyninst/inline", ""); BPatch_image *appImage = appThread->getImage(); BPatch_Vector<BPatch_point*> *points = appImage->findFunctionByAddr("f"); BPatch_variableExpr *intCounter = appThread->malloc(*appImage->findType("int")); /*int zero = 0; intCounter.writeValue(&zero);*/ BPatch_arithExpr addOne(BPatch_assign, *intCounter, BPatch_arithExpr(BPatch_plus, *intCounter, BPatch_constExpr(1))); appThread->insertSnippet(addOne, *points); } -----Inline Attachment Follows----- #include <stdio.h> #include <stdlib.h> #include <string.h> #define N 1 //#define INCOMING_FRAME_SP_OFFSET //void TARGET_ASM_FUNCTION_PROLOGUE (FILE *file, HOST_WIDE_INT size); /*void __cyg_profile_func_enter( void *func_address, void *call_site ) __attribute__ ((no_instrument_function)); void __cyg_profile_func_enter( void *func_address, void *call_site ) { printf("haha\n"); } void __cyg_profile_func_exit ( void *func_address, void *call_site ) __attribute__ ((no_instrument_function)); void __cyg_profile_func_exit ( void *func_address, void *call_site ) { printf("hehe\n"); }*/ void f() { printf("I am a function\n"); } int main(int argc, char ** argv) { f(); // TARGET_ASM_FUNCTION_EPILOGUE(stdout, 1000); // printf("INCOMING_FRAME_SP_OFFSET:%d\n", INCOMING_FRAME_SP_OFFSET); f(); f(); return 0; } Get the freedom to save as many mails as you wish. Click here to know how. #include <iostream.h>
#include "/usr/include/dyninst/BPatch.h"
#include "/usr/include/dyninst/BPatch_image.h"
#include "/usr/include/dyninst/BPatch_thread.h"
#include "/usr/include/dyninst/BPatch_Vector.h"
#include "/usr/include/dyninst/BPatch_point.h"
using namespace std;
int main()
{
BPatch bpatch;
BPatch_thread *appThread->bpatch.createProcess("/home/alok/Documents/Dyninst/inline", "");
BPatch_image *appImage = appThread->getImage();
BPatch_Vector<BPatch_point*> *points = appImage->findFunctionByAddr("f");
BPatch_variableExpr *intCounter = appThread->malloc(*appImage->findType("int"));
/*int zero = 0;
intCounter.writeValue(&zero);*/
BPatch_arithExpr addOne(BPatch_assign, *intCounter, BPatch_arithExpr(BPatch_plus, *intCounter, BPatch_constExpr(1)));
appThread->insertSnippet(addOne, *points);
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 1
//#define INCOMING_FRAME_SP_OFFSET
//void TARGET_ASM_FUNCTION_PROLOGUE (FILE *file, HOST_WIDE_INT size);
/*void __cyg_profile_func_enter( void *func_address, void *call_site )
__attribute__ ((no_instrument_function));
void __cyg_profile_func_enter( void *func_address, void *call_site )
{
printf("haha\n");
}
void __cyg_profile_func_exit ( void *func_address, void *call_site )
__attribute__ ((no_instrument_function));
void __cyg_profile_func_exit ( void *func_address, void *call_site )
{
printf("hehe\n");
}*/
void f()
{
printf("I am a function\n");
}
int main(int argc, char ** argv)
{
f();
// TARGET_ASM_FUNCTION_EPILOGUE(stdout, 1000);
// printf("INCOMING_FRAME_SP_OFFSET:%d\n", INCOMING_FRAME_SP_OFFSET);
f();
f();
return 0;
}
Attachment:
inline |
| [← Prev in Thread] | Current Thread | [Next in Thread→] |
|---|---|---|
| ||
| Previous by Date: | , (nil) |
|---|---|
| Next by Date: | [DynInst_API:] Reg. symtabAPI - findLocalVariable method, Praveen Venkatachari |
| Previous by Thread: | , (nil) |
| Next by Thread: | [DynInst_API:] Reg. symtabAPI - findLocalVariable method, Praveen Venkatachari |
| Indexes: | [Date] [Thread] |