From af5bf4ada48ff65b6658be1fab8f9c8f8ab5f319 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 14 Oct 2017 08:06:29 -0400 Subject: Replace psymbol_allocation_list with std::vector psymbol_allocation_list is basically a vector implementation. We can replace it with an std::vector, now that objfile has been C++-ified. I sent this to the buildbot, there are a few suspicious failures, but I don't think they are related to this patch. For example on powerpc: new FAIL: gdb.base/catch-syscall.exp: execve: syscall execve has returned new FAIL: gdb.base/catch-syscall.exp: execve: continue to main new FAIL: gdb.base/catch-syscall.exp: execve: continue until exit I get the same failures when testing manually on gcc112, without this patch. gdb/ChangeLog: * objfiles.h: Don't include symfile.h. (struct partial_symbol): Remove forward-declaration. (struct objfile) : Change type to std::vector. * objfiles.c (objfile::objfile): Don't memset those fields. (objfile::~objfile): Don't free those fields. * psympriv.h (struct psymbol_allocation_list): Remove forward-declaration. (add_psymbol_to_list): Change psymbol_allocation_list parameter to std::vector. (start_psymtab_common): Change parameters to std::vector. * psymtab.c: Include algorithm. (require_partial_symbols): Call shrink_to_fit. (find_pc_sect_psymbol): Adjust to vector change. (match_partial_symbol): Likewise. (lookup_partial_symbol): Likewise. (psym_relocate): Likewise. (dump_psymtab): Likewise. (recursively_search_psymtabs): Likewise. (compare_psymbols): Remove. (sort_pst_symbols): Adjust to vector change. (start_psymtab_common): Likewise. (end_psymtab_common): Likewise. (psymbol_bcache_full): De-constify return value. (add_psymbol_to_bcache): Likewise. (extend_psymbol_list): Remove. (append_psymbol_to_list): Adjust to vector change. (add_psymbol_to_list): Likewise. (init_psymbol_list): Likewise. (maintenance_info_psymtabs): Likewise. (maintenance_check_psymtabs): Likewise. * symfile.h (struct psymbol_allocation_list): Remove. * symfile.c (reread_symbols): Adjust to vector change. * dbxread.c (start_psymtab): Change type of parameters. (dbx_symfile_read): Adjust to vector change. (read_dbx_symtab): Likewise. (start_psymtab): Change type of parameters. * dwarf2read.c (dwarf2_build_psymtabs): Adjust to vector change. (create_partial_symtab): Likewise. (add_partial_symbol): Likewise. (write_one_signatured_type): Likewise. (recursively_write_psymbols): Likewise. * mdebugread.c (parse_partial_symbols): Likewise. * xcoffread.c (xcoff_start_psymtab): Change type of parameters. (scan_xcoff_symtab): Adjust to vector change. (xcoff_initial_scan): Likewise. --- gdb/xcoffread.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'gdb/xcoffread.c') diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 0707cd7..ea11b3f 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2030,15 +2030,15 @@ static unsigned int first_fun_line_offset; static struct partial_symtab * xcoff_start_psymtab (struct objfile *objfile, const char *filename, int first_symnum, - struct partial_symbol **global_syms, - struct partial_symbol **static_syms) + std::vector &global_psymbols, + std::vector &static_psymbols) { struct partial_symtab *result = start_psymtab_common (objfile, filename, /* We fill in textlow later. */ 0, - global_syms, static_syms); + global_psymbols, static_psymbols); result->read_symtab_private = XOBNEW (&objfile->objfile_obstack, struct symloc); @@ -2332,8 +2332,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, (objfile, filestring, symnum_before, - objfile->global_psymbols.next, - objfile->static_psymbols.next); + objfile->global_psymbols, + objfile->static_psymbols); } } /* Activate the misc_func_recorded mechanism for @@ -2515,8 +2515,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, pst = xcoff_start_psymtab (objfile, filestring, symnum_before, - objfile->global_psymbols.next, - objfile->static_psymbols.next); + objfile->global_psymbols, + objfile->static_psymbols); last_csect_name = NULL; } break; @@ -3018,7 +3018,8 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) perror_with_name (_("reading symbol table")); /* If we are reinitializing, or if we have never loaded syms yet, init. */ - if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0) + if (objfile->global_psymbols.capacity () == 0 + && objfile->static_psymbols.capacity () == 0) /* I'm not sure how how good num_symbols is; the rule of thumb in init_psymbol_list was developed for a.out. On the one hand, num_symbols includes auxents. On the other hand, it doesn't -- cgit v1.1