Allow the dmesg command to show the last N bytes of the kernel message
buffer.
This commit is contained in:
parent
1121191d31
commit
c9bc6f3a9a
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: db_xxx.c,v 1.24 2003/06/29 22:29:55 fvdl Exp $ */
|
/* $NetBSD: db_xxx.c,v 1.25 2003/07/02 07:05:29 simonb Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||||
@ -43,7 +43,7 @@
|
|||||||
#include "opt_kgdb.h"
|
#include "opt_kgdb.h"
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.24 2003/06/29 22:29:55 fvdl Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.25 2003/07/02 07:05:29 simonb Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -234,6 +234,7 @@ void
|
|||||||
db_dmesg(db_expr_t addr, int haddr, db_expr_t count, char *modif)
|
db_dmesg(db_expr_t addr, int haddr, db_expr_t count, char *modif)
|
||||||
{
|
{
|
||||||
struct kern_msgbuf *mbp;
|
struct kern_msgbuf *mbp;
|
||||||
|
db_expr_t print;
|
||||||
int ch, newl, skip, i;
|
int ch, newl, skip, i;
|
||||||
char *p, *bufdata;
|
char *p, *bufdata;
|
||||||
|
|
||||||
@ -245,10 +246,17 @@ db_dmesg(db_expr_t addr, int haddr, db_expr_t count, char *modif)
|
|||||||
mbp = msgbufp;
|
mbp = msgbufp;
|
||||||
bufdata = &mbp->msg_bufc[0];
|
bufdata = &mbp->msg_bufc[0];
|
||||||
|
|
||||||
|
if (haddr && addr < mbp->msg_bufs)
|
||||||
|
print = addr;
|
||||||
|
else
|
||||||
|
print = mbp->msg_bufs;
|
||||||
|
|
||||||
for (newl = skip = i = 0, p = bufdata + mbp->msg_bufx;
|
for (newl = skip = i = 0, p = bufdata + mbp->msg_bufx;
|
||||||
i < mbp->msg_bufs; i++, p++) {
|
i < mbp->msg_bufs; i++, p++) {
|
||||||
if (p == bufdata + mbp->msg_bufs)
|
if (p == bufdata + mbp->msg_bufs)
|
||||||
p = bufdata;
|
p = bufdata;
|
||||||
|
if (i < mbp->msg_bufs - print)
|
||||||
|
continue;
|
||||||
ch = *p;
|
ch = *p;
|
||||||
/* Skip "\n<.*>" syslog sequences. */
|
/* Skip "\n<.*>" syslog sequences. */
|
||||||
if (skip) {
|
if (skip) {
|
||||||
|
Loading…
Reference in New Issue
Block a user