From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gLshOZ5aA2HLVAAAWB0awg (envelope-from ) for ; Thu, 29 Jul 2021 21:49:18 -0400 Received: by simark.ca (Postfix, from userid 112) id D9CBB1EDFB; Thu, 29 Jul 2021 21:49:18 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D1E471E813 for ; Thu, 29 Jul 2021 21:49:17 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 561ED3838028 for ; Fri, 30 Jul 2021 01:49:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 561ED3838028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1627609757; bh=gfRj5hw8VidPADds5yEGAeOnClOxyW1GC7Yn/ighn5g=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=GhNjA8RF9lQncV7NpKXjLFn5j2VP49mJ+dyThr4Gln2JHuUQEiI7Xj2OE6qOl5pVO 3x2ansbjb/EK5/2vbHptCXYd6VY+hV6gt3e1MZ/flOSEmYy6mtLFYQYZgjNJiHCAgl MD1d6vNamBmerhrDr3NDOLK377aSMpSAqIxCMWSs= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 6AE233857C5B for ; Fri, 30 Jul 2021 01:48:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6AE233857C5B Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 16U1mp2n015494 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Jul 2021 21:48:56 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 16U1mp2n015494 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 9D10C1E813; Thu, 29 Jul 2021 21:48:51 -0400 (EDT) Subject: Re: [PATCH master + 11][gdb/symtab] Fix zero address complaint for shlib To: Tom de Vries , gdb-patches@sourceware.org References: <20210729212317.GA8528@delia> <27cf76cf-b650-6b2e-e260-292f91db96e7@polymtl.ca> Message-ID: Date: Thu, 29 Jul 2021 21:48:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <27cf76cf-b650-6b2e-e260-292f91db96e7@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 30 Jul 2021 01:48:51 +0000 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" >> The test-case excercises the latter only for now. >> >> Tested on x86_64-linux. >> >> Any comments? > > Maybe state in the commit message what impact this patch has. It gets > rid of the warning shown above? I think I was wrong here: we do check that the warning is printed while reading partial symbols? Or while reading full symbols? I'm confused here. In any case, here's an addendum to your patch in case you'd like to add coverage for .debug_rnglists: >From 096253d5f663b035f144e472d47642a4a511f87c Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 29 Jul 2021 21:42:10 -0400 Subject: [PATCH] Add .debug_rnglists to test Change-Id: I724166d8736d0a855ae39568b61c39b3b7aa6b33 --- gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp | 132 +++++++++++++------- 1 file changed, 85 insertions(+), 47 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp index 1805733db6cf..7916182699ba 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp @@ -35,63 +35,101 @@ if !$gcc_compiled { standard_testfile .c -shlib.c -dw.S -set asm_file [standard_output_file $srcfile3] -Dwarf::assemble $asm_file { - global srcdir subdir srcfile2 - declare_labels ranges_label - - cu {} { - compile_unit { - {language @DW_LANG_C} - {name $srcfile2} - {ranges ${ranges_label} DW_FORM_sec_offset} - } { - subprogram { - {external 1 flag} - {name foo} +# Test with both a .debug_ranges section (DWARF 4) and a .debug_rnglists +# section (DWARF 5). + +foreach_with_prefix ranges_sect {ranges rnglists} { + set asm_file [standard_output_file ${ranges_sect}-$srcfile3] + + if { $ranges_sect == "ranges" } { + Dwarf::assemble $asm_file { + global srcdir subdir srcfile2 + declare_labels ranges_label + + cu {} { + compile_unit { + {language @DW_LANG_C} + {name $srcfile2} + {ranges ${ranges_label} DW_FORM_sec_offset} + } { + subprogram { + {external 1 flag} + {name foo} + } + } + } + + ranges {is_64 [is_64_target]} { + ranges_label: sequence { + base 0 + range 0 1 + } } } - } + } elseif { $ranges_sect == "rnglists" } { + Dwarf::assemble $asm_file { + global srcdir subdir srcfile2 + declare_labels rnglists_label + + cu { + version 5 + } { + compile_unit { + {language @DW_LANG_C} + {name $srcfile2} + {ranges ${rnglists_label} DW_FORM_sec_offset} + } { + subprogram { + {external 1 flag} + {name foo} + } + } + } - ranges {is_64 [is_64_target]} { - ranges_label: sequence { - base 0 - range 0 1 + rnglists { + table { + rnglists_label: list_ { + start_end 0 1 + } + } + } } + } else { + error "invalid ranges section kind" } -} -set lib1 [standard_output_file shr1.sl] -set lib_opts "nodebug" + set lib1 [standard_output_file shr1.sl] + set lib_opts "nodebug" -set sources [list ${srcdir}/${subdir}/$srcfile2 $asm_file] -if { [gdb_compile_shlib $sources ${lib1} $lib_opts] != "" } { - untested "failed to compile" - return -1 -} + set sources [list ${srcdir}/${subdir}/$srcfile2 $asm_file] + if { [gdb_compile_shlib $sources ${lib1} $lib_opts] != "" } { + untested "failed to compile" + return -1 + } -set exec_opts [list debug shlib=${lib1}] -set sources ${srcdir}/${subdir}/${srcfile} -if { [gdb_compile $sources ${binfile} executable \ - $exec_opts] != ""} { - untested "failed to compile" - return -1 -} + set exec_opts [list debug shlib=${lib1}] + set sources ${srcdir}/${subdir}/${srcfile} + if { [gdb_compile $sources ${binfile} executable \ + $exec_opts] != ""} { + untested "failed to compile" + return -1 + } -clean_restart $binfile + clean_restart $binfile -# Don't load the symbols for $lib1 during runto_main. -# Instead, we do this afterwards using "sharedlibrary $lib1". -gdb_test_no_output "set auto-solib-add off" + # Don't load the symbols for $lib1 during runto_main. + # Instead, we do this afterwards using "sharedlibrary $lib1". + gdb_test_no_output "set auto-solib-add off" -if ![runto_main] { - return -1 -} + if ![runto_main] { + return -1 + } -# Test for presence of complaint. -set complaint_re ".debug_ranges entry has start address of zero" -set re \ - "During symbol reading: $complaint_re \\\[in module \[^\r\n\]*\\\]" -with_complaints 1 { - gdb_test "sharedlibrary $lib1" $re "Zero address complaint" + # Test for presence of complaint. + set complaint_re ".debug_${ranges_sect} entry has start address of zero" + set re \ + "During symbol reading: $complaint_re \\\[in module \[^\r\n\]*\\\]" + with_complaints 1 { + gdb_test "sharedlibrary $lib1" $re "Zero address complaint" + } } -- 2.32.0