summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pmcstat
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2005-12-25 05:11:29 +0000
committerjkoshy <jkoshy@FreeBSD.org>2005-12-25 05:11:29 +0000
commit30ec812b4719e3e06bf435d53c9ccf6a6e76f846 (patch)
treedb8e9274511ad2b90a01100514e507bf7e0ab8a4 /usr.sbin/pmcstat
parentabdeb4cf6731742018d5541e04a2067c4bf6b1b6 (diff)
downloadFreeBSD-src-30ec812b4719e3e06bf435d53c9ccf6a6e76f846.zip
FreeBSD-src-30ec812b4719e3e06bf435d53c9ccf6a6e76f846.tar.gz
When generating profiles (-g) warn about shared objects that were
not found.
Diffstat (limited to 'usr.sbin/pmcstat')
-rw-r--r--usr.sbin/pmcstat/pmcstat_log.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c
index a7bb4ef..9b7e02f 100644
--- a/usr.sbin/pmcstat/pmcstat_log.c
+++ b/usr.sbin/pmcstat/pmcstat_log.c
@@ -727,7 +727,7 @@ pmcstat_process_add_elf_image(struct pmcstat_process *pp, const char *path,
char *line;
uintmax_t libstart;
struct pmcstat_image *image, *rtldimage;
- char libpath[PATH_MAX];
+ char libname[PATH_MAX], libpath[PATH_MAX];
char command[PATH_MAX + sizeof(PMCSTAT_LDD_COMMAND) + 1];
/* Look up path in the cache. */
@@ -792,10 +792,18 @@ pmcstat_process_add_elf_image(struct pmcstat_process *pp, const char *path,
continue;
line[linelen-1] = '\0';
- if (sscanf(line, "%s %jx",
- libpath, &libstart) != 2)
+ libstart = 0;
+ libpath[0] = libname[0] = '\0';
+ if (sscanf(line, "%s \"%[^\"]\" %jx",
+ libname, libpath, &libstart) != 3)
continue;
+ if (libstart == 0) {
+ warnx("WARNING: object \"%s\" was not found "
+ "for program \"%s\".", libname, path);
+ continue;
+ }
+
image = pmcstat_image_from_path(
pmcstat_string_intern(libpath));
if (image == NULL)
@@ -1281,7 +1289,7 @@ pmcstat_initialize_logging(struct pmcstat_args *a)
struct pmcstat_image *img;
/* use a convenient format for 'ldd' output */
- if (setenv("LD_TRACE_LOADED_OBJECTS_FMT1","%p %x\n",1) != 0)
+ if (setenv("LD_TRACE_LOADED_OBJECTS_FMT1","%o \"%p\" %x\n",1) != 0)
goto error;
/* Initialize hash tables */
OpenPOWER on IntegriCloud