From d0ad455673cf217e0dcd42c7c7547fe8fcdcb697 Mon Sep 17 00:00:00 2001 From: darrenr Date: Sat, 28 Jun 2003 17:15:07 +0000 Subject: [PATCH] add appropriate hack to display ktr_buf as the lwpid if -L is supplied on the command line. --- usr.bin/kdump/kdump.1 | 6 ++++-- usr.bin/kdump/kdump.c | 15 +++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/usr.bin/kdump/kdump.1 b/usr.bin/kdump/kdump.1 index f8349c95d47a..1b7c055e7869 100644 --- a/usr.bin/kdump/kdump.1 +++ b/usr.bin/kdump/kdump.1 @@ -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 diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 8f1fefc546b8..e90b948f82cc 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -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);