aboutsummaryrefslogtreecommitdiff
path: root/gdb/elfread.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-07-13 20:51:34 +0000
committerTom Tromey <tromey@redhat.com>2010-07-13 20:51:34 +0000
commit9291a0cd80ce4d50cbe531a872b7b00e3e67e3c9 (patch)
tree1136abf1538a2fe83874339f6fea2566fd1e6235 /gdb/elfread.c
parent58b6ab1339836b1684461bec9eb72682bc2972df (diff)
downloadgdb-9291a0cd80ce4d50cbe531a872b7b00e3e67e3c9.zip
gdb-9291a0cd80ce4d50cbe531a872b7b00e3e67e3c9.tar.gz
gdb-9291a0cd80ce4d50cbe531a872b7b00e3e67e3c9.tar.bz2
gdb
* breakpoint.c (save_cmdlist): No longer static. * gdbcmd.h (save_cmdlist): Declare. * symfile.c (symbol_file_add_with_addrs_or_offsets): Set OBJF_READNOW on objfile if readnow_symbol_files. * elfread.c (elf_symfile_read): Use dwarf2_initialize_objfile. (elf_sym_fns_gdb_index): New global. * dwarf2read.c: Include exceptions.h. (offset_type): New. (struct mapped_index): New. (dwarf2_per_cu_data_ptr): New typedef. (struct dwarf2_per_objfile) <using_index, index_table, gdb_index>: New fields. (GDB_INDEX_SECTION): New define. (struct dwarf2_per_cu_quick_data): New. (struct dwarf2_per_cu_data) <objfile>: New field. <psymtab>: Removed. <v>: New field. (byte_swap): New function. (MAYBE_SWAP): New macro. (INDEX_SUFFIX): New macro. (dw2_do_instantiate_symtab): New function. (dw2_instantiate_symtab): Likewise. (create_cus_from_index): Likewise. (create_addrmap_from_index): Likewise. (mapped_index_string_hash): Likewise. (find_slot_in_mapped_hash): Likewise. (dwarf2_read_index): Likewise. (dw2_setup): Likewise. (dw2_require_line_header): Likewise. (dw2_require_full_path): Likewise. (dw2_find_last_source_symtab): Likewise. (dw2_forget_cached_source_info): Likewise. (dw2_lookup_symtab): Likewise. (dw2_lookup_symbol): Likewise. (dw2_do_expand_symtabs_matching): Likewise. (dw2_pre_expand_symtabs_matching): Likewise. (dw2_print_stats): Likewise. (dw2_dump): Likewise. (dw2_relocate): Likewise. (dw2_expand_symtabs_for_function): Likewise. (dw2_expand_all_symtabs): Likewise. (dw2_expand_symtabs_with_filename): Likewise. (dw2_find_symbol_file): Likewise. (dw2_map_ada_symtabs): Likewise. (dw2_expand_symtabs_matching): Likewise. (dw2_find_pc_sect_symtab): Likewise. (dw2_map_symbol_names): Likewise. (dw2_map_symbol_filenames): Likewise. (dw2_has_symbols): Likewise. (dwarf2_gdb_index_functions): New global. (dwarf2_initialize_objfile): New function. (process_psymtab_comp_unit): Update. (add_partial_subprogram): Likewise. (dwarf2_psymtab_to_symtab): Likewise. (psymtab_to_symtab_1): Use dw2_do_instantiate_symtab. (process_full_comp_unit): Update. (find_file_and_directory): New function. (read_file_scope): Use find_file_and_directory. (dwarf2_per_cu_objfile): Update. (dwarf2_per_cu_addr_size): Update. (dwarf2_per_cu_offset_size): Update. (dwarf2_free_objfile): Free the index, if needed. (dwarf2_per_objfile_free): Unmap the index, if needed. (struct strtab_entry): New. (hash_strtab_entry): New function. (eq_strtab_entry): Likewise. (create_strtab): Likewise. (add_string): Likewise. (struct symtab_index_entry): New. (struct mapped_symtab): New. (hash_symtab_entry): New function. (eq_symtab_entry): Likewise. (delete_symtab_entry): Likewise. (create_index_table): Likewise. (create_mapped_symtab): Likewise. (cleanup_mapped_symtab): Likewise. (find_slot): Likewise. (hash_expand): Likewise. (add_index_entry): Likewise. (add_indices_to_cpool): Likewise. (write_hash_table): Likewise. (add_address_entry): Likewise. (write_psymbols): Likewise. (write_obstack): Likewise. (unlink_if_set): Likewise. (write_psymtabs_to_index): Likewise. (save_gdb_index_command): Likewise. (_initialize_dwarf2_read): Install "save gdb-index" command. (create_all_comp_units): Initialize 'objfile' field of CU. (dwarf2_locate_sections): Check for .gdb_index. * psymtab.h (dwarf2_gdb_index_functions): Declare. * symfile.h (dwarf2_initialize_objfile): Declare. gdb/doc * gdb.texinfo (Index Files): New node.
Diffstat (limited to 'gdb/elfread.c')
-rw-r--r--gdb/elfread.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 8c00938..ae92ff6 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -40,6 +40,9 @@
extern void _initialize_elfread (void);
+/* Forward declaration. */
+static struct sym_fns elf_sym_fns_gdb_index;
+
/* The struct elfinfo is available only during ELF symbol table and
psymtab reading. It is destroyed at the completion of psymtab-reading.
It's local to elf_symfile_read. */
@@ -869,11 +872,9 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
str_sect->filepos,
bfd_section_size (abfd, str_sect));
}
- if (dwarf2_has_info (objfile))
- {
- /* DWARF 2 sections */
- dwarf2_build_psymtabs (objfile);
- }
+
+ if (dwarf2_has_info (objfile) && dwarf2_initialize_objfile (objfile))
+ objfile->sf = &elf_sym_fns_gdb_index;
/* If the file has its own symbol tables it has no separate debug info.
`.dynsym'/`.symtab' go to MSYMBOLS, `.debug_info' goes to SYMTABS/PSYMTABS.
@@ -1049,6 +1050,24 @@ static struct sym_fns elf_sym_fns =
NULL /* next: pointer to next struct sym_fns */
};
+/* The same as elf_sym_fns, but not registered and uses the
+ DWARF-specific GNU index rather than psymtab. */
+static struct sym_fns elf_sym_fns_gdb_index =
+{
+ bfd_target_elf_flavour,
+ elf_new_init, /* sym_new_init: init anything gbl to entire symab */
+ elf_symfile_init, /* sym_init: read initial info, setup for sym_red() */
+ elf_symfile_read, /* sym_read: read a symbol file into symtab */
+ elf_symfile_finish, /* sym_finish: finished with file, cleanup */
+ default_symfile_offsets, /* sym_offsets: Translate ext. to int. relocatin */
+ elf_symfile_segments, /* sym_segments: Get segment information from
+ a file. */
+ NULL, /* sym_read_linetable */
+ default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
+ &dwarf2_gdb_index_functions,
+ NULL /* next: pointer to next struct sym_fns */
+};
+
void
_initialize_elfread (void)
{