From 4b878043309e88af813468ae0116ea190d569864 Mon Sep 17 00:00:00 2001 From: Laura Abbott <lauraa@codeaurora.org> Date: Wed, 13 Aug 2014 10:36:09 -0700 Subject: [PATCH] linux-ramdump-parser-v2: Add support for --check-for-panic on arm64 --check-for-panic works by scanning the stacks of each task and finding a pc that matches 'panic'. arm64 and arm have different stack disciplines so the scanning code needs to account for this. Update this to work with both arm and arm64. Change-Id: I65f05156c51c117713a6dd0e87ca71fd09e17568 --- linux-ramdump-parser-v2/parsers/taskdump.py | 34 +++++++++++++++------ 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/linux-ramdump-parser-v2/parsers/taskdump.py b/linux-ramdump-parser-v2/parsers/taskdump.py index ad1ca27..83555bd 100644 --- a/linux-ramdump-parser-v2/parsers/taskdump.py +++ b/linux-ramdump-parser-v2/parsers/taskdump.py @@ -14,20 +14,36 @@ from print_out import print_out_str from parser_util import register_parser, RamParser, cleanupString def find_panic(ramdump, addr_stack, thread_task_name): - for i in range(addr_stack, addr_stack + 0x2000, 4): - pc = ramdump.read_word(i) - lr = ramdump.read_word(i + 4) - spx = ramdump.read_word(i + 8) + if ramdump.arm64: + stack_size = 0x4000 + increment = 8 + else: + stack_size = 0x2000 + increment = 4 + for i in range(addr_stack, addr_stack + stack_size, increment): + if ramdump.arm64: + pc = ramdump.read_word(i + 8) - 4 + fp = ramdump.read_word(i) + spx = i + 16 + lr = 0 + else: + pc = ramdump.read_word(i) + lr = ramdump.read_word(i + 4) + spx = i + 4 + fp = 0 l = ramdump.unwind_lookup(pc) if l is not None: s, offset = l if s == 'panic': - print_out_str('Faulting process found! Name {0}. Attempting to retrieve stack (sp = {1:x} pc = {2:x})'.format( - thread_task_name, i + 4, pc)) - ramdump.unwind.unwind_backtrace(i + 4, 0, pc, lr, '') + print_out_str('Faulting process found! Name {0})'.format(thread_task_name)) + ramdump.unwind.unwind_backtrace(spx, fp, pc, lr, '') regspanic = ramdump.open_file('regs_panic.cmm') - regspanic.write('r.s pc 0x{0:x}\n'.format(pc)) - regspanic.write('r.s r13 0x{0:x}\n'.format(i + 4)) + if ramdump.arm64: + regspanic.write('r.s pc 0x{0:x}\n'.format(pc)) + regspanic.write('r.s sp 0x{0:x}\n'.format(spx)) + else: + regspanic.write('r.s pc 0x{0:x}\n'.format(pc)) + regspanic.write('r.s r13 0x{0:x}\n'.format(i + 4)) regspanic.close() return True return False -- GitLab