From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 34AFC3858C53; Fri, 1 Mar 2024 06:44:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34AFC3858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709275494; bh=K48YrVr0nfFemtWJw58C00rXVzDcGUFCRdC4p1A3vVM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AAbS5rDw5Dpl9fP6HcfeA0HIt3G35vKBOyWUVn/hy/I9q2T9cHsyMSK9OPp/uIHqO v4mGMpOLGbSMALm82MipHt9gBXTOO1ky4lTFjjZCD7pYRIAUIVlKrCK16osfbo4E+B Br76fCreTg0LhBUvWAMsnnMREij2c9zWw7Qw3Mug= From: "lukas.graetz@tu-darmstadt.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114116] [14 Regression] Broken backtraces in bootstrapped x86_64 gcc Date: Fri, 01 Mar 2024 06:44:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lukas.graetz@tu-darmstadt.de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114116 --- Comment #14 from Lukas Gr=C3=A4tz --- (In reply to Jakub Jelinek from comment #2) > Created attachment 57545 [details] > gcc14-pr114116.patch >=20 > This seems to fix it, so far tested just on the small testcase, back to t= he > expected backtrace there. As I said in PR 38534, comment [1], the rsp could be saved to rbp due to an unknown-sized stack-frame: movq %rsp, %rbp .cfi_def_cfa_register 6 Therefore, if we want the backtrace in such situations, we would need to sa= ve rbp, too, as your patch does. The patch might even not be enough, if there = is the possibility that we could .cfi_def_cfa_register with a register other t= han rbp/6. In that case, the patch can be ignored and it is left to disable the optimization by default, as you already suggested, I think you already have= a patch for that. H.J. Lu's patch to emit .cfi_undefined is needed in any case. Only that both patches are currently incompatible. There also seems to be a bug in libgcc/unwind-dw2.c:249, causing a SEGV when register values are unavailable due to .cfi_undefined. This is already know= n, as the comment there suggests. This happens during a call to glibc's backtrace(), even though the registers are not needed for the backtrace (in that case, gdb's backtrace is fine, glibc's backtrace crashes in libgcc). It should be possible to print best-effort-traces without crashing, in fact, calling backtrace() should never lead to a crash. Bug 103510 might be relat= ed and this should be fixed independently. Thanks for the work putting in this and I am sorry for the mess on my side! [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D38534#c45=