From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 53C6C385841F; Sun, 24 Jul 2022 01:55:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 53C6C385841F From: "simark at simark dot ca" To: gdb-prs@sourceware.org Subject: [Bug backtrace/29374] Internal-error when printing exception backtrace Date: Sun, 24 Jul 2022 01:55:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: backtrace X-Bugzilla-Version: 12.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: simark at simark dot ca X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on bug_status everconfirmed cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jul 2022 01:55:39 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29374 Simon Marchi changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-07-24 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 CC| |simark at simark dot ca --- Comment #3 from Simon Marchi --- Thanks for the reproducer, I am able to reproduce. And thanks for the bisection. The patch you found added some additional checks, and it looks = like it caught a pre-existing problem. Here: https://gitlab.com/gnutools/binutils-gdb/-/blob/6577f365ebdee7dda71cb996efa= 29d3714cbccd0/gdb/dwarf2/expr.c#L1027 We try to get the length of subobj_type, but it is a typedef whose actual s= ize hasn't been computed yet: (top-gdb) p subobj_type.main_type.name $1 =3D 0x6210001ef820 "Handler::key_type" (top-gdb) p subobj_type.main_type.code $2 =3D TYPE_CODE_TYPEDEF (top-gdb) p subobj_type.length=20 $3 =3D 0 If I add a check_typedef at the beginning of fetch_result, it looks like it works: >>From 13d2d8b935f22ac2345c76a69ba009e583f9dc50 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 23 Jul 2022 21:41:55 -0400 Subject: [PATCH] patch Change-Id: I182733ad08e34df40d8bcc47af72c482fabf4900 --- gdb/dwarf2/expr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 592dbe19d562..d2b7a131de33 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -930,6 +930,11 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type, if (subobj_type =3D=3D nullptr) subobj_type =3D type; + /* Ensure that, if TYPE or SUBOBJ_TYPE are typedefs, their length is fil= led + in instead of being zero. */ + check_typedef (type); + check_typedef (subobj_type); + if (this->m_pieces.size () > 0) { ULONGEST bit_size =3D 0; base-commit: 4bce7cdaf481901edbc5ee47d953ea7e8efb56ca --=20 2.37.1 $./gdb -nx --data-directory=3Ddata-directory -q -batch -ex "catch throw" -e= x r -ex bt a.out=20 Catchpoint 1 (throw) This GDB supports auto-downloading debuginfo from the following URLs: https://debuginfod.archlinux.org Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal] Debuginfod has been disabled. To make this setting permanent, add 'set debuginfod enabled off' to .gdbini= t. [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1". Catchpoint 1 (exception thrown), 0x00007ffff7ca5e91 in __cxxabiv1::__cxa_th= row (obj=3D0x55555556af30, tinfo=3D0x555555557d20 , dest=3D0x7ffff7cbd370 ) at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_throw.cc:81 81 /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_throw.cc: No such file= or directory. #0 0x00007ffff7ca5e91 in __cxxabiv1::__cxa_throw (obj=3D0x55555556af30, tinfo=3D0x555555557d20 , dest=3D0x7ffff7cbd370 ) at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_throw.cc:81 #1 0x00005555555554a9 in Handler::find (this=3Dthis@entry=3D0x7fffffffdb20, key=3Dkey@entry=3D@0x7fffffffdb1c: 0) at /usr/include/c++/12.1.0/bits/new_allocator.h:90 #2 0x000055555555526e in Handler::operator() (key=3D@0x7fffffffdb1c: 0, this=3D0x7fffffffdb20) at repro.cpp:14 #3 State::find (type=3D, this=3D0x7fffffffdb20) at repro.cp= p:39 #4 main () at repro.cpp:49 --=20 You are receiving this mail because: You are on the CC list for the bug.=