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
923da40b
Commit
923da40b
authored
6 years ago
by
Linux Build Service Account
Committed by
Gerrit - the friendly Code Review server
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "lrdp_V2 : Fix for broken lsof.py"
parents
0a3cbbd8
b4912b9b
No related branches found
Branches containing commit
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/lsof.py
+2
-10
2 additions, 10 deletions
linux-ramdump-parser-v2/parsers/lsof.py
linux-ramdump-parser-v2/ramdump.py
+124
-0
124 additions, 0 deletions
linux-ramdump-parser-v2/ramdump.py
with
126 additions
and
10 deletions
linux-ramdump-parser-v2/parsers/lsof.py
+
2
−
10
View file @
923da40b
...
@@ -33,17 +33,9 @@ TASK_NAME_LENGTH = 16
...
@@ -33,17 +33,9 @@ TASK_NAME_LENGTH = 16
def
do_dump_lsof_info
(
self
,
ramdump
,
lsof_info
):
def
do_dump_lsof_info
(
self
,
ramdump
,
lsof_info
):
task_list_head_offset
=
ramdump
.
field_offset
(
'
struct task_struct
'
,
'
tasks
'
)
for
task_struct
in
ramdump
.
for_each_process
():
init_task_address
=
self
.
ramdump
.
address_of
(
'
init_task
'
)
parse_task
(
self
,
ramdump
,
task_struct
,
lsof_info
)
init_tasklist_head
=
init_task_address
+
task_list_head_offset
task_list_head
=
ramdump
.
read_structure_field
(
init_tasklist_head
,
'
struct list_head
'
,
'
next
'
)
while
task_list_head
!=
init_tasklist_head
:
task
=
task_list_head
-
task_list_head_offset
parse_task
(
self
,
ramdump
,
task
,
lsof_info
)
lsof_info
.
write
(
"
\n
*********************************
"
)
lsof_info
.
write
(
"
\n
*********************************
"
)
task_list_head
=
ramdump
.
read_structure_field
(
task_list_head
,
'
struct list_head
'
,
'
next
'
)
def
parse_task
(
self
,
ramdump
,
task
,
lsof_info
):
def
parse_task
(
self
,
ramdump
,
task
,
lsof_info
):
...
...
This diff is collapsed.
Click to expand it.
linux-ramdump-parser-v2/ramdump.py
+
124
−
0
View file @
923da40b
...
@@ -1686,6 +1686,130 @@ class RamDump():
...
@@ -1686,6 +1686,130 @@ class RamDump():
else
:
else
:
return
self
.
thread_saved_field_common_32
(
task
,
self
.
field_offset
(
'
struct cpu_context_save
'
,
'
fp
'
))
return
self
.
thread_saved_field_common_32
(
task
,
self
.
field_offset
(
'
struct cpu_context_save
'
,
'
fp
'
))
def
for_each_process
(
self
):
"""
create a generator for traversing through each valid process
"""
init_task
=
self
.
address_of
(
'
init_task
'
)
tasks_offset
=
self
.
field_offset
(
'
struct task_struct
'
,
'
tasks
'
)
prev_offset
=
self
.
field_offset
(
'
struct list_head
'
,
'
prev
'
)
next
=
init_task
seen_tasks
=
[]
while
(
1
):
task_pointer
=
self
.
read_word
(
next
+
tasks_offset
,
True
)
if
not
task_pointer
:
break
task_struct
=
task_pointer
-
tasks_offset
if
((
self
.
validate_task_struct
(
task_struct
)
==
-
1
)
or
(
self
.
validate_sched_class
(
task_struct
)
==
-
1
)):
next
=
init_task
while
(
1
):
task_pointer
=
self
.
read_word
(
next
+
tasks_offset
+
prev_offset
,
True
)
if
not
task_pointer
:
break
task_struct
=
task_pointer
-
tasks_offset
if
(
self
.
validate_task_struct
(
task_struct
)
==
-
1
):
break
if
(
self
.
validate_sched_class
(
task_struct
)
==
-
1
):
break
if
task_struct
in
seen_tasks
:
break
yield
task_struct
seen_tasks
.
append
(
task_struct
)
next
=
task_struct
if
(
next
==
init_task
):
break
break
if
task_struct
in
seen_tasks
:
break
yield
task_struct
seen_tasks
.
append
(
task_struct
)
next
=
task_struct
if
(
next
==
init_task
):
break
def
for_each_thread
(
self
,
task_addr
):
thread_group_offset
=
self
.
field_offset
(
'
struct task_struct
'
,
'
thread_group
'
)
thread_group_pointer
=
self
.
read_word
(
task_addr
+
thread_group_offset
,
True
)
prev_offset
=
self
.
field_offset
(
'
struct list_head
'
,
'
prev
'
)
thread_group_pointer
=
thread_group_pointer
-
thread_group_offset
next
=
thread_group_pointer
seen_thread
=
[]
while
(
1
):
task_offset
=
next
+
thread_group_offset
task_pointer
=
self
.
read_word
(
task_offset
,
True
)
if
not
task_pointer
:
break
task_struct
=
task_pointer
-
thread_group_offset
if
(
self
.
validate_task_struct
(
task_struct
)
==
-
1
)
or
(
self
.
validate_sched_class
(
task_struct
)
==
-
1
):
next
=
thread_group_pointer
while
(
1
):
task_pointer
=
self
.
read_word
(
next
+
thread_group_offset
+
prev_offset
)
if
not
task_pointer
:
break
task_struct
=
task_pointer
-
thread_group_offset
if
(
self
.
validate_task_struct
(
task_struct
)
==
-
1
)
or
(
self
.
validate_sched_class
(
task_struct
)
==
-
1
):
break
yield
task_struct
seen_thread
.
append
(
task_struct
)
next
=
task_struct
if
(
next
==
thread_group_pointer
):
break
break
if
task_struct
in
seen_thread
:
break
yield
task_struct
seen_thread
.
append
(
task_struct
)
next
=
task_struct
if
(
next
==
thread_group_pointer
):
break
def
validate_task_struct
(
self
,
task
):
thread_info_address
=
self
.
get_thread_info_addr
(
task
)
if
self
.
is_thread_info_in_task
():
task_struct
=
task
else
:
task_address
=
thread_info_address
+
self
.
field_offset
(
'
struct thread_info
'
,
'
task
'
)
task_struct
=
self
.
read_word
(
task_address
,
True
)
cpu_number
=
self
.
get_task_cpu
(
task_struct
,
thread_info_address
)
if
((
task
!=
task_struct
)
or
(
thread_info_address
==
0x0
)):
return
-
1
if
((
cpu_number
<
0
)
or
(
cpu_number
>
self
.
get_num_cpus
())):
return
-
1
def
validate_sched_class
(
self
,
task
):
sc_top
=
self
.
address_of
(
'
stop_sched_class
'
)
sc_rt
=
self
.
address_of
(
'
rt_sched_class
'
)
sc_idle
=
self
.
address_of
(
'
idle_sched_class
'
)
sc_fair
=
self
.
address_of
(
'
fair_sched_class
'
)
sched_class
=
self
.
read_structure_field
(
task
,
'
struct task_struct
'
,
'
sched_class
'
)
if
not
((
sched_class
==
sc_top
)
or
(
sched_class
==
sc_rt
)
or
(
sched_class
==
sc_idle
)
or
(
sched_class
==
sc_fair
)):
return
-
1
class
Struct
(
object
):
class
Struct
(
object
):
"""
"""
...
...
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