diff options
author | markj <markj@FreeBSD.org> | 2017-09-21 12:37:12 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2017-09-21 12:37:12 +0000 |
commit | 35095d31eac54db19b0d6811fb5481c784cd6a9d (patch) | |
tree | dc73122deb62e279dd1e68feb98cc9ac9ea06183 /usr.bin | |
parent | 86f226dc9c9e89e445a04c1290a3e61299e64c42 (diff) | |
download | FreeBSD-src-35095d31eac54db19b0d6811fb5481c784cd6a9d.zip FreeBSD-src-35095d31eac54db19b0d6811fb5481c784cd6a9d.tar.gz |
MFC r323439:
Provide an error message if KTR symbols in a vmcore cannot be resolved.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ktrdump/ktrdump.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c index 84ab3a8..d1cf061 100644 --- a/usr.bin/ktrdump/ktrdump.c +++ b/usr.bin/ktrdump/ktrdump.c @@ -93,6 +93,7 @@ main(int ac, char **av) char *p; int version; int entries; + int count; int index, index2; int parm; int in; @@ -162,8 +163,12 @@ main(int ac, char **av) 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) + count = kvm_nlist(kd, nl); + if (count == -1) + errx(1, "%s", kvm_geterr(kd)); + if (count > 0) + errx(1, "failed to resolve ktr symbols"); + if (kvm_read(kd, nl[0].n_value, &version, sizeof(version)) == -1) errx(1, "%s", kvm_geterr(kd)); if (version != KTR_VERSION) errx(1, "ktr version mismatch"); |