summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2015-03-19 13:08:17 +0000
committerjhb <jhb@FreeBSD.org>2015-03-19 13:08:17 +0000
commita81d6ed0b784f018a14c35109d57e973d67e38fe (patch)
tree8db45eaec4bee210fe3174694aa32d260790baeb /usr.bin
parent7fe0fee3eb948182a252b31ed8c3acf4e9d6d74b (diff)
downloadFreeBSD-src-a81d6ed0b784f018a14c35109d57e973d67e38fe.zip
FreeBSD-src-a81d6ed0b784f018a14c35109d57e973d67e38fe.tar.gz
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.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ktrdump/ktrdump.812
-rw-r--r--usr.bin/ktrdump/ktrdump.c18
2 files changed, 16 insertions, 14 deletions
diff --git a/usr.bin/ktrdump/ktrdump.8 b/usr.bin/ktrdump/ktrdump.8
index 9a77bfc..f725a76 100644
--- a/usr.bin/ktrdump/ktrdump.8
+++ b/usr.bin/ktrdump/ktrdump.8
@@ -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 .
diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c
index 77ae522..ccd466d 100644
--- a/usr.bin/ktrdump/ktrdump.c
+++ b/usr.bin/ktrdump/ktrdump.c
@@ -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;
@@ -103,16 +103,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;
@@ -122,11 +123,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)
@@ -157,8 +159,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)
OpenPOWER on IntegriCloud