Skip to content
Snippets Groups Projects
Commit 5d521765 authored by Soumen Ghosh's avatar Soumen Ghosh
Browse files

lrdp-v2: vmlinux linux banner timestamp matching with ramdump

	Read the linux banner data from vmlinux rodata section.
	Also read the linux banner data from ramump. Do a matching of both the data.
	If success then ramparser will go ahead and proces further
Change-Id: I1b9245f1a4fcc9cdff0a3bfb7293b2385981feba
parent a60260db
Branches
No related tags found
No related merge requests found
...@@ -291,6 +291,20 @@ class GdbMI(object): ...@@ -291,6 +291,20 @@ class GdbMI(object):
result = self._run_for_one('print /d {0}'.format(symbol)) result = self._run_for_one('print /d {0}'.format(symbol))
return int(result.split(' ')[-1], 10) return int(result.split(' ')[-1], 10)
def get_value_of_string(self, symbol):
"""Returns the value of a symbol (as a string)"""
cmd = 'print /s {0}'.format(symbol)
result = self._run(cmd)
if len(result.lines) == 0:
raise GdbMIException(
cmd, '\n'.join(result.lines + result.oob_lines))
match = re.search(r'^[$]\d+ = \\"(.*)(\\\\n\\")', result.lines[0])
if match:
return match.group(1)
return None
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) != 3: if len(sys.argv) != 3:
print('Usage: gdbmi.py gdb_path elf') print('Usage: gdbmi.py gdb_path elf')
......
...@@ -831,7 +831,18 @@ class RamDump(): ...@@ -831,7 +831,18 @@ class RamDump():
print_out_str('Linux Banner: ' + b.rstrip()) print_out_str('Linux Banner: ' + b.rstrip())
print_out_str('version = {0}'.format(self.version)) print_out_str('version = {0}'.format(self.version))
vm_v = self.gdbmi.get_value_of_string('linux_banner')
if vm_v is None:
print_out_str('!!! Could not read banner address from vmlinux!')
return False
if str(vm_v) in str(b):
print_out_str("Linux banner from vmlinux = %s" % vm_v)
print_out_str("Linux banner from dump = %s" % b)
return True return True
else:
print_out_str("Expected Linux banner = %s" % vm_v)
print_out_str("But Linux banner got = %s" % b)
return False
else: else:
print_out_str('!!! Could not lookup banner address') print_out_str('!!! Could not lookup banner address')
return False return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment