diff options
Diffstat (limited to 'usr.bin/ktrdump/ktrdump.c')
-rw-r--r-- | usr.bin/ktrdump/ktrdump.c | 18 |
1 files changed, 10 insertions, 8 deletions
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) |