[patch] Fix shared library handling in solib-pa64.c (take 2)

John David Anglin
2008-08-06T18:20:26Z

> 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 <dave.anglin@nrc-cnrc.gc.ca>

* 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,