Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tools
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
vendor
qcom-opensource
tools
Commits
4372c731
Commit
4372c731
authored
11 years ago
by
Linux Build Service Account
Committed by
Gerrit - the friendly Code Review server
11 years ago
Browse files
Options
Downloads
Plain Diff
Merge "linux-ramdump-parser-v2: Cleanup task dumping"
parents
6f4d70cf
351e249e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
linux-ramdump-parser-v2/parsers/taskdump.py
+11
-44
11 additions, 44 deletions
linux-ramdump-parser-v2/parsers/taskdump.py
linux-ramdump-parser-v2/ramdump.py
+15
-0
15 additions, 0 deletions
linux-ramdump-parser-v2/ramdump.py
with
26 additions
and
44 deletions
linux-ramdump-parser-v2/parsers/taskdump.py
+
11
−
44
View file @
4372c731
...
@@ -13,43 +13,6 @@ import string
...
@@ -13,43 +13,6 @@ 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
cpu_context_save_str
=
''
.
join
([
'
I
'
,
# __u32 r4
'
I
'
,
# __u32 r5
'
I
'
,
# __u32 r6
'
I
'
,
# __u32 r7
'
I
'
,
# __u32 r8
'
I
'
,
# __u32 r9
'
I
'
,
# __u32 sl
'
I
'
,
# __u32 fp 14
'
I
'
,
# __u32 sp 15
'
I
'
,
# __u32 pc 16
'
II
'
,
# __u32 extra[2] /* Xscale 'acc' register, etc */
])
thread_info_str
=
''
.
join
([
# struct thread_info {
'
I
'
,
# flags /* low level flags */
# int preempt_count /* 0 => preemptable, <0 => bug */
'
I
'
,
'
I
'
,
# addr_limit /* address limit */
'
I
'
,
# task
'
I
'
,
# exec_domain /* execution domain */
'
I
'
,
# 5 cpu /* cpu */
'
I
'
,
# cpu_domain /* cpu domain */
# struct cpu_context_save cpu_context /* cpu context */
cpu_context_save_str
,
'
I
'
,
# syscall /* syscall number */
# unsigned char used_cp[16] /* thread used copro */
'
I
'
,
'
I
'
,
# tp_value
])
thread_info_cpu_idx
=
5
thread_info_fp_idx
=
14
thread_info_sp_idx
=
15
thread_info_pc_idx
=
16
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
):
for
i
in
range
(
addr_stack
,
addr_stack
+
0x2000
,
4
):
pc
=
ramdump
.
read_word
(
i
)
pc
=
ramdump
.
read_word
(
i
)
...
@@ -79,6 +42,7 @@ def dump_thread_group(ramdump, thread_group, task_out, check_for_panic=0):
...
@@ -79,6 +42,7 @@ def dump_thread_group(ramdump, thread_group, task_out, check_for_panic=0):
offset_state
=
ramdump
.
field_offset
(
'
struct task_struct
'
,
'
state
'
)
offset_state
=
ramdump
.
field_offset
(
'
struct task_struct
'
,
'
state
'
)
offset_exit_state
=
ramdump
.
field_offset
(
offset_exit_state
=
ramdump
.
field_offset
(
'
struct task_struct
'
,
'
exit_state
'
)
'
struct task_struct
'
,
'
exit_state
'
)
offset_cpu
=
ramdump
.
field_offset
(
'
struct thread_info
'
,
'
cpu
'
)
orig_thread_group
=
thread_group
orig_thread_group
=
thread_group
first
=
0
first
=
0
seen_threads
=
[]
seen_threads
=
[]
...
@@ -93,33 +57,36 @@ def dump_thread_group(ramdump, thread_group, task_out, check_for_panic=0):
...
@@ -93,33 +57,36 @@ def dump_thread_group(ramdump, thread_group, task_out, check_for_panic=0):
ramdump
.
read_cstring
(
next_thread_comm
,
16
))
ramdump
.
read_cstring
(
next_thread_comm
,
16
))
if
thread_task_name
is
None
:
if
thread_task_name
is
None
:
return
return
thread_task_pid
=
ramdump
.
read_
word
(
next_thread_pid
)
thread_task_pid
=
ramdump
.
read_
int
(
next_thread_pid
)
if
thread_task_pid
is
None
:
if
thread_task_pid
is
None
:
return
return
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
task_exit_state
=
ramdump
.
read_
word
(
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
addr_stack
=
ramdump
.
read_word
(
next_thread_stack
)
addr_stack
=
ramdump
.
read_word
(
next_thread_stack
)
if
addr_stack
is
None
:
if
addr_stack
is
None
:
return
return
threadinfo
=
ramdump
.
read_string
(
addr_stack
,
thread_info_str
)
threadinfo
=
addr_stack
if
threadinfo
is
None
:
if
threadinfo
is
None
:
return
return
if
not
check_for_panic
:
if
not
check_for_panic
:
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
,
th
readin
fo
[
thread
_
info
_cpu_idx
]
,
thread_task_pid
,
next_thread_start
))
thread_task_name
,
ramdump
.
read
_
in
t
(
threadinfo
+
offset_cpu
)
,
thread_task_pid
,
next_thread_start
))
task_out
.
write
(
task_out
.
write
(
'
=====================================================
\n
'
)
'
=====================================================
\n
'
)
first
=
1
first
=
1
task_out
.
write
(
'
Task name: {0} pid: {1} cpu: {2}
\n
state: 0x{3:x} exit_state: 0x{4:x} stack base: 0x{5:x}
\n
'
.
format
(
task_out
.
write
(
'
Task name: {0} pid: {1} cpu: {2}
\n
state: 0x{3:x} exit_state: 0x{4:x} stack base: 0x{5:x}
\n
'
.
format
(
thread_task_name
,
thread_task_pid
,
th
readin
fo
[
thread
_
info
_cpu_idx
]
,
task_state
,
task_exit_state
,
addr_stack
))
thread_task_name
,
thread_task_pid
,
ramdump
.
read
_
in
t
(
threadinfo
+
offset_cpu
)
,
task_state
,
task_exit_state
,
addr_stack
))
task_out
.
write
(
'
Stack:
'
)
task_out
.
write
(
'
Stack:
'
)
ramdump
.
unwind
.
unwind_backtrace
(
threadinfo
[
thread_info_sp_idx
],
threadinfo
[
ramdump
.
unwind
.
unwind_backtrace
(
thread_info_fp_idx
],
threadinfo
[
thread_info_pc_idx
],
0
,
'
'
,
task_out
)
ramdump
.
thread_saved_sp
(
next_thread_start
),
ramdump
.
thread_saved_fp
(
next_thread_start
),
ramdump
.
thread_saved_pc
(
next_thread_start
),
0
,
'
'
,
task_out
)
task_out
.
write
(
task_out
.
write
(
'
=======================================================
\n
'
)
'
=======================================================
\n
'
)
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
linux-ramdump-parser-v2/ramdump.py
+
15
−
0
View file @
4372c731
...
@@ -1022,3 +1022,18 @@ class RamDump():
...
@@ -1022,3 +1022,18 @@ class RamDump():
def
iter_cpus
(
self
):
def
iter_cpus
(
self
):
return
xrange
(
self
.
get_num_cpus
())
return
xrange
(
self
.
get_num_cpus
())
def
thread_saved_field_common
(
self
,
task
,
reg_offset
):
thread_info
=
self
.
read_word
(
task
+
self
.
field_offset
(
'
struct task_struct
'
,
'
stack
'
))
cpu_context_offset
=
self
.
field_offset
(
'
struct thread_info
'
,
'
cpu_context
'
)
val
=
self
.
read_word
(
thread_info
+
cpu_context_offset
+
reg_offset
)
return
val
def
thread_saved_pc
(
self
,
task
):
return
self
.
thread_saved_field_common
(
task
,
self
.
field_offset
(
'
struct cpu_context_save
'
,
'
pc
'
))
def
thread_saved_sp
(
self
,
task
):
return
self
.
thread_saved_field_common
(
task
,
self
.
field_offset
(
'
struct cpu_context_save
'
,
'
sp
'
))
def
thread_saved_fp
(
self
,
task
):
return
self
.
thread_saved_field_common
(
task
,
self
.
field_offset
(
'
struct cpu_context_save
'
,
'
fp
'
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment