From: Mark Wielaard Date: Sat, 18 Sep 2021 01:23:52 +0000 (+0200) Subject: readdwarf3: Immediately skip to end of CU when not parsing children X-Git-Tag: VALGRIND_3_18_0~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a543c57c8ffca25f4817750317c981ea2d84311;p=thirdparty%2Fvalgrind.git readdwarf3: Immediately skip to end of CU when not parsing children --- diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c index e63e357881..b02e239900 100644 --- a/coregrind/m_debuginfo/readdwarf3.c +++ b/coregrind/m_debuginfo/readdwarf3.c @@ -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 );