forked from hatem-mahmoud/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
line_tracker.stp
93 lines (67 loc) · 2.38 KB
/
line_tracker.stp
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
global plsql_run_addr,monitor,b_monitor,last_offset
#PL/SQL begin execution
probe process("oracle").function("plsql_run").call {
plsql_run_addr = register("rdi");
monitor = 1;
printf("Line Begin|%d|%x|%x\n",local_clock_us(),0,0);
}
#PL/SQL end execution
probe process("oracle").function("plsql_run").return {
monitor = 0;
printf("Line End|%d|%x|%x\n",local_clock_us(),0,0);
}
probe process("oracle").function("p*").call
{
if ( monitor > 1 ) {
current_addr = plsql_run_addr+120;
base_addr1 = plsql_run_addr+144;
base_addr2 = user_int64(base_addr1);
base_addr3 = user_int64(base_addr2)+264;
KGLHDADR = user_int64(base_addr2)+104;
inst_offset = user_int64(current_addr) - user_int64(user_int64(base_addr3))
printf("Line Tracker|%d|%x|%x\n",local_clock_us(),inst_offset,user_int64(KGLHDADR));
}
}
#Follow plsql call
probe process("oracle").function("pfrinstr_ENTER").call {
if (b_monitor == 1) {
monitor = monitor + 1;
b_monitor = 0;
} else {
b_monitor = 2;
}
}
probe process("oracle").function("pfrust").call {
if ( b_monitor < 2 ) {
monitor = monitor - 1;
current_addr = plsql_run_addr+120;
base_addr1 = plsql_run_addr+144;
base_addr2 = user_int64(base_addr1);
base_addr3 = user_int64(base_addr2)+264;
KGLHDADR = user_int64(base_addr2)+104;
inst_offset = user_int64(current_addr) - user_int64(user_int64(base_addr3))
printf("Line Tracker|%d|%x|%x|%d\n",local_clock_us(),inst_offset,user_int64(KGLHDADR),99999)
} else {
b_monitor = 0;
}
}
probe process("oracle").function("prfinstr_XCAL").call {
b_monitor = 1;
current_addr = plsql_run_addr+120;
base_addr1 = plsql_run_addr+144;
base_addr2 = user_int64(base_addr1);
base_addr3 = user_int64(base_addr2)+264;
KGLHDADR = user_int64(base_addr2)+104;
inst_offset = user_int64(current_addr) - user_int64(user_int64(base_addr3))
last_offset = inst_offset;
}
probe process("oracle").function("pfrxca").call {
b_monitor = 1;
current_addr = plsql_run_addr+120;
base_addr1 = plsql_run_addr+144;
base_addr2 = user_int64(base_addr1);
base_addr3 = user_int64(base_addr2)+264;
KGLHDADR = user_int64(base_addr2)+104;
inst_offset = last_offset;
printf("Line Tracker|%d|%x|%x|%d\n",local_clock_us(),inst_offset,user_int64(KGLHDADR),monitor);
}