X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fcoffread.c;h=f24ec0713a09007293d9d36c86e996691155f04e;hb=4e9668d0d1ddad73af7c20a92a00704fbea2a8d9;hp=501e9011222b451c632806a336908da6652f4a5f;hpb=b15cc25cbe7c13e450f77b4a309223b9b3da3936;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/coffread.c b/gdb/coffread.c index 501e901122..f24ec0713a 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1,5 +1,5 @@ /* Read coff symbol tables and convert to internal format, for GDB. - Copyright (C) 1987-2016 Free Software Foundation, Inc. + Copyright (C) 1987-2018 Free Software Foundation, Inc. Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu). This file is part of GDB. @@ -43,8 +43,6 @@ #include "psymtab.h" #include "build-id.h" -extern void _initialize_coffread (void); - /* Key for COFF-associated data. */ static const struct objfile_data *coff_objfile_data_key; @@ -394,7 +392,9 @@ coff_start_symtab (struct objfile *objfile, const char *name) NULL, /* The start address is irrelevant, since we set last_source_start_addr in coff_end_symtab. */ - 0); + 0, + /* Let buildsym.c deduce the language for this symtab. */ + language_unknown); record_debugformat ("COFF"); } @@ -699,7 +699,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) } } - bfd_map_over_sections (abfd, coff_locate_sections, (void *) info); + if (!(objfile->flags & OBJF_READNEVER)) + bfd_map_over_sections (abfd, coff_locate_sections, (void *) info); if (info->stabsects) { @@ -732,20 +733,17 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) /* Try to add separate debug file if no symbols table found. */ if (!objfile_has_partial_symbols (objfile)) { - char *debugfile; - - debugfile = find_separate_debug_file_by_buildid (objfile); + std::string debugfile = find_separate_debug_file_by_buildid (objfile); - if (debugfile == NULL) + if (debugfile.empty ()) debugfile = find_separate_debug_file_by_debuglink (objfile); - make_cleanup (xfree, debugfile); - if (debugfile) + if (!debugfile.empty ()) { - bfd *abfd = symfile_bfd_open (debugfile); + gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile.c_str ())); - make_cleanup_bfd_unref (abfd); - symbol_file_add_separate (abfd, debugfile, symfile_flags, objfile); + symbol_file_add_separate (abfd.get (), debugfile.c_str (), + symfile_flags, objfile); } } @@ -930,6 +928,7 @@ coff_symtab_read (minimal_symbol_reader &reader, backtraces, so filter them out (from phdm@macqel.be). */ if (within_function) break; + /* Fall through. */ case C_STAT: case C_THUMBLABEL: case C_THUMBSTAT: @@ -966,7 +965,8 @@ coff_symtab_read (minimal_symbol_reader &reader, /* At least on a 3b1, gcc generates swbeg and string labels that look like this. Ignore them. */ break; - /* Fall in for static symbols that don't start with '.' */ + /* For static symbols that don't start with '.'... */ + /* Fall through. */ case C_THUMBEXT: case C_THUMBEXTFUNC: case C_EXT: