From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: eassert always aborts in eval.c in an optimized build Date: Sun, 27 Oct 2024 21:26:46 +0200 Message-ID: <865xpd8hzd.fsf@gnu.org> References: <8634kiaq0b.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26315"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Oct 27 20:27:39 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t58vJ-0006iJ-Ox for ged-emacs-devel@m.gmane-mx.org; Sun, 27 Oct 2024 20:27:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t58uY-0003Ye-E7; Sun, 27 Oct 2024 15:26:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t58uV-0003YB-VX for emacs-devel@gnu.org; Sun, 27 Oct 2024 15:26:47 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t58uV-0006Uq-NL; Sun, 27 Oct 2024 15:26:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=oHNf6sLe+VbY0D7LXGRbcueOfXo4MM0fG1SqsdFn2XI=; b=oNrdp/fhejN7 zeyQwyO1qnm8lBvVeZ0upjbMRCpc6+9+uUmqJZmRdTx9iLGb4682cbT0R6r/PGjvHcL+2pO1iF3CW fEotOZPPCxiti1OibWzvDpqvmzQHNOqPOUHsw5AMHexmC3hzLGtWsW97jr51XB5Y8mgDowRsEGFOa DQ4ZB3rP86d+3KH9PvyBHKytFjAl3IDaRS6HpDcVMkWtvXJrFwzIllf62hnHcxZOGIwVWEU/mh0/Y hThc44IIIw8GH6uQu0yowVeRjb7OZHQNg2u5I2HR5qELcvvotMcuzvwb/odV1EUqlYgEvo3EABvFq dFZh3zodcK20nH2N6RnZxQ==; In-Reply-To: (message from Paul Eggert on Sun, 27 Oct 2024 10:57:21 -0700) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:324887 Archived-At: > Date: Sun, 27 Oct 2024 10:57:21 -0700 > Cc: emacs-devel@gnu.org > From: Paul Eggert > > On 2024-10-27 01:50, Eli Zaretskii wrote: > > Something is wrong with our definition/use of eassert in eval.c when > > Emacs is compiled with optimizations and with --enable-checking: all > > the functions in eval.c that assert pdl->kind's value are compiled > > into code that always aborts. > > A quick look suggests that although the actual code is fine, GDB is > confused and its "disassemble" and other commands think that the symbol > "backtrace_function" stands for the address of just part of the > backtrace_function code, not the address of the function's first > instruction. But then why does xbacktrace always abort? Are you saying it calls the part that aborts? > If my guess is right, if you try to debug Emacs with GDB and use > xbacktrace or similar commands, things will go haywire. You'll see > symptoms like this: > > (gdb) p backtrace_function > $1 = {Lisp_Object (union specbinding *)} 0x6ed5c > > ... whereas the shell command "nm emacs | grep backtrace_function" > outputs this: > > 0000000000293cd0 T backtrace_function > 000000000006ee78 t backtrace_function.cold > 000000000006ed5c t backtrace_function.part.0 I see the first and the last of these 3 lines; mo "cold" part. > ... and we can see that GDB has the wrong "backtrace_function". > > Does this match the symptoms you're observing? Sounds like that, yes. > If my guess is right, GDB should be fixed, and also we should look into > patching Emacs to work around the GDB bug. I see this with GDB 12.1 on GNU/Linux and with GDB 15.1 on MS-Windows, so I'm guessing fixing GDB will not be easy, and there will be many un-fixed GDB versions around even after GDB is fixed. We should work around this in Emacs regardless. Thanks.