From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21860 invoked by alias); 6 Aug 2008 18:20:26 -0000 Received: (qmail 21852 invoked by uid 22791); 6 Aug 2008 18:20:25 -0000 X-Spam-Check-By: sourceware.org Received: from hiauly1.hia.nrc.ca (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 06 Aug 2008 18:19:54 +0000 Received: by hiauly1.hia.nrc.ca (Postfix, from userid 1000) id 5D99A431A; Wed, 6 Aug 2008 14:19:51 -0400 (EDT) Subject: [patch] Fix shared library handling in solib-pa64.c (take 2) To: drow@false.org (Daniel Jacobowitz) Date: Wed, 06 Aug 2008 18:20:00 -0000 From: "John David Anglin" Cc: gdb-patches@sourceware.org, randolph@tausq.org In-Reply-To: <20080806142017.GA27139@caradoc.them.org> from "Daniel Jacobowitz" at Aug 6, 2008 10:20:17 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20080806181952.5D99A431A@hiauly1.hia.nrc.ca> 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: 2008-08/txt/msg00128.txt.bz2 > Does this really do what you want it to? > > Looking at that HP man page, it looks like dlmodinfo will use "its own > data structures" - i.e. GDB's load map, not the debugged program's. Here's take 2. This one actually works. This shows the result for a simple program. ... This GDB was configured as "hppa64-hp-hpux11.00"... (gdb) info shared No shared libraries loaded at this time. (gdb) break main Breakpoint 1 at 0x40000000000029c8: file main.c, line 4. (gdb) r Starting program: /home/gnu/gdb/objdir64/main warning: Loadable segment ".tbss" outside of ELF segments warning: Loadable segment ".tbss" outside of ELF segments Breakpoint 1, main () at main.c:4 4 return 0; (gdb) info shared >From To Syms Read Shared Object Library 0xc00000000000ac80 0xc0000000000419b4 Yes /usr/lib/pa20_64/dld.sl 0x800003ffeff23538 0x800003ffeffe67f8 Yes /lib/pa20_64/libc.2 0x800003ffefec7150 0x800003ffefec8578 Yes /usr/lib/pa20_64/libdl.1 0x800003ffefec2574 0x800003ffefec2574 Yes /opt/graphics/OpenGL/lib/pa20_64/libogltls.sl One thing that I have noticed is that the shared libraries are always forced private which makes them writeable. I recently had a program which dropped core when the library code was shared but not when they were private. On hpux 11, the chatr "+dbg" can be used to make libraries private or shareable. Possibly, it's not a great idea to always force private libraries. Detection of this is broken for the som target. The information is now in the shared library header and not __dld_flags. On hpux 10, I guess we are stuck with forcing private libraries. Ok? Dave -- J. David Anglin dave.anglin@nrc-cnrc.gc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6602) 2008-08-06 John David Anglin * solib-pa64.c (read_dld_descriptor): Return zero if load map is not setup. Index: solib-pa64.c =================================================================== RCS file: /cvs/src/src/gdb/solib-pa64.c,v retrieving revision 1.10 diff -u -3 -p -r1.10 solib-pa64.c --- solib-pa64.c 1 Jan 2008 22:53:13 -0000 1.10 +++ solib-pa64.c 6 Aug 2008 17:19:39 -0000 @@ -125,8 +125,8 @@ pa64_target_read_memory (void *buffer, C This must happen after dld starts running, so we can't do it in read_dynamic_info. Record the fact that we have loaded the - descriptor. If the library is archive bound, then return zero, else - return nonzero. */ + descriptor. If the library is archive bound or the load map + hasn't been setup, then return zero; else return nonzero. */ static int read_dld_descriptor (void) @@ -161,6 +161,9 @@ read_dld_descriptor (void) error (_("Error while reading in load map pointer.")); } + if (!dld_cache.load_map) + return 0; + /* Read in the dld load module descriptor */ if (dlgetmodinfo (-1, &dld_cache.dld_desc,