From 08d1d520616557f6ff7dd023e260ad6577e9e0e8 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 18 Jan 2010 09:13:30 +0100 Subject: PR11173 Markers get a bad address in prelinked libraries. Our literal_addr_to_sym_addr() function was just wrong. To compensate for raw addresses read from elf (either given by the user or through a mark transformation) we need to know what the elf_bias is (as returned by dwfl_module_getelf) before feeding them to any libdwfl functions. * tapsets.cxx (query_module_dwarf): Always add elf_bias to raw function or statement addresses before calling query_addr(). (query_addr): Don't call literal_addr_to_sym_addr(). * dwflpp.h (literal_addr_to_sym_addr): Removed. * dwflpp.cxx (literal_addr_to_sym_addr): Likewise. --- tapsets.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 071f92db..d5c6b25e 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -761,6 +761,13 @@ dwarf_query::query_module_dwarf() // number plus the module's bias. Dwarf_Addr addr = has_function_num ? function_num_val : statement_num_val; + + // These are raw addresses, we need to know what the elf_bias + // is to feed it to libdwfl based functions. + Dwarf_Addr elf_bias; + Elf *elf = dwfl_module_getelf (dw.module, &elf_bias); + assert(elf); + addr += elf_bias; query_addr(addr, this); } else @@ -1168,8 +1175,8 @@ query_addr(Dwarf_Addr addr, dwarf_query *q) { dwflpp &dw = q->dw; - // Translate to and actual sumbol address. - addr = dw.literal_addr_to_sym_addr(addr); + if (q->sess.verbose > 2) + clog << "query_addr 0x" << hex << addr << dec << endl; // First pick which CU contains this address Dwarf_Die* cudie = dw.query_cu_containing_address(addr); -- cgit