public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Replace an assertion in the dwarf code with a warning message.
@ 2023-04-11 16:24 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-04-11 16:24 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7bb9e56c6a69c99866d8827cda8fd7ace2298b47

commit 7bb9e56c6a69c99866d8827cda8fd7ace2298b47
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Apr 11 17:24:09 2023 +0100

    Replace an assertion in the dwarf code with a warning message.
    
      PR 30327
      * dwarf.c (read_and_display_attr_value): Warn if the number of views is greater than the number of locations.

Diff:
---
 binutils/ChangeLog |  4 ++++
 binutils/dwarf.c   | 10 ++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 59ab08a26e6..3b6f045e78a 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,9 @@
 2023-04-11  Nick Clifton  <nickc@redhat.com>
 
+	PR 30327
+	* dwarf.c (read_and_display_attr_value): Warn if the number of
+	views is greater than the number of locations.
+
 	PR 30313
 	* dwarf.c (display_debug_lines_decoded): Check for an overlarge
 	number of files or directories.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index f6ff238d3cb..87ce1541d1c 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2927,8 +2927,14 @@ read_and_display_attr_value (unsigned long attribute,
 		}
 	      else
 		{
-		  assert (debug_info_p->num_loc_views <= num);
-		  num = debug_info_p->num_loc_views;
+		  if (debug_info_p->num_loc_views > num)
+		    {
+		      warn (_("The number of views (%u) is greater than the number of locations (%u)\n"),
+			    debug_info_p->num_loc_views, num);
+		      debug_info_p->num_loc_views = num;
+		    }
+		  else
+		    num = debug_info_p->num_loc_views;
 		  if (num > debug_info_p->num_loc_offsets)
 		    warn (_("More DW_AT_GNU_locview attributes than location offset attributes\n"));
 		  else

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-11 16:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-11 16:24 [binutils-gdb] Replace an assertion in the dwarf code with a warning message Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).