From patchwork Tue Aug 19 14:37:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 35605 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EF5FA201EF for ; Tue, 19 Aug 2014 14:38:12 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id b6sf22495208yha.9 for ; Tue, 19 Aug 2014 07:38:12 -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=zKVVaUaIjKh8o058zZ5S3b+vlA8ywL9wjDkaNTlZpv8=; b=Aieg98ZwlRxn0b/SG1I886XnFvF3AKqocids1jF+2ba/7sLWD4JyJ/ubD8yxSCRI3n o9iPJAUmZ5Xe+mNvvHA4vnGYMQYBEMlpH5BCV2XfhnwujEU2PEvihFCHYmpbgfGG1dlf rVGpPwWLrYtgZ7NS1Yp2mjHdOf4It3wU8LK4bvSohC/jWp6mAb4LOtPgDAE+l+tZbNMc rrtf2VcqoJmL+fmt5Ib0mWDwCu08DTh952+ZnuoXZMjtuOyd3nno3E1uykcv14Da/4vv 6UQuSgaMbWBD1TpqOnlGREe3Fv4MMeM9T0Pj4x4egNm00OMacbSZ6/0RiXdOeHHID7Hq M1Tw== X-Gm-Message-State: ALoCoQnbNP8Dxg5jM0G15dqXN9sM7ZxUzqyhfixRZJogLVt0UF0CMJ9UqpapiQhdILw6UKL3TcON X-Received: by 10.236.118.37 with SMTP id k25mr18168637yhh.1.1408459092809; Tue, 19 Aug 2014 07:38:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.21 with SMTP id h21ls2913247qge.52.gmail; Tue, 19 Aug 2014 07:38:12 -0700 (PDT) X-Received: by 10.52.248.211 with SMTP id yo19mr672148vdc.67.1408459092686; Tue, 19 Aug 2014 07:38:12 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id z7si8847165vce.30.2014.08.19.07.38.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 07:38:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hy4so7339932vcb.8 for ; Tue, 19 Aug 2014 07:38:12 -0700 (PDT) X-Received: by 10.52.119.229 with SMTP id kx5mr1690132vdb.40.1408459092545; Tue, 19 Aug 2014 07:38:12 -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.221.37.5 with SMTP id tc5csp244017vcb; Tue, 19 Aug 2014 07:38:11 -0700 (PDT) X-Received: by 10.194.63.205 with SMTP id i13mr51401627wjs.74.1408459091299; Tue, 19 Aug 2014 07:38:11 -0700 (PDT) Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) by mx.google.com with ESMTPS id fw8si22447254wib.38.2014.08.19.07.38.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 07:38:11 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.47 as permitted sender) client-ip=74.125.82.47; Received: by mail-wg0-f47.google.com with SMTP id b13so6378244wgh.6 for ; Tue, 19 Aug 2014 07:38:09 -0700 (PDT) X-Received: by 10.194.123.1 with SMTP id lw1mr21886537wjb.4.1408459089581; Tue, 19 Aug 2014 07:38:09 -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 k6sm50920144wjq.5.2014.08.19.07.38.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Aug 2014 07:38:08 -0700 (PDT) From: Daniel Thompson To: Jason Wessel Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, patches@linaro.org, linaro-kernel@lists.linaro.org, 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 v3 3/3] kdb: Implement seq_file command Date: Tue, 19 Aug 2014 15:37:42 +0100 Message-Id: <1408459062-19120-4-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1408459062-19120-1-git-send-email-daniel.thompson@linaro.org> References: <1398872427-18435-1-git-send-email-daniel.thompson@linaro.org> <1408459062-19120-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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) 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 379650b..f11db91 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. */