forked from hawkinsw/hwbp_lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
39 lines (31 loc) · 782 Bytes
/
Copy pathtest.cpp
File metadata and controls
39 lines (31 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include "hwbp.h"
using namespace std;
/*
* Example of how to use this /library/.
*/
int handled = 0;
void handle(int s) {
handled = 1;
return;
}
int main(int argc, char **argv) {
int a = 0;
if (!install_breakpoint(&a, sizeof(a), 0, handle)) {
cout << "failed to set the breakpoint!" << endl;
return 1;
}
cout << "About to read 'a'." << endl;
cout << "Done." << endl;
cout << "handled: " << handled << endl;
cout << endl;
cout << "About to write 'a'." << endl;
a = 1;
cout << "Done." << endl;
cout << "handled: " << handled << endl;
cout << endl;
if (!disable_breakpoint(0)) {
cout << "failed to disable the breakpoint!" << endl;
return 1;
}
}