Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Verlässliche Systemsoftware
projects
osv
Commits
c642cfcb
Commit
c642cfcb
authored
12 years ago
by
Avi Kivity
Browse files
Options
Downloads
Patches
Plain Diff
gdb: put thread list into a vmstate object
We'll collect more osv state there.
parent
dab69183
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
scripts/loader.py
+25
-18
25 additions, 18 deletions
scripts/loader.py
with
25 additions
and
18 deletions
scripts/loader.py
+
25
−
18
View file @
c642cfcb
...
@@ -105,22 +105,27 @@ class osv_info(gdb.Command):
...
@@ -105,22 +105,27 @@ class osv_info(gdb.Command):
gdb
.
Command
.
__init__
(
self
,
'
osv info
'
,
gdb
.
COMMAND_USER
,
gdb
.
Command
.
__init__
(
self
,
'
osv info
'
,
gdb
.
COMMAND_USER
,
gdb
.
COMPLETE_COMMAND
,
True
)
gdb
.
COMPLETE_COMMAND
,
True
)
def
thread_list
():
class
vmstate
(
object
):
ret
=
[]
def
__init__
(
self
):
thread_list
=
gdb
.
lookup_global_symbol
(
'
sched::thread_list
'
).
value
()
self
.
reload
()
root
=
thread_list
[
'
data_
'
][
'
root_plus_size_
'
][
'
root_
'
]
def
reload
(
self
):
node
=
root
[
'
next_
'
]
self
.
load_thread_list
()
thread_type
=
gdb
.
lookup_type
(
'
sched::thread
'
)
def
load_thread_list
(
self
):
void_ptr
=
gdb
.
lookup_type
(
'
void
'
).
pointer
()
ret
=
[]
for
f
in
thread_type
.
fields
():
thread_list
=
gdb
.
lookup_global_symbol
(
'
sched::thread_list
'
).
value
()
if
f
.
name
==
'
_thread_list_link
'
:
root
=
thread_list
[
'
data_
'
][
'
root_plus_size_
'
][
'
root_
'
]
link_offset
=
f
.
bitpos
/
8
node
=
root
[
'
next_
'
]
while
node
!=
root
.
address
:
thread_type
=
gdb
.
lookup_type
(
'
sched::thread
'
)
t
=
node
.
cast
(
void_ptr
)
-
link_offset
void_ptr
=
gdb
.
lookup_type
(
'
void
'
).
pointer
()
t
=
t
.
cast
(
thread_type
.
pointer
())
for
f
in
thread_type
.
fields
():
ret
.
append
(
t
.
dereference
())
if
f
.
name
==
'
_thread_list_link
'
:
node
=
node
[
'
next_
'
]
link_offset
=
f
.
bitpos
/
8
return
ret
while
node
!=
root
.
address
:
t
=
node
.
cast
(
void_ptr
)
-
link_offset
t
=
t
.
cast
(
thread_type
.
pointer
())
ret
.
append
(
t
.
dereference
())
node
=
node
[
'
next_
'
]
self
.
thread_list
=
ret
class
thread_context
(
object
):
class
thread_context
(
object
):
def
__init__
(
self
,
thread
):
def
__init__
(
self
,
thread
):
...
@@ -156,7 +161,8 @@ class osv_info_threads(gdb.Command):
...
@@ -156,7 +161,8 @@ class osv_info_threads(gdb.Command):
gdb
.
Command
.
__init__
(
self
,
'
osv info threads
'
,
gdb
.
Command
.
__init__
(
self
,
'
osv info threads
'
,
gdb
.
COMMAND_USER
,
gdb
.
COMPLETE_NONE
)
gdb
.
COMMAND_USER
,
gdb
.
COMPLETE_NONE
)
def
invoke
(
self
,
arg
,
for_tty
):
def
invoke
(
self
,
arg
,
for_tty
):
for
t
in
thread_list
():
state
=
vmstate
()
for
t
in
state
.
thread_list
:
with
thread_context
(
t
):
with
thread_context
(
t
):
cpu
=
t
[
'
_cpu
'
]
cpu
=
t
[
'
_cpu
'
]
fr
=
gdb
.
selected_frame
()
fr
=
gdb
.
selected_frame
()
...
@@ -199,7 +205,8 @@ class osv_thread_apply_all(gdb.Command):
...
@@ -199,7 +205,8 @@ class osv_thread_apply_all(gdb.Command):
gdb
.
Command
.
__init__
(
self
,
'
osv thread apply all
'
,
gdb
.
COMMAND_USER
,
gdb
.
Command
.
__init__
(
self
,
'
osv thread apply all
'
,
gdb
.
COMMAND_USER
,
gdb
.
COMPLETE_NONE
)
gdb
.
COMPLETE_NONE
)
def
invoke
(
self
,
arg
,
from_tty
):
def
invoke
(
self
,
arg
,
from_tty
):
for
t
in
thread_list
():
state
=
vmstate
()
for
t
in
state
.
thread_list
:
gdb
.
write
(
'
thread %s
\n\n
'
%
t
.
address
)
gdb
.
write
(
'
thread %s
\n\n
'
%
t
.
address
)
with
thread_context
(
t
):
with
thread_context
(
t
):
gdb
.
execute
(
arg
,
from_tty
)
gdb
.
execute
(
arg
,
from_tty
)
...
...
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