Make sure we visit both symbol sections even if one of them doesn't
exist. This makes it possible to dtrace some C++ programs like devd.
This commit is contained in:
parent
c3927cd956
commit
19a75aff51
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240040
@ -254,7 +254,7 @@ proc_addr2sym(struct proc_handle *p, uintptr_t addr, char *name,
|
||||
*/
|
||||
if ((data = elf_getdata(dynsymscn, NULL)) == NULL) {
|
||||
DPRINTF("ERROR: elf_getdata() failed");
|
||||
goto err2;
|
||||
goto symtab;
|
||||
}
|
||||
i = 0;
|
||||
while (gelf_getsym(data, i++, &sym) != NULL) {
|
||||
@ -274,11 +274,11 @@ proc_addr2sym(struct proc_handle *p, uintptr_t addr, char *name,
|
||||
* the function.
|
||||
*/
|
||||
symcopy->st_value = rsym;
|
||||
error = 0;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
symtab:
|
||||
/*
|
||||
* Iterate over the Symbols Table to find the symbol.
|
||||
* Then look up the string name in STRTAB (.dynstr)
|
||||
@ -430,10 +430,8 @@ proc_name2sym(struct proc_handle *p, const char *object, const char *symbol,
|
||||
* Iterate over the Dynamic Symbols table to find the symbol.
|
||||
* Then look up the string name in STRTAB (.dynstr)
|
||||
*/
|
||||
if ((data = elf_getdata(dynsymscn, NULL)) == NULL) {
|
||||
if ((data = elf_getdata(dynsymscn, NULL))) {
|
||||
DPRINTF("ERROR: elf_getdata() failed");
|
||||
goto err2;
|
||||
}
|
||||
i = 0;
|
||||
while (gelf_getsym(data, i++, &sym) != NULL) {
|
||||
s = elf_strptr(e, dynsymstridx, sym.st_name);
|
||||
@ -444,16 +442,14 @@ proc_name2sym(struct proc_handle *p, const char *object, const char *symbol,
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Iterate over the Symbols Table to find the symbol.
|
||||
* Then look up the string name in STRTAB (.dynstr)
|
||||
*/
|
||||
if (symtabscn == NULL)
|
||||
goto err2;
|
||||
if ((data = elf_getdata(symtabscn, NULL)) == NULL) {
|
||||
DPRINTF("ERROR: elf_getdata() failed");
|
||||
goto err2;
|
||||
}
|
||||
if ((data = elf_getdata(symtabscn, NULL))) {
|
||||
i = 0;
|
||||
while (gelf_getsym(data, i++, &sym) != NULL) {
|
||||
s = elf_strptr(e, symtabstridx, sym.st_name);
|
||||
@ -463,6 +459,7 @@ proc_name2sym(struct proc_handle *p, const char *object, const char *symbol,
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
out:
|
||||
err2:
|
||||
elf_end(e);
|
||||
|
Loading…
Reference in New Issue
Block a user