diff options
| author | Jessica Clarke <jrtc27@FreeBSD.org> | 2023-05-30 23:15:34 +0000 |
|---|---|---|
| committer | Jessica Clarke <jrtc27@FreeBSD.org> | 2023-05-30 23:15:34 +0000 |
| commit | 53d0b9e438bc30ef12c24fddec13e97ade852164 (patch) | |
| tree | 95aa3f00780aa93db37d9019369a9615181d4583 /lib/libpmcstat | |
| parent | 8e63e787abbd69d29e55e2e0b2aa0aa624339f3b (diff) | |
Diffstat (limited to 'lib/libpmcstat')
| -rw-r--r-- | lib/libpmcstat/libpmcstat.h | 3 | ||||
| -rw-r--r-- | lib/libpmcstat/libpmcstat_image.c | 24 |
2 files changed, 6 insertions, 21 deletions
diff --git a/lib/libpmcstat/libpmcstat.h b/lib/libpmcstat/libpmcstat.h index 8e8d94b116d8..07d82d4d0e57 100644 --- a/lib/libpmcstat/libpmcstat.h +++ b/lib/libpmcstat/libpmcstat.h @@ -98,7 +98,7 @@ struct pmcstat_args { #define FLAG_READ_LOGFILE 0x00000200 /* -R file */ #define FLAG_DO_GPROF 0x00000400 /* -g */ #define FLAG_HAS_SAMPLESDIR 0x00000800 /* -D dir */ -#define FLAG_HAS_KERNELPATH 0x00001000 /* -k kernel */ +/* was FLAG_HAS_KERNELPATH 0x00001000 */ #define FLAG_DO_PRINT 0x00002000 /* -o */ #define FLAG_DO_CALLGRAPHS 0x00004000 /* -G or -F */ #define FLAG_DO_ANNOTATE 0x00008000 /* -m */ @@ -121,7 +121,6 @@ struct pmcstat_args { char *pa_outputpath; /* path to output log */ void *pa_logparser; /* log file parser */ const char *pa_fsroot; /* FS root where executables reside */ - char *pa_kernel; /* pathname of the kernel */ const char *pa_samplesdir; /* directory for profile files */ const char *pa_mapfilename;/* mapfile name */ FILE *pa_graphfile; /* where to send the callgraph */ diff --git a/lib/libpmcstat/libpmcstat_image.c b/lib/libpmcstat/libpmcstat_image.c index c63f00e03253..bd62a4818f2c 100644 --- a/lib/libpmcstat/libpmcstat_image.c +++ b/lib/libpmcstat/libpmcstat_image.c @@ -315,7 +315,6 @@ pmcstat_image_get_elf_params(struct pmcstat_image *image, GElf_Shdr sh; enum pmcstat_image_type image_type; char buffer[PATH_MAX]; - char buffer_modules[PATH_MAX]; assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN); @@ -330,32 +329,19 @@ pmcstat_image_get_elf_params(struct pmcstat_image *image, assert(path != NULL); /* - * Look for kernel modules under FSROOT/KERNELPATH/NAME and - * FSROOT/boot/modules/NAME, and user mode executable objects - * under FSROOT/PATHNAME. + * Look for files under FSROOT/PATHNAME. */ - if (image->pi_iskernelmodule) { - (void) snprintf(buffer, sizeof(buffer), "%s%s/%s", - args->pa_fsroot, args->pa_kernel, path); - (void) snprintf(buffer_modules, sizeof(buffer_modules), - "%s/boot/modules/%s", args->pa_fsroot, path); - } else { - (void) snprintf(buffer, sizeof(buffer), "%s%s", - args->pa_fsroot, path); - } + (void) snprintf(buffer, sizeof(buffer), "%s%s", + args->pa_fsroot, path); e = NULL; fd = open(buffer, O_RDONLY, 0); - if (fd < 0 && !image->pi_iskernelmodule) { + if (fd < 0) { warnx("WARNING: Cannot open \"%s\".", buffer); goto done; } - if (fd < 0 && (fd = open(buffer_modules, O_RDONLY, 0)) < 0) { - warnx("WARNING: Cannot open \"%s\" or \"%s\".", - buffer, buffer_modules); - goto done; - } + if (elf_version(EV_CURRENT) == EV_NONE) { warnx("WARNING: failed to init elf\n"); goto done; |
