From 75e18b5ec64a59776b27a9b8ee23b40dc12b5611 Mon Sep 17 00:00:00 2001 From: Mitchel Humpherys <mitchelh@codeaurora.org> Date: Fri, 6 Nov 2015 17:02:57 -0800 Subject: [PATCH] lrdp-v2: ramdump: Save config values in a dictionary It can be useful to look up the values of config items. Store a dictionary mapping config options to their values. Change-Id: I99f7615b2c5926558dfba100fa0c45b6e29ecdb5 --- linux-ramdump-parser-v2/ramdump.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/linux-ramdump-parser-v2/ramdump.py b/linux-ramdump-parser-v2/ramdump.py index feb9f6a..10af037 100644 --- a/linux-ramdump-parser-v2/ramdump.py +++ b/linux-ramdump-parser-v2/ramdump.py @@ -496,6 +496,7 @@ class RamDump(): self.phys_offset = options.phys_offset self.lookup_table = [] self.config = [] + self.config_dict = {} if self.arm64: self.page_offset = 0xffffffc000000000 self.thread_size = 16384 @@ -618,8 +619,14 @@ class RamDump(): os.remove(zconfig.name) for l in t: self.config.append(l.rstrip().decode('ascii', 'ignore')) + if not l.startswith('#') and l.strip() != '': + cfg, val = l.split('=') + self.config_dict[cfg] = val.strip() return True + def get_config_val(self, config): + return self.config_dict.get(config) + def is_config_defined(self, config): s = config + '=y' return s in self.config -- GitLab