OLD | NEW |
1 /* Definitions for reading symbol files into GDB. | 1 /* Definitions for reading symbol files into GDB. |
2 | 2 |
3 Copyright (C) 1990-2004, 2007-2012 Free Software Foundation, Inc. | 3 Copyright (C) 1990-2004, 2007-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. |
11 | 11 |
12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
16 | 16 |
17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
19 | 19 |
20 #if !defined (SYMFILE_H) | 20 #if !defined (SYMFILE_H) |
21 #define SYMFILE_H | 21 #define SYMFILE_H |
22 | 22 |
23 /* This file requires that you first include "bfd.h". */ | 23 /* This file requires that you first include "bfd.h". */ |
24 #include "symtab.h" | 24 #include "symtab.h" |
| 25 #include "gdb_vecs.h" |
25 | 26 |
26 /* Opaque declarations. */ | 27 /* Opaque declarations. */ |
27 struct target_section; | 28 struct target_section; |
28 struct objfile; | 29 struct objfile; |
29 struct obj_section; | 30 struct obj_section; |
30 struct obstack; | 31 struct obstack; |
31 struct block; | 32 struct block; |
| 33 struct probe; |
| 34 struct value; |
| 35 struct frame_info; |
| 36 struct agent_expr; |
| 37 struct axs_value; |
32 | 38 |
33 /* Comparison function for symbol look ups. */ | 39 /* Comparison function for symbol look ups. */ |
34 | 40 |
35 typedef int (symbol_compare_ftype) (const char *string1, | 41 typedef int (symbol_compare_ftype) (const char *string1, |
36 const char *string2); | 42 const char *string2); |
37 | 43 |
38 /* Partial symbols are stored in the psymbol_cache and pointers to | 44 /* Partial symbols are stored in the psymbol_cache and pointers to |
39 them are kept in a dynamically grown array that is obtained from | 45 them are kept in a dynamically grown array that is obtained from |
40 malloc and grown as necessary via realloc. Each objfile typically | 46 malloc and grown as necessary via realloc. Each objfile typically |
41 has two of these, one for global symbols and one for static | 47 has two of these, one for global symbols and one for static |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 /* Return the symbol table for the "last" file appearing in | 152 /* Return the symbol table for the "last" file appearing in |
147 OBJFILE. */ | 153 OBJFILE. */ |
148 struct symtab *(*find_last_source_symtab) (struct objfile *objfile); | 154 struct symtab *(*find_last_source_symtab) (struct objfile *objfile); |
149 | 155 |
150 /* Forget all cached full file names for OBJFILE. */ | 156 /* Forget all cached full file names for OBJFILE. */ |
151 void (*forget_cached_source_info) (struct objfile *objfile); | 157 void (*forget_cached_source_info) (struct objfile *objfile); |
152 | 158 |
153 /* Expand and iterate over each "partial" symbol table in OBJFILE | 159 /* Expand and iterate over each "partial" symbol table in OBJFILE |
154 where the source file is named NAME. | 160 where the source file is named NAME. |
155 | 161 |
156 If there is no '/' in the name, a match after a '/' in the symbol | 162 If NAME is not absolute, a match after a '/' in the symbol |
157 table's file name will also work. FULL_PATH is the absolute file | 163 table's file name will also work. FULL_PATH is the absolute file |
158 name, and REAL_PATH is the same, run through gdb_realpath. | 164 name, and REAL_PATH is the same, run through gdb_realpath. |
159 | 165 |
160 If a match is found, the "partial" symbol table is expanded. | 166 If a match is found, the "partial" symbol table is expanded. |
161 Then, this calls iterate_over_some_symtabs (or equivalent) over | 167 Then, this calls iterate_over_some_symtabs (or equivalent) over |
162 all newly-created symbol tables, passing CALLBACK and DATA to it. | 168 all newly-created symbol tables, passing CALLBACK and DATA to it. |
163 The result of this call is returned. */ | 169 The result of this call is returned. */ |
164 int (*map_symtabs_matching_filename) (struct objfile *objfile, | 170 int (*map_symtabs_matching_filename) (struct objfile *objfile, |
165 const char *name, | 171 const char *name, |
166 const char *full_path, | 172 const char *full_path, |
167 const char *real_path, | 173 const char *real_path, |
168 int (*callback) (struct symtab *, | 174 int (*callback) (struct symtab *, |
169 void *), | 175 void *), |
170 void *data); | 176 void *data); |
171 | 177 |
172 /* Check to see if the symbol is defined in a "partial" symbol table | 178 /* Check to see if the symbol is defined in a "partial" symbol table |
173 of OBJFILE. KIND should be either GLOBAL_BLOCK or STATIC_BLOCK, | 179 of OBJFILE. KIND should be either GLOBAL_BLOCK or STATIC_BLOCK, |
174 depending on whether we want to search global symbols or static | 180 depending on whether we want to search global symbols or static |
175 symbols. NAME is the name of the symbol to look for. DOMAIN | 181 symbols. NAME is the name of the symbol to look for. DOMAIN |
176 indicates what sort of symbol to search for. | 182 indicates what sort of symbol to search for. |
177 | 183 |
178 Returns the newly-expanded symbol table in which the symbol is | 184 Returns the newly-expanded symbol table in which the symbol is |
179 defined, or NULL if no such symbol table exists. */ | 185 defined, or NULL if no such symbol table exists. If OBJFILE |
| 186 contains !TYPE_OPAQUE symbol prefer its symtab. If it contains |
| 187 only TYPE_OPAQUE symbol(s), return at least that symtab. */ |
180 struct symtab *(*lookup_symbol) (struct objfile *objfile, | 188 struct symtab *(*lookup_symbol) (struct objfile *objfile, |
181 int kind, const char *name, | 189 int kind, const char *name, |
182 domain_enum domain); | 190 domain_enum domain); |
183 | 191 |
184 /* This is called to expand symbol tables before looking up a | 192 /* This is called to expand symbol tables before looking up a |
185 symbol. A backend can choose to implement this and then have its | 193 symbol. A backend can choose to implement this and then have its |
186 `lookup_symbol' hook always return NULL, or the reverse. (It | 194 `lookup_symbol' hook always return NULL, or the reverse. (It |
187 doesn't make sense to implement both.) The arguments are as for | 195 doesn't make sense to implement both.) The arguments are as for |
188 `lookup_symbol'. */ | 196 `lookup_symbol'. */ |
189 void (*pre_expand_symtabs_matching) (struct objfile *objfile, | 197 void (*pre_expand_symtabs_matching) (struct objfile *objfile, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 symbol_compare_ftype *match, | 259 symbol_compare_ftype *match, |
252 symbol_compare_ftype *ordered_compare); | 260 symbol_compare_ftype *ordered_compare); |
253 | 261 |
254 /* Expand all symbol tables in OBJFILE matching some criteria. | 262 /* Expand all symbol tables in OBJFILE matching some criteria. |
255 | 263 |
256 FILE_MATCHER is called for each file in OBJFILE. The file name | 264 FILE_MATCHER is called for each file in OBJFILE. The file name |
257 and the DATA argument are passed to it. If it returns zero, this | 265 and the DATA argument are passed to it. If it returns zero, this |
258 file is skipped. If FILE_MATCHER is NULL such file is not skipped. | 266 file is skipped. If FILE_MATCHER is NULL such file is not skipped. |
259 | 267 |
260 Otherwise, if KIND does not match this symbol is skipped. | 268 Otherwise, if KIND does not match this symbol is skipped. |
261 | 269 |
262 If even KIND matches, then NAME_MATCHER is called for each symbol | 270 If even KIND matches, then NAME_MATCHER is called for each symbol |
263 defined in the file. The current language, the symbol name and | 271 defined in the file. The symbol "search" name and DATA are passed |
264 DATA are passed to NAME_MATCHER. The symbol "natural" name should | 272 to NAME_MATCHER. |
265 be passed to NAME_MATCHER for all languages except Ada, where | |
266 the encoded name is passed instead (see la_symbol_name_compare in | |
267 struct language_defn for more details on this). | |
268 | 273 |
269 If NAME_MATCHER returns zero, then this symbol is skipped. | 274 If NAME_MATCHER returns zero, then this symbol is skipped. |
270 | 275 |
271 Otherwise, this symbol's symbol table is expanded. | 276 Otherwise, this symbol's symbol table is expanded. |
272 | 277 |
273 DATA is user data that is passed unmodified to the callback | 278 DATA is user data that is passed unmodified to the callback |
274 functions. */ | 279 functions. */ |
275 void (*expand_symtabs_matching) | 280 void (*expand_symtabs_matching) |
276 (struct objfile *objfile, | 281 (struct objfile *objfile, |
277 int (*file_matcher) (const char *, void *), | 282 int (*file_matcher) (const char *, void *), |
278 int (*name_matcher) (const struct language_defn *, const char *, void *), | 283 int (*name_matcher) (const char *, void *), |
279 enum search_domain kind, | 284 enum search_domain kind, |
280 void *data); | 285 void *data); |
281 | 286 |
282 /* Return the symbol table from OBJFILE that contains PC and | 287 /* Return the symbol table from OBJFILE that contains PC and |
283 SECTION. Return NULL if there is no such symbol table. This | 288 SECTION. Return NULL if there is no such symbol table. This |
284 should return the symbol table that contains a symbol whose | 289 should return the symbol table that contains a symbol whose |
285 address exactly matches PC, or, if there is no exact match, the | 290 address exactly matches PC, or, if there is no exact match, the |
286 symbol table that contains a symbol whose address is closest to | 291 symbol table that contains a symbol whose address is closest to |
287 PC. */ | 292 PC. */ |
288 struct symtab *(*find_pc_sect_symtab) (struct objfile *objfile, | 293 struct symtab *(*find_pc_sect_symtab) (struct objfile *objfile, |
289 struct minimal_symbol *msymbol, | 294 struct minimal_symbol *msymbol, |
290 CORE_ADDR pc, | 295 CORE_ADDR pc, |
291 struct obj_section *section, | 296 struct obj_section *section, |
292 int warn_if_readin); | 297 int warn_if_readin); |
293 | 298 |
294 /* Call a callback for every file defined in OBJFILE whose symtab is | 299 /* Call a callback for every file defined in OBJFILE whose symtab is |
295 not already read in. FUN is the callback. It is passed the file's | 300 not already read in. FUN is the callback. It is passed the file's |
296 FILENAME, the file's FULLNAME (if need_fullname is non-zero), and | 301 FILENAME, the file's FULLNAME (if need_fullname is non-zero), and |
297 the DATA passed to this function. */ | 302 the DATA passed to this function. */ |
298 void (*map_symbol_filenames) (struct objfile *objfile, | 303 void (*map_symbol_filenames) (struct objfile *objfile, |
299 symbol_filename_ftype *fun, void *data, | 304 symbol_filename_ftype *fun, void *data, |
300 int need_fullname); | 305 int need_fullname); |
301 }; | 306 }; |
302 | 307 |
| 308 /* Structure of functions used for probe support. If one of these functions |
| 309 is provided, all must be. */ |
| 310 |
| 311 struct sym_probe_fns |
| 312 { |
| 313 /* If non-NULL, return an array of probe objects. |
| 314 |
| 315 The returned value does not have to be freed and it has lifetime of the |
| 316 OBJFILE. */ |
| 317 VEC (probe_p) *(*sym_get_probes) (struct objfile *); |
| 318 |
| 319 /* Return the number of arguments available to PROBE. PROBE will |
| 320 have come from a call to this objfile's sym_get_probes method. |
| 321 If you provide an implementation of sym_get_probes, you must |
| 322 implement this method as well. */ |
| 323 unsigned (*sym_get_probe_argument_count) (struct objfile *objfile, |
| 324 struct probe *probe); |
| 325 |
| 326 /* Evaluate the Nth argument available to PROBE. PROBE will have |
| 327 come from a call to this objfile's sym_get_probes method. N will |
| 328 be between 0 and the number of arguments available to this probe. |
| 329 FRAME is the frame in which the evaluation is done; the frame's |
| 330 PC will match the address of the probe. If you provide an |
| 331 implementation of sym_get_probes, you must implement this method |
| 332 as well. */ |
| 333 struct value *(*sym_evaluate_probe_argument) (struct objfile *objfile, |
| 334 struct probe *probe, |
| 335 unsigned n); |
| 336 |
| 337 /* Compile the Nth probe argument to an agent expression. PROBE |
| 338 will have come from a call to this objfile's sym_get_probes |
| 339 method. N will be between 0 and the number of arguments |
| 340 available to this probe. EXPR and VALUE are the agent expression |
| 341 that is being updated. */ |
| 342 void (*sym_compile_to_ax) (struct objfile *objfile, |
| 343 struct probe *probe, |
| 344 struct agent_expr *expr, |
| 345 struct axs_value *value, |
| 346 unsigned n); |
| 347 |
| 348 /* Relocate the probe section of OBJFILE. */ |
| 349 void (*sym_relocate_probe) (struct objfile *objfile, |
| 350 struct section_offsets *new_offsets, |
| 351 struct section_offsets *delta); |
| 352 }; |
| 353 |
303 /* Structure to keep track of symbol reading functions for various | 354 /* Structure to keep track of symbol reading functions for various |
304 object file types. */ | 355 object file types. */ |
305 | 356 |
306 struct sym_fns | 357 struct sym_fns |
307 { | 358 { |
308 | 359 |
309 /* BFD flavour that we handle, or (as a special kludge, see | 360 /* BFD flavour that we handle, or (as a special kludge, see |
310 xcoffread.c, (enum bfd_flavour)-1 for xcoff). */ | 361 xcoffread.c, (enum bfd_flavour)-1 for xcoff). */ |
311 | 362 |
312 enum bfd_flavour sym_flavour; | 363 enum bfd_flavour sym_flavour; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 information. */ | 414 information. */ |
364 | 415 |
365 void (*sym_read_linetable) (void); | 416 void (*sym_read_linetable) (void); |
366 | 417 |
367 /* Relocate the contents of a debug section SECTP. The | 418 /* Relocate the contents of a debug section SECTP. The |
368 contents are stored in BUF if it is non-NULL, or returned in a | 419 contents are stored in BUF if it is non-NULL, or returned in a |
369 malloc'd buffer otherwise. */ | 420 malloc'd buffer otherwise. */ |
370 | 421 |
371 bfd_byte *(*sym_relocate) (struct objfile *, asection *sectp, bfd_byte *buf); | 422 bfd_byte *(*sym_relocate) (struct objfile *, asection *sectp, bfd_byte *buf); |
372 | 423 |
| 424 /* If non-NULL, this objfile has probe support, and all the probe |
| 425 functions referred to here will be non-NULL. */ |
| 426 const struct sym_probe_fns *sym_probe_fns; |
| 427 |
373 /* The "quick" (aka partial) symbol functions for this symbol | 428 /* The "quick" (aka partial) symbol functions for this symbol |
374 reader. */ | 429 reader. */ |
375 const struct quick_symbol_functions *qf; | 430 const struct quick_symbol_functions *qf; |
376 }; | 431 }; |
377 | 432 |
378 extern struct section_addr_info * | 433 extern struct section_addr_info * |
379 build_section_addr_info_from_objfile (const struct objfile *objfile); | 434 build_section_addr_info_from_objfile (const struct objfile *objfile); |
380 | 435 |
381 extern void relative_addr_info_to_section_offsets | 436 extern void relative_addr_info_to_section_offsets |
382 (struct section_offsets *section_offsets, int num_sections, | 437 (struct section_offsets *section_offsets, int num_sections, |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 struct dwarf2_debug_sections { | 640 struct dwarf2_debug_sections { |
586 struct dwarf2_section_names info; | 641 struct dwarf2_section_names info; |
587 struct dwarf2_section_names abbrev; | 642 struct dwarf2_section_names abbrev; |
588 struct dwarf2_section_names line; | 643 struct dwarf2_section_names line; |
589 struct dwarf2_section_names loc; | 644 struct dwarf2_section_names loc; |
590 struct dwarf2_section_names macinfo; | 645 struct dwarf2_section_names macinfo; |
591 struct dwarf2_section_names macro; | 646 struct dwarf2_section_names macro; |
592 struct dwarf2_section_names str; | 647 struct dwarf2_section_names str; |
593 struct dwarf2_section_names ranges; | 648 struct dwarf2_section_names ranges; |
594 struct dwarf2_section_names types; | 649 struct dwarf2_section_names types; |
| 650 struct dwarf2_section_names addr; |
595 struct dwarf2_section_names frame; | 651 struct dwarf2_section_names frame; |
596 struct dwarf2_section_names eh_frame; | 652 struct dwarf2_section_names eh_frame; |
597 struct dwarf2_section_names gdb_index; | 653 struct dwarf2_section_names gdb_index; |
598 /* This field has no meaning, but exists solely to catch changes to | 654 /* This field has no meaning, but exists solely to catch changes to |
599 this structure which are not reflected in some instance. */ | 655 this structure which are not reflected in some instance. */ |
600 int sentinel; | 656 int sentinel; |
601 }; | 657 }; |
602 | 658 |
603 extern int dwarf2_has_info (struct objfile *, | 659 extern int dwarf2_has_info (struct objfile *, |
604 const struct dwarf2_debug_sections *); | 660 const struct dwarf2_debug_sections *); |
(...skipping 26 matching lines...) Expand all Loading... |
631 | 687 |
632 extern void mdebug_build_psymtabs (struct objfile *, | 688 extern void mdebug_build_psymtabs (struct objfile *, |
633 const struct ecoff_debug_swap *, | 689 const struct ecoff_debug_swap *, |
634 struct ecoff_debug_info *); | 690 struct ecoff_debug_info *); |
635 | 691 |
636 extern void elfmdebug_build_psymtabs (struct objfile *, | 692 extern void elfmdebug_build_psymtabs (struct objfile *, |
637 const struct ecoff_debug_swap *, | 693 const struct ecoff_debug_swap *, |
638 asection *); | 694 asection *); |
639 | 695 |
640 #endif /* !defined(SYMFILE_H) */ | 696 #endif /* !defined(SYMFILE_H) */ |
OLD | NEW |