Skip to content
Snippets Groups Projects
Commit 80268207 authored by Laura Abbott's avatar Laura Abbott
Browse files

linux-ramdump-parser-v2: Add sized read functions

The return size of read_word may change depending on the architecture.
Add functions to read specific types and sizes.

Change-Id: I3b9b11c263bf684a8e3783a10dcdc770a6a1b25e
parent 5ab8b9a8
No related branches found
No related tags found
No related merge requests found
......@@ -940,6 +940,29 @@ class RamDump():
else:
return s[0]
# returns a value guaranteed to be 32 bits
def read_u32(self, address, virtual=True, trace=False, cpu=None):
if trace:
print_out_str('reading {0:x}'.format(address))
s = self.read_string(address, '<I', virtual, trace, cpu)
if s is None:
return None
else:
return s[0]
def read_int(self, address, virtual=True, trace=False, cpu=None):
return self.read_u32(address, virtual, trace, cpu)
# returns a value guaranteed to be 16 bits
def read_u16(self, address, virtual=True, trace=False, cpu=None):
if trace:
print_out_str('reading {0:x}'.format(address))
s = self.read_string(address, '<H', virtual, trace, cpu)
if s is None:
return None
else:
return s[0]
def read_cstring(self, address, max_length, virtual=True, cpu=None, trace=False):
addr = address
if virtual:
......
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