Re: [PATCH v5 14/20] scripts/gdb: Add internal helper andconvenience function to retrieve thread_info

From: Borislav Petkov
Date: Tue Jan 29 2013 - 08:59:55 EST


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@xxxxxxxxx>
> CC: Fenghua Yu <fenghua.yu@xxxxxxxxx>
> CC: linux-ia64@xxxxxxxxxxxxxxx
> Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
> ---

[ â ]

> +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.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/