From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12560 invoked by alias); 6 Aug 2008 19:24:52 -0000 Received: (qmail 12551 invoked by uid 22791); 6 Aug 2008 19:24:51 -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 19:24:17 +0000 Received: by hiauly1.hia.nrc.ca (Postfix, from userid 1000) id ABC03431A; Wed, 6 Aug 2008 15:24:13 -0400 (EDT) Subject: [patch] Don't set DT_HP_DEBUG_PRIVATE in solib-pa64.c To: dave@hiauly1.hia.nrc.ca (John David Anglin) Date: Wed, 06 Aug 2008 19:24:00 -0000 From: "John David Anglin" Cc: drow@false.org, gdb-patches@sourceware.org, randolph@tausq.org In-Reply-To: from "John David Anglin" at Aug 6, 2008 02:19:51 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20080806192413.ABC03431A@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/msg00133.txt.bz2 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 * 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;