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
3926635c
Commit
3926635c
authored
9 years ago
by
Linux Build Service Account
Committed by
Gerrit - the friendly Code Review server
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "lrdp-v2: make ListWalker as iterator"
parents
c7a9c733
775b9548
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
linux-ramdump-parser-v2/linux_list.py
+25
-1
25 additions, 1 deletion
linux-ramdump-parser-v2/linux_list.py
with
25 additions
and
1 deletion
linux-ramdump-parser-v2/linux_list.py
+
25
−
1
View file @
3926635c
# Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
# Copyright (c) 2013-2014,
2016,
The Linux Foundation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 and
...
...
@@ -31,11 +31,35 @@ class ListWalker(object):
self
.
list_elem_offset
=
list_elem_offset
self
.
last_node
=
node_addr
self
.
seen_nodes
=
[]
self
.
curr_node
=
node_addr
def
__iter__
(
self
):
return
self
def
next
(
self
):
next_node_addr
=
self
.
curr_node
+
\
self
.
ram_dump
.
field_offset
(
'
struct list_head
'
,
'
next
'
)
next_node
=
self
.
ram_dump
.
read_word
(
next_node_addr
)
self
.
curr_node
=
next_node
if
next_node
==
self
.
last_node
:
raise
StopIteration
()
elif
next_node
in
self
.
seen_nodes
:
print_out_str
(
'
[!] WARNING: Cycle found in attach list. List is corrupted!
'
)
raise
StopIteration
()
else
:
self
.
seen_nodes
.
append
(
next_node
)
return
next_node
-
self
.
list_elem_offset
def
is_empty
(
self
):
"""
Return True if the list is empty, False otherwise.
"""
if
self
.
last_node
is
None
:
return
True
next_node_addr
=
self
.
last_node
+
self
.
ram_dump
.
field_offset
(
'
struct list_head
'
,
'
next
'
)
next_node
=
self
.
ram_dump
.
read_word
(
next_node_addr
)
...
...
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