Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755716Ab3J1JiP (ORCPT ); Mon, 28 Oct 2013 05:38:15 -0400 Received: from david.siemens.de ([192.35.17.14]:15580 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754678Ab3J1JiO (ORCPT ); Mon, 28 Oct 2013 05:38:14 -0400 From: Jan Kiszka To: Andrew Morton , linux-kernel@vger.kernel.org Cc: Jason Wessel , kgdb-bugreport@lists.sourceforge.net, Andi Kleen , Tom Tromey , Ben Widawsky , Borislav Petkov , Tatiana Al-Chueyr Martins Subject: [PATCH v6 18/21] scripts/gdb: Add lx_current convenience function Date: Mon, 28 Oct 2013 09:58:55 +0100 Message-Id: <2b0ff2a70e966f7349ad79ce1816c7fdd07744a7.1382950737.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.8.1.1.298.ge7eed54 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1256 Lines: 41 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/linux/cpus.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py index 18337e0..b683da9 100644 --- a/scripts/gdb/linux/cpus.py +++ b/scripts/gdb/linux/cpus.py @@ -66,3 +66,20 @@ Note that VAR has to be quoted as string.""" PerCpu() + + +class LxCurrentFunc(gdb.Function): + """Return current task. + +$lx_current([CPU]): Return the per-cpu task variable for the given CPU +number. If CPU is omitted, the CPU of the current context is used.""" + + def __init__(self): + super(LxCurrentFunc, self).__init__("lx_current") + + def invoke(self, cpu=-1): + var_ptr = gdb.parse_and_eval("¤t_task") + return per_cpu(var_ptr, cpu).dereference() + + +LxCurrentFunc() -- 1.8.1.1.298.ge7eed54 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/