From 30ec812b4719e3e06bf435d53c9ccf6a6e76f846 Mon Sep 17 00:00:00 2001 From: jkoshy Date: Sun, 25 Dec 2005 05:11:29 +0000 Subject: When generating profiles (-g) warn about shared objects that were not found. --- usr.sbin/pmcstat/pmcstat_log.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'usr.sbin/pmcstat') 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 */ -- cgit v1.1