svn commit: r280255 - in stable: 10/usr.bin/ktrdump 9/usr.bin/ktrdump

John Baldwin jhb at FreeBSD.org
Thu Mar 19 13:08:20 UTC 2015


Author: jhb
Date: Thu Mar 19 13:08:17 2015
New Revision: 280255
URL: https://svnweb.freebsd.org/changeset/base/280255

Log:
  MFC 278327:
  Change ktrdump to use the more standard -M/-N flags to specify the path
  to a crash dump and kernel, respectively.  The existing -m/-e flags are
  still supported for backwards compatiblity but are no longer documented.

Modified:
  stable/9/usr.bin/ktrdump/ktrdump.8
  stable/9/usr.bin/ktrdump/ktrdump.c
Directory Properties:
  stable/9/usr.bin/ktrdump/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/usr.bin/ktrdump/ktrdump.8
  stable/10/usr.bin/ktrdump/ktrdump.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/usr.bin/ktrdump/ktrdump.8
==============================================================================
--- stable/9/usr.bin/ktrdump/ktrdump.8	Thu Mar 19 13:05:55 2015	(r280254)
+++ stable/9/usr.bin/ktrdump/ktrdump.8	Thu Mar 19 13:08:17 2015	(r280255)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 8, 2005
+.Dd February 6, 2015
 .Dt KTRDUMP 8
 .Os
 .Sh NAME
@@ -34,9 +34,9 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl cfqrtH
-.Op Fl e Ar execfile
 .Op Fl i Ar ktrfile
-.Op Fl m Ar corefile
+.Op Fl M Ar core
+.Op Fl N Ar system
 .Op Fl o Ar outfile
 .Sh DESCRIPTION
 The
@@ -44,7 +44,7 @@ The
 utility is used to dump the contents of the kernel ktr trace buffer.
 .Pp
 The following options are available:
-.Bl -tag -width ".Fl e Ar execfile"
+.Bl -tag -width ".Fl i Ar ktrfile"
 .It Fl c
 Print the CPU number that each entry was logged from.
 .It Fl f
@@ -61,11 +61,11 @@ Print the thread ID for each entry.
 File containing saved ktr trace events; for more information see the
 .Xr ktr 4
 manual page.
-.It Fl e Ar execfile
+.It Fl N Ar system
 The kernel image to resolve symbols from.
 The default is the value returned via
 .Xr getbootfile 3 .
-.It Fl m Ar corefile
+.It Fl M Ar core
 The core file or memory image to read from.
 The default is
 .Pa /dev/mem .

Modified: stable/9/usr.bin/ktrdump/ktrdump.c
==============================================================================
--- stable/9/usr.bin/ktrdump/ktrdump.c	Thu Mar 19 13:05:55 2015	(r280254)
+++ stable/9/usr.bin/ktrdump/ktrdump.c	Thu Mar 19 13:08:17 2015	(r280255)
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
 
 #define	SBUFLEN	128
 #define	USAGE \
-	"usage: ktrdump [-cfqrtH] [-e execfile] [-i ktrfile] [-m corefile] [-o outfile]\n"
+	"usage: ktrdump [-cfqrtH] [-i ktrfile] [-M core] [-N system] [-o outfile]\n"
 
 static void usage(void);
 
@@ -59,9 +59,9 @@ static struct nlist nl[] = {
 };
 
 static int cflag;
-static int eflag;
 static int fflag;
-static int mflag;
+static int Mflag;
+static int Nflag;
 static int qflag;
 static int rflag;
 static int tflag;
@@ -102,16 +102,17 @@ main(int ac, char **av)
 	 * Parse commandline arguments.
 	 */
 	out = stdout;
-	while ((c = getopt(ac, av, "cfqrtHe:i:m:o:")) != -1)
+	while ((c = getopt(ac, av, "cfqrtHe:i:m:M:N:o:")) != -1)
 		switch (c) {
 		case 'c':
 			cflag = 1;
 			break;
+		case 'N':
 		case 'e':
 			if (strlcpy(execfile, optarg, sizeof(execfile))
 			    >= sizeof(execfile))
 				errx(1, "%s: File name too long", optarg);
-			eflag = 1;
+			Nflag = 1;
 			break;
 		case 'f':
 			fflag = 1;
@@ -121,11 +122,12 @@ main(int ac, char **av)
 			if ((in = open(optarg, O_RDONLY)) == -1)
 				err(1, "%s", optarg);
 			break;
+		case 'M':
 		case 'm':
 			if (strlcpy(corefile, optarg, sizeof(corefile))
 			    >= sizeof(corefile))
 				errx(1, "%s: File name too long", optarg);
-			mflag = 1;
+			Mflag = 1;
 			break;
 		case 'o':
 			if ((out = fopen(optarg, "w")) == NULL)
@@ -156,8 +158,8 @@ main(int ac, char **av)
 	 * Open our execfile and corefile, resolve needed symbols and read in
 	 * the trace buffer.
 	 */
-	if ((kd = kvm_openfiles(eflag ? execfile : NULL,
-	    mflag ? corefile : NULL, NULL, O_RDONLY, errbuf)) == NULL)
+	if ((kd = kvm_openfiles(Nflag ? execfile : NULL,
+	    Mflag ? corefile : NULL, NULL, O_RDONLY, errbuf)) == NULL)
 		errx(1, "%s", errbuf);
 	if (kvm_nlist(kd, nl) != 0 ||
 	    kvm_read(kd, nl[0].n_value, &version, sizeof(version)) == -1)


More information about the svn-src-stable-9 mailing list