Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/kdump It's easy for ktrace can generate trace files ...
details: https://anonhg.NetBSD.org/src/rev/51255f11842d
branches: trunk
changeset: 533086:51255f11842d
user: atatat <atatat%NetBSD.org@localhost>
date: Thu Jun 20 22:02:32 2002 +0000
description:
It's easy for ktrace can generate trace files that contain data from
multiple processes, so let's add a "-p pid" option to kdump so that it
can pull out the data for one process easily.
diffstat:
usr.bin/kdump/kdump.1 | 5 ++++-
usr.bin/kdump/kdump.c | 15 +++++++++++----
2 files changed, 15 insertions(+), 5 deletions(-)
diffs (90 lines):
diff -r 59fd8d1d13c9 -r 51255f11842d usr.bin/kdump/kdump.1
--- a/usr.bin/kdump/kdump.1 Thu Jun 20 21:03:19 2002 +0000
+++ b/usr.bin/kdump/kdump.1 Thu Jun 20 22:02:32 2002 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: kdump.1,v 1.10 2001/12/01 16:43:16 wiz Exp $
+.\" $NetBSD: kdump.1,v 1.11 2002/06/20 22:02:32 atatat Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -45,6 +45,7 @@
.Op Fl e Ar emulation
.Op Fl f Ar file
.Op Fl m Ar maxdata
+.Op Fl p Ar pid
.Op Fl t Ar trstr
.Sh DESCRIPTION
.Nm
@@ -74,6 +75,8 @@
.Ar maxdata
bytes when decoding
.Tn I/O .
+.It Fl p Ar pid
+Only display records from the trace file that are for the indicated pid.
.It Fl n
Suppress ad hoc translations.
Normally
diff -r 59fd8d1d13c9 -r 51255f11842d usr.bin/kdump/kdump.c
--- a/usr.bin/kdump/kdump.c Thu Jun 20 21:03:19 2002 +0000
+++ b/usr.bin/kdump/kdump.c Thu Jun 20 22:02:32 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kdump.c,v 1.38 2002/04/08 20:15:59 christos Exp $ */
+/* $NetBSD: kdump.c,v 1.39 2002/06/20 22:02:32 atatat Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: kdump.c,v 1.38 2002/04/08 20:15:59 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.39 2002/06/20 22:02:32 atatat Exp $");
#endif
#endif /* not lint */
@@ -71,6 +71,7 @@
#include <sys/syscall.h>
int timestamp, decimal, plain, tail, maxdata;
+pid_t do_pid = -1;
const char *tracefile = DEF_TRACEFILE;
struct ktr_header ktr_header;
int emul_changed = 0;
@@ -121,7 +122,7 @@
int trpoints = ALL_POINTS;
const char *emul_name = "netbsd";
- while ((ch = getopt(argc, argv, "e:f:dlm:nRTt:")) != -1)
+ while ((ch = getopt(argc, argv, "e:f:dlm:np:RTt:")) != -1)
switch (ch) {
case 'e':
emul_name = strdup(optarg); /* it's safer to copy it */
@@ -135,6 +136,9 @@
case 'l':
tail = 1;
break;
+ case 'p':
+ do_pid = atoi(optarg);
+ break;
case 'm':
maxdata = atoi(optarg);
break;
@@ -170,7 +174,8 @@
err(1, "%s", tracefile);
while (fread_tail((char *)&ktr_header, sizeof(struct ktr_header), 1)) {
if (trpoints & (1<<ktr_header.ktr_type))
- dumpheader(&ktr_header);
+ if (do_pid == -1 || ktr_header.ktr_pid == do_pid)
+ dumpheader(&ktr_header);
if ((ktrlen = ktr_header.ktr_len) < 0)
errx(1, "bogus length 0x%x", ktrlen);
if (ktrlen > size) {
@@ -185,6 +190,8 @@
continue;
/* update context to match currently processed record */
+ if (do_pid != -1 && ktr_header.ktr_pid != do_pid)
+ continue;
ectx_sanify(ktr_header.ktr_pid);
switch (ktr_header.ktr_type) {
Home |
Main Index |
Thread Index |
Old Index