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 .\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -41,7 +41,7 @@
.Nd display kernel trace data .Nd display kernel trace data
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl dlNnRT .Op Fl dlLNnRT
.Op Fl e Ar emulation .Op Fl e Ar emulation
.Op Fl f Ar file .Op Fl f Ar file
.Op Fl m Ar maxdata .Op Fl m Ar maxdata
@ -73,6 +73,8 @@ Display the specified file instead of
.It Fl l .It Fl l
Loop reading the trace file, once the end-of-file is reached, waiting for Loop reading the trace file, once the end-of-file is reached, waiting for
more data. more data.
.It Fl L
Show light weight process id's as well as the process id.
.It Fl m Ar maxdata .It Fl m Ar maxdata
Display at most Display at most
.Ar maxdata .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 * Copyright (c) 1988, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95"; static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95";
#else #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
#endif /* not lint */ #endif /* not lint */
@ -77,6 +77,7 @@ pid_t do_pid = -1;
const char *tracefile = NULL; const char *tracefile = NULL;
struct ktr_header ktr_header; struct ktr_header ktr_header;
int emul_changed = 0; int emul_changed = 0;
int show_lwp = 0;
#define eqs(s1, s2) (strcmp((s1), (s2)) == 0) #define eqs(s1, s2) (strcmp((s1), (s2)) == 0)
@ -126,7 +127,7 @@ main(argc, argv)
int trpoints = ALL_POINTS; int trpoints = ALL_POINTS;
const char *emul_name = "netbsd"; 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) { switch (ch) {
case 'e': case 'e':
emul_name = strdup(optarg); /* it's safer to copy it */ emul_name = strdup(optarg); /* it's safer to copy it */
@ -140,6 +141,9 @@ main(argc, argv)
case 'l': case 'l':
tail = 1; tail = 1;
break; break;
case 'L':
show_lwp = 1;
break;
case 'p': case 'p':
do_pid = atoi(optarg); do_pid = atoi(optarg);
break; break;
@ -302,7 +306,10 @@ dumpheader(kth)
type = unknown; 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) {
if (timestamp == 2) { if (timestamp == 2) {
timersub(&kth->ktr_time, &prevtime, &temp); timersub(&kth->ktr_time, &prevtime, &temp);