Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Sep 2017 15:18:43 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323439 - head/usr.bin/ktrdump
Message-ID:  <201709111518.v8BFIhqf088757@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon Sep 11 15:18:43 2017
New Revision: 323439
URL: https://svnweb.freebsd.org/changeset/base/323439

Log:
  Provide an error message if KTR symbols in a vmcore cannot be resolved.
  
  libkvm does not set an error string in this case, so we were previously
  failing silently.
  
  MFC after:	1 week

Modified:
  head/usr.bin/ktrdump/ktrdump.c

Modified: head/usr.bin/ktrdump/ktrdump.c
==============================================================================
--- head/usr.bin/ktrdump/ktrdump.c	Mon Sep 11 14:41:57 2017	(r323438)
+++ head/usr.bin/ktrdump/ktrdump.c	Mon Sep 11 15:18:43 2017	(r323439)
@@ -98,6 +98,7 @@ main(int ac, char **av)
 	char *p;
 	int version;
 	int entries;
+	int count;
 	int index, index2;
 	int parm;
 	int in;
@@ -184,8 +185,12 @@ main(int ac, char **av)
 	 */
 	caph_cache_catpages();
 
-	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");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709111518.v8BFIhqf088757>