From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14491 invoked by alias); 9 Jan 2005 13:05:52 -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 14440 invoked from network); 9 Jan 2005 13:05:45 -0000 Received: from unknown (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org with SMTP; 9 Jan 2005 13:05:45 -0000 Received: from elgar.sibelius.xs4all.nl (elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.0/8.13.0) with ESMTP id j09D5HlH022822; Sun, 9 Jan 2005 14:05:17 +0100 (CET) Received: from elgar.sibelius.xs4all.nl (localhost [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.12.6p3/8.12.6) with ESMTP id j09D5HCh000573; Sun, 9 Jan 2005 14:05:17 +0100 (CET) (envelope-from kettenis@elgar.sibelius.xs4all.nl) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.12.6p3/8.12.6/Submit) id j09D5FfO000568; Sun, 9 Jan 2005 14:05:15 +0100 (CET) Date: Sun, 09 Jan 2005 13:05:00 -0000 Message-Id: <200501091305.j09D5FfO000568@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: drow@false.org CC: gdb-patches@sources.redhat.com, kevinb@redhat.com, eliz@gnu.org In-reply-to: <20050109000104.GA1853@nevyn.them.org> (message from Daniel Jacobowitz on Sat, 8 Jan 2005 19:01:04 -0500) Subject: Re: [RFA] Introduce solib_loaded observer References: <200501082314.j08NE6a1080151@elgar.sibelius.xs4all.nl> <20050109000104.GA1853@nevyn.them.org> X-SW-Source: 2005-01/txt/msg00052.txt.bz2 Date: Sat, 8 Jan 2005 19:01:04 -0500 From: Daniel Jacobowitz On Sun, Jan 09, 2005 at 12:14:06AM +0100, Mark Kettenis wrote: > This patch introduces a new solib_loaded observer that parallels the > solub_unloaded observer that we already have. I need this observer to > properly implement a threads stratum for FreeBSD and OpenBSD > user-space threads library support. With this observer I'll also be > able to fix the problems we're having with statically linked programs > that use the threading library on Linux. If you think about it a bit, > the problems with static thread libraries stem from the fact that we > abuse the now deprecated target_new_objfile_hook to get notified about > newly loaded libraries. Unfortunately that hook is also called when > the main executable is loaded, which causes all kinds of trouble. Actually, I've already posted patches for the Linux problem. The basic "abuse" of the target_new_objfile_hook isn't really the stumbling block, rather, the attempt to use it for both running and non-running programs. The necessary fix was to use inferior_created. Still, it'll definitely be cleaner to use a solib_loaded hook there, and I look forward to that. I missed that patch. But I'm doing the same thing for the BSD user-level threads support. Works like a charm. I'll ping that patch after I get back from travelling next week. > The patch below doesn't only implement the new observer. The reason > for that is that when the solib_loaded observer is called, the symbols > for the new library haven't been loaded yet. So I've split out the > code to read in those symbols out from solib_add() into a seperate > function, and made that public. Could you explain why this is necessary, instead of calling the observer after loading symbols? I don't see notification at that point as particularly useful. Certainly the first thing the GNU/Linux code would want to do would be to load the symbols. Calling the observer after loading the symbols isn't possible. You can set "auto-solib-add" to 0, and then the symbols will never be loaded at all. So you'll always have to force loading the symbols from within your observer anyway (but you only have to do so for the threads library). From a code perspective the point where the notification is called is the most logical. And that way it's less likely that we see "auto-solib-add" related bugs ;-). Mark