From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27595 invoked by alias); 19 Jul 2012 11:05:30 -0000 Received: (qmail 27558 invoked by uid 22791); 19 Jul 2012 11:05:28 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_FAIL X-Spam-Check-By: sourceware.org Received: from gbenson.demon.co.uk (HELO gbenson.demon.co.uk) (80.177.220.214) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 19 Jul 2012 11:05:10 +0000 Date: Thu, 19 Jul 2012 11:05:00 -0000 From: Gary Benson To: gdb-patches@sourceware.org Subject: [RFA 2/4 take 2] Improved linker-debugger interface Message-ID: <20120719110509.GC16185@redhat.com> Mail-Followup-To: gdb-patches@sourceware.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="9ADF8FXzFeE7X4jE" Content-Disposition: inline X-IsSubscribed: yes 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: 2012-07/txt/msg00331.txt.bz2 --9ADF8FXzFeE7X4jE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 202 Hi all, This patch moves a block of code in solib-svr4.c. There are no code changes. I couldn't figure out how to write a ChangeLog for this--does it need one? Cheers, Gary -- http://gbenson.net/ --9ADF8FXzFeE7X4jE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="rtld-stap-4.patch" Content-length: 3274 diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 307e483..c88b9cb 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -106,6 +106,59 @@ static const char * const main_name_list[] = NULL }; +/* Per pspace SVR4 specific data. */ + +struct svr4_info +{ + CORE_ADDR debug_base; /* Base of dynamic linker structures. */ + + /* Validity flag for debug_loader_offset. */ + int debug_loader_offset_p; + + /* Load address for the dynamic linker, inferred. */ + CORE_ADDR debug_loader_offset; + + /* Name of the dynamic linker, valid if debug_loader_offset_p. */ + char *debug_loader_name; + + /* Load map address for the main executable. */ + CORE_ADDR main_lm_addr; + + CORE_ADDR interp_text_sect_low; + CORE_ADDR interp_text_sect_high; + CORE_ADDR interp_plt_sect_low; + CORE_ADDR interp_plt_sect_high; +}; + +/* Per-program-space data key. */ +static const struct program_space_data *solib_svr4_pspace_data; + +static void +svr4_pspace_data_cleanup (struct program_space *pspace, void *arg) +{ + struct svr4_info *info; + + info = program_space_data (pspace, solib_svr4_pspace_data); + xfree (info); +} + +/* Get the current svr4 data. If none is found yet, add it now. This + function always returns a valid object. */ + +static struct svr4_info * +get_svr4_info (void) +{ + struct svr4_info *info; + + info = program_space_data (current_program_space, solib_svr4_pspace_data); + if (info != NULL) + return info; + + info = XZALLOC (struct svr4_info); + set_program_space_data (current_program_space, solib_svr4_pspace_data, info); + return info; +} + /* Return non-zero if GDB_SO_NAME and INFERIOR_SO_NAME represent the same shared library. */ @@ -291,59 +344,6 @@ lm_addr_check (struct so_list *so, bfd *abfd) return so->lm_info->l_addr; } -/* Per pspace SVR4 specific data. */ - -struct svr4_info -{ - CORE_ADDR debug_base; /* Base of dynamic linker structures. */ - - /* Validity flag for debug_loader_offset. */ - int debug_loader_offset_p; - - /* Load address for the dynamic linker, inferred. */ - CORE_ADDR debug_loader_offset; - - /* Name of the dynamic linker, valid if debug_loader_offset_p. */ - char *debug_loader_name; - - /* Load map address for the main executable. */ - CORE_ADDR main_lm_addr; - - CORE_ADDR interp_text_sect_low; - CORE_ADDR interp_text_sect_high; - CORE_ADDR interp_plt_sect_low; - CORE_ADDR interp_plt_sect_high; -}; - -/* Per-program-space data key. */ -static const struct program_space_data *solib_svr4_pspace_data; - -static void -svr4_pspace_data_cleanup (struct program_space *pspace, void *arg) -{ - struct svr4_info *info; - - info = program_space_data (pspace, solib_svr4_pspace_data); - xfree (info); -} - -/* Get the current svr4 data. If none is found yet, add it now. This - function always returns a valid object. */ - -static struct svr4_info * -get_svr4_info (void) -{ - struct svr4_info *info; - - info = program_space_data (current_program_space, solib_svr4_pspace_data); - if (info != NULL) - return info; - - info = XZALLOC (struct svr4_info); - set_program_space_data (current_program_space, solib_svr4_pspace_data, info); - return info; -} - /* Local function prototypes */ static int match_main (const char *); --9ADF8FXzFeE7X4jE--