-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodify.cpp
More file actions
22 lines (20 loc) · 701 Bytes
/
modify.cpp
File metadata and controls
22 lines (20 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <sys/fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include "BPatch.h"
#include "BPatch_Vector.h"
#include "BPatch_thread.h"
#include "BPatch_snippet.h"
int main(int argc,char** argv){
BPatch* bpatch = new BPatch ;
BPatch_Vector<BPatch_function*> old_func ;
BPatch_Vector<BPatch_function*> new_func ;
BPatch_process* app = bpatch->processAttach("test_dynamic",atoi(argv[1])) ;
BPatch_image* appImage = app->getImage() ;
BPatch_Vector<BPatch_function*> *tmp = appImage->findFunction("old",old_func) ;
tmp = appImage->findFunction("new",new_func) ;
app->replaceFunction(*old_func[0],*new_func[0]) ;
app->detach(1) ;
return 0 ;
}