2015-05-14 06:05:36

by Thiébaud Weksteen

[permalink] [raw]
Subject: [PATCH] scripts/gdb: Add ps command

Signed-off-by: Thiébaud Weksteen <[email protected]>
---
scripts/gdb/linux/tasks.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py
index 0fa33b0..862a4ae 100644
--- a/scripts/gdb/linux/tasks.py
+++ b/scripts/gdb/linux/tasks.py
@@ -66,6 +66,22 @@ return that task_struct variable which PID matches."""
LxTaskByPidFunc()


+class LxPs(gdb.Command):
+ """Dump Linux tasks."""
+
+ def __init__(self):
+ super(LxPs, self).__init__("lx-ps", gdb.COMMAND_DATA)
+
+ def invoke(self, arg, from_tty):
+ for task in task_lists():
+ gdb.write("{address} {pid} {comm}\n".format(
+ address=task,
+ pid=task["pid"],
+ comm=task["comm"].string()))
+
+LxPs()
+
+
thread_info_type = utils.CachedType("struct thread_info")

ia64_task_size = None
--
2.1.0


2015-05-15 11:45:36

by Jan Kiszka

[permalink] [raw]
Subject: Re: [PATCH] scripts/gdb: Add ps command

On 2015-05-14 07:25, Thiébaud Weksteen wrote:
> Signed-off-by: Thiébaud Weksteen <[email protected]>
> ---
> scripts/gdb/linux/tasks.py | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py
> index 0fa33b0..862a4ae 100644
> --- a/scripts/gdb/linux/tasks.py
> +++ b/scripts/gdb/linux/tasks.py
> @@ -66,6 +66,22 @@ return that task_struct variable which PID matches."""
> LxTaskByPidFunc()
>
>
> +class LxPs(gdb.Command):
> + """Dump Linux tasks."""
> +
> + def __init__(self):
> + super(LxPs, self).__init__("lx-ps", gdb.COMMAND_DATA)
> +
> + def invoke(self, arg, from_tty):
> + for task in task_lists():
> + gdb.write("{address} {pid} {comm}\n".format(
> + address=task,
> + pid=task["pid"],
> + comm=task["comm"].string()))
> +
> +LxPs()
> +
> +
> thread_info_type = utils.CachedType("struct thread_info")
>
> ia64_task_size = None
>

Nice! Applied.

Jan

--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux