Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.9/dist-packages/pyvex/data_ref.py: 35%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1def data_ref_type_str(dref_enum):
2 """
3 Translate an ``enum DataRefTypes`` value into a string representation.
4 """
5 if dref_enum == 0x9000:
6 return "unknown"
7 elif dref_enum == 0x9001:
8 return "integer"
9 elif dref_enum == 0x9002:
10 return "fp"
11 elif dref_enum == 0x9003:
12 return "integer(store)"
13 else:
14 return "INVALID"
17class DataRef:
18 """
19 A data reference object. Indicates a data access in an IRSB.
21 :ivar data_addr: The address of the data being accessed
22 :ivar data_size: The size of the data being accessed, in bytes
23 :ivar data_type: The type of the data, a DataRefTypes enum.
24 :ivar stmt_idx: The IRSB statement index containing the data access
25 :ivar ins_addr: The address of the instruction performing the data access
26 """
28 __slots__ = ("data_addr", "data_size", "data_type", "stmt_idx", "ins_addr")
30 def __init__(self, data_addr, data_size, data_type, stmt_idx, ins_addr):
31 self.data_addr = data_addr
32 self.data_size = data_size
33 self.data_type = data_type
34 self.stmt_idx = stmt_idx
35 self.ins_addr = ins_addr
37 @property
38 def data_type_str(self):
39 """
40 The data ref type as a string, "unknown" "integer" "fp" or "INVALID"
41 """
42 return data_ref_type_str(self.data_type)
44 def __repr__(self):
45 return "<DataRef accessing %#x %s:%d at %#x:%d>" % (
46 self.data_addr,
47 data_ref_type_str(self.data_type),
48 self.data_size,
49 self.ins_addr,
50 self.stmt_idx,
51 )
53 @classmethod
54 def from_c(cls, r):
55 return cls(r.data_addr, r.size, r.data_type, r.stmt_idx, r.ins_addr)