Subject: Re: ddb dmesg change
To: Andrew Brown <atatat@atatdot.net>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 05/29/2003 13:24:34
Andrew Brown wrote:
> >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. :) ^
Picky picky! Fixed.
> >+ 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?
I'm not sure how big a deal this is. I also could have just started
printing after adding "mbp->msg_bufs - print" to the current message
buffer start, checking for wraparound, etc but that seemed like too
much work.
The way the skip/newl logic works would require a bit of re-ordering
of the existing code. Unless ... I simply moved the new check to
immediately before the "db_printf("%c", ch);", and that seems to
work ok (but I didn't have any syslog messages in the kernel buffer
to skip over).
> > ch = *p;
> > /* Skip "\n<.*>" syslog sequences. */
> > if (skip) {
Thanks for the feedback,
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD Support and Service: http://www.wasabisystems.com/