From 2e547da1cadce72d7238efcb2b653a18cb4f1c4f Mon Sep 17 00:00:00 2001 From: Philippe Waroquiers Date: Tue, 7 Oct 2014 20:35:06 +0000 Subject: [PATCH] follow up to fix for 339721 assertion 'check_sibling == sibling' failed in readdwarf3.c ... The fix committed in revision 14603 is properly fixing the bug 339721. However, when enabling the dwarf tracing, the DW_FORM_ref_sig8 causes a segmentation violation, as the tracing code is shared with the reading code. But the DW_FORM_ref_sig8 reading code is dereferencing some data structure that is only initialised when --read-var-info=yes. So, in case DW_FORM_ref_sig8 form reading is done and --read-var-info=no, then check that we are tracing, and avoid dereferencing the (not initialised) signature hash table. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14610 --- NEWS | 2 +- coregrind/m_debuginfo/readdwarf3.c | 28 +++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 8c3320be45..de86c41c98 100644 --- a/NEWS +++ b/NEWS @@ -35,7 +35,7 @@ where XXXXXX is the bug number as listed below. 339182 ppc64: AvSplat ought to load destination vector register with 16/16 bytes stored prior 339433 ppc64 lxvw4x instruction uses four 32-byte loads -(not fully fixed yet) 339721 assertion 'check_sibling == sibling' failed in readdwarf3.c ... +339721 assertion 'check_sibling == sibling' failed in readdwarf3.c ... n-i-bz Old STABS code is still being compiled, but never used. Remove it. n-i-bz Fix compilation on distros with glibc < 2.5 diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c index 1a933d9bfe..db924d72f3 100644 --- a/coregrind/m_debuginfo/readdwarf3.c +++ b/coregrind/m_debuginfo/readdwarf3.c @@ -1371,11 +1371,29 @@ void get_Form_contents ( /*OUT*/FormContents* cts, TRACE_D3("%x ", (UInt)u8); work >>= 8; } - /* Due to the way that the hash table is constructed, the - resulting DIE offset here is already "cooked". See - cook_die_using_form. */ - cts->u.val = lookup_signatured_type (cc->signature_types, signature, - c->barf); + + /* cc->signature_types is only built/initialised when + VG_(clo_read_var_info) is set. In this case, + the DW_FORM_ref_sig8 can be looked up. + But we can also arrive here when only reading inline info + and VG_(clo_trace_symtab) is set. In such a case, + we cannot lookup the DW_FORM_ref_sig8, we rather assign + a dummy value. This is a kludge, but otherwise, + the 'dwarf inline info reader' tracing would have to + do type processing/reading. It is better to avoid + adding significant 'real' processing only due to tracing. */ + if (VG_(clo_read_var_info)) { + /* Due to the way that the hash table is constructed, the + resulting DIE offset here is already "cooked". See + cook_die_using_form. */ + cts->u.val = lookup_signatured_type (cc->signature_types, signature, + c->barf); + } else { + vg_assert (td3); + vg_assert (VG_(clo_read_inline_info)); + TRACE_D3(""); + cts->u.val = 0; /* Assign a dummy/rubbish value */ + } cts->szB = sizeof(UWord); break; } -- 2.47.2