This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Don't set DT_HP_DEBUG_PRIVATE in solib-pa64.c
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: dave at hiauly1 dot hia dot nrc dot ca (John David Anglin)
- Cc: drow at false dot org, gdb-patches at sourceware dot org, randolph at tausq dot org
- Date: Wed, 6 Aug 2008 15:24:12 -0400 (EDT)
- Subject: [patch] Don't set DT_HP_DEBUG_PRIVATE in solib-pa64.c
Hi,
> 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.
The patch below implements my suggestion to not set DT_HP_DEBUG_PRIVATE
in solib-pa64.c as the user can do this with chatr (or pxdb). Tested
on hppa2.0w-hp-hpux11.11.
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 (pa64_solib_create_inferior_hook): Don't set
DT_HP_DEBUG_PRIVATE. Add warning if DT_HP_DEBUG_PRIVATE is not set.
Revise comment.
(pa64_current_sos): Remove map private warning warning.
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 19:13:08 -0000
@@ -319,13 +322,12 @@ bfd_lookup_symbol (bfd *abfd, char *symn
to tell the dynamic linker that a private copy of the library is
needed (so GDB can set breakpoints in the library).
- We need to set two flag bits in this routine.
-
- DT_HP_DEBUG_PRIVATE to indicate that shared libraries should be
- mapped private.
-
- DT_HP_DEBUG_CALLBACK to indicate that we want the dynamic linker to
- call the breakpoint routine for significant events. */
+ We need to set DT_HP_DEBUG_CALLBACK to indicate that we want the
+ dynamic linker to call the breakpoint routine for significant events.
+ We used to set DT_HP_DEBUG_PRIVATE to indicate that shared libraries
+ should be mapped private. However, this flag can be set using
+ "chatr +dbg enable". Not setting DT_HP_DEBUG_PRIVATE allows debugging
+ with shared libraries mapped shareable. */
static void
pa64_solib_create_inferior_hook (void)
@@ -357,8 +359,13 @@ pa64_solib_create_inferior_hook (void)
if (! read_dynamic_info (shlib_info, &dld_cache))
error (_("Unable to read the .dynamic section."));
+ /* If the libraries were not mapped private, warn the user. */
+ if ((dld_cache.dld_flags & DT_HP_DEBUG_PRIVATE) == 0)
+ warning (_("The shared libraries were not privately mapped; setting a\n"
+ "breakpoint in a shared library will not work. Use \"chatr +dbg "
+ "enable\"\nto map shared library text privately.\n"));
+
/* Turn on the flags we care about. */
- dld_cache.dld_flags |= DT_HP_DEBUG_PRIVATE;
dld_cache.dld_flags |= DT_HP_DEBUG_CALLBACK;
status = target_write_memory (dld_cache.dld_flags_addr,
(char *) &dld_cache.dld_flags,
@@ -451,12 +458,6 @@ pa64_current_sos (void)
if (! read_dld_descriptor ())
return NULL;
- /* If the libraries were not mapped private, warn the user. */
- if ((dld_cache.dld_flags & DT_HP_DEBUG_PRIVATE) == 0)
- warning (_("The shared libraries were not privately mapped; setting a\n"
- "breakpoint in a shared library will not work until you rerun "
- "the program.\n"));
-
for (dll_index = -1; ; dll_index++)
{
struct load_module_desc dll_desc;