Skip to content
Snippets Groups Projects
Commit c59c224b authored by Tengfei Fan's avatar Tengfei Fan
Browse files

lrdp-v2: dump Dsleep and Running task to hightlight_task.txt


Dump Dsleep and Running task to hightlight_task.txt

Change-Id: Idefe615588c8bed4001f39564062c77fc799dbfd
Signed-off-by: default avatarTengfei Fan <tengfeif@codeaurora.org>
parent f6f6e02d
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
import string import string
from print_out import print_out_str from print_out import print_out_str
from parser_util import register_parser, RamParser, cleanupString from parser_util import register_parser, RamParser, cleanupString
taskhighlight_out = None
highlight_tasks = "\n=====List of all runing and uninterruptable sleep process====\n"
def find_panic(ramdump, addr_stack, thread_task_name): def find_panic(ramdump, addr_stack, thread_task_name):
if ramdump.arm64: if ramdump.arm64:
...@@ -49,8 +50,9 @@ def find_panic(ramdump, addr_stack, thread_task_name): ...@@ -49,8 +50,9 @@ def find_panic(ramdump, addr_stack, thread_task_name):
return True return True
return False return False
task_state_name = ["Runing", "ISleep", "DSleep"]
def dump_thread_group(ramdump, thread_group, task_out, check_for_panic=0): def dump_thread_group(ramdump, thread_group, task_out, taskhighlight_out, check_for_panic=0):
global highlight_tasks
offset_thread_group = ramdump.field_offset( offset_thread_group = ramdump.field_offset(
'struct task_struct', 'thread_group') 'struct task_struct', 'thread_group')
offset_comm = ramdump.field_offset('struct task_struct', 'comm') offset_comm = ramdump.field_offset('struct task_struct', 'comm')
...@@ -85,6 +87,10 @@ def dump_thread_group(ramdump, thread_group, task_out, check_for_panic=0): ...@@ -85,6 +87,10 @@ def dump_thread_group(ramdump, thread_group, task_out, check_for_panic=0):
task_state = ramdump.read_word(next_thread_state) task_state = ramdump.read_word(next_thread_state)
if task_state is None: if task_state is None:
return return
if task_state < 3:
task_state_str = task_state_name[task_state]
else:
task_state_str = task_state
task_exit_state = ramdump.read_int(next_thread_exit_state) task_exit_state = ramdump.read_int(next_thread_exit_state)
if task_exit_state is None: if task_exit_state is None:
return return
...@@ -96,6 +102,24 @@ def dump_thread_group(ramdump, thread_group, task_out, check_for_panic=0): ...@@ -96,6 +102,24 @@ def dump_thread_group(ramdump, thread_group, task_out, check_for_panic=0):
return return
if not check_for_panic: if not check_for_panic:
task_cpu = ramdump.get_task_cpu(next_thread_start, threadinfo) task_cpu = ramdump.get_task_cpu(next_thread_start, threadinfo)
#thread_line = thread_task_pid + task_cpu + task_state_str+ next_thread_start+thread_task_name
thread_line = "PID %6d cpu %1d state %16s start 0x%x comm %32s\n" %(thread_task_pid, task_cpu, task_state_str, next_thread_start, thread_task_name)
if task_state != 1:
if not first:
highlight_tasks += "*" + thread_line
taskhighlight_out.write("**"+thread_line)
else:
highlight_tasks += " " + thread_line
taskhighlight_out.write(" " + thread_line)
ramdump.unwind.unwind_backtrace(
ramdump.thread_saved_sp(next_thread_start),
ramdump.thread_saved_fp(next_thread_start),
ramdump.thread_saved_pc(next_thread_start),
0, ' ', taskhighlight_out)
thread_line = '+' + thread_line
else:
thread_line = ' ' + thread_line
if not first: if not first:
task_out.write('Process: {0}, cpu: {1} pid: {2} start: 0x{3:x}\n'.format( task_out.write('Process: {0}, cpu: {1} pid: {2} start: 0x{3:x}\n'.format(
thread_task_name, task_cpu, thread_task_pid, next_thread_start)) thread_task_name, task_cpu, thread_task_pid, next_thread_start))
...@@ -146,11 +170,13 @@ def do_dump_stacks(ramdump, check_for_panic=0): ...@@ -146,11 +170,13 @@ def do_dump_stacks(ramdump, check_for_panic=0):
seen_tasks = [] seen_tasks = []
if check_for_panic == 0: if check_for_panic == 0:
task_out = ramdump.open_file('tasks.txt') task_out = ramdump.open_file('tasks.txt')
taskhighlight_out = ramdump.open_file('tasks_highlight.txt')
else: else:
task_out = None task_out = None
taskhighlight_out = None
while True: while True:
dump_thread_group(ramdump, init_thread_group, dump_thread_group(ramdump, init_thread_group,
task_out, check_for_panic) task_out, taskhighlight_out, check_for_panic)
next_task = ramdump.read_word(init_next_task) next_task = ramdump.read_word(init_next_task)
if next_task is None: if next_task is None:
init_next_task = init_addr + offset_tasks init_next_task = init_addr + offset_tasks
...@@ -203,6 +229,8 @@ def do_dump_stacks(ramdump, check_for_panic=0): ...@@ -203,6 +229,8 @@ def do_dump_stacks(ramdump, check_for_panic=0):
break break
if check_for_panic == 0: if check_for_panic == 0:
task_out.close() task_out.close()
taskhighlight_out.write(highlight_tasks + "\n")
taskhighlight_out.close()
print_out_str('---wrote tasks to tasks.txt') print_out_str('---wrote tasks to tasks.txt')
def do_dump_task_timestamps(ramdump): def do_dump_task_timestamps(ramdump):
......
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