This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
libbacktrace: walk the elf_syminfo_data chain in elf_syminfo
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 22 Jul 2013 17:26:21 +0400 (MSK)
- Subject: libbacktrace: walk the elf_syminfo_data chain in elf_syminfo
Hello,
this fixes a bug (found by inspection) that would prevent elf_syminfo from
looking up symbols defined in modules other than the executable.
Bootstrapped and regtested together with the next patch on x86_64-linux
(excluding Java, including Go), OK for trunk?
libbacktrace/Changelog:
2013-07-22 Alexander Monakov <amonakov@ispras.ru>
* elf.c (elf_syminfo): Loop over the elf_syminfo_data chain.
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index ef9bcdf..a90afaa 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -454,12 +454,15 @@ elf_syminfo (struct backtrace_state *state, uintptr_t pc,
void *data)
{
struct elf_syminfo_data *edata;
- struct elf_symbol *sym;
+ struct elf_symbol *sym = NULL;
+
+ for (edata = (struct elf_syminfo_data *) state->syminfo_data;
+ edata && sym == NULL;
+ edata = edata->next)
+ sym = ((struct elf_symbol *)
+ bsearch (&pc, edata->symbols, edata->count,
+ sizeof (struct elf_symbol), elf_symbol_search));
- edata = (struct elf_syminfo_data *) state->syminfo_data;
- sym = ((struct elf_symbol *)
- bsearch (&pc, edata->symbols, edata->count,
- sizeof (struct elf_symbol), elf_symbol_search));
if (sym == NULL)
callback (data, pc, NULL, 0);
else