From: Tom Hughes Date: Wed, 21 Nov 2007 16:09:18 +0000 (+0000) Subject: Don't load debug sections from the linked debug file if we have X-Git-Tag: svn/VALGRIND_3_3_0~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70a166657038e8511b278aff0fcba1c9cc103ee3;p=thirdparty%2Fvalgrind.git Don't load debug sections from the linked debug file if we have already loaded them from the main ELF file. Fixes #145609. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7196 --- diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index dfe9cf90e4..0dd7f06370 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -1142,6 +1142,9 @@ Bool ML_(read_elf_debug_info) ( struct _SegInfo* si ) && ehdr->e_shoff + ehdr->e_shnum*sizeof(ElfXX_Shdr) <= n_dimage) { Bool need_symtab = (NULL == symtab_img); + Bool need_stabs = (NULL == stab_img); + Bool need_dwarf2 = (NULL == debug_info_img); + Bool need_dwarf1 = (NULL == dwarf1d_img); for (i = 0; i < ehdr->e_phnum; i++) { ElfXX_Phdr *o_phdr = &((ElfXX_Phdr *)(dimage + ehdr->e_phoff))[i]; @@ -1186,14 +1189,14 @@ Bool ML_(read_elf_debug_info) ( struct _SegInfo* si ) /* ?? NAME SIZE IMAGE addr */ FIND(need_symtab, ".symtab", symtab_sz, symtab_img) FIND(need_symtab, ".strtab", strtab_sz, strtab_img) - FIND(1, ".stab", stab_sz, stab_img) - FIND(1, ".stabstr", stabstr_sz, stabstr_img) - FIND(1, ".debug_line", debug_line_sz, debug_line_img) - FIND(1, ".debug_info", debug_info_sz, debug_info_img) - FIND(1, ".debug_abbrev", debug_abbv_sz, debug_abbv_img) - FIND(1, ".debug_str", debug_str_sz, debug_str_img) - FIND(1, ".debug", dwarf1d_sz, dwarf1d_img) - FIND(1, ".line", dwarf1l_sz, dwarf1l_img) + FIND(need_stabs, ".stab", stab_sz, stab_img) + FIND(need_stabs, ".stabstr", stabstr_sz, stabstr_img) + FIND(need_dwarf2, ".debug_line", debug_line_sz, debug_line_img) + FIND(need_dwarf2, ".debug_info", debug_info_sz, debug_info_img) + FIND(need_dwarf2, ".debug_abbrev", debug_abbv_sz, debug_abbv_img) + FIND(need_dwarf2, ".debug_str", debug_str_sz, debug_str_img) + FIND(need_dwarf1, ".debug", dwarf1d_sz, dwarf1d_img) + FIND(need_dwarf1, ".line", dwarf1l_sz, dwarf1l_img) # undef FIND }