Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Apr 2010 21:53:27 +0000 (UTC)
From:      Fabien Thomas <fabient@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r206635 - head/usr.sbin/pmcstat
Message-ID:  <201004142153.o3ELrRv9097883@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fabient
Date: Wed Apr 14 21:53:27 2010
New Revision: 206635
URL: http://svn.freebsd.org/changeset/base/206635

Log:
  Move fatal error at the right place.
  Fix exit from top mode when checking if PMC is available.
  
  MFC after: 3 days

Modified:
  head/usr.sbin/pmcstat/pmcpl_callgraph.c
  head/usr.sbin/pmcstat/pmcpl_gprof.c
  head/usr.sbin/pmcstat/pmcstat_log.c

Modified: head/usr.sbin/pmcstat/pmcpl_callgraph.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcpl_callgraph.c	Wed Apr 14 21:46:22 2010	(r206634)
+++ head/usr.sbin/pmcstat/pmcpl_callgraph.c	Wed Apr 14 21:53:27 2010	(r206635)
@@ -581,6 +581,8 @@ pmcpl_cg_topdisplay(void)
 	struct pmcstat_pmcrecord *pmcr;
 
 	pmcr = pmcstat_pmcindex_to_pmcr(pmcstat_pmcinfilter);
+	if (!pmcr)
+		err(EX_SOFTWARE, "ERROR: invalid pmcindex");
 
 	/*
 	 * We pull out all callgraph nodes in the top-level hash table

Modified: head/usr.sbin/pmcstat/pmcpl_gprof.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcpl_gprof.c	Wed Apr 14 21:46:22 2010	(r206634)
+++ head/usr.sbin/pmcstat/pmcpl_gprof.c	Wed Apr 14 21:53:27 2010	(r206635)
@@ -171,6 +171,8 @@ pmcstat_gmon_create_name(const char *sam
 	char fullpath[PATH_MAX];
 
 	pmcname = pmcstat_pmcid_to_name(pmcid);
+	if (!pmcname)
+		err(EX_SOFTWARE, "ERROR: cannot find pmcid");
 
 	(void) snprintf(fullpath, sizeof(fullpath),
 	    "%s/%s/%s", samplesdir, pmcname,

Modified: head/usr.sbin/pmcstat/pmcstat_log.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat_log.c	Wed Apr 14 21:46:22 2010	(r206634)
+++ head/usr.sbin/pmcstat/pmcstat_log.c	Wed Apr 14 21:53:27 2010	(r206635)
@@ -1050,7 +1050,6 @@ pmcstat_pmcid_to_name(pmc_id_t pmcid)
 	    if (pr->pr_pmcid == pmcid)
 		    return (pmcstat_string_unintern(pr->pr_pmcname));
 
-	err(EX_SOFTWARE, "ERROR: cannot find pmcid");
 	return NULL;
 }
 
@@ -1083,7 +1082,6 @@ pmcstat_pmcindex_to_pmcr(int pmcin)
 		if (pr->pr_pmcin == pmcin)
 			return pr;
 
-	err(EX_SOFTWARE, "ERROR: invalid pmcindex");
 	return NULL;
 }
 



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