[Kgdb-bugreport] [PATCH v3 10/13] scripts/gdb: Add internal helper and convenience function to retrieve thread_info

2012-11-27 Thread Jan Kiszka
Add the internal helper get_thread_info that calculated the thread_info from a given task variable. Also export this service as a convenience function. Note: ia64 version is untested. CC: Tony Luck CC: Fenghua Yu CC: linux-i...@vger.kernel.org Signed-off-by: Jan Kiszka --- scripts/gdb/task.py

[Kgdb-bugreport] [PATCH v3 07/13] scripts/gdb: Add task iteration helper

2012-11-27 Thread Jan Kiszka
The internal helper for_each_task iterates over all tasks of the target, calling the provided function on each. For performance reasons, we cache a reference to the gdb type object of a task. Signed-off-by: Jan Kiszka --- scripts/gdb/task.py | 40 1 fil

[Kgdb-bugreport] [PATCH v3 04/13] scripts/gdb: Add get_target_endianness helper

2012-11-27 Thread Jan Kiszka
Parse the target endianness from the output of "show endian" and cache the result to return it via the new helper get_target_endiannes. We will need it for reading integers from buffers that contain target memory. Signed-off-by: Jan Kiszka --- scripts/gdb/utils.py | 17 + 1 fil

[Kgdb-bugreport] [PATCH v3 02/13] scripts/gdb: Add container_of helper and convenience function

2012-11-27 Thread Jan Kiszka
Provide an internal helper with container_of semantics. As type lookups are very slow in gdb-python and we need a type "long" for this, cache the reference to this type object. Then export the helper also as a convenience function form use at the gdb command line. Signed-off-by: Jan Kiszka --- s

[Kgdb-bugreport] [PATCH v3 03/13] scripts/gdb: Add lx-symbols command

2012-11-27 Thread Jan Kiszka
This is probably the most useful helper when debugging kernel modules: lx-symbols will first reload vmlinux. Then it searches recursively for *.ko files in the specified paths and the current directory. Finally it walks the kernel's module list, issuing the necessary add-symbol-file command for eac

[Kgdb-bugreport] [PATCH v3 11/13] scripts/gdb: Add get_gdbserver_type helper

2012-11-27 Thread Jan Kiszka
This helper probes the type of the gdb server. Supported are QEMU and KGDB so far. Knowledge about the gdb server is required e.g. to retrieve the current CPU or current task. Signed-off-by: Jan Kiszka --- scripts/gdb/utils.py | 35 +++ 1 files changed, 35 inser

[Kgdb-bugreport] [PATCH v3 08/13] scripts/gdb: Add helper and convenience function to look up tasks

2012-11-27 Thread Jan Kiszka
Add the helper task_by_pid that can look up a task by its PID. Also export it as a convenience function. Signed-off-by: Jan Kiszka --- scripts/gdb/task.py| 29 + scripts/gdb/vmlinux-gdb.py |1 + 2 files changed, 30 insertions(+), 0 deletions(-) diff --g

[Kgdb-bugreport] [PATCH v3 12/13] scripts/gdb: Add internal helper and convenience function for per-cpu lookup

2012-11-27 Thread Jan Kiszka
This function allows to obtain a per-cpu variable, either of the current or an explicitly specified CPU. Note: sparc64 version is untested. CC: "David S. Miller" CC: sparcli...@vger.kernel.org Signed-off-by: Jan Kiszka --- scripts/gdb/percpu.py | 61 +

[Kgdb-bugreport] [PATCH v3 06/13] scripts/gdb: Add lx-dmesg command

2012-11-27 Thread Jan Kiszka
This pokes into the log buffer of the debugged kernel, dumping it to the gdb console. Helping in case the target should or can no longer execute dmesg itself. CC: Kay Sievers Signed-off-by: Jan Kiszka --- scripts/gdb/dmesg.py | 63 scripts/gd

[Kgdb-bugreport] [PATCH v3 05/13] scripts/gdb: Add read_u16/32/64 helpers

2012-11-27 Thread Jan Kiszka
Add helpers for reading integers from target memory buffers. Required when caching the memory access is more efficient than reading individual values via gdb. Signed-off-by: Jan Kiszka --- scripts/gdb/utils.py | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --g

[Kgdb-bugreport] [PATCH v3 09/13] scripts/gdb: Add is_target_arch helper

2012-11-27 Thread Jan Kiszka
This helper caches to result of "show architecture" and matches the provided arch (sub-)string against that output. Signed-off-by: Jan Kiszka --- scripts/gdb/utils.py |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/scripts/gdb/utils.py b/scripts/gdb/utils.py inde

[Kgdb-bugreport] [PATCH v3 13/13] scripts/gdb: Add lx_current convenience function

2012-11-27 Thread Jan Kiszka
This is a shorthand for *$lx_per_cpu("current_task"), i.e. a convenience function to retrieve the currently running task of the active context. Signed-off-by: Jan Kiszka --- scripts/gdb/percpu.py | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/scripts/gdb/

[Kgdb-bugreport] [PATCH v3 01/13] scripts/gdb: Add infrastructure

2012-11-27 Thread Jan Kiszka
This provides the basic infrastructure to load kernel-specific python helper scripts when debugging the kernel in gdb. The loading mechanism is based on gdb loading for -gdb.py when opening . Therefore, this places a corresponding link to the main helper script into the output directory that conta