From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29070 invoked by alias); 25 Nov 2001 20:44:43 -0000 Mailing-List: contact gdb-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 29031 invoked from network); 25 Nov 2001 20:44:43 -0000 Received: from unknown (HELO bothner.com) (216.102.199.253) by sourceware.cygnus.com with SMTP; 25 Nov 2001 20:44:43 -0000 Received: from bothner.com (eureka.bothner.com [192.168.1.9]) by bothner.com (8.11.0/8.11.0) with ESMTP id fAPKieM12265; Sun, 25 Nov 2001 12:44:40 -0800 Message-ID: <3C01584A.2000609@bothner.com> Date: Tue, 13 Nov 2001 10:20:00 -0000 From: Per Bothner User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6) Gecko/20011120 X-Accept-Language: en-us MIME-Version: 1.0 To: tromey@redhat.com CC: Gdb List Subject: Re: breakpoints in shared libraries References: <87elmmaeki.fsf@creche.redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2001-11/txt/msg00141.txt.bz2 Tom Tromey wrote: >Suppose I set a breakpoint in a shared library. I find on my Linux >box I can only do this after the inferior has been started. So I use >`b main', then `run', then set the breakpoints I really care about. >(This gets old fast, btw.) > Yes. It should be fixed. I seem to remember that at one point Gilmore wrote code so that gdb could set a break point on a shared Solaris library that had not been loaded. There really is no excuse for gdb not being able to set a breakpoint on a shared library specified on the linker command line. (Shared libraries loaded with an explicit call to dlopen are of course a different matter.) It should not be very difficult, but it requires knowing how the linker does things. Somewhere in the executable there has to be a data structure that lists the libraries that will be loaded. I seem to remember there actually is some Linux program that will list the shared libraries requried by an excutable, which should make it easy.. Gdb just has to be able to read that data structure, and pre-load the symbol tables for the shared libraries. You can then set breakpoints in those shared libraries. When the library actually gets loaded, we don't need to read the symbol tables, but we need to relocate them. Let's fix the real bug instead of kludge to make the bug slightly less obnoxious. --Per