From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29352 invoked by alias); 11 Aug 2004 04:07:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 29317 invoked from network); 11 Aug 2004 04:07:04 -0000 Received: from unknown (HELO aragorn.inter.net.il) (192.114.186.23) by sourceware.org with SMTP; 11 Aug 2004 04:07:04 -0000 Received: from zaretski ([80.230.159.46]) by aragorn.inter.net.il (MOS 3.4.6-GR) with ESMTP id EDM12824; Wed, 11 Aug 2004 07:06:39 +0300 (IDT) Date: Wed, 11 Aug 2004 04:07:00 -0000 From: "Eli Zaretskii" To: Jeff Johnston Message-Id: <7494-Wed11Aug2004070352+0300-eliz@gnu.org> CC: gdb-patches@sources.redhat.com In-reply-to: <41191D71.60204@redhat.com> (message from Jeff Johnston on Tue, 10 Aug 2004 15:09:37 -0400) Subject: Re: [RFA]: Fix for pending breakpoints in manually loaded/unloaded shlibs Reply-to: Eli Zaretskii References: <41191D71.60204@redhat.com> X-SW-Source: 2004-08/txt/msg00385.txt.bz2 > Date: Tue, 10 Aug 2004 15:09:37 -0400 > From: Jeff Johnston > > To fix this, I have added an observer for a new event: solib_unloaded. When > update_solib_list discovers a shared library has been unloaded, it notifies all > observers (initially this is just breakpoint.c). Breakpoint.c sets up an > observer to find all breakpoints in the removed shlib and mark them as > non-inserted and bp_shlib_disabled. This solves the problem. Could you please explain why this complicated mechanism is needed to fix this problem? Why cannot GDB directly mark the breakpoints when the library is unloaded, instead of going the observer path? > Index: doc/observer.texi > =================================================================== > RCS file: /cvs/src/src/gdb/doc/observer.texi,v > retrieving revision 1.7 > diff -u -p -r1.7 observer.texi > --- doc/observer.texi 21 May 2004 16:04:03 -0000 1.7 > +++ doc/observer.texi 10 Aug 2004 18:47:47 -0000 > @@ -90,3 +90,8 @@ at the entry-point instruction. For @sa > @value{GDBN} calls this observer immediately after connecting to the > inferior, and before any information on the inferior has been printed. > @end deftypefun > + > +@deftypefun void solib_unloaded (struct so_list *@var{solib}) > +The specified shared library has been discovered to be unloaded. > +@end deftypefun > + This part is approved (provided that the rest of the patch is aproved). > +/* Disable any breakpoints that are in in an unloaded shared library. Only ^^^^^ A typo. > +void > +disable_breakpoints_in_unloaded_shlib (struct so_list *solib) > +{ > + struct breakpoint *b; > + int disabled_shlib_breaks = 0; > + > + /* See also: insert_breakpoints, under DISABLE_UNSETTABLE_BREAK. */ > + ALL_BREAKPOINTS (b) > + { > +#if defined (PC_SOLIB) I think this #ifdef should be outside the loop: why loop at all if we do nothing inside the loop body?