forked from Imagelibrary/binutils-gdb
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) <global_psymbols, static_psymbols>: Change type to std::vector<partial_symbol *>. * 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.
This commit is contained in:
@@ -45,37 +45,6 @@ struct axs_value;
|
||||
typedef int (symbol_compare_ftype) (const char *string1,
|
||||
const char *string2);
|
||||
|
||||
/* Partial symbols are stored in the psymbol_cache and pointers to
|
||||
them are kept in a dynamically grown array that is obtained from
|
||||
malloc and grown as necessary via realloc. Each objfile typically
|
||||
has two of these, one for global symbols and one for static
|
||||
symbols. Although this adds a level of indirection for storing or
|
||||
accessing the partial symbols, it allows us to throw away duplicate
|
||||
psymbols and set all pointers to the single saved instance. */
|
||||
|
||||
struct psymbol_allocation_list
|
||||
{
|
||||
|
||||
/* Pointer to beginning of dynamically allocated array of pointers
|
||||
to partial symbols. The array is dynamically expanded as
|
||||
necessary to accommodate more pointers. */
|
||||
|
||||
struct partial_symbol **list;
|
||||
|
||||
/* Pointer to next available slot in which to store a pointer to a
|
||||
partial symbol. */
|
||||
|
||||
struct partial_symbol **next;
|
||||
|
||||
/* Number of allocated pointer slots in current dynamic array (not
|
||||
the number of bytes of storage). The "next" pointer will always
|
||||
point somewhere between list[0] and list[size], and when at
|
||||
list[size] the array will be expanded on the next attempt to
|
||||
store a pointer. */
|
||||
|
||||
int size;
|
||||
};
|
||||
|
||||
struct other_sections
|
||||
{
|
||||
CORE_ADDR addr;
|
||||
|
||||
Reference in New Issue
Block a user