Skip to content
Snippets Groups Projects
Commit e6f9d44b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "lrdp-v2: Add accessor for pointer variables"

parents 9fe813a1 fb5e7dda
No related branches found
No related tags found
No related merge requests found
......@@ -1142,6 +1142,16 @@ class RamDump():
s = self.read_string(addr_or_name, '<H', virtual, cpu)
return s[0] if s is not None else None
def read_pointer(self, addr_or_name, virtual=True, cpu=None):
"""Reads `addr_or_name' as a pointer variable.
The read length is either 32-bit or 64-bit depending on the
architecture. This returns the *value* of the pointer variable
(i.e. the address it contains), not the data it points to.
"""
fn = self.read_u32 if self.sizeof('void *') == 4 else self.read_u64
return fn(addr_or_name, virtual, cpu)
def read_structure_field(self, addr_or_name, struct_name, field):
"""reads a 4 or 8 byte field from a structure"""
size = self.sizeof("(({0} *)0)->{1}".format(struct_name, field))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment