198944Sobrien/* Shared library declarations for GDB, the GNU Debugger. 298944Sobrien Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 398944Sobrien 2001 498944Sobrien Free Software Foundation, Inc. 598944Sobrien 698944Sobrien This file is part of GDB. 798944Sobrien 898944Sobrien This program is free software; you can redistribute it and/or modify 998944Sobrien it under the terms of the GNU General Public License as published by 1098944Sobrien the Free Software Foundation; either version 2 of the License, or 1198944Sobrien (at your option) any later version. 1298944Sobrien 1398944Sobrien This program is distributed in the hope that it will be useful, 1498944Sobrien but WITHOUT ANY WARRANTY; without even the implied warranty of 1598944Sobrien MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1698944Sobrien GNU General Public License for more details. 1798944Sobrien 1898944Sobrien You should have received a copy of the GNU General Public License 1998944Sobrien along with this program; if not, write to the Free Software 2098944Sobrien Foundation, Inc., 59 Temple Place - Suite 330, 2198944Sobrien Boston, MA 02111-1307, USA. */ 2298944Sobrien 2398944Sobrien#ifndef SOLIST_H 2498944Sobrien#define SOLIST_H 2598944Sobrien 2698944Sobrien#define SO_NAME_MAX_PATH_SIZE 512 /* FIXME: Should be dynamic */ 2798944Sobrien 2898944Sobrien/* Forward declaration for target specific link map information. This 2998944Sobrien struct is opaque to all but the target specific file. */ 3098944Sobrienstruct lm_info; 3198944Sobrien 3298944Sobrienstruct so_list 3398944Sobrien { 3498944Sobrien /* The following fields of the structure come directly from the 3598944Sobrien dynamic linker's tables in the inferior, and are initialized by 3698944Sobrien current_sos. */ 3798944Sobrien 3898944Sobrien struct so_list *next; /* next structure in linked list */ 3998944Sobrien 4098944Sobrien /* A pointer to target specific link map information. Often this 4198944Sobrien will be a copy of struct link_map from the user process, but 4298944Sobrien it need not be; it can be any collection of data needed to 4398944Sobrien traverse the dynamic linker's data structures. */ 4498944Sobrien struct lm_info *lm_info; 4598944Sobrien 4698944Sobrien /* Shared object file name, exactly as it appears in the 4798944Sobrien inferior's link map. This may be a relative path, or something 4898944Sobrien which needs to be looked up in LD_LIBRARY_PATH, etc. We use it 4998944Sobrien to tell which entries in the inferior's dynamic linker's link 5098944Sobrien map we've already loaded. */ 5198944Sobrien char so_original_name[SO_NAME_MAX_PATH_SIZE]; 5298944Sobrien 5398944Sobrien /* shared object file name, expanded to something GDB can open */ 5498944Sobrien char so_name[SO_NAME_MAX_PATH_SIZE]; 5598944Sobrien 5698944Sobrien /* The following fields of the structure are built from 5798944Sobrien information gathered from the shared object file itself, and 5898944Sobrien are set when we actually add it to our symbol tables. 5998944Sobrien 6098944Sobrien current_sos must initialize these fields to 0. */ 6198944Sobrien 6298944Sobrien bfd *abfd; 6398944Sobrien char symbols_loaded; /* flag: symbols read in yet? */ 6498944Sobrien char from_tty; /* flag: print msgs? */ 6598944Sobrien struct objfile *objfile; /* objfile for loaded lib */ 6698944Sobrien struct section_table *sections; 6798944Sobrien struct section_table *sections_end; 6898944Sobrien struct section_table *textsection; 6998944Sobrien }; 7098944Sobrien 7198944Sobrienstruct target_so_ops 7298944Sobrien { 7398944Sobrien /* Adjust the section binding addresses by the base address at 7498944Sobrien which the object was actually mapped. */ 7598944Sobrien void (*relocate_section_addresses) (struct so_list *so, 7698944Sobrien struct section_table *); 7798944Sobrien 7898944Sobrien /* Free the the link map info and any other private data 7998944Sobrien structures associated with a so_list entry. */ 8098944Sobrien void (*free_so) (struct so_list *so); 8198944Sobrien 8298944Sobrien /* Reset or free private data structures not associated with 8398944Sobrien so_list entries. */ 8498944Sobrien void (*clear_solib) (void); 8598944Sobrien 8698944Sobrien /* Target dependent code to run after child process fork. */ 8798944Sobrien void (*solib_create_inferior_hook) (void); 8898944Sobrien 8998944Sobrien /* Do additional symbol handling, lookup, etc. after symbols 9098944Sobrien for a shared object have been loaded. */ 9198944Sobrien void (*special_symbol_handling) (void); 9298944Sobrien 9398944Sobrien /* Construct a list of the currently loaded shared objects. */ 9498944Sobrien struct so_list *(*current_sos) (void); 9598944Sobrien 9698944Sobrien /* Find, open, and read the symbols for the main executable. */ 9798944Sobrien int (*open_symbol_file_object) (void *from_ttyp); 9898944Sobrien 9998944Sobrien /* Determine if PC lies in the dynamic symbol resolution code of 10098944Sobrien the run time loader */ 10198944Sobrien int (*in_dynsym_resolve_code) (CORE_ADDR pc); 102130803Smarcel 103130803Smarcel /* Extra hook for finding and opening a solib. Convenience function 104130803Smarcel for remote debuggers finding host libs */ 105130803Smarcel int (*find_and_open_solib) (char *soname, 106130803Smarcel unsigned o_flags, char **temp_pathname); 107130803Smarcel 10898944Sobrien }; 10998944Sobrien 11098944Sobrienvoid free_so (struct so_list *so); 11198944Sobrien 11298944Sobrien/* Find solib binary file and open it. */ 11398944Sobrienextern int solib_open (char *in_pathname, char **found_pathname); 11498944Sobrien 11598944Sobrien/* FIXME: gdbarch needs to control this variable */ 11698944Sobrienextern struct target_so_ops *current_target_so_ops; 11798944Sobrien 11898944Sobrien#define TARGET_SO_RELOCATE_SECTION_ADDRESSES \ 11998944Sobrien (current_target_so_ops->relocate_section_addresses) 12098944Sobrien#define TARGET_SO_FREE_SO (current_target_so_ops->free_so) 12198944Sobrien#define TARGET_SO_CLEAR_SOLIB (current_target_so_ops->clear_solib) 12298944Sobrien#define TARGET_SO_SOLIB_CREATE_INFERIOR_HOOK \ 12398944Sobrien (current_target_so_ops->solib_create_inferior_hook) 12498944Sobrien#define TARGET_SO_SPECIAL_SYMBOL_HANDLING \ 12598944Sobrien (current_target_so_ops->special_symbol_handling) 12698944Sobrien#define TARGET_SO_CURRENT_SOS (current_target_so_ops->current_sos) 12798944Sobrien#define TARGET_SO_OPEN_SYMBOL_FILE_OBJECT \ 12898944Sobrien (current_target_so_ops->open_symbol_file_object) 12998944Sobrien#define TARGET_SO_IN_DYNSYM_RESOLVE_CODE \ 13098944Sobrien (current_target_so_ops->in_dynsym_resolve_code) 131130803Smarcel#define TARGET_SO_FIND_AND_OPEN_SOLIB \ 132130803Smarcel (current_target_so_ops->find_and_open_solib) 13398944Sobrien 13498944Sobrien#endif 135