From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8087 invoked by alias); 29 Nov 2007 18:54:51 -0000 Received: (qmail 8078 invoked by uid 22791); 29 Nov 2007 18:54:50 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 29 Nov 2007 18:54:43 +0000 Received: (qmail 2184 invoked from network); 29 Nov 2007 18:54:41 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 29 Nov 2007 18:54:41 -0000 To: Vladimir Prus Cc: Eli Zaretskii , gdb-patches@sources.redhat.com Subject: Re: [RFA] Don't reset watchpoint block on solib load. References: <200711202013.47537.vladimir@codesourcery.com> <200711291003.58932.vladimir@codesourcery.com> From: Jim Blandy Date: Thu, 29 Nov 2007 18:54:00 -0000 In-Reply-To: <200711291003.58932.vladimir@codesourcery.com> (Vladimir Prus's message of "Thu, 29 Nov 2007 10:03:58 +0300") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2007-11/txt/msg00551.txt.bz2 Vladimir Prus writes: > On Thursday 29 November 2007 07:24:36 Eli Zaretskii wrote: >> > Cc: gdb-patches@sources.redhat.com >> > From: Jim Blandy >> > Date: Wed, 28 Nov 2007 14:18:06 -0800 >> > >> > Now, if I later unload libx.so, the watchpoint should delete itself >> > with an appropriate message, just as a watchpoint on a stack variable >> > does when its frame is popped --- when a shared library is unloaded, >> > that ends the lifetimes of the variables it defines, just as exiting a >> > block ends the lifetimes of the variables defined in the block. >> >> Actually, a more useful behavior would be to disable the watchpoint in >> this case, and reenable it (and, possibly, re-parse the expression) if >> the library gets loaded again. > > This is probably good behaviour, indeed. Or maybe we should not > disable watchpoint, but mark it as pending, in the same sense of > "user wanted it to be enabled, but it won't trigger until a shared > lib is loaded" that is used for ordinary watchpoints. I think so, too. I guess the key observation is that, while it's not meaningful to talk about a particular local variable "coming back alive", since each function call creates a distinct set of local variables, and you can have recursion, etc., it is meaningful to talk about a shared library being reloaded, and it's intuitive to identify the 'X' from the first loading with the 'X' in the second loading, even if they're at different addresses.