X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fxcoffread.c;h=66e74439b1aceccca81dcbd2538b133578fdea74;hb=86a73007627a3c52d1c624ed430ac0e74fb8cc3e;hp=ea11b3f966ccca4facfe748406cca9a2450795d7;hpb=af5bf4ada48ff65b6658be1fab8f9c8f8ab5f319;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index ea11b3f966..66e74439b1 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1,5 +1,5 @@ /* Read AIX xcoff symbol tables and convert to internal format, for GDB. - Copyright (C) 1986-2017 Free Software Foundation, Inc. + Copyright (C) 1986-2018 Free Software Foundation, Inc. Derived from coffread.c, dbxread.c, and a lot of hacking. Contributed by IBM Corporation. @@ -174,6 +174,8 @@ static const struct dwarf2_debug_sections dwarf2_xcoff_names = { { ".dwframe", NULL }, { NULL, NULL }, /* eh_frame */ { NULL, NULL }, /* gdb_index */ + { NULL, NULL }, /* debug_names */ + { NULL, NULL }, /* debug_aranges */ 23 }; @@ -1044,7 +1046,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst) last_csect_name = 0; start_stabs (); - start_symtab (objfile, filestring, (char *) NULL, file_start_addr); + start_symtab (objfile, filestring, (char *) NULL, file_start_addr, + language_unknown); record_debugformat (debugfmt); symnum = ((struct symloc *) pst->read_symtab_private)->first_symnum; max_symnum = @@ -1137,7 +1140,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst) } start_stabs (); - start_symtab (objfile, "_globals_", (char *) NULL, (CORE_ADDR) 0); + start_symtab (objfile, "_globals_", (char *) NULL, (CORE_ADDR) 0, + language_unknown); record_debugformat (debugfmt); cur_src_end_addr = first_object_file_end; /* Done with all files, everything from here on is globals. */ @@ -1227,7 +1231,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst) /* Give all csects for this source file the same name. */ start_symtab (objfile, filestring, NULL, - (CORE_ADDR) 0); + (CORE_ADDR) 0, language_unknown); record_debugformat (debugfmt); } @@ -1347,7 +1351,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst) filestring = cs->c_name; start_stabs (); - start_symtab (objfile, filestring, (char *) NULL, (CORE_ADDR) 0); + start_symtab (objfile, filestring, (char *) NULL, (CORE_ADDR) 0, + language_unknown); record_debugformat (debugfmt); last_csect_name = 0; @@ -1833,7 +1838,6 @@ find_linenos (struct bfd *abfd, struct bfd_section *asect, void *vpinfo) static void xcoff_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst) { - struct cleanup *old_chain; int i; if (!pst) @@ -1870,11 +1874,9 @@ xcoff_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst) /* Init stuff necessary for reading in symbols. */ stabsread_init (); buildsym_init (); - old_chain = make_cleanup (really_free_pendings, 0); + scoped_free_pendings free_pending; read_xcoff_symtab (objfile, pst); - - do_cleanups (old_chain); } pst->readin = 1; @@ -2529,9 +2531,9 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, } /* FALLTHROUGH */ + case C_FCN: /* C_FCN is .bf and .ef symbols. I think it is sufficient to handle only the C_FUN and C_EXT. */ - case C_FCN: case C_BSTAT: case C_ESTAT: @@ -2950,7 +2952,6 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) { bfd *abfd; int val; - struct cleanup *back_to; int num_symbols; /* # of symbols */ file_ptr symtab_offset; /* symbol table and */ file_ptr stringtab_offset; /* string table file offsets */ @@ -2976,31 +2977,33 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) /* Read the string table. */ init_stringtab (abfd, stringtab_offset, objfile); - /* Read the .debug section, if present. */ - { - struct bfd_section *secp; - bfd_size_type length; - bfd_byte *debugsec = NULL; + /* Read the .debug section, if present and if we're not ignoring + it. */ + if (!(objfile->flags & OBJF_READNEVER)) + { + struct bfd_section *secp; + bfd_size_type length; + bfd_byte *debugsec = NULL; - secp = bfd_get_section_by_name (abfd, ".debug"); - if (secp) - { - length = bfd_section_size (abfd, secp); - if (length) - { - debugsec - = (bfd_byte *) obstack_alloc (&objfile->objfile_obstack, - length); + secp = bfd_get_section_by_name (abfd, ".debug"); + if (secp) + { + length = bfd_section_size (abfd, secp); + if (length) + { + debugsec + = (bfd_byte *) obstack_alloc (&objfile->objfile_obstack, + length); - if (!bfd_get_full_section_contents (abfd, secp, &debugsec)) - { - error (_("Error reading .debug section of `%s': %s"), - name, bfd_errmsg (bfd_get_error ())); - } - } - } - info->debugsec = (char *) debugsec; - } + if (!bfd_get_full_section_contents (abfd, secp, &debugsec)) + { + error (_("Error reading .debug section of `%s': %s"), + name, bfd_errmsg (bfd_get_error ())); + } + } + } + info->debugsec = (char *) debugsec; + } } /* Read the symbols. We keep them in core because we will want to @@ -3027,8 +3030,8 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) init_psymbol_list (objfile, num_symbols); free_pending_blocks (); - back_to = make_cleanup (really_free_pendings, 0); + scoped_free_pendings free_pending; minimal_symbol_reader reader (objfile); /* Now that the symbol table data of the executable file are all in core, @@ -3047,13 +3050,11 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) dwarf2_build_psymtabs (objfile); dwarf2_build_frame_info (objfile); - - do_cleanups (back_to); } static void xcoff_symfile_offsets (struct objfile *objfile, - const struct section_addr_info *addrs) + const section_addr_info &addrs) { const char *first_section_name;