From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3525 invoked by alias); 5 Nov 2017 19:54:16 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 3383 invoked by uid 89); 5 Nov 2017 19:54:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*c:iso-2022-jp, corrupted, Hx-languages-length:864 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 05 Nov 2017 19:54:15 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B3D49356F7; Sun, 5 Nov 2017 19:54:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B3D49356F7 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jan.kratochvil@redhat.com Received: from host1.jankratochvil.net (ovpn-117-191.ams2.redhat.com [10.36.117.191]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 014E860C8A; Sun, 5 Nov 2017 19:54:12 +0000 (UTC) Date: Sun, 05 Nov 2017 19:54:00 -0000 From: Jan Kratochvil To: =?iso-2022-jp?B?GyRCSmlFX048GyhC?= Cc: gdb@sourceware.org Subject: Re: why does assert(0) corrupt the stack trace? Message-ID: <20171105195410.GA29185@host1.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-SW-Source: 2017-11/txt/msg00002.txt.bz2 On Sun, 05 Nov 2017 20:13:20 +0100, 慕冬亮 wrote: > I have a question about debugging assert in gdb. When one program > crash at one assert statement, the stack trace shown in the gdb is > corrupted. Is it normal? It was happening in the past as when assert() detects a failure it calls abort() which does never return - using GCC attribute noreturn. Then GCC optimizer does not save enough registers to make the backtrace possible because the code will just abort anyway, the code does not need to know where to return. It was some intermediate development phase where such optimization was created and before an exception has been made to make the backtracing by debuggers possible. Sorry for not looking up the Bugs/commits. As usual you should update your compiler + debugger to latest versions. Jan