From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26690 invoked by alias); 28 Aug 2007 13:05:23 -0000 Received: (qmail 26223 invoked by uid 22791); 28 Aug 2007 13:05:21 -0000 X-Spam-Check-By: sourceware.org Received: from s200aog14.obsmtp.com (HELO s200aog14.obsmtp.com) (207.126.144.128) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 28 Aug 2007 13:05:11 +0000 Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob014.postini.com ([207.126.147.11]) with SMTP; Tue, 28 Aug 2007 13:05:08 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9298CDAAE for ; Tue, 28 Aug 2007 13:05:06 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3C8444C038 for ; Tue, 28 Aug 2007 13:05:06 +0000 (GMT) Received: from [164.129.14.85] (bri1017.bri.st.com [164.129.14.85]) by mail1.bri.st.com (MOS 3.7.5a-GA) with ESMTP id CJE63022 (AUTH antony); Tue, 28 Aug 2007 14:05:05 +0100 (BST) Message-ID: <46D41D81.3020003@st.com> Date: Tue, 28 Aug 2007 13:05:00 -0000 From: Antony KING User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: gdb@sourceware.org Subject: [RFC] Add commands to dynamically enable/disable shared library support Content-Type: multipart/mixed; boundary="------------090101010503000103030007" X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00233.txt.bz2 This is a multi-part message in MIME format. --------------090101010503000103030007 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1366 Hi, Attached is a patch I have constructed against GDB 6.6 which adds the following commands to GDB: * disable sharedlibrary This command removes the shared library breakpoints and implicitly calls the "nosharedlibrary" command. The solib_create_inferior_hook() API is also disabled (until re-enabled by "enable sharedlibrary"). * enable sharedlibrary This command explicitly calls the solib_create_inferior_hook() API and re-enables the auto loading of shared libraries. The intent of this patch is to be able to control the insertion of the breakpoint used to monitor when a shared library is loaded (and so update GDB's symbolic information). The reason for this is that when debugging boot from ROM applications it is only legitimate to insert a breakpoint when the application has been re-located from ROM to RAM. At present it is only possible to control this by removing the symbolic information (so that GDB does not "see" the special symbol in the target application). This is not desirable if one wishes to set a breakpoint (using a hardware breakpoint) in the loaded application. I plan to add these commands to the version of GDB we support, unless someone suggests a better solution, but I would also like to get a wider opinion (other than my own) on the implementation and whether the changes a desirable in standard GDB. Cheers, Antony. --------------090101010503000103030007 Content-Type: text/plain; name="patch-INSbl26139.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch-INSbl26139.txt" Content-length: 1853 --- gdb/solib.c@@/main/INSIGHT-6.6-ST-1.0-int/LATEST 2007-08-28 11:30:33.257546000 +0100 +++ gdb/solib.c 2007-08-28 11:26:54.360656000 +0100 @@ -82,6 +82,8 @@ static int solib_cleanup_queued = 0; /* make_run_cleanup called */ +static int solib_enabled = 1; /* Shared libraries enabled ? */ + /* Local function prototypes */ static void do_clear_solib (void *); @@ -869,7 +871,8 @@ solib_create_inferior_hook (void) { struct target_so_ops *ops = solib_ops (current_gdbarch); - ops->solib_create_inferior_hook(); + if (solib_enabled) + ops->solib_create_inferior_hook(); } /* GLOBAL FUNCTION @@ -951,6 +954,39 @@ value); } +/* LOCAL FUNCTION + + disable_shared_libraries -- handle command to disable shared library + support. + + DESCRIPTION + + Implements the command "disable sharedlibrary". */ + +static void +disable_shared_libraries (char *ignored, int from_tty) +{ + solib_enabled = 0; + remove_solib_event_breakpoints (); + no_shared_libraries (NULL, from_tty); +} + +/* LOCAL FUNCTION + + enable_shared_libraries -- handle command to enable shared library + support. + + DESCRIPTION + + Implements the command "enable sharedlibrary". */ + +static void +enable_shared_libraries (char *ignored, int from_tty) +{ + solib_enabled = 1; + solib_create_inferior_hook (); + solib_add (NULL, from_tty, NULL, auto_solib_add); +} extern initialize_file_ftype _initialize_solib; /* -Wmissing-prototypes */ @@ -1001,4 +1037,12 @@ reload_shared_libraries, show_solib_search_path, &setlist, &showlist); + + add_cmd ("sharedlibrary", class_support, disable_shared_libraries, _("\ +Disable shared library support."), + &disablelist); + + add_cmd ("sharedlibrary", class_support, enable_shared_libraries, _("\ +Enable shared library support."), + &enablelist); } --------------090101010503000103030007--