From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38708 invoked by alias); 19 Mar 2019 15:42:10 -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 38615 invoked by uid 89); 19 Mar 2019 15:42:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=justin, Justin, H*i:sk:CAEndGg, tailrecursion X-HELO: gateway21.websitewelcome.com Received: from gateway21.websitewelcome.com (HELO gateway21.websitewelcome.com) (192.185.45.36) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Mar 2019 15:42:07 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 4BC6E400D98D2 for ; Tue, 19 Mar 2019 10:42:05 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 6GsPhiBcR2qH76GsPh9VnE; Tue, 19 Mar 2019 10:42:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VSRuO10DiFUC85qsbbIRGX7pmREtep6x1AjN3TRzrcM=; b=RzGGM2oieMsg6k4lreUmGmzoo3 WB5y5XAxMM0y9AHReHM+pylXkb8i428XsRcwCRYmlEZIlc1zWguLSIelioZZbUIMZwDM6Dzvs9+X9 5YblDFTa0MvqqrwszpVRpsCtA; Received: from 174-29-37-56.hlrn.qwest.net ([174.29.37.56]:47784 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1h6GsP-002xCR-1B; Tue, 19 Mar 2019 10:42:05 -0500 From: Tom Tromey To: Justin Paston-Cooper Cc: Simon Marchi , gdb@sourceware.org Subject: Re: Command to break before exiting stack frame? References: <87va0i74jq.fsf@igel.home> <431d242053ca491be67a21d0d95b71a4@polymtl.ca> Date: Tue, 19 Mar 2019 15:42:00 -0000 In-Reply-To: (Justin Paston-Cooper's message of "Sun, 17 Mar 2019 13:58:48 +0000") Message-ID: <87mulqx44z.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-03/txt/msg00057.txt.bz2 Justin> Given its documentation, I would have expected the "finish" command to Justin> print the returned value at each tail call. It turns out that it Justin> prints the returned value only for the f(0) call. I would similarly Justin> expect a "break on exit" command to break on the exit of the frame in Justin> which it is called even if a tail-recursion occurs. Is there a reason Justin> that it doesn't? It seems to me that a tail call means there just isn't a return value from the calling function, only from the callee, because the caller doesn't even really have a separate return statement. I suppose, though, if it is like inlining, then this text from the manual also applies: * GDB cannot locate the return value of inlined calls after using the 'finish' command. This is a limitation of compiler-generated debugging information; after 'finish', you can step to the next line and print a variable where your program stored the return value. Justin> On the actual implementation of this command: Is the implementation of Justin> such a feature feasible? If so, how much work would it take? For the compiler, I couldn't say. For gdb, doing it without help from the compiler seems difficult, as you'd probably have to write an instruction decoder. gdb already has these for some architectures (various kinds, actually, for different things), but probably not in a useful form. On the whole I think it would be better to start with the compiler. If it emits epilogue markers, then the gdb work is not difficult. Tom