OLD | NEW |
1 /* Private partial symbol table definitions. | 1 /* Private partial symbol table definitions. |
2 | 2 |
3 Copyright (C) 2009-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2009-2012 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GDB. | 5 This file is part of GDB. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 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 | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 /* Address class (for info_symbols). */ | 48 /* Address class (for info_symbols). */ |
49 | 49 |
50 ENUM_BITFIELD(address_class) aclass : 6; | 50 ENUM_BITFIELD(address_class) aclass : 6; |
51 | 51 |
52 }; | 52 }; |
53 | 53 |
54 #define PSYMBOL_DOMAIN(psymbol) (psymbol)->domain | 54 #define PSYMBOL_DOMAIN(psymbol) (psymbol)->domain |
55 #define PSYMBOL_CLASS(psymbol) (psymbol)->aclass | 55 #define PSYMBOL_CLASS(psymbol) (psymbol)->aclass |
56 | 56 |
| 57 /* A convenience enum to give names to some constants used when |
| 58 searching psymtabs. This is internal to psymtab and should not be |
| 59 used elsewhere. */ |
| 60 |
| 61 enum psymtab_search_status |
| 62 { |
| 63 PST_NOT_SEARCHED, |
| 64 PST_SEARCHED_AND_FOUND, |
| 65 PST_SEARCHED_AND_NOT_FOUND |
| 66 }; |
| 67 |
57 /* Each source file that has not been fully read in is represented by | 68 /* Each source file that has not been fully read in is represented by |
58 a partial_symtab. This contains the information on where in the | 69 a partial_symtab. This contains the information on where in the |
59 executable the debugging symbols for a specific file are, and a | 70 executable the debugging symbols for a specific file are, and a |
60 list of names of global symbols which are located in this file. | 71 list of names of global symbols which are located in this file. |
61 They are all chained on partial symtab lists. | 72 They are all chained on partial symtab lists. |
62 | 73 |
63 Even after the source file has been read into a symtab, the | 74 Even after the source file has been read into a symtab, the |
64 partial_symtab remains around. They are allocated on an obstack, | 75 partial_symtab remains around. They are allocated on an obstack, |
65 objfile_obstack. */ | 76 objfile_obstack. */ |
66 | 77 |
67 struct partial_symtab | 78 struct partial_symtab |
68 { | 79 { |
69 | 80 |
70 /* Chain of all existing partial symtabs. */ | 81 /* Chain of all existing partial symtabs. */ |
71 | 82 |
72 struct partial_symtab *next; | 83 struct partial_symtab *next; |
73 | 84 |
74 /* Name of the source file which this partial_symtab defines. */ | 85 /* Name of the source file which this partial_symtab defines, |
| 86 or if the psymtab is anonymous then a descriptive name for |
| 87 debugging purposes, or "". It must not be NULL. */ |
75 | 88 |
76 const char *filename; | 89 const char *filename; |
77 | 90 |
78 /* Full path of the source file. NULL if not known. */ | 91 /* Full path of the source file. NULL if not known. */ |
79 | 92 |
80 char *fullname; | 93 char *fullname; |
81 | 94 |
82 /* Directory in which it was compiled, or NULL if we don't know. */ | 95 /* Directory in which it was compiled, or NULL if we don't know. */ |
83 | 96 |
84 const char *dirname; | 97 const char *dirname; |
(...skipping 19 matching lines...) Expand all Loading... |
104 to have any loops. "depends on" means that symbols must be read | 117 to have any loops. "depends on" means that symbols must be read |
105 for the dependencies before being read for this psymtab; this is | 118 for the dependencies before being read for this psymtab; this is |
106 for type references in stabs, where if foo.c includes foo.h, declarations | 119 for type references in stabs, where if foo.c includes foo.h, declarations |
107 in foo.h may use type numbers defined in foo.c. For other debugging | 120 in foo.h may use type numbers defined in foo.c. For other debugging |
108 formats there may be no need to use dependencies. */ | 121 formats there may be no need to use dependencies. */ |
109 | 122 |
110 struct partial_symtab **dependencies; | 123 struct partial_symtab **dependencies; |
111 | 124 |
112 int number_of_dependencies; | 125 int number_of_dependencies; |
113 | 126 |
| 127 /* If NULL, this is an ordinary partial symbol table. |
| 128 |
| 129 If non-NULL, this holds a single includer of this partial symbol |
| 130 table, and this partial symbol table is a shared one. |
| 131 |
| 132 A shared psymtab is one that is referenced by multiple other |
| 133 psymtabs, and which conceptually has its contents directly |
| 134 included in those. |
| 135 |
| 136 Shared psymtabs have special semantics. When a search finds a |
| 137 symbol in a shared table, we instead return one of the non-shared |
| 138 tables that include this one. |
| 139 |
| 140 A shared psymtabs can be referred to by other shared ones. |
| 141 |
| 142 The psymtabs that refer to a shared psymtab will list the shared |
| 143 psymtab in their 'dependencies' array. |
| 144 |
| 145 In DWARF terms, a shared psymtab is a DW_TAG_partial_unit; but |
| 146 of course using a name based on that would be too confusing, so |
| 147 "shared" was chosen instead. |
| 148 |
| 149 Only a single user is needed because, when expanding a shared |
| 150 psymtab, we only need to expand its "canonical" non-shared user. |
| 151 The choice of which one should be canonical is left to the |
| 152 debuginfo reader; it can be arbitrary. */ |
| 153 |
| 154 struct partial_symtab *user; |
| 155 |
114 /* Global symbol list. This list will be sorted after readin to | 156 /* Global symbol list. This list will be sorted after readin to |
115 improve access. Binary search will be the usual method of | 157 improve access. Binary search will be the usual method of |
116 finding a symbol within it. globals_offset is an integer offset | 158 finding a symbol within it. globals_offset is an integer offset |
117 within global_psymbols[]. */ | 159 within global_psymbols[]. */ |
118 | 160 |
119 int globals_offset; | 161 int globals_offset; |
120 int n_global_syms; | 162 int n_global_syms; |
121 | 163 |
122 /* Static symbol list. This list will *not* be sorted after readin; | 164 /* Static symbol list. This list will *not* be sorted after readin; |
123 to find a symbol in it, exhaustive search must be used. This is | 165 to find a symbol in it, exhaustive search must be used. This is |
(...skipping 11 matching lines...) Expand all Loading... |
135 on 64-bit systems. */ | 177 on 64-bit systems. */ |
136 | 178 |
137 unsigned char readin; | 179 unsigned char readin; |
138 | 180 |
139 /* True iff objfile->psymtabs_addrmap is properly populated for this | 181 /* True iff objfile->psymtabs_addrmap is properly populated for this |
140 partial_symtab. For discontiguous overlapping psymtabs is the only usable | 182 partial_symtab. For discontiguous overlapping psymtabs is the only usable |
141 info in PSYMTABS_ADDRMAP. */ | 183 info in PSYMTABS_ADDRMAP. */ |
142 | 184 |
143 unsigned char psymtabs_addrmap_supported; | 185 unsigned char psymtabs_addrmap_supported; |
144 | 186 |
| 187 /* True if the name of this partial symtab is not a source file name. */ |
| 188 |
| 189 unsigned char anonymous; |
| 190 |
| 191 /* A flag that is temporarily used when searching psymtabs. */ |
| 192 |
| 193 ENUM_BITFIELD (psymtab_search_status) searched_flag : 2; |
| 194 |
145 /* Pointer to symtab eventually allocated for this source file, 0 if | 195 /* Pointer to symtab eventually allocated for this source file, 0 if |
146 !readin or if we haven't looked for the symtab after it was readin. */ | 196 !readin or if we haven't looked for the symtab after it was readin. */ |
147 | 197 |
148 struct symtab *symtab; | 198 struct symtab *symtab; |
149 | 199 |
150 /* Pointer to function which will read in the symtab corresponding to | 200 /* Pointer to function which will read in the symtab corresponding to |
151 this psymtab. */ | 201 this psymtab. */ |
152 | 202 |
153 void (*read_symtab) (struct partial_symtab *); | 203 void (*read_symtab) (struct partial_symtab *); |
154 | 204 |
155 /* Information that lets read_symtab() locate the part of the symbol table | 205 /* Information that lets read_symtab() locate the part of the symbol table |
156 that this psymtab corresponds to. This information is private to the | 206 that this psymtab corresponds to. This information is private to the |
157 format-dependent symbol reading routines. For further detail examine | 207 format-dependent symbol reading routines. For further detail examine |
158 the various symbol reading modules. */ | 208 the various symbol reading modules. */ |
159 | 209 |
160 void *read_symtab_private; | 210 void *read_symtab_private; |
161 }; | 211 }; |
162 | 212 |
163 extern void sort_pst_symbols (struct partial_symtab *); | 213 extern void sort_pst_symbols (struct partial_symtab *); |
164 | 214 |
165 /* Add any kind of symbol to a psymbol_allocation_list. */ | 215 /* Add any kind of symbol to a psymbol_allocation_list. */ |
166 | 216 |
167 extern const | 217 extern void add_psymbol_to_list (const char *, int, |
168 struct partial_symbol *add_psymbol_to_list (const char *, int, | 218 » » » » int, domain_enum, |
169 » » » » » int, domain_enum, | 219 » » » » enum address_class, |
170 » » » » » enum address_class, | 220 » » » » struct psymbol_allocation_list *, |
171 » » » » » struct psymbol_allocation_list *, | 221 » » » » long, CORE_ADDR, |
172 » » » » » long, CORE_ADDR, | 222 » » » » enum language, struct objfile *); |
173 » » » » » enum language, struct objfile *); | |
174 | 223 |
175 extern void init_psymbol_list (struct objfile *, int); | 224 extern void init_psymbol_list (struct objfile *, int); |
176 | 225 |
177 extern struct partial_symtab *start_psymtab_common (struct objfile *, | 226 extern struct partial_symtab *start_psymtab_common (struct objfile *, |
178 struct section_offsets *, | 227 struct section_offsets *, |
179 const char *, CORE_ADDR, | 228 const char *, CORE_ADDR, |
180 struct partial_symbol **, | 229 struct partial_symbol **, |
181 struct partial_symbol **); | 230 struct partial_symbol **); |
182 | 231 |
183 extern struct partial_symtab *allocate_psymtab (const char *, | 232 extern struct partial_symtab *allocate_psymtab (const char *, |
184 struct objfile *); | 233 struct objfile *); |
185 | 234 |
186 extern void discard_psymtab (struct partial_symtab *); | 235 extern void discard_psymtab (struct partial_symtab *); |
187 | 236 |
188 /* Traverse all psymtabs in one objfile. */ | 237 /* Traverse all psymtabs in one objfile. */ |
189 | 238 |
190 #define ALL_OBJFILE_PSYMTABS(objfile, p) \ | 239 #define ALL_OBJFILE_PSYMTABS(objfile, p) \ |
191 for ((p) = (objfile) -> psymtabs; (p) != NULL; (p) = (p) -> next) | 240 for ((p) = (objfile) -> psymtabs; (p) != NULL; (p) = (p) -> next) |
192 | 241 |
193 #endif /* PSYMPRIV_H */ | 242 #endif /* PSYMPRIV_H */ |
OLD | NEW |