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

Merge "linux-ramdump-parser-v2: Pass options object to RamDump constructor"

parents babff3e0 5e7d333a
Branches
No related tags found
No related merge requests found
...@@ -438,35 +438,32 @@ class RamDump(): ...@@ -438,35 +438,32 @@ class RamDump():
if urc < 0: if urc < 0:
break break
def __init__(self, vmlinux_path, nm_path, gdb_path, objdump_path, ebi, def __init__(self, options, nm_path, gdb_path, objdump_path):
file_path, phys_offset, outdir, qtf_path, hw_id=None,
hw_version=None, arm64=False, page_offset=None, qtf=False,
t32_host_system=None):
self.ebi_files = [] self.ebi_files = []
self.phys_offset = None self.phys_offset = None
self.tz_start = 0 self.tz_start = 0
self.ebi_start = 0 self.ebi_start = 0
self.cpu_type = None self.cpu_type = None
self.hw_id = hw_id self.hw_id = options.force_hardware or None
self.hw_version = hw_version self.hw_version = options.force_hardware_version or None
self.offset_table = [] self.offset_table = []
self.vmlinux = vmlinux_path self.vmlinux = options.vmlinux
self.nm_path = nm_path self.nm_path = nm_path
self.gdb_path = gdb_path self.gdb_path = gdb_path
self.objdump_path = objdump_path self.objdump_path = objdump_path
self.outdir = outdir self.outdir = options.outdir
self.imem_fname = None self.imem_fname = None
self.gdbmi = gdbmi.GdbMI(self.gdb_path, self.vmlinux) self.gdbmi = gdbmi.GdbMI(self.gdb_path, self.vmlinux)
self.gdbmi.open() self.gdbmi.open()
self.arm64 = arm64 self.arm64 = options.arm64
self.page_offset = 0xc0000000 self.page_offset = 0xc0000000
self.thread_size = 8192 self.thread_size = 8192
self.qtf_path = qtf_path self.qtf_path = options.qtf_path
self.qtf = qtf self.qtf = options.qtf
self.t32_host_system = t32_host_system self.t32_host_system = options.t32_host_system or None
if ebi is not None: if options.ram_addr is not None:
# TODO sanity check to make sure the memory regions don't overlap # TODO sanity check to make sure the memory regions don't overlap
for file_path, start, end in ebi: for file_path, start, end in options.ram_addr:
fd = open(file_path, 'rb') fd = open(file_path, 'rb')
if not fd: if not fd:
print_out_str( print_out_str(
...@@ -474,25 +471,26 @@ class RamDump(): ...@@ -474,25 +471,26 @@ class RamDump():
continue continue
self.ebi_files.append((fd, start, end, file_path)) self.ebi_files.append((fd, start, end, file_path))
else: else:
if not self.auto_parse(file_path): if not self.auto_parse(options.autodump):
return None return None
if self.ebi_start == 0: if self.ebi_start == 0:
self.ebi_start = self.ebi_files[0][1] self.ebi_start = self.ebi_files[0][1]
if self.phys_offset is None: if self.phys_offset is None:
self.get_hw_id() self.get_hw_id()
if phys_offset is not None: if options.phys_offset is not None:
print_out_str( print_out_str(
'[!!!] Phys offset was set to {0:x}'.format(phys_offset)) '[!!!] Phys offset was set to {0:x}'.format(\
self.phys_offset = phys_offset options.phys_offset))
self.phys_offset = options.phys_offset
self.lookup_table = [] self.lookup_table = []
self.config = [] self.config = []
if self.arm64: if self.arm64:
self.page_offset = 0xffffffc000000000 self.page_offset = 0xffffffc000000000
self.thread_size = 16384 self.thread_size = 16384
if page_offset is not None: if options.page_offset is not None:
print_out_str( print_out_str(
'[!!!] Page offset was set to {0:x}'.format(page_offset)) '[!!!] Page offset was set to {0:x}'.format(page_offset))
self.page_offset = page_offset self.page_offset = options.page_offset
self.setup_symbol_tables() self.setup_symbol_tables()
# The address of swapper_pg_dir can be used to determine # The address of swapper_pg_dir can be used to determine
......
#!/usr/bin/env python2 #!/usr/bin/env python2
# Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. # Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 and # it under the terms of the GNU General Public License version 2 and
...@@ -273,12 +273,7 @@ if __name__ == '__main__': ...@@ -273,12 +273,7 @@ if __name__ == '__main__':
if options.everything: if options.everything:
options.qtf = True options.qtf = True
dump = RamDump(options.vmlinux, nm_path, gdb_path, objdump_path, options.ram_addr, dump = RamDump(options, nm_path, gdb_path, objdump_path)
options.autodump, options.phys_offset, options.outdir, options.qtf_path,
options.force_hardware, options.force_hardware_version,
arm64=options.arm64,
page_offset=options.page_offset, qtf=options.qtf,
t32_host_system=options.t32_host_system)
if options.shell or options.classic_shell: if options.shell or options.classic_shell:
print("Entering interactive shell mode.") print("Entering interactive shell mode.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment