Repository navigation
Expand file tree
/
Copy patheacy.py
More file actions
76 lines (65 loc) · 2.4 KB
/
Copy patheacy.py
File metadata and controls
76 lines (65 loc) · 2.4 KB
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
'''
Copyright 2023 Matthew Peter Smith
This code is provided under an MIT License.
See LICENSE.txt at the root of this Git repository.
'''
import gdb
gdb.execute("set $eacy_rev = 0")
class EACBreak(gdb.Command):
def __init__(self):
super(EACBreak, self).__init__("eacbreak", gdb.COMMAND_USER)
def invoke(self, bp_name, from_tty):
bp = gdb.Breakpoint(bp_name)
if(len(bp.locations) == 0):
print("Failed to create a breakpoint.")
return
if(len(bp.locations) == 1):
return
opt = 0
while opt + 1 < len(bp.locations) and bp.locations[opt].source is None:
opt += 1
min = bp.locations[opt].source[1]
for k in range(opt+1, len(bp.locations)):
if (bp.locations[k].source is None):
continue
if(bp.locations[k].source[1] < min):
min = bp.locations[k].source[1]
opt = k
for k in range(len(bp.locations)):
if k != opt:
bp.locations[k].enabled = False
EACBreak()
class EACTBreak(gdb.Command):
def __init__(self):
super(EACTBreak, self).__init__("eactbreak", gdb.COMMAND_USER)
def invoke(self, bp_name, from_tty):
bp = gdb.Breakpoint(bp_name, temporary = True)
if(len(bp.locations) == 0):
print("Failed to create a temporary breakpoint.")
return
if(len(bp.locations) == 1):
return
opt = 0
while opt + 1 < len(bp.locations) and bp.locations[opt].source is None:
opt += 1
min = bp.locations[opt].source[1]
for k in range(opt+1, len(bp.locations)):
if (bp.locations[k].source is None):
continue
if(bp.locations[k].source[1] < min):
min = bp.locations[k].source[1]
opt = k
for k in range(len(bp.locations)):
if k != opt:
bp.locations[k].enabled = False
EACTBreak()
class EACReload(gdb.Command):
def __init__(self):
super(EACReload, self).__init__("eacreload", gdb.COMMAND_USER)
def invoke(self, arg, from_tty):
gdb.execute("set $eacy_rev = $eacy_rev + 1")
gdb.execute("eval \"shell rm -rf .eac.%d\", $eacy_rev")
gdb.execute("eval \"shell cp -r .eac .eac.%d\", $eacy_rev")
gdb.execute("call EACRevision($eacy_rev)")
# gdb.execute("set reload = 1")
EACReload()