[PATCH] Linux kernel thread runtime support
Thu Dec 22 17:34:00 GMT 2016
Hi GDB maintainers,
The following patch implements a Linux kernel thread runtime stratum
which can be used when using GDB to debug a Linux kernel. For example
when connecting to a QEMU GDB stub, or OpenOCD which then communicates
with the target via JTAG or SWD.
This patch is a refactored version based on the 'Linux kernel
debugger' GDB plugin written at STMicroelectronics which used to
be packaged with their JTAG debuggers. There has been some discussion
previously on the list by myself , Kieran  and one of the original
authors at ST Marc Titinger .
This patchset I'm hoping is a lot closer to something which can
be upstreamed to GDB project after some discussion about structure with
Yao Qi at Linaro Connect, the code has been refactored to be structured
much more like the existing upstream thread runtimes (such as
ravenscar-thread.c and sparc-ravenscar-thread etc).
Since the original email  various helper commands have also been
migrated into python and merged into the Linux kernel source tree.
The GDB python extensions, combined with the linux-kthread GDB
thread runtime implemented in this patchset provide a powerful
Linux kernel debug solution, and is a working implementation
of what Andreas talked about on slide 17 and 18 of his talk at GNU
I have currently been testing this patchset using mainline GDB debugging
arm-linux kernels in Qemu and via OpenoCD to real hardware. It is straight
forward with the current strructure to add new architecture support, and
I'm looking at adding PowerPC so I can easily validate big endian targets.
What I'm really hoping for now is some patch review on the GDB mailing list
from the GDB maintainers and community with a view to getting this functionality
which has been talked about for quite a few years finally merged to the
upstream GDB project.
All patch review feedback greatfully received :)
Peter Griffin (1):
Add Linux kernel thread runtime support.
gdb/ChangeLog | 12 +
gdb/Makefile.in | 8 +-
gdb/arm-linux-kthread.c | 178 +++++
gdb/arm-linux-kthread.h | 27 +
gdb/arm-tdep.c | 4 +
gdb/configure.tgt | 6 +-
gdb/gdbarch.c | 23 +
gdb/gdbarch.h | 5 +
gdb/gdbarch.sh | 3 +
gdb/linux-kthread.c | 1828 +++++++++++++++++++++++++++++++++++++++++++++++
gdb/linux-kthread.h | 223 ++++++
11 files changed, 2311 insertions(+), 6 deletions(-)
create mode 100644 gdb/arm-linux-kthread.c
create mode 100644 gdb/arm-linux-kthread.h
create mode 100644 gdb/linux-kthread.c
create mode 100644 gdb/linux-kthread.h
More information about the Gdb-patches