public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Jason Wessel <jason.wessel@windriver.com>,
	kgdb-bugreport@lists.sourceforge.net,
	Andi Kleen <andi@firstfloor.org>, Tom Tromey <tromey@redhat.com>,
	Ben Widawsky <ben@bwidawsk.net>, Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	linux-ia64@vger.kernel.org
Subject: Re: [PATCH v5 14/20] scripts/gdb: Add internal helper and convenience function to retrieve thread_info
Date: Tue, 29 Jan 2013 14:59:46 +0100	[thread overview]
Message-ID: <20130129135946.GG14302@pd.tnic> (raw)
In-Reply-To: <c4fb2b8d82932f2e86956bd0bd08caf15855b652.1359463075.git.jan.kiszka@siemens.com>

On Tue, Jan 29, 2013 at 01:37:57PM +0100, Jan Kiszka wrote:
> 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 <tony.luck@intel.com>
> CC: Fenghua Yu <fenghua.yu@intel.com>
> CC: linux-ia64@vger.kernel.org
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---

[ … ]

> +class LxThreadInfoFunc (gdb.Function):
> +	# Calculate Linux thread_info from task variable.
> +	__doc__ = "Calculate Linux thread_info from task variable.\n" \
> +		  "\n" \
> +		  "$lx_thread_info(TASK): Given TASK, return the corresponding thread_info\n" \
> +		  "variable."
> +
> +	def __init__(self):
> +		super(LxThreadInfoFunc, self).__init__("lx_thread_info")
> +
> +	def invoke(self, task):
> +		return get_thread_info(task)
> +
> +LxThreadInfoFunc()

Nice, you can plug commands into one-another:

(gdb) p $lx_thread_info($lx_current())
$12 = {task = 0xffffffff81a14440, exec_domain = 0xffffffff81a21e00, flags = 0, status = 0, cpu = 0, 
  preempt_count = 1, addr_limit = {seg = 18446744073709551615}, restart_block = {
    fn = 0xffffffff81054cd0 <do_no_restart_syscall>, {futex = {uaddr = 0x0, val = 0, flags = 0, bitset = 0, 
        time = 0, uaddr2 = 0x0}, nanosleep = {clockid = 0, rmtp = 0x0, compat_rmtp = 0x0, expires = 0}, 
      poll = {ufds = 0x0, nfds = 0, has_timeout = 0, tv_sec = 0, tv_nsec = 0}}}, sysenter_return = 0x0, 
  sig_on_uaccess_error = 0, uaccess_err = 0}

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

  reply	other threads:[~2013-01-29 13:59 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 12:37 [PATCH v5 00/20] Add gdb python scripts as kernel debugging helpers Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 01/20] scripts/gdb: Add infrastructure Jan Kiszka
2013-02-13 21:43   ` Tom Tromey
2013-01-29 12:37 ` [PATCH v5 02/20] scripts/gdb: Add cache for type objects Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 03/20] scripts/gdb: Add container_of helper and convenience function Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 04/20] scripts/gdb: Add module iteration helper Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 05/20] scripts/gdb: Add lx-symbols command Jan Kiszka
2013-02-14 15:40   ` Tom Tromey
2013-02-14 15:48     ` Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 06/20] scripts/gdb: Add internal helper and convenience function to look up a module Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 07/20] scripts/gdb: Add lx_modvar convenience function Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 08/20] scripts/gdb: Add get_target_endianness helper Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 09/20] scripts/gdb: Add read_u16/32/64 helpers Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 10/20] scripts/gdb: Add lx-dmesg command Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 11/20] scripts/gdb: Add task iteration helper Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 12/20] scripts/gdb: Add helper and convenience function to look up tasks Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 13/20] scripts/gdb: Add is_target_arch helper Jan Kiszka
2013-02-13 21:38   ` Tom Tromey
2013-01-29 12:37 ` [PATCH v5 14/20] scripts/gdb: Add internal helper and convenience function to retrieve thread_info Jan Kiszka
2013-01-29 13:59   ` Borislav Petkov [this message]
2013-01-29 12:37 ` [PATCH v5 15/20] scripts/gdb: Add get_gdbserver_type helper Jan Kiszka
2013-01-29 12:37 ` [PATCH v5 16/20] scripts/gdb: Add internal helper and convenience function for per-cpu lookup Jan Kiszka
2013-01-29 13:51   ` Borislav Petkov
2013-01-29 13:56     ` Jan Kiszka
2013-01-29 14:12       ` Borislav Petkov
2013-01-29 14:25         ` Jan Kiszka
2013-01-29 12:38 ` [PATCH v5 17/20] scripts/gdb: Add lx_current convenience function Jan Kiszka
2013-01-29 12:38 ` [PATCH v5 18/20] scripts/gdb: Add helper to iterate over CPU masks Jan Kiszka
2013-01-29 12:38 ` [PATCH v5 19/20] scripts/gdb: Add lx-lsmod command Jan Kiszka
2013-01-29 12:38 ` [PATCH v5 20/20] scripts/gdb: Add basic documentation Jan Kiszka
2013-02-06  9:23   ` [PATCH v6 " Jan Kiszka
2013-02-09 16:15   ` [PATCH v5 " Rob Landley
2013-01-29 14:15 ` [PATCH v5 00/20] Add gdb python scripts as kernel debugging helpers Borislav Petkov

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=20130129135946.GG14302@pd.tnic \
    --to=bp@alien8.de \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=ben@bwidawsk.net \
    --cc=fenghua.yu@intel.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=tromey@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox