2004-09-16 23:10:41

by linas

[permalink] [raw]
Subject: [PATCH] add syslog printing to xmon debugger.



Hi,

This patch 'dmesg'/printk log buffer printing to xmon. I find this
useful because crashes are almost always preceeded by interesting
printk's. This patch is simple & straightforward, except for one
possibly controversial aspect: it embeds a small snippet in
kernel/printk.c to return the location of the syslog. This is
needed because kallsyms and even CONFIG_KALLSYMS_ALL is not enough
to reveal the location of log_buf. This code is about 90%
cut-n-paste of earlier code from Keith Owens.

Andrew,

Please apply at least the kernel/printk.c part of the patch,
if you are feeling at all charitable.

Signed-off-by: Linas Vepstas <[email protected]>


Attachments:
(No filename) (668.00 B)
xmon-dmesg-printing.patch (2.92 kB)
Download all attachments

2004-10-22 01:57:51

by Paul Mackerras

[permalink] [raw]
Subject: Re: [PATCH] add syslog printing to xmon debugger.

Linas,

> Andrew,
>
> Please apply at least the kernel/printk.c part of the patch,
> if you are feeling at all charitable.

Did you ever get any reaction to that?

Paul.

2004-10-28 06:35:19

by Keith Owens

[permalink] [raw]
Subject: Re: [PATCH] add syslog printing to xmon debugger.

On Fri, 22 Oct 2004 11:59:17 +1000,
Paul Mackerras <[email protected]> wrote:
>Linas,
>
>> Andrew,
>>
>> Please apply at least the kernel/printk.c part of the patch,
>> if you are feeling at all charitable.
>
>Did you ever get any reaction to that?

I see that the printk.c patch was lifted straight from kdb - without
any mention of kdb. It even has the same bug as kdb, which was
corrected in kdb-v4.4-2.6.9-common-2. The current kdb patch to
printk.c is :-

Index: linux/kernel/printk.c
===================================================================
--- linux.orig/kernel/printk.c Tue Oct 19 07:55:35 2004
+++ linux/kernel/printk.c Thu Oct 21 18:06:28 2004
@@ -373,6 +373,20 @@ out:
return error;
}

+#ifdef CONFIG_KDB
+/* kdb dmesg command needs access to the syslog buffer. do_syslog() uses locks
+ * so it cannot be used during debugging. Just tell kdb where the start and
+ * end of the physical and logical logs are. This is equivalent to do_syslog(3).
+ */
+void kdb_syslog_data(char *syslog_data[4])
+{
+ syslog_data[0] = log_buf;
+ syslog_data[1] = log_buf + log_buf_len;
+ syslog_data[2] = log_buf + log_end - (logged_chars < log_buf_len ? logged_chars : log_buf_len);
+ syslog_data[3] = log_buf + log_end;
+}
+#endif /* CONFIG_KDB */
+
asmlinkage long sys_syslog(int type, char __user * buf, int len)
{
return do_syslog(type, buf, len);