From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16639 invoked by alias); 5 Mar 2011 12:52:50 -0000 Received: (qmail 16629 invoked by uid 22791); 5 Mar 2011 12:52:49 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 05 Mar 2011 12:52:43 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p25CqgH0004851 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 5 Mar 2011 07:52:42 -0500 Received: from host1.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p25Cqecr015782 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 5 Mar 2011 07:52:42 -0500 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p25Cqe6w029113; Sat, 5 Mar 2011 13:52:40 +0100 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p25CqeMK029112; Sat, 5 Mar 2011 13:52:40 +0100 Date: Sat, 05 Mar 2011 12:52:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: RFC: lazily call save_current_space_and_thread Message-ID: <20110305125239.GA31797@host1.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2011-03/txt/msg00368.txt.bz2 On Fri, 04 Mar 2011 20:52:41 +0100, Tom Tromey wrote: > + /* We lazily save the current program space. Saving the current > + program space is reasonably expensive in the multi-inferior case, > + and in many situations we don't need to do it. Comparing a > + cleanup against NULL is usually forbidden, but in this case we > + have already made a cleanup, so we know it is safe. */ > + struct cleanup *current_space_cleanup = NULL; > + [...] > + if (current_space_cleanup == NULL) > + current_space_cleanup = save_current_space_and_thread (); save_current_space_and_thread - like any make_cleanup derivation - may return NULL even for successfully pushed cleanup function. For example inside TRY_CATCH, due to its save_cleanups. GDB does need more C++. Thanks, Jan