From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4536 invoked by alias); 1 May 2008 19:58:21 -0000 Received: (qmail 4528 invoked by uid 22791); 1 May 2008 19:58:21 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 01 May 2008 19:58:01 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 1250D983D6; Thu, 1 May 2008 19:58:00 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id D137598366; Thu, 1 May 2008 19:57:59 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1Jreuk-0007Mx-VE; Thu, 01 May 2008 15:57:58 -0400 Date: Thu, 01 May 2008 19:58:00 -0000 From: Daniel Jacobowitz To: Vladimir Prus Cc: Joel Brobecker , gdb-patches@sources.redhat.com Subject: Re: [RFA] Use observers to report stop events. Message-ID: <20080501195758.GL22218@caradoc.them.org> Mail-Followup-To: Vladimir Prus , Joel Brobecker , gdb-patches@sources.redhat.com References: <200804112145.58456.vladimir@codesourcery.com> <20080429031411.GB28505@adacore.com> <200804292210.31614.vladimir@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200804292210.31614.vladimir@codesourcery.com> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-05/txt/msg00033.txt.bz2 On Tue, Apr 29, 2008 at 10:10:30PM +0400, Vladimir Prus wrote: > Here are 3 independent bits. > > 1. Introduce the make_cleanup_restore_integer function. You're right > that it can lead to bad results if one discards this cleanup, but then > one should be careful with discarding cleanups anyway. This patch looks fine except that ... > 2. Modify the normal_stop observer not to fire in some cases. One > case is when doing function call -- we don't announce the stop in CLI > and for similar reason we don't have observer to be called. Also, > for the benefit of next patch, we want the call to observer to > be delayed until we print function return value, if we're doing finish. ... unless I'm mistaken you have exactly the memory leak Joel warned about, since finish_command discards continuations. Am I correct that the cleanup for finish_command is never supposed to survive the function returning? It's run on error and discarded on normal return. So you could put the closure in a local variable, maybe. struct foo_closure my_closure = { &my_global, my_global }; make_cleanup (restore_integer, &my_closure); -- Daniel Jacobowitz CodeSourcery