Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH master + 11][gdb/symtab] Fix zero address complaint for shlib
Date: Thu, 29 Jul 2021 21:48:51 -0400	[thread overview]
Message-ID: <f45f8c7a-9775-5638-c7a0-7c0dcf372a0a@polymtl.ca> (raw)
In-Reply-To: <27cf76cf-b650-6b2e-e260-292f91db96e7@polymtl.ca>

>> 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 <simon.marchi@polymtl.ca>
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


  reply	other threads:[~2021-07-30  1:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 21:23 Tom de Vries
2021-07-30  1:25 ` Simon Marchi via Gdb-patches
2021-07-30  1:48   ` Simon Marchi via Gdb-patches [this message]
2021-07-30 15:25   ` Tom de Vries
2021-07-30 17:50     ` Simon Marchi via Gdb-patches
2021-08-01 17:59       ` Tom de Vries
2021-08-02 13:09         ` Simon Marchi via Gdb-patches
2021-08-06 14:43           ` Tom de Vries via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f45f8c7a-9775-5638-c7a0-7c0dcf372a0a@polymtl.ca \
    --to=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox