Skip to content
Snippets Groups Projects
Commit b70d9718 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

lrdp-v2: look for vmlinux in autodump dir when missing

It's not uncommon for the vmlinux file to live in the same directory as
the actual RAM dumps. If the users doesn't explicitly specify a vmlinux
image to use, look for it in the autodump dir. If we still can't find it
there, error out as usual.

Change-Id: I702c5584477e26912e0857dbd03b02491bd33c6c
parent 7b181bfb
No related branches found
No related tags found
No related merge requests found
......@@ -105,10 +105,6 @@ if __name__ == '__main__':
set_outfile(options.outdir + '/' + options.outfile)
print_out_str('Linux Ram Dump Parser Version %s' % VERSION)
if options.vmlinux is None:
print_out_str("No vmlinux given. I can't proceed!")
parser.print_usage()
sys.exit(1)
args = ''
for arg in sys.argv:
......@@ -118,6 +114,24 @@ if __name__ == '__main__':
system_type = parser_util.get_system_type()
if options.autodump is not None:
if os.path.exists(options.autodump):
print_out_str(
'Looking for Ram dumps in {0}'.format(options.autodump))
else:
print_out_str(
'Path {0} does not exist for Ram dumps. Exiting...'.format(options.autodump))
sys.exit(1)
if options.vmlinux is None:
autovm = os.path.join(options.autodump, 'vmlinux')
if os.path.isfile(autovm):
options.vmlinux = autovm
else:
print_out_str("No vmlinux given or found in autodump dir. I can't proceed!")
parser.print_usage()
sys.exit(1)
if not os.path.exists(options.vmlinux):
print_out_str(
'{0} does not exist. Cannot proceed without vmlinux. Exiting...'.format(options.vmlinux))
......@@ -126,8 +140,8 @@ if __name__ == '__main__':
print_out_str(
'{0} is not a file. Did you pass the ram file directory instead of the vmlinux?'.format(options.vmlinux))
sys.exit(1)
else:
print_out_str('using vmlinx file {0}'.format(options.vmlinux))
print_out_str('using vmlinux file {0}'.format(options.vmlinux))
if options.ram_addr is None and options.autodump is None:
print_out_str('Need one of --auto-dump or at least one --ram-file')
......@@ -143,15 +157,6 @@ if __name__ == '__main__':
'Ram file {0} does not exist. Exiting...'.format(a[0]))
sys.exit(1)
if options.autodump is not None:
if os.path.exists(options.autodump):
print_out_str(
'Looking for Ram dumps in {0}'.format(options.autodump))
else:
print_out_str(
'Path {0} does not exist for Ram dumps. Exiting...'.format(options.autodump))
sys.exit(1)
gdb_path = options.gdb
nm_path = options.nm
......
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