All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: linux-kernel@vger.kernel.org
Cc: Jason Wessel <jason.wessel@windriver.com>,
	kgdb-bugreport@lists.sourceforge.net,
	Andi Kleen <andi@firstfloor.org>,
	"David S. Miller" <davem@davemloft.net>,
	Fenghua Yu <fenghua.yu@intel.com>, Kay Sievers <kay@vrfy.org>,
	linux-ia64@vger.kernel.org, linux-kbuild@vger.kernel.org,
	Michal Marek <mmarek@suse.cz>,
	sparclinux@vger.kernel.org, Tony Luck <tony.luck@intel.com>
Subject: [PATCH 00/13] Add gdb python scripts as kernel debugging helpers
Date: Mon,  5 Nov 2012 17:08:53 +0100	[thread overview]
Message-ID: <cover.1352131729.git.jan.kiszka@siemens.com> (raw)

Version 2 of this series is a rebase over 3.7-rc4 to resolve some minor
collision in the top-level makefile. Moreover, this implements automatic
symbol loading for kernel modules using silent breakpoints. See patch 3
for details.

Unless someone complains over this series or suggests a better workflow,
I'm planning to send a pull to Linus during the next merge window.


Here is the original intro for reference:

This adds the infrastructure and first tools that make kernel debugging
through gdb more comfortable. Since 7.0, gdb supports python scripting.
And this opens the doors to automate steps like the tedious loading of
module symbols at the right address, resolving per-cpu variables or even
retrieving the current kernel log without resuming an stopped target.

Many of the helpers naturally depend on the layout of structures or
internal mechanics of the kernel. So the best place to maintain such
things, keeping them consistent with the corresponding kernel is, well,
the kernel itself.

While these scripts have been originally developed for debugging via
QEMU/KVM, I've now also added the required bits for KGDB. Works fine,
but as QEMU/KVM tends to outperform KGDB it remains the recommendation
- when available.

There are two architecture dependencies so far, one regarding per-cpu,
the other regarding thread_info calculation. None of them I was able to
test on a target, so I'm counting on review/testing by the corresponding
communities.

This series should be considered the foundation of much more kernel
state exploration helper, e.g. around tasks, timers, locks, sockets -
I guess people will have even more ideas.

Hope it's useful!

PS: Also available via git://git.kiszka.org/linux.git queues/gdb-scripts

CC: "David S. Miller" <davem@davemloft.net>
CC: Fenghua Yu <fenghua.yu@intel.com>
CC: Kay Sievers <kay@vrfy.org>
CC: linux-ia64@vger.kernel.org
CC: linux-kbuild@vger.kernel.org
CC: Michal Marek <mmarek@suse.cz>
CC: sparclinux@vger.kernel.org
CC: Tony Luck <tony.luck@intel.com>

Jan Kiszka (13):
  scripts/gdb: Add infrastructure
  scripts/gdb: Add container_of helper and convenience function
  scripts/gdb: Add lx-symbols command
  scripts/gdb: Add get_target_endianness helper
  scripts/gdb: Add read_u16/32/64 helpers
  scripts/gdb: Add lx-dmesg command
  scripts/gdb: Add task iteration helper
  scripts/gdb: Add helper and convenience function to look up tasks
  scripts/gdb: Add is_target_arch helper
  scripts/gdb: Add internal helper and convenience function to retrieve
    thread_info
  scripts/gdb: Add get_gdbserver_type helper
  scripts/gdb: Add internal helper and convenience function for per-cpu
    lookup
  scripts/gdb: Add lx_current convenience function

 Makefile                   |    5 +-
 scripts/Makefile           |    3 +-
 scripts/gdb/Makefile       |    9 +++
 scripts/gdb/dmesg.py       |   63 +++++++++++++++++++++
 scripts/gdb/percpu.py      |   76 +++++++++++++++++++++++++
 scripts/gdb/symbols.py     |  133 +++++++++++++++++++++++++++++++++++++++++++
 scripts/gdb/task.py        |  108 +++++++++++++++++++++++++++++++++++
 scripts/gdb/utils.py       |  134 ++++++++++++++++++++++++++++++++++++++++++++
 scripts/gdb/vmlinux-gdb.py |   26 +++++++++
 9 files changed, 555 insertions(+), 2 deletions(-)
 create mode 100644 scripts/gdb/Makefile
 create mode 100644 scripts/gdb/dmesg.py
 create mode 100644 scripts/gdb/percpu.py
 create mode 100644 scripts/gdb/symbols.py
 create mode 100644 scripts/gdb/task.py
 create mode 100644 scripts/gdb/utils.py
 create mode 100644 scripts/gdb/vmlinux-gdb.py

-- 
1.7.3.4


WARNING: multiple messages have this Message-ID (diff)
From: Jan Kiszka <jan.kiszka@siemens.com>
To: linux-kernel@vger.kernel.org
Cc: Jason Wessel <jason.wessel@windriver.com>,
	kgdb-bugreport@lists.sourceforge.net,
	Andi Kleen <andi@firstfloor.org>,
	"David S. Miller" <davem@davemloft.net>,
	Fenghua Yu <fenghua.yu@intel.com>, Kay Sievers <kay@vrfy.org>,
	linux-ia64@vger.kernel.org, linux-kbuild@vger.kernel.org,
	Michal Marek <mmarek@suse.cz>,
	sparclinux@vger.kernel.org, Tony Luck <tony.luck@intel.com>
Subject: [PATCH 00/13] Add gdb python scripts as kernel debugging helpers
Date: Mon, 05 Nov 2012 16:08:53 +0000	[thread overview]
Message-ID: <cover.1352131729.git.jan.kiszka@siemens.com> (raw)

Version 2 of this series is a rebase over 3.7-rc4 to resolve some minor
collision in the top-level makefile. Moreover, this implements automatic
symbol loading for kernel modules using silent breakpoints. See patch 3
for details.

Unless someone complains over this series or suggests a better workflow,
I'm planning to send a pull to Linus during the next merge window.


Here is the original intro for reference:

This adds the infrastructure and first tools that make kernel debugging
through gdb more comfortable. Since 7.0, gdb supports python scripting.
And this opens the doors to automate steps like the tedious loading of
module symbols at the right address, resolving per-cpu variables or even
retrieving the current kernel log without resuming an stopped target.

Many of the helpers naturally depend on the layout of structures or
internal mechanics of the kernel. So the best place to maintain such
things, keeping them consistent with the corresponding kernel is, well,
the kernel itself.

While these scripts have been originally developed for debugging via
QEMU/KVM, I've now also added the required bits for KGDB. Works fine,
but as QEMU/KVM tends to outperform KGDB it remains the recommendation
- when available.

There are two architecture dependencies so far, one regarding per-cpu,
the other regarding thread_info calculation. None of them I was able to
test on a target, so I'm counting on review/testing by the corresponding
communities.

This series should be considered the foundation of much more kernel
state exploration helper, e.g. around tasks, timers, locks, sockets -
I guess people will have even more ideas.

Hope it's useful!

PS: Also available via git://git.kiszka.org/linux.git queues/gdb-scripts

CC: "David S. Miller" <davem@davemloft.net>
CC: Fenghua Yu <fenghua.yu@intel.com>
CC: Kay Sievers <kay@vrfy.org>
CC: linux-ia64@vger.kernel.org
CC: linux-kbuild@vger.kernel.org
CC: Michal Marek <mmarek@suse.cz>
CC: sparclinux@vger.kernel.org
CC: Tony Luck <tony.luck@intel.com>

Jan Kiszka (13):
  scripts/gdb: Add infrastructure
  scripts/gdb: Add container_of helper and convenience function
  scripts/gdb: Add lx-symbols command
  scripts/gdb: Add get_target_endianness helper
  scripts/gdb: Add read_u16/32/64 helpers
  scripts/gdb: Add lx-dmesg command
  scripts/gdb: Add task iteration helper
  scripts/gdb: Add helper and convenience function to look up tasks
  scripts/gdb: Add is_target_arch helper
  scripts/gdb: Add internal helper and convenience function to retrieve
    thread_info
  scripts/gdb: Add get_gdbserver_type helper
  scripts/gdb: Add internal helper and convenience function for per-cpu
    lookup
  scripts/gdb: Add lx_current convenience function

 Makefile                   |    5 +-
 scripts/Makefile           |    3 +-
 scripts/gdb/Makefile       |    9 +++
 scripts/gdb/dmesg.py       |   63 +++++++++++++++++++++
 scripts/gdb/percpu.py      |   76 +++++++++++++++++++++++++
 scripts/gdb/symbols.py     |  133 +++++++++++++++++++++++++++++++++++++++++++
 scripts/gdb/task.py        |  108 +++++++++++++++++++++++++++++++++++
 scripts/gdb/utils.py       |  134 ++++++++++++++++++++++++++++++++++++++++++++
 scripts/gdb/vmlinux-gdb.py |   26 +++++++++
 9 files changed, 555 insertions(+), 2 deletions(-)
 create mode 100644 scripts/gdb/Makefile
 create mode 100644 scripts/gdb/dmesg.py
 create mode 100644 scripts/gdb/percpu.py
 create mode 100644 scripts/gdb/symbols.py
 create mode 100644 scripts/gdb/task.py
 create mode 100644 scripts/gdb/utils.py
 create mode 100644 scripts/gdb/vmlinux-gdb.py

-- 
1.7.3.4


             reply	other threads:[~2012-11-05 16:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-05 16:08 Jan Kiszka [this message]
2012-11-05 16:08 ` [PATCH 00/13] Add gdb python scripts as kernel debugging helpers Jan Kiszka
2012-11-05 16:08 ` [PATCH 01/13] scripts/gdb: Add infrastructure Jan Kiszka
2012-11-05 16:08 ` [PATCH 02/13] scripts/gdb: Add container_of helper and convenience function Jan Kiszka
2012-11-05 16:08 ` [PATCH 03/13] scripts/gdb: Add lx-symbols command Jan Kiszka
2012-11-05 16:08 ` [PATCH 04/13] scripts/gdb: Add get_target_endianness helper Jan Kiszka
2012-11-05 16:08 ` [PATCH 05/13] scripts/gdb: Add read_u16/32/64 helpers Jan Kiszka
2012-11-05 16:08 ` [PATCH 06/13] scripts/gdb: Add lx-dmesg command Jan Kiszka
2012-11-05 16:09 ` [PATCH 07/13] scripts/gdb: Add task iteration helper Jan Kiszka
2012-11-05 16:09 ` [PATCH 08/13] scripts/gdb: Add helper and convenience function to look up tasks Jan Kiszka
2012-11-05 16:09 ` [PATCH 09/13] scripts/gdb: Add is_target_arch helper Jan Kiszka
2012-11-05 16:09 ` [PATCH 10/13] scripts/gdb: Add internal helper and convenience function to retrieve thread_info Jan Kiszka
2012-11-05 16:09   ` Jan Kiszka
2012-11-05 16:09 ` [PATCH 11/13] scripts/gdb: Add get_gdbserver_type helper Jan Kiszka
2012-11-05 16:09 ` [PATCH 12/13] scripts/gdb: Add internal helper and convenience function for per-cpu lookup Jan Kiszka
2012-11-05 16:09   ` Jan Kiszka
2012-11-05 16:09 ` [PATCH 13/13] scripts/gdb: Add lx_current convenience function Jan Kiszka
2012-12-20 17:59 ` [PATCH 00/13] Add gdb python scripts as kernel debugging helpers Ben Widawsky
  -- strict thread matches above, loose matches on Subject: below --
2012-10-03 11:21 Jan Kiszka
2012-10-03 11:21 ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1352131729.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=andi@firstfloor.org \
    --cc=davem@davemloft.net \
    --cc=fenghua.yu@intel.com \
    --cc=jason.wessel@windriver.com \
    --cc=kay@vrfy.org \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=sparclinux@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.