2012-07-19 Gary Benson * solib-svr4.c (svr4_info): Move earlier. (solib_svr4_pspace_data): Likewise. (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. 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 *);