diff options
| author | 2015-09-01 15:35:24 +0200 | |
|---|---|---|
| committer | 2015-09-01 15:35:24 +0200 | |
| commit | 067e2601d3c076abbf45db91261f9065eaa879b2 (patch) | |
| tree | 86c8d4b913873dbd3b4ff23562a3a8597984b4df /scripts/gdb/linux/tasks.py | |
| parent | Merge branches 'for-4.2/upstream-fixes-devm-fixed' and 'for-4.3/upstream' into for-linus (diff) | |
| parent | HID: gembird: add new driver to fix Gembird JPD-DualForce 2 (diff) | |
| download | wireguard-linux-067e2601d3c076abbf45db91261f9065eaa879b2.tar.xz wireguard-linux-067e2601d3c076abbf45db91261f9065eaa879b2.zip | |
Merge branch 'for-4.3/gembird' into for-linus
Diffstat (limited to 'scripts/gdb/linux/tasks.py')
| -rw-r--r-- | scripts/gdb/linux/tasks.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py index e2037d9bb7eb..862a4ae24d49 100644 --- a/scripts/gdb/linux/tasks.py +++ b/scripts/gdb/linux/tasks.py @@ -18,8 +18,8 @@ from linux import utils task_type = utils.CachedType("struct task_struct") + def task_lists(): - global task_type task_ptr_type = task_type.get_type().pointer() init_task = gdb.parse_and_eval("init_task").address t = g = init_task @@ -38,6 +38,7 @@ def task_lists(): if t == init_task: return + def get_task_by_pid(pid): for task in task_lists(): if int(task['pid']) == pid: @@ -65,13 +66,28 @@ 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 def get_thread_info(task): - global thread_info_type thread_info_ptr_type = thread_info_type.get_type().pointer() if utils.is_target_arch("ia64"): global ia64_task_size |
