Fix the computation of debuginfo bias values, in the case where the

debuginfo object has been not been prelinked but the main object has.
Fixes a segfault observed running any C++ application (eg,
drd/tests/annotate_smart_pointer) on Fedora 14 (32-bit), when the
debuginfo RPM for libstdc++ is installed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11801
This commit is contained in:
Julian Seward 2011-06-07 22:44:09 +00:00
parent db1a5172ce
commit d9ce3d3cc8

View File

@ -2179,8 +2179,15 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
shdr_strtab_dimg + shdr->sh_name)) { \
vg_assert(di->sec##_size == shdr->sh_size); \
vg_assert(di->sec##_avma + shdr->sh_addr + seg##_dbias); \
/* Assume we have a correct value for the main */ \
/* object's bias. Use that to derive the debuginfo */ \
/* object's bias, by adding the difference in SVMAs */ \
/* for the corresponding sections in the two files. */ \
/* That should take care of all prelinking effects. */ \
di->sec##_debug_svma = shdr->sh_addr; \
di->sec##_debug_bias = seg##_dbias; \
di->sec##_debug_bias \
= di->sec##_bias + \
di->sec##_svma - di->sec##_debug_svma; \
TRACE_SYMTAB("acquiring ." #sec " debug svma = %#lx .. %#lx\n", \
di->sec##_debug_svma, \
di->sec##_debug_svma + di->sec##_size - 1); \