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
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab 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
19289961
Commit
19289961
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: Update vmalloc parsing for all cases"
parents
42763111
2e8bd2ad
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
linux-ramdump-parser-v2/parsers/vmalloc.py
+84
-45
84 additions, 45 deletions
linux-ramdump-parser-v2/parsers/vmalloc.py
with
84 additions
and
45 deletions
linux-ramdump-parser-v2/parsers/vmalloc.py
+
84
−
45
View file @
19289961
...
...
@@ -9,8 +9,10 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
import
re
from
print_out
import
print_out_str
from
parser_util
import
register_parser
,
RamParser
import
linux_list
as
llist
VM_IOREMAP
=
0x00000001
VM_ALLOC
=
0x00000002
...
...
@@ -23,34 +25,34 @@ VM_UNLIST = 0x00000020
@register_parser
(
'
--print-vmalloc
'
,
'
print vmalloc information
'
)
class
Vmalloc
(
RamParser
):
def
print_vmalloc_info
(
self
,
ram_dump
,
out_path
):
vmlist_addr
=
ram_dump
.
addr_lookup
(
'
vmlist
'
)
vmlist
=
ram_dump
.
read_word
(
vmlist_addr
)
vmalloc_out
=
ram_dump
.
open_file
(
'
vmalloc.txt
'
)
next_offset
=
ram_dump
.
field_offset
(
'
struct vm_struct
'
,
'
next
'
)
addr_offset
=
ram_dump
.
field_offset
(
'
struct vm_struct
'
,
'
addr
'
)
size_offset
=
ram_dump
.
field_offset
(
'
struct vm_struct
'
,
'
size
'
)
flags_offset
=
ram_dump
.
field_offset
(
'
struct vm_struct
'
,
'
flags
'
)
pages_offset
=
ram_dump
.
field_offset
(
'
struct vm_struct
'
,
'
pages
'
)
nr_pages_offset
=
ram_dump
.
field_offset
(
'
struct vm_struct
'
,
'
nr_pages
'
)
phys_addr_offset
=
ram_dump
.
field_offset
(
def
print_vm
(
self
,
vm
):
if
vm
==
0
or
vm
is
None
:
return
next_offset
=
self
.
ramdump
.
field_offset
(
'
struct vm_struct
'
,
'
next
'
)
addr_offset
=
self
.
ramdump
.
field_offset
(
'
struct vm_struct
'
,
'
addr
'
)
size_offset
=
self
.
ramdump
.
field_offset
(
'
struct vm_struct
'
,
'
size
'
)
flags_offset
=
self
.
ramdump
.
field_offset
(
'
struct vm_struct
'
,
'
flags
'
)
pages_offset
=
self
.
ramdump
.
field_offset
(
'
struct vm_struct
'
,
'
pages
'
)
nr_pages_offset
=
self
.
ramdump
.
field_offset
(
'
struct vm_struct
'
,
'
nr_pages
'
)
phys_addr_offset
=
self
.
ramdump
.
field_offset
(
'
struct vm_struct
'
,
'
phys_addr
'
)
caller_offset
=
ram
_
dump
.
field_offset
(
'
struct vm_struct
'
,
'
caller
'
)
caller_offset
=
self
.
ramdump
.
field_offset
(
'
struct vm_struct
'
,
'
caller
'
)
while
(
vmlist
is
not
None
)
and
(
vmlist
!=
0
):
addr
=
ram_dump
.
read_word
(
vmlist
+
addr_offset
)
caller
=
ram_dump
.
read_word
(
vmlist
+
caller_offset
)
nr_pages
=
ram_dump
.
read_word
(
vmlist
+
nr_pages_offset
)
phys_addr
=
ram_dump
.
read_word
(
vmlist
+
phys_addr_offset
)
flags
=
ram_dump
.
read_word
(
vmlist
+
flags_offset
)
size
=
ram_dump
.
read_word
(
vmlist
+
size_offset
)
addr
=
self
.
ramdump
.
read_word
(
vm
+
addr_offset
)
caller
=
self
.
ramdump
.
read_word
(
vm
+
caller_offset
)
nr_pages
=
self
.
ramdump
.
read_word
(
vm
+
nr_pages_offset
)
phys_addr
=
self
.
ramdump
.
read_word
(
vm
+
phys_addr_offset
)
flags
=
self
.
ramdump
.
read_word
(
vm
+
flags_offset
)
size
=
self
.
ramdump
.
read_word
(
vm
+
size_offset
)
if
addr
is
None
:
return
vmalloc_str
=
'
{0:x}-{1:x} {2:x}
'
.
format
(
addr
,
addr
+
size
,
size
)
if
(
caller
!=
0
):
a
=
ram
_
dump
.
unwind_lookup
(
caller
)
a
=
self
.
ramdump
.
unwind_lookup
(
caller
)
if
a
is
not
None
:
symname
,
offset
=
a
vmalloc_str
=
vmalloc_str
+
\
...
...
@@ -78,9 +80,43 @@ class Vmalloc(RamParser):
vmalloc_str
=
vmalloc_str
+
'
vpages
'
vmalloc_str
=
vmalloc_str
+
'
\n
'
vmalloc_out
.
write
(
vmalloc_str
)
self
.
vmalloc_out
.
write
(
vmalloc_str
)
def
list_func
(
self
,
vmlist
):
vm_offset
=
self
.
ramdump
.
field_offset
(
'
struct vmap_area
'
,
'
vm
'
)
vm
=
self
.
ramdump
.
read_word
(
vmlist
+
vm_offset
)
self
.
print_vm
(
vm
)
def
print_vmalloc_info_3_10
(
self
,
out_path
):
vmalloc_out
=
self
.
ramdump
.
open_file
(
'
vmalloc.txt
'
)
next_offset
=
self
.
ramdump
.
field_offset
(
'
struct vmap_area
'
,
'
list
'
)
vmlist
=
self
.
ramdump
.
read_word
(
'
vmap_area_list
'
)
orig_vmlist
=
vmlist
list_next_offset
,
list_prev_offset
=
llist
.
get_list_offsets
(
self
.
ramdump
)
list_walker
=
llist
.
ListWalker
(
self
.
ramdump
,
vmlist
,
next_offset
,
list_next_offset
,
list_prev_offset
)
self
.
vmalloc_out
=
vmalloc_out
list_walker
.
walk
(
vmlist
,
self
.
list_func
)
print_out_str
(
'
---wrote vmalloc to vmalloc.txt
'
)
vmalloc_out
.
close
()
def
print_vmalloc_info
(
self
,
out_path
):
vmlist
=
self
.
ramdump
.
read_word
(
'
vmlist
'
)
next_offset
=
self
.
ramdump
.
field_offset
(
'
struct vm_struct
'
,
'
next
'
)
vmalloc_out
=
self
.
ramdump
.
open_file
(
'
vmalloc.txt
'
)
self
.
vmalloc_out
=
vmalloc_out
while
(
vmlist
is
not
None
)
and
(
vmlist
!=
0
):
self
.
print_vm
(
vmlist
)
vmlist
=
ram
_
dump
.
read_word
(
vmlist
+
next_offset
)
vmlist
=
self
.
ramdump
.
read_word
(
vmlist
+
next_offset
)
print_out_str
(
'
---wrote vmalloc to vmalloc.txt
'
)
vmalloc_out
.
close
()
...
...
@@ -88,4 +124,7 @@ class Vmalloc(RamParser):
def
parse
(
self
):
out_path
=
self
.
ramdump
.
outdir
ver
=
self
.
ramdump
.
version
self
.
print_vmalloc_info
(
self
.
ramdump
,
out_path
)
if
re
.
search
(
'
3\.10\.\d
'
,
ver
)
is
not
None
:
self
.
print_vmalloc_info_3_10
(
out_path
)
else
:
self
.
print_vmalloc_info
(
out_path
)
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