Author: fabient
Date: Thu Oct  8 09:46:35 2015
New Revision: 289023
URL: https://svnweb.freebsd.org/changeset/base/289023

Log:
  Fix for r288176 changes related to debug symbols move.
  
  Reviewed by: emaste
  Sponsored by: Stormshield

Modified:
  head/usr.sbin/pmcstat/pmcstat_log.c

Modified: head/usr.sbin/pmcstat/pmcstat_log.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat_log.c Thu Oct  8 08:55:34 2015        
(r289022)
+++ head/usr.sbin/pmcstat/pmcstat_log.c Thu Oct  8 09:46:35 2015        
(r289023)
@@ -966,21 +966,32 @@ pmcstat_image_addr2line(struct pmcstat_i
     char *funcname, size_t funcname_len)
 {
        static int addr2line_warn = 0;
-       unsigned l;
 
        char *sep, cmdline[PATH_MAX], imagepath[PATH_MAX];
+       unsigned l;
        int fd;
 
        if (image->pi_addr2line == NULL) {
-               snprintf(imagepath, sizeof(imagepath), "%s%s.symbols",
+               /* 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) {
-                       snprintf(imagepath, sizeof(imagepath), "%s%s",
+                       /* Old kernel symbol path. */
+                       snprintf(imagepath, sizeof(imagepath), "%s%s.symbols",
                            args.pa_fsroot,
                            pmcstat_string_unintern(image->pi_fullpath));
-               } else
+                       fd = open(imagepath, O_RDONLY);
+                       if (fd < 0) {
+                               snprintf(imagepath, sizeof(imagepath), "%s%s",
+                                   args.pa_fsroot,
+                                   pmcstat_string_unintern(
+                                       image->pi_fullpath));
+                       }
+               }
+               if (fd >= 0)
                        close(fd);
                /*
                 * New addr2line support recursive inline function with -i
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to