Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1367143
| From | Kieran Bingham <kieran.bingham@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCHv4 12/12] scripts/gdb: Add lx_thread_info_by_pid helper |
| Date | 2016-03-30 14:10 +0200 |
| Message-ID | <rin6G-57W-11@gated-at.bofh.it> (permalink) |
| References | <rin6G-57W-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The tasks module already provides helpers to find the task struct by
pid, and the thread_info by task struct; however this is cumbersome to
utilise on the gdb commandline.
Wrap these two functionalities together in an extra single helper to
allow exploring the thread info, from a PID value
Signed-off-by: Kieran Bingham <kieran.bingham@linaro.org>
---
scripts/gdb/linux/tasks.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py
index 862a4ae24d49..1bf949c43b76 100644
--- a/scripts/gdb/linux/tasks.py
+++ b/scripts/gdb/linux/tasks.py
@@ -114,3 +114,22 @@ variable."""
LxThreadInfoFunc()
+
+
+class LxThreadInfoByPidFunc (gdb.Function):
+ """Calculate Linux thread_info from task variable found by pid
+
+$lx_thread_info_by_pid(PID): Given PID, return the corresponding thread_info
+variable."""
+
+ def __init__(self):
+ super(LxThreadInfoByPidFunc, self).__init__("lx_thread_info_by_pid")
+
+ def invoke(self, pid):
+ task = get_task_by_pid(pid)
+ if task:
+ return get_thread_info(task.dereference())
+ else:
+ raise gdb.GdbError("No task of PID " + str(pid))
+
+LxThreadInfoByPidFunc()
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHv4 00/12] gdb/scripts: Linux awareness debug commands Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 10/12] scripts/gdb: Add a Radix Tree Parser Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 12/12] scripts/gdb: Add lx_thread_info_by_pid helper Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 05/12] scripts/gdb: Support !CONFIG_MODULES gracefully Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 09/12] scripts/gdb: Add cpu iterators Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 01/12] scripts/gdb: Provide linux constants Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
Re: [PATCHv4 01/12] scripts/gdb: Provide linux constants Jan Kiszka <jan.kiszka@siemens.com> - 2016-03-30 23:10 +0200
[PATCHv4 06/12] scripts/gdb: Provide a dentry_name VFS path helper Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 02/12] scripts/gdb: Provide kernel list item generators Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 07/12] scripts/gdb: Add io resource readers Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 08/12] scripts/gdb: Add mount point list command Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 11/12] scripts/gdb: Add documentation example for radix tree Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 04/12] scripts/gdb: Provide exception catching parser Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
[PATCHv4 03/12] scripts/gdb: Convert modules usage to lists functions Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
csiph-web