Skip to content
Snippets Groups Projects
Commit 4b878043 authored by Laura Abbott's avatar Laura Abbott
Browse files

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
parent 88c731ed
No related branches found
No related tags found
No related merge requests found
...@@ -14,20 +14,36 @@ from print_out import print_out_str ...@@ -14,20 +14,36 @@ from print_out import print_out_str
from parser_util import register_parser, RamParser, cleanupString from parser_util import register_parser, RamParser, cleanupString
def find_panic(ramdump, addr_stack, thread_task_name): def find_panic(ramdump, addr_stack, thread_task_name):
for i in range(addr_stack, addr_stack + 0x2000, 4): if ramdump.arm64:
pc = ramdump.read_word(i) stack_size = 0x4000
lr = ramdump.read_word(i + 4) increment = 8
spx = ramdump.read_word(i + 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) l = ramdump.unwind_lookup(pc)
if l is not None: if l is not None:
s, offset = l s, offset = l
if s == 'panic': if s == 'panic':
print_out_str('Faulting process found! Name {0}. Attempting to retrieve stack (sp = {1:x} pc = {2:x})'.format( print_out_str('Faulting process found! Name {0})'.format(thread_task_name))
thread_task_name, i + 4, pc)) ramdump.unwind.unwind_backtrace(spx, fp, pc, lr, '')
ramdump.unwind.unwind_backtrace(i + 4, 0, pc, lr, '')
regspanic = ramdump.open_file('regs_panic.cmm') regspanic = ramdump.open_file('regs_panic.cmm')
regspanic.write('r.s pc 0x{0:x}\n'.format(pc)) if ramdump.arm64:
regspanic.write('r.s r13 0x{0:x}\n'.format(i + 4)) 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() regspanic.close()
return True return True
return False return False
......
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