summaryrefslogtreecommitdiffstats
path: root/lib/libproc/proc_sym.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libproc/proc_sym.c')
-rw-r--r--lib/libproc/proc_sym.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/libproc/proc_sym.c b/lib/libproc/proc_sym.c
index 2dd21fe..4f3d83b 100644
--- a/lib/libproc/proc_sym.c
+++ b/lib/libproc/proc_sym.c
@@ -238,16 +238,16 @@ proc_addr2sym(struct proc_handle *p, uintptr_t addr, char *name,
if ((map = proc_addr2map(p, addr)) == NULL)
return (-1);
- if (!map->pr_mapname || (fd = open(map->pr_mapname, O_RDONLY, 0)) < 0) {
- warn("ERROR: open %s failed", map->pr_mapname);
+ if ((fd = open(map->pr_mapname, O_RDONLY, 0)) < 0) {
+ DPRINTF("ERROR: open %s failed", map->pr_mapname);
goto err0;
}
if ((e = elf_begin(fd, ELF_C_READ, NULL)) == NULL) {
- warn("ERROR: elf_begin() failed");
+ DPRINTFX("ERROR: elf_begin() failed: %s", elf_errmsg(-1));
goto err1;
}
if (gelf_getehdr(e, &ehdr) == NULL) {
- warn("ERROR: gelf_getehdr() failed");
+ DPRINTFX("ERROR: gelf_getehdr() failed: %s", elf_errmsg(-1));
goto err2;
}
/*
@@ -275,7 +275,7 @@ proc_addr2sym(struct proc_handle *p, uintptr_t addr, char *name,
* Then look up the string name in STRTAB (.dynstr)
*/
if ((data = elf_getdata(dynsymscn, NULL)) == NULL) {
- DPRINTF("ERROR: elf_getdata() failed");
+ DPRINTFX("ERROR: elf_getdata() failed: %s", elf_errmsg(-1));
goto symtab;
}
i = 0;
@@ -312,7 +312,7 @@ symtab:
if (symtabscn == NULL)
goto err2;
if ((data = elf_getdata(symtabscn, NULL)) == NULL) {
- DPRINTF("ERROR: elf_getdata() failed");
+ DPRINTFX("ERROR: elf_getdata() failed: %s", elf_errmsg(-1));
goto err2;
}
i = 0;
@@ -420,7 +420,7 @@ proc_name2sym(struct proc_handle *p, const char *object, const char *symbol,
unsigned long symtabstridx = 0, dynsymstridx = 0;
if ((map = proc_name2map(p, object)) == NULL) {
- DPRINTF("ERROR: couldn't find object %s", object);
+ DPRINTFX("ERROR: couldn't find object %s", object);
goto err0;
}
if ((fd = open(map->pr_mapname, O_RDONLY, 0)) < 0) {
@@ -428,11 +428,11 @@ proc_name2sym(struct proc_handle *p, const char *object, const char *symbol,
goto err0;
}
if ((e = elf_begin(fd, ELF_C_READ, NULL)) == NULL) {
- warn("ERROR: elf_begin() failed");
+ DPRINTFX("ERROR: elf_begin() failed: %s", elf_errmsg(-1));
goto err1;
}
if (gelf_getehdr(e, &ehdr) == NULL) {
- warn("ERROR: gelf_getehdr() failed");
+ DPRINTFX("ERROR: gelf_getehdr() failed: %s", elf_errmsg(-1));
goto err2;
}
/*
@@ -460,7 +460,6 @@ proc_name2sym(struct proc_handle *p, const char *object, const char *symbol,
* Then look up the string name in STRTAB (.dynstr)
*/
if ((data = elf_getdata(dynsymscn, NULL))) {
- DPRINTF("ERROR: elf_getdata() failed");
i = 0;
while (gelf_getsym(data, i++, &sym) != NULL) {
s = elf_strptr(e, dynsymstridx, sym.st_name);
@@ -519,11 +518,11 @@ proc_iter_symbyaddr(struct proc_handle *p, const char *object, int which,
if ((map = proc_name2map(p, object)) == NULL)
return (-1);
if ((fd = open(map->pr_mapname, O_RDONLY)) < 0) {
- warn("ERROR: open %s failed", map->pr_mapname);
+ DPRINTF("ERROR: open %s failed", map->pr_mapname);
goto err0;
}
if ((e = elf_begin(fd, ELF_C_READ, NULL)) == NULL) {
- warn("ERROR: elf_begin() failed");
+ DPRINTFX("ERROR: elf_begin() failed: %s", elf_errmsg(-1));
goto err1;
}
/*
@@ -546,7 +545,7 @@ proc_iter_symbyaddr(struct proc_handle *p, const char *object, int which,
return (-1);
stridx = shdr.sh_link;
if ((data = elf_getdata(foundscn, NULL)) == NULL) {
- DPRINTF("ERROR: elf_getdata() failed");
+ DPRINTFX("ERROR: elf_getdata() failed: %s", elf_errmsg(-1));
goto err2;
}
i = 0;
OpenPOWER on IntegriCloud