Subject: Re: ddb dmesg change
To: Simon Burge <simonb@wasabisystems.com>
From: Andrew Brown <atatat@atatdot.net>
List: tech-kern
Date: 05/28/2003 23:08:17
>The following patch adds support for the ddb "dmesg" command to only
>print the last N bytes of the kernel message buffer.  I've found this
>useful when debugging a system with a large message buffer, but was
>interested in only the last few pages of dmesg output.

neat!

>Any objections before I commit it?

not really, but see below anyway.  :)

>@@ -245,10 +246,17 @@ db_dmesg(db_expr_t addr, int haddr, db_e
> 	mbp = msgbufp;
> 	bufdata = &mbp->msg_bufc[0];
> 
>+	if (haddr && addr <  mbp->msg_bufs)

extra space.  :)            ^

>+		print = addr;
>+	else
>+		print = mbp->msg_bufs;
>+
> 	for (newl = skip = i = 0, p = bufdata + mbp->msg_bufx;
> 	    i < mbp->msg_bufs; i++, p++) {
> 		if (p == bufdata + mbp->msg_bufs)
> 			p = bufdata;
>+		if (i < mbp->msg_bufs - print)
>+			continue;

you realize that this doesn't take the "\n<.*>" sequences into
account, yes?

> 		ch = *p;
> 		/* Skip "\n<.*>" syslog sequences. */
> 		if (skip) {

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
werdna@squooshy.com       * "information is power -- share the wealth."