forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.py
72 lines (46 loc) · 1.54 KB
/
util.py
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
"""
GDB utility convenience functions.
"""
from compatibility import *
import gdb
from gdbutils import *
#------------------------------------------------------------------------------
# `ptr' function.
class PtrFunction(gdb.Function):
def __init__(self):
super(PtrFunction, self).__init__('ptr')
@errorwrap
def invoke(self, val):
return rawptr(val)
PtrFunction._PtrFunction__doc__ = rawptr.__doc__
PtrFunction()
#------------------------------------------------------------------------------
# `deref' function.
class DerefFunction(gdb.Function):
def __init__(self):
super(DerefFunction, self).__init__('deref')
@errorwrap
def invoke(self, val):
return deref(val)
DerefFunction._DerefFunction__doc__ = deref.__doc__
DerefFunction()
#------------------------------------------------------------------------------
# `strhash' function.
class StrhashFunction(gdb.Function):
"""Return the hash of a string."""
def __init__(self):
super(StrhashFunction, self).__init__('strhash')
@errorwrap
def invoke(self, val):
return strinfo(val)['hash']
StrhashFunction()
#------------------------------------------------------------------------------
# `hhcry' command.
class HHCryCommand(gdb.Command):
"""Perform a bunch of obscure actions for unspecified reasons."""
def __init__(self):
super(HHCryCommand, self).__init__('hhcry', gdb.COMMAND_SUPPORT)
@errorwrap
def invoke(self, args, from_tty):
invalidate_all_memoizers()
HHCryCommand()