]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
readdwarf3: Immediately skip to end of CU when not parsing children
authorMark Wielaard <mark@klomp.org>
Sat, 18 Sep 2021 01:23:52 +0000 (03:23 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 24 Sep 2021 20:28:12 +0000 (22:28 +0200)
coregrind/m_debuginfo/readdwarf3.c

index e63e357881139005be6a0b3703b76a498b8b3b56..b02e2399006c18260cc9f89bd55f7ba1b92bfddb 100644 (file)
@@ -4787,6 +4787,16 @@ static void read_DIE (
       vg_assert (inlparser->sibling == 0 || inlparser->sibling == sibling);
    }
 
+   /* Top level CU DIE, but we don't want to read anything else, just skip
+      to the end and return.  */
+   if (level == 0 && !parse_children) {
+      UWord cu_size_including_IniLen = (cc->unit_length
+                                        + (cc->is_dw64 ? 12 : 4));
+      set_position_of_Cursor( c, (cc->cu_start_offset
+                                  + cu_size_including_IniLen));
+      return;
+   }
+
    if (after_die_c_offset > 0) {
       // DIE was read by a parser above, so we know where the DIE ends.
       set_position_of_Cursor( c, after_die_c_offset );