From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7559 invoked by alias); 29 Nov 2007 07:04:11 -0000 Received: (qmail 7544 invoked by uid 22791); 29 Nov 2007 07:04:10 -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 07:04:06 +0000 Received: (qmail 17874 invoked from network); 29 Nov 2007 07:04:04 -0000 Received: from unknown (HELO wind.local) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 29 Nov 2007 07:04:04 -0000 From: Vladimir Prus To: Eli Zaretskii Subject: Re: [RFA] Don't reset watchpoint block on solib load. Date: Thu, 29 Nov 2007 07:04:00 -0000 User-Agent: KMail/1.9.6 Cc: Jim Blandy , gdb-patches@sources.redhat.com References: <200711202013.47537.vladimir@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200711291003.58932.vladimir@codesourcery.com> 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/msg00538.txt.bz2 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. But before we even get to that, we need to fix all the existing bugs with watchpoints/solib interaction. For example, currently a watchpoint on a global variable in shared library wedges gdb if that shared library is unloaded: Old value = 1 New value = 2 foo (i=2) at helper.cpp:7 7 } (gdb) n main () at main.cpp:14 14 dlclose(h); (gdb) n Address of symbol "g" is unknown. (gdb) n Single stepping until exit from function _dl_debug_state, which has no line number information. Address of symbol "g" is unknown. Here, all further 'next' commands will tell you the same. This is problem present before my patch, and I don't try to fix it. Then, there's problem whereby local watchpoint gets deleted if a completely unrelated shared library is loaded. Probably, there's much more. With that done, we can think about more useful general behaviour. - Volodya > > Similarly when a watchpoint on a static variable, or an automatic > variable in the `main' function, goes out of scope, because the > program exits: it would be useful, at least as an option, to have the > watchpoint re-enabled when the program is restarted. >