add appropriate hack to display ktr_buf as the lwpid if -L is supplied on

the command line.
This commit is contained in:
darrenr 2003-06-28 17:15:07 +00:00
parent 887069bda8
commit d0ad455673
2 changed files with 15 additions and 6 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: kdump.1,v 1.16 2003/02/25 10:35:45 wiz Exp $
.\" $NetBSD: kdump.1,v 1.17 2003/06/28 17:15:07 darrenr Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -41,7 +41,7 @@
.Nd display kernel trace data
.Sh SYNOPSIS
.Nm
.Op Fl dlNnRT
.Op Fl dlLNnRT
.Op Fl e Ar emulation
.Op Fl f Ar file
.Op Fl m Ar maxdata
@ -73,6 +73,8 @@ Display the specified file instead of
.It Fl l
Loop reading the trace file, once the end-of-file is reached, waiting for
more data.
.It Fl L
Show light weight process id's as well as the process id.
.It Fl m Ar maxdata
Display at most
.Ar maxdata

View File

@ -1,4 +1,4 @@
/* $NetBSD: kdump.c,v 1.48 2003/05/15 12:57:54 dsl Exp $ */
/* $NetBSD: kdump.c,v 1.49 2003/06/28 17:15:07 darrenr Exp $ */
/*-
* Copyright (c) 1988, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\
#if 0
static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: kdump.c,v 1.48 2003/05/15 12:57:54 dsl Exp $");
__RCSID("$NetBSD: kdump.c,v 1.49 2003/06/28 17:15:07 darrenr Exp $");
#endif
#endif /* not lint */
@ -77,6 +77,7 @@ pid_t do_pid = -1;
const char *tracefile = NULL;
struct ktr_header ktr_header;
int emul_changed = 0;
int show_lwp = 0;
#define eqs(s1, s2) (strcmp((s1), (s2)) == 0)
@ -126,7 +127,7 @@ main(argc, argv)
int trpoints = ALL_POINTS;
const char *emul_name = "netbsd";
while ((ch = getopt(argc, argv, "e:f:dlm:Nnp:RTt:")) != -1)
while ((ch = getopt(argc, argv, "e:f:dlLm:Nnp:RTt:")) != -1)
switch (ch) {
case 'e':
emul_name = strdup(optarg); /* it's safer to copy it */
@ -140,6 +141,9 @@ main(argc, argv)
case 'l':
tail = 1;
break;
case 'L':
show_lwp = 1;
break;
case 'p':
do_pid = atoi(optarg);
break;
@ -302,7 +306,10 @@ dumpheader(kth)
type = unknown;
}
(void)printf("%6d %-8.*s ", kth->ktr_pid, MAXCOMLEN, kth->ktr_comm);
(void)printf("%6d", kth->ktr_pid);
if (show_lwp)
(void)printf("/%d", (int)kth->ktr_buf);
(void)printf(" %-8.*s ", MAXCOMLEN, kth->ktr_comm);
if (timestamp) {
if (timestamp == 2) {
timersub(&kth->ktr_time, &prevtime, &temp);