Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libproc/dist use the netbsd path for separate d...



details:   https://anonhg.NetBSD.org/src/rev/5f3edeeac8e7
branches:  trunk
changeset: 344897:5f3edeeac8e7
user:      chs <chs%NetBSD.org@localhost>
date:      Tue Apr 26 14:28:39 2016 +0000

description:
use the netbsd path for separate debuginfo files.
only attempt to look up symbols in the dynsym table if the object
actually has one, which a separate debuginfo file does not.

diffstat:

 external/bsd/libproc/dist/proc_sym.c |  23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diffs (61 lines):

diff -r 1d7b599e58f0 -r 5f3edeeac8e7 external/bsd/libproc/dist/proc_sym.c
--- a/external/bsd/libproc/dist/proc_sym.c      Tue Apr 26 14:26:49 2016 +0000
+++ b/external/bsd/libproc/dist/proc_sym.c      Tue Apr 26 14:28:39 2016 +0000
@@ -32,7 +32,7 @@
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/lib/libproc/proc_sym.c 279946 2015-03-13 04:26:48Z stas $");
 #else
-__RCSID("$NetBSD: proc_sym.c,v 1.2 2015/09/24 14:12:48 christos Exp $");
+__RCSID("$NetBSD: proc_sym.c,v 1.3 2016/04/26 14:28:39 chs Exp $");
 #endif
 
 #include <sys/types.h>
@@ -58,6 +58,8 @@
 
 #include "_libproc.h"
 
+#define DBG_PATH_FMT "/usr/libdata/debug/%s.debug"
+
 #ifdef NO_CTF
 typedef struct ctf_file ctf_file_t;
 #endif
@@ -105,8 +107,7 @@
        int fd;
        char dbg_path[PATH_MAX];
 
-       snprintf(dbg_path, sizeof(dbg_path),
-           "/usr/lib/debug/%s.debug", path);
+       snprintf(dbg_path, sizeof(dbg_path), DBG_PATH_FMT, path);
        fd = open(dbg_path, O_RDONLY);
        if (fd >= 0)
                return (fd);
@@ -364,9 +365,11 @@
         * First look up the symbol in the dynsymtab, and fall back to the
         * symtab if the lookup fails.
         */
-       error = lookup_addr(e, dynsymscn, dynsymstridx, off, addr, &s, symcopy);
-       if (error == 0)
-               goto out;
+       if (dynsymscn) {
+               error = lookup_addr(e, dynsymscn, dynsymstridx, off, addr, &s, symcopy);
+               if (error == 0)
+                       goto out;
+       }
 
        error = lookup_addr(e, symtabscn, symtabstridx, off, addr, &s, symcopy);
        if (error != 0)
@@ -508,9 +511,11 @@
         * First look up the symbol in the dynsymtab, and fall back to the
         * symtab if the lookup fails.
         */
-       error = lookup_name(e, dynsymscn, dynsymstridx, symbol, symcopy, si);
-       if (error == 0)
-               goto out;
+       if (dynsymscn) {
+               error = lookup_name(e, dynsymscn, dynsymstridx, symbol, symcopy, si);
+               if (error == 0)
+                       goto out;
+       }
 
        error = lookup_name(e, symtabscn, symtabstridx, symbol, symcopy, si);
        if (error == 0)



Home | Main Index | Thread Index | Old Index