From: Daniel Thompson <daniel.thompson@linaro.org>
To: Jason Wessel <jason.wessel@windriver.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>,
kgdb-bugreport@lists.sourceforge.net, patches@linaro.org,
linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org,
Paul Gortmaker <paul.gortmaker@windriver.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Travis <travis@sgi.com>, Dimitri Sivanich <sivanich@sgi.com>,
Hedi Berriche <hedi@sgi.com>,
John Stultz <john.stultz@linaro.org>,
Anton Vorontsov <anton.vorontsov@linaro.org>,
Colin Cross <ccross@android.com>,
kernel-team@android.com
Subject: [PATCH v3 3/3] kdb: Implement seq_file command
Date: Tue, 19 Aug 2014 15:37:42 +0100 [thread overview]
Message-ID: <1408459062-19120-4-git-send-email-daniel.thompson@linaro.org> (raw)
In-Reply-To: <1408459062-19120-1-git-send-email-daniel.thompson@linaro.org>
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 <daniel.thompson@linaro.org>
---
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. */
--
1.9.3
prev parent reply other threads:[~2014-08-19 14:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-29 14:30 [PATCH 0/3] kdb: Infrastructure to display sequence files Daniel Thompson
2014-04-29 14:30 ` [PATCH 1/3] kdb: Add framework " Daniel Thompson
2014-04-29 14:30 ` [PATCH 2/3] proc: Provide access to /proc/interrupts from kdb Daniel Thompson
2014-04-29 14:30 ` [PATCH 3/3] kdb: Implement seq_file command Daniel Thompson
2014-04-30 15:40 ` [PATCH 0/3] kdb: Infrastructure to display sequence files Daniel Thompson
2014-04-30 15:40 ` [PATCH 1/3] kdb: Add framework " Daniel Thompson
2014-04-30 15:40 ` [PATCH 2/3] proc: Provide access to /proc/interrupts from kdb Daniel Thompson
2014-04-30 15:40 ` [PATCH 3/3] kdb: Implement seq_file command Daniel Thompson
2014-08-19 14:37 ` [PATCH v3 0/3] kdb: Infrastructure to display sequence files Daniel Thompson
2014-08-19 14:37 ` [PATCH v3 1/3] kdb: Add framework " Daniel Thompson
2014-08-19 14:37 ` [PATCH v3 2/3] proc: Provide access to /proc/interrupts from kdb Daniel Thompson
2014-08-19 14:37 ` Daniel Thompson [this message]
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=1408459062-19120-4-git-send-email-daniel.thompson@linaro.org \
--to=daniel.thompson@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=anton.vorontsov@linaro.org \
--cc=ccross@android.com \
--cc=hedi@sgi.com \
--cc=jason.wessel@windriver.com \
--cc=john.stultz@linaro.org \
--cc=kernel-team@android.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@linaro.org \
--cc=paul.gortmaker@windriver.com \
--cc=sivanich@sgi.com \
--cc=travis@sgi.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
all inboxes | Powered by JetHome®