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