Commit | Line | Data |
---|---|---|
13437d4b KB |
1 | /* Shared library declarations for GDB, the GNU Debugger. |
2 | Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999, 2000 | |
3 | Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, | |
20 | Boston, MA 02111-1307, USA. */ | |
21 | ||
22 | #define SO_NAME_MAX_PATH_SIZE 512 /* FIXME: Should be dynamic */ | |
23 | ||
24 | /* Forward declaration for target specific link map information. This | |
25 | struct is opaque to all but the target specific file. */ | |
26 | struct lm_info; | |
27 | ||
28 | struct so_list | |
29 | { | |
30 | /* The following fields of the structure come directly from the | |
31 | dynamic linker's tables in the inferior, and are initialized by | |
32 | current_sos. */ | |
33 | ||
34 | struct so_list *next; /* next structure in linked list */ | |
35 | ||
36 | /* A pointer to target specific link map information. Often this | |
37 | will be a copy of struct link_map from the user process, but | |
38 | it need not be; it can be any collection of data needed to | |
39 | traverse the dynamic linker's data structures. */ | |
40 | struct lm_info *lm_info; | |
41 | ||
42 | /* Shared object file name, exactly as it appears in the | |
43 | inferior's link map. This may be a relative path, or something | |
44 | which needs to be looked up in LD_LIBRARY_PATH, etc. We use it | |
45 | to tell which entries in the inferior's dynamic linker's link | |
46 | map we've already loaded. */ | |
47 | char so_original_name[SO_NAME_MAX_PATH_SIZE]; | |
48 | ||
49 | /* shared object file name, expanded to something GDB can open */ | |
50 | char so_name[SO_NAME_MAX_PATH_SIZE]; | |
51 | ||
52 | /* The following fields of the structure are built from | |
53 | information gathered from the shared object file itself, and | |
54 | are initialized when we actually add it to our symbol tables. */ | |
55 | ||
56 | bfd *abfd; | |
13437d4b KB |
57 | char symbols_loaded; /* flag: symbols read in yet? */ |
58 | char from_tty; /* flag: print msgs? */ | |
59 | struct objfile *objfile; /* objfile for loaded lib */ | |
60 | struct section_table *sections; | |
61 | struct section_table *sections_end; | |
62 | struct section_table *textsection; | |
63 | }; | |
64 | ||
65 | struct target_so_ops | |
66 | { | |
749499cb KB |
67 | /* Adjust the section binding addresses by the base address at |
68 | which the object was actually mapped. */ | |
69 | void (*relocate_section_addresses) (struct so_list *so, | |
70 | struct section_table *); | |
71 | ||
72 | /* Free the the link map info and any other private data | |
73 | structures associated with a so_list entry. */ | |
13437d4b | 74 | void (*free_so) (struct so_list *so); |
749499cb KB |
75 | |
76 | /* Reset or free private data structures not associated with | |
77 | so_list entries. */ | |
13437d4b | 78 | void (*clear_solib) (void); |
749499cb KB |
79 | |
80 | /* Target dependent code to run after child process fork. */ | |
13437d4b | 81 | void (*solib_create_inferior_hook) (void); |
749499cb KB |
82 | |
83 | /* Do additional symbol handling, lookup, etc. after symbols | |
84 | for a shared object have been loaded. */ | |
13437d4b | 85 | void (*special_symbol_handling) (void); |
749499cb KB |
86 | |
87 | /* Construct a list of the currently loaded shared objects. */ | |
13437d4b | 88 | struct so_list *(*current_sos) (void); |
749499cb KB |
89 | |
90 | /* Find, open, and read the symbols for the main executable. */ | |
13437d4b KB |
91 | int (*open_symbol_file_object) (void *from_ttyp); |
92 | }; | |
93 | ||
94 | void free_so (struct so_list *so); | |
95 | ||
96 | /* FIXME: gdbarch needs to control this variable */ | |
97 | extern struct target_so_ops *current_target_so_ops; | |
98 | ||
749499cb KB |
99 | #define TARGET_SO_RELOCATE_SECTION_ADDRESSES \ |
100 | (current_target_so_ops->relocate_section_addresses) | |
13437d4b KB |
101 | #define TARGET_SO_FREE_SO (current_target_so_ops->free_so) |
102 | #define TARGET_SO_CLEAR_SOLIB (current_target_so_ops->clear_solib) | |
103 | #define TARGET_SO_SOLIB_CREATE_INFERIOR_HOOK \ | |
104 | (current_target_so_ops->solib_create_inferior_hook) | |
105 | #define TARGET_SO_SPECIAL_SYMBOL_HANDLING \ | |
106 | (current_target_so_ops->special_symbol_handling) | |
107 | #define TARGET_SO_CURRENT_SOS (current_target_so_ops->current_sos) | |
108 | #define TARGET_SO_OPEN_SYMBOL_FILE_OBJECT \ | |
109 | (current_target_so_ops->open_symbol_file_object) |