The code for symbol lookup (elfxx.c:lookup_symbol) works by iterating over symbol tables while maintaing the symbol closest to the supplied instruction pointer. Whenever this search encountered symbol that was longer than result buffer, the function returned -UNW_ENOMEM even though the final symbol wasn't too long.
Signed-off-by: Martin Milata <[email protected]> --- src/elfxx.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/elfxx.c b/src/elfxx.c index 844cc1c..2d5aacc 100644 --- a/src/elfxx.c +++ b/src/elfxx.c @@ -41,7 +41,7 @@ elf_w (lookup_symbol) (unw_addr_space_t as, Elf_W (Off) soff, str_soff; Elf_W (Shdr) *shdr, *str_shdr; Elf_W (Addr) val, min_dist = ~(Elf_W (Addr))0; - int i, ret = 0; + int i, ret = -UNW_ENOINFO; char *strtab; if (!elf_w (valid_object) (ei)) @@ -102,8 +102,8 @@ elf_w (lookup_symbol) (unw_addr_space_t as, min_dist = (Elf_W (Addr)) (ip - val); strncpy (buf, strtab + sym->st_name, buf_len); buf[buf_len - 1] = '\0'; - if (strlen (strtab + sym->st_name) >= buf_len) - ret = -UNW_ENOMEM; + ret = (strlen (strtab + sym->st_name) >= buf_len + ? -UNW_ENOMEM : 0); } } } -- 1.7.7.6 _______________________________________________ Libunwind-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/libunwind-devel
