From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2124) id 394C93858D28; Tue, 11 Apr 2023 16:24:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 394C93858D28 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nick Clifton To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Replace an assertion in the dwarf code with a warning message. X-Act-Checkin: binutils-gdb X-Git-Author: Nick Clifton X-Git-Refname: refs/heads/master X-Git-Oldrev: 91496180eba5150fb169c5edaff16877eefae7f9 X-Git-Newrev: 7bb9e56c6a69c99866d8827cda8fd7ace2298b47 Message-Id: <20230411162445.394C93858D28@sourceware.org> Date: Tue, 11 Apr 2023 16:24:45 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Apr 2023 16:24:45 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7bb9e56c6a69= c99866d8827cda8fd7ace2298b47 commit 7bb9e56c6a69c99866d8827cda8fd7ace2298b47 Author: Nick Clifton Date: Tue Apr 11 17:24:09 2023 +0100 Replace an assertion in the dwarf code with a warning message. =20 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 =20 + 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 <=3D num); - num =3D 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 lo= cations (%u)\n"), + debug_info_p->num_loc_views, num); + debug_info_p->num_loc_views =3D num; + } + else + num =3D debug_info_p->num_loc_views; if (num > debug_info_p->num_loc_offsets) warn (_("More DW_AT_GNU_locview attributes than location offset attr= ibutes\n")); else