From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 18E4A3851C20 for ; Fri, 8 May 2020 15:16:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 18E4A3851C20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C089AAA55; Fri, 8 May 2020 15:16:06 +0000 (UTC) Subject: Re: [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form. From: Tom de Vries To: Tom Tromey , nitachra Cc: JiniSusan.George@amd.com, gdb-patches@sourceware.org References: <20200504061319.3699-1-Nitika.Achra@amd.com> <87k11nzxjn.fsf@tromey.com> <43349381-fcbb-6e78-b4bc-9c15888ad260@suse.de> Autocrypt: addr=tdevries@suse.de; keydata= xsBNBF0ltCcBCADDhsUnMMdEXiHFfqJdXeRvgqSEUxLCy/pHek88ALuFnPTICTwkf4g7uSR7 HvOFUoUyu8oP5mNb4VZHy3Xy8KRZGaQuaOHNhZAT1xaVo6kxjswUi3vYgGJhFMiLuIHdApoc u5f7UbV+egYVxmkvVLSqsVD4pUgHeSoAcIlm3blZ1sDKviJCwaHxDQkVmSsGXImaAU+ViJ5l CwkvyiiIifWD2SoOuFexZyZ7RUddLosgsO0npVUYbl6dEMq2a5ijGF6/rBs1m3nAoIgpXk6P TCKlSWVW6OCneTaKM5C387972qREtiArTakRQIpvDJuiR2soGfdeJ6igGA1FZjU+IsM5ABEB AAHNH1RvbSBkZSBWcmllcyA8dGRldnJpZXNAc3VzZS5kZT7CwKsEEwEIAD4WIQSsnSe5hKbL MK1mGmjuhV2rbOJEoAUCXSW0JwIbAwUJA8JnAAULCQgHAgYVCgkICwIEFgIDAQ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TA3U yGaIvI/BGOtHZ7bEBVUCFDFfOWJ26IOCoPnSVUvKPEOH9dv+sNy7jyBsP5QxeTqwxC/1ZtNS DUCSFQjqA6bEGwM22dP8OUY6SC94x1G81A9/xbtm9LQxKm0EiDH8KBMLfQ== Message-ID: Date: Fri, 8 May 2020 17:16:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <43349381-fcbb-6e78-b4bc-9c15888ad260@suse.de> Content-Type: multipart/mixed; boundary="------------E895D335D14A9D5566AC5823" Content-Language: en-US X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 May 2020 15:16:09 -0000 This is a multi-part message in MIME format. --------------E895D335D14A9D5566AC5823 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 08-05-2020 16:36, Tom de Vries wrote: > On 07-05-2020 15:26, Tom Tromey wrote: >>>>>>> ">" == nitachra writes: >> >>>> Following complaint is observed with the executable compiled with -gdwarf-5 >>>> and -gpubnames flags- "During symbol reading: Unsupported .debug_names form >>>> DW_FORM_ref4". This is the form corresponding to DW_IDX_die_offset attribute. >>>> This patch fixes this complaint. Tested with clang 10.0.0. Test case used- >> >>>> int main() >>>> { >>>> int sum,a,b; >>>> sum = a + b; >>>> return sum; >>>> } >> >> Does it fail some existing test in the gdb testsuite? > > I don't think so, that is, not unless you use: > - clang as CC_FOR_TARGET, and > - target board unix/-gdwarf-5/-gpubnames. > >> Normally what we like to see is either that a patch fixes some existing >> failure (perhaps when the test suite is run in a certain way); or a new >> test that fails before the patch and passes afterward. >> > > I've add a dwarf assembly test-case for this ( > https://sourceware.org/pipermail/gdb-patches/2020-May/168244.html ). > > It should kfail without this patch, and pass with this patch (though it > doesn't pass for me on openSUSE due to the problem described in PR25941). > So, if someone can verify that the test-case passes with this patch, I'll commit. Thanks, - Tom --------------E895D335D14A9D5566AC5823 Content-Type: text/x-patch; charset=UTF-8; name="0001-Fix-for-the-complaint-observed-when-symbol-reading-due-to-unsupported-.debug_names-form.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-Fix-for-the-complaint-observed-when-symbol-reading-due-"; filename*1="to-unsupported-.debug_names-form.patch" Fix for the complaint observed when symbol reading due to unsupported .debug_names form Following complaint is observed with the executable compiled with -gdwarf-5 and -gpubnames flags - "During symbol reading: Unsupported .debug_names form DW_FORM_ref4". This is the form corresponding to DW_IDX_die_offset attribute. This patch fixes this complaint. Tested with clang 10.0.0. Test case used - int main() { int sum,a,b; sum = a + b; return sum; } clang -gdwarf-5 -gpubnames test.c -o test.out gdb -q test.out -ex "set complaints 1" -ex "start" Reading symbols from test.out... During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \ [in module test.out] Temporary breakpoint 1 at 0x400484 Starting program: test.out During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \ [in module test.out] During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \ [in module test.out] During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \ [in module test.out] gdb/dwarf2/ChangeLog: 2020-05-08 Nitika Achra PR symtab/25952 * read.c (dw2_debug_names_iterator::next): Handle DW_FORM_ref* and DW_IDX_die_offset. If there is no compilation unit attribute in the index entry, then there is a single CU. Return the CU at O index of compilation unit vector. gdb/testsuite/ChangeLog: 2020-05-08 Tom de Vries * gdb.dwarf2/clang-debug-names.exp: Remove PR25952 kfail. --- gdb/dwarf2/read.c | 18 ++++++++++++++++++ gdb/testsuite/gdb.dwarf2/clang-debug-names.exp | 13 +------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index ac208991ff..fc48bb6006 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -5352,6 +5352,18 @@ dw2_debug_names_iterator::next () ull = read_unsigned_leb128 (abfd, m_addr, &bytes_read); m_addr += bytes_read; break; + case DW_FORM_ref4: + ull = read_4_bytes (abfd, m_addr); + m_addr += 4; + break; + case DW_FORM_ref8: + ull = read_8_bytes (abfd, m_addr); + m_addr += 8; + break; + case DW_FORM_ref_sig8: + ull = read_8_bytes (abfd, m_addr); + m_addr += 8; + break; default: complaint (_("Unsupported .debug_names form %s [in module %s]"), dwarf_form_name (attr.form), @@ -5384,6 +5396,12 @@ dw2_debug_names_iterator::next () } per_cu = &dwarf2_per_objfile->get_tu (ull)->per_cu; break; + case DW_IDX_die_offset: + /* In a per-CU index (as opposed to a per-module index), index + entries without CU attribute implicitly refer to the single CU. */ + if (per_cu == NULL) + per_cu = dwarf2_per_objfile->get_cu (0); + break; case DW_IDX_GNU_internal: if (!m_map.augmentation_is_gdb) break; diff --git a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp index 8bd60401c4..a6e33c1d89 100644 --- a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp +++ b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp @@ -142,15 +142,4 @@ set pass_re \ [multi_line \ $cmd \ "type = int \\(\\)"] -set kfail_re \ - [multi_line \ - $cmd \ - "type = \\(\\)"] -gdb_test_multiple $cmd "" { - -re -wrap $pass_re { - pass $gdb_test_name - } - -re -wrap $kfail_re { - kfail symtab/25952 $gdb_test_name - } -} +gdb_test $cmd $pass_re --------------E895D335D14A9D5566AC5823--