Patchwork libbacktrace: allow using DWARF if the main executable lacks it

login
register
mail settings
Submitter Alexander Monakov
Date July 22, 2013, 1:34 p.m.
Message ID <alpine.LNX.2.00.1307221726500.1061@monopod.intra.ispras.ru>
Download mbox | patch
Permalink /patch/260699/
State New
Headers show

Comments

Alexander Monakov - July 22, 2013, 1:34 p.m.
This fixes a bug that would prevent using DWARF debug info available in
dynamically linked libraries when the main executable did not have DWARF debug
info.

pd.fileline_fn is not examined after dl_iterate_phdr in backtrace_initialize,
so updating *fileline_fn in dl_iterate_phdr is useless as later it is
overwritten from elf_fileline_fn.  OK for trunk?

2013-07-22  Alexander Monakov  <amonakov@ispras.ru>

	* elf.c (backtrace_initialize): Pass elf_fileline_fn to
	dl_iterate_phdr callbacks.
Ian Taylor - July 22, 2013, 3:35 p.m.
On Mon, Jul 22, 2013 at 6:34 AM, Alexander Monakov <amonakov@ispras.ru> wrote:
>
> 2013-07-22  Alexander Monakov  <amonakov@ispras.ru>
>
>         * elf.c (backtrace_initialize): Pass elf_fileline_fn to
>         dl_iterate_phdr callbacks.

This is OK.

Thanks.

Ian

Patch

diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index a90afaa..fde884a 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -865,7 +865,7 @@  backtrace_initialize (struct backtrace_state *state, int descriptor,
   pd.state = state;
   pd.error_callback = error_callback;
   pd.data = data;
-  pd.fileline_fn = fileline_fn;
+  pd.fileline_fn = &elf_fileline_fn;
   pd.found_sym = &found_sym;
   pd.found_dwarf = &found_dwarf;