From patchwork Tue Apr 29 14:30:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 29357 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CC4FF202FE for ; Tue, 29 Apr 2014 14:31:17 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf1443784obc.9 for ; Tue, 29 Apr 2014 07:31:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=1PlGgtgK2wKdKrXfFEPlDoRp7U3FD30RrIYzwJQrHEc=; b=B5CpKerMD5Sn4HuQFP36M7fj+l3v6iNNTwQKWlXC/BlXNS5cRvNqBVl+sRnoMq6Sgq fPy/+P0QNG499qqbhk2kDgJArrJmfm8PhZpMu0T7cGMZaglRZfcjECL+z3M++TxrtbTT oJwq51uViWd2d2VwcbLsJ81cVlN2wVqZSc7YMyZGKR+WbtDacKkKjxWAe49GmY0vtUzo JeplOTCs3NaYcRXSMwd7TYKBtYfa3RApwQQ6wLzn5jsa+fo9gFc7NxPuTURJV89ungum vPsy/TJHodpeM8mgET1tVygNAdyCIXtjydudiQBPlMR7C8lDnUZfL/WMdKjztRQuDA67 5u4Q== X-Gm-Message-State: ALoCoQnjoyco3EA9hl0vGopCIe5htJdnzzEiM10alEEjnL1gXwcnM/J0qz2Q4/oHGNmD49rpDccn X-Received: by 10.182.196.8 with SMTP id ii8mr16364489obc.5.1398781877369; Tue, 29 Apr 2014 07:31:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.248 with SMTP id i111ls139106qge.7.gmail; Tue, 29 Apr 2014 07:31:17 -0700 (PDT) X-Received: by 10.220.106.7 with SMTP id v7mr307162vco.46.1398781877250; Tue, 29 Apr 2014 07:31:17 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id tm8si4539914vdc.98.2014.04.29.07.31.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Apr 2014 07:31:17 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id jw12so355070veb.37 for ; Tue, 29 Apr 2014 07:31:17 -0700 (PDT) X-Received: by 10.58.1.5 with SMTP id 5mr30255838vei.8.1398781877185; Tue, 29 Apr 2014 07:31:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp202451vcb; Tue, 29 Apr 2014 07:31:16 -0700 (PDT) X-Received: by 10.194.171.198 with SMTP id aw6mr25007907wjc.23.1398781875604; Tue, 29 Apr 2014 07:31:15 -0700 (PDT) Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) by mx.google.com with ESMTPS id cz1si1445323wib.90.2014.04.29.07.31.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Apr 2014 07:31:15 -0700 (PDT) Received-SPF: none (google.com: daniel.thompson@linaro.org does not designate permitted sender hosts) client-ip=74.125.82.51; Received: by mail-wg0-f51.google.com with SMTP id z12so296163wgg.34 for ; Tue, 29 Apr 2014 07:31:15 -0700 (PDT) X-Received: by 10.194.203.170 with SMTP id kr10mr24956354wjc.19.1398781875075; Tue, 29 Apr 2014 07:31:15 -0700 (PDT) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id uc3sm5389589wib.10.2014.04.29.07.31.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Apr 2014 07:31:14 -0700 (PDT) From: Daniel Thompson To: kgdb-bugreport@lists.sourceforge.net, Jason Wessel Cc: patches@linaro.org, linaro-kernel@lists.linaro.org, Daniel Thompson , linux-kernel@vger.kernel.org, Paul Gortmaker , Andrew Morton , Mike Travis , Dimitri Sivanich , Hedi Berriche , John Stultz , Anton Vorontsov , Colin Cross , kernel-team@android.com Subject: [PATCH 3/3] kdb: Implement seq_file command Date: Tue, 29 Apr 2014 15:30:41 +0100 Message-Id: <1398781841-15152-5-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1398781841-15152-1-git-send-email-daniel.thompson@linaro.org> References: <1398781841-15152-1-git-send-email-daniel.thompson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Combining the kdb seq_file infrastructure with its symbolic lookups allows a good sub-set of files held in pseudo filesystems to be displayed by kdb. The seq_file command does exactly this and allows a significant subset of pseudo files to be safely examined whilst debugging (and in the hands of a brave expert an even bigger subset can be unsafely examined). Good arguments to try with this command include: cpuinfo_op, gpiolib_seq_ops and vmalloc_op. Signed-off-by: Daniel Thompson --- kernel/debug/kdb/kdb_main.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index 0b097c8..d87731c 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c @@ -1734,6 +1734,32 @@ static int kdb_mm(int argc, const char **argv) } /* + * kdb_seq_file - This function implements the 'seq_file' command. + * seq_file address-expression + */ +static int kdb_seq_file(int argc, const char **argv) +{ + int diag; + unsigned long addr; + int nextarg; + long offset; + char *name; + const struct seq_operations *ops; + + nextarg = 1; + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, &name); + if (diag) + return diag; + + if (nextarg != argc+1) + return KDB_ARGCOUNT; + + ops = (const struct seq_operations *) (addr + offset); + kdb_printf("Using sequence_ops at 0x%p (%s)\n", ops, name); + return kdb_print_seq_file(ops); +} + +/* * kdb_go - This function implements the 'go' command. * go [address-expression] */ @@ -2838,6 +2864,8 @@ static void __init kdb_inittab(void) "Display per_cpu variables", 3, KDB_REPEAT_NONE); kdb_register_repeat("grephelp", kdb_grep_help, "", "Display help on | grep", 0, KDB_REPEAT_NONE); + kdb_register_repeat("seq_file", kdb_seq_file, "", + "Show a seq_file using struct seq_operations", 3, KDB_REPEAT_NONE); } /* Execute any commands defined in kdb_cmds. */