Blame SOURCES/valgrind-3.18.1-demangle-namespace.patch

4db4a6
commit 542447d4708d4418a08e678dcf467af92b90b7ad
4db4a6
Author: Mark Wielaard <mark@klomp.org>
4db4a6
Date:   Mon Nov 22 13:07:59 2021 +0100
4db4a6
4db4a6
    readdwarf3.c (parse_inl_DIE) inlined_subroutine can appear in namespaces
4db4a6
    
4db4a6
    This was broken by commit 75e3ef0f3 "readdwarf3: Skip units without
4db4a6
    addresses when looking for inlined functions". Specifically by this
4db4a6
    part: "Also use skip_DIE instead of read_DIE when not parsing
4db4a6
    (skipping) children"
4db4a6
    
4db4a6
    rustc puts concrete function instances in namespaces (which is
4db4a6
    allowed in DWARF since there is no strict separation between type
4db4a6
    declarations and program scope entries in a DIE tree), the inline
4db4a6
    parser didn't expect this and so skipped any DIE under a namespace
4db4a6
    entry. This wasn't an issue before because "skipping" a DIE tree was
4db4a6
    done by reading it, so it wasn't actually skipped. But now that we
4db4a6
    really skip the DIE (sub)tree (which is faster than actually parsing
4db4a6
    it) some entries were missed in the rustc case.
4db4a6
    
4db4a6
    https://bugs.kde.org/show_bug.cgi?id=445668
4db4a6
4db4a6
diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c
4db4a6
index 18eecea9f..5489f8d13 100644
4db4a6
--- a/coregrind/m_debuginfo/readdwarf3.c
4db4a6
+++ b/coregrind/m_debuginfo/readdwarf3.c
4db4a6
@@ -3358,7 +3358,7 @@ static Bool parse_inl_DIE (
4db4a6
    // might maybe contain a DW_TAG_inlined_subroutine:
4db4a6
    Bool ret = (unit_has_addrs
4db4a6
                || dtag == DW_TAG_lexical_block || dtag == DW_TAG_subprogram
4db4a6
-               || dtag == DW_TAG_inlined_subroutine);
4db4a6
+               || dtag == DW_TAG_inlined_subroutine || dtag == DW_TAG_namespace);
4db4a6
    return ret;
4db4a6
 
4db4a6
   bad_DIE: