FreeBSD Bugzilla – Attachment 120742 Details for
Bug 163602
pmcstat(8) doesn't search symbols under /boot/modules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
pmcstat_modules.diff
pmcstat_modules.diff (text/plain), 2.30 KB, created by
Ulf Lilleengen
on 2014-01-14 19:44:15 UTC
(
hide
)
Description:
pmcstat_modules.diff
Filename:
MIME Type:
Creator:
Ulf Lilleengen
Created:
2014-01-14 19:44:15 UTC
Size:
2.30 KB
patch
obsolete
>diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c >index cc43b82..d0db9c5 100644 >--- a/usr.sbin/pmcstat/pmcstat.c >+++ b/usr.sbin/pmcstat/pmcstat.c >@@ -583,7 +583,7 @@ main(int argc, char **argv) > args.pa_verbosity = 1; > args.pa_logfd = -1; > args.pa_fsroot = ""; >- args.pa_kernel = strdup("/boot/kernel"); >+ args.pa_kernel = strdup("/boot/kernel;/boot/modules"); > args.pa_samplesdir = "."; > args.pa_printfile = stderr; > args.pa_graphdepth = DEFAULT_CALLGRAPH_DEPTH; >diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c >index fdcf9c4..6606fa5 100644 >--- a/usr.sbin/pmcstat/pmcstat_log.c >+++ b/usr.sbin/pmcstat/pmcstat_log.c >@@ -230,6 +230,8 @@ float pmcstat_threshold = 0.5; /* Cost filter for top mode. */ > static struct pmcstat_image *pmcstat_image_from_path(pmcstat_interned_string > _path, int _iskernelmodule); > static void pmcstat_image_get_aout_params(struct pmcstat_image *_image); >+static void pmcstat_locate_kernelmodule(char *_buffer, size_t _buffer_length, >+ const char *_path); > static void pmcstat_image_get_elf_params(struct pmcstat_image *_image); > static void pmcstat_image_link(struct pmcstat_process *_pp, > struct pmcstat_image *_i, uintfptr_t _lpc); >@@ -602,6 +604,22 @@ pmcstat_image_add_symbols(struct pmcstat_image *image, Elf *e, > symptr->ps_end = (symptr+1)->ps_start; > } > >+static void >+pmcstat_locate_kernelmodule(char *buffer, size_t buffer_length, >+ const char *path) >+{ >+ char * module_paths = strdup(args.pa_kernel); >+ char * module_path = NULL; >+ while ((module_path = strsep(&module_paths, ";")) != NULL) { >+ (void) snprintf(buffer, buffer_length, "%s%s/%s", args.pa_fsroot, >+ module_path, path); >+ if (access(buffer, R_OK) == 0) { >+ break; >+ } >+ } >+ free(module_paths); >+} >+ > /* > * Examine an ELF file to determine the size of its text segment. > * Sets image->pi_type if anything conclusive can be determined about >@@ -641,8 +659,7 @@ pmcstat_image_get_elf_params(struct pmcstat_image *image) > * and user mode executable objects under FSROOT/PATHNAME. > */ > if (image->pi_iskernelmodule) >- (void) snprintf(buffer, sizeof(buffer), "%s%s/%s", >- args.pa_fsroot, args.pa_kernel, path); >+ (void) pmcstat_locate_kernelmodule(buffer, sizeof(buffer), path); > else > (void) snprintf(buffer, sizeof(buffer), "%s%s", > args.pa_fsroot, path);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 163602
: 120742