Fix for r288176 changes related to debug symbols move.

Reviewed by: emaste
Sponsored by:	Stormshield
This commit is contained in:
Fabien Thomas 2015-10-08 09:46:35 +00:00
parent 2663942208
commit 66ca84a7ba

View File

@ -966,12 +966,20 @@ pmcstat_image_addr2line(struct pmcstat_image *image, uintfptr_t addr,
char *funcname, size_t funcname_len) char *funcname, size_t funcname_len)
{ {
static int addr2line_warn = 0; static int addr2line_warn = 0;
unsigned l;
char *sep, cmdline[PATH_MAX], imagepath[PATH_MAX]; char *sep, cmdline[PATH_MAX], imagepath[PATH_MAX];
unsigned l;
int fd; int fd;
if (image->pi_addr2line == NULL) { if (image->pi_addr2line == NULL) {
/* Try default debug file location. */
snprintf(imagepath, sizeof(imagepath),
"/usr/lib/debug/%s%s.debug",
args.pa_fsroot,
pmcstat_string_unintern(image->pi_fullpath));
fd = open(imagepath, O_RDONLY);
if (fd < 0) {
/* Old kernel symbol path. */
snprintf(imagepath, sizeof(imagepath), "%s%s.symbols", snprintf(imagepath, sizeof(imagepath), "%s%s.symbols",
args.pa_fsroot, args.pa_fsroot,
pmcstat_string_unintern(image->pi_fullpath)); pmcstat_string_unintern(image->pi_fullpath));
@ -979,8 +987,11 @@ pmcstat_image_addr2line(struct pmcstat_image *image, uintfptr_t addr,
if (fd < 0) { if (fd < 0) {
snprintf(imagepath, sizeof(imagepath), "%s%s", snprintf(imagepath, sizeof(imagepath), "%s%s",
args.pa_fsroot, args.pa_fsroot,
pmcstat_string_unintern(image->pi_fullpath)); pmcstat_string_unintern(
} else image->pi_fullpath));
}
}
if (fd >= 0)
close(fd); close(fd);
/* /*
* New addr2line support recursive inline function with -i * New addr2line support recursive inline function with -i