From 923c6a3dd16a18e87efab5731053fbf31269b505 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 14 Sep 2010 22:50:30 +0000 Subject: [PATCH] * psympriv.h (add_psymbol_to_list, init_psymbol_list) (start_psymtab_common, allocate_psymtab, discard_psymtab): Declare. * symfile.h (extend_psymbol_list): Remove. (add_psymbol_to_list, init_psymbol_list, start_psymtab_common) (allocate_psymtab, discard_psymtab): Move to psympriv.h. * psymtab.c (extend_psymbol_list): Move earlier. Now static. --- gdb/ChangeLog | 10 +++++++++ gdb/psympriv.h | 26 +++++++++++++++++++++- gdb/psymtab.c | 58 +++++++++++++++++++++++++------------------------- gdb/symfile.h | 27 ----------------------- 4 files changed, 64 insertions(+), 57 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d82b4cce673..6ca89bf795f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2010-09-14 Tom Tromey + + * psympriv.h (add_psymbol_to_list, init_psymbol_list) + (start_psymtab_common, allocate_psymtab, discard_psymtab): + Declare. + * symfile.h (extend_psymbol_list): Remove. + (add_psymbol_to_list, init_psymbol_list, start_psymtab_common) + (allocate_psymtab, discard_psymtab): Move to psympriv.h. + * psymtab.c (extend_psymbol_list): Move earlier. Now static. + 2010-09-14 Jan Kratochvil * dwarf2read.c (dw2_map_ada_symtabs): Remove the internal_error. diff --git a/gdb/psympriv.h b/gdb/psympriv.h index 52f6e03c69a..e0ea839838a 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -1,6 +1,6 @@ /* Private partial symbol table definitions. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This file is part of GDB. @@ -22,6 +22,8 @@ #include "psymtab.h" +struct psymbol_allocation_list; + /* A partial_symbol records the name, domain, and address class of symbols whose types we have not parsed yet. For functions, it also contains their memory address, so we can find them from a PC value. @@ -151,6 +153,28 @@ struct partial_symtab extern void sort_pst_symbols (struct partial_symtab *); +/* Add any kind of symbol to a psymbol_allocation_list. */ + +extern const +struct partial_symbol *add_psymbol_to_list (char *, int, int, domain_enum, + enum address_class, + struct psymbol_allocation_list *, + long, CORE_ADDR, + enum language, struct objfile *); + +extern void init_psymbol_list (struct objfile *, int); + +extern struct partial_symtab *start_psymtab_common (struct objfile *, + struct section_offsets *, + const char *, CORE_ADDR, + struct partial_symbol **, + struct partial_symbol **); + +extern struct partial_symtab *allocate_psymtab (const char *, + struct objfile *); + +extern void discard_psymtab (struct partial_symtab *); + /* Traverse all psymtabs in one objfile. */ #define ALL_OBJFILE_PSYMTABS(objfile, p) \ diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 2f1bfc6565d..aa6dc17b1e9 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1406,6 +1406,35 @@ add_psymbol_to_bcache (char *name, int namelength, int copy_name, added); } +/* Increase the space allocated for LISTP, which is probably + global_psymbols or static_psymbols. This space will eventually + be freed in free_objfile(). */ + +static void +extend_psymbol_list (struct psymbol_allocation_list *listp, + struct objfile *objfile) +{ + int new_size; + + if (listp->size == 0) + { + new_size = 255; + listp->list = (struct partial_symbol **) + xmalloc (new_size * sizeof (struct partial_symbol *)); + } + else + { + new_size = listp->size * 2; + listp->list = (struct partial_symbol **) + xrealloc ((char *) listp->list, + new_size * sizeof (struct partial_symbol *)); + } + /* Next assumes we only went one over. Should be good if + program works correctly */ + listp->next = listp->list + listp->size; + listp->size = new_size; +} + /* Helper function, adds partial symbol to the given partial symbol list. */ @@ -1557,35 +1586,6 @@ discard_psymtab (struct partial_symtab *pst) pst->objfile->free_psymtabs = pst; } -/* Increase the space allocated for LISTP, which is probably - global_psymbols or static_psymbols. This space will eventually - be freed in free_objfile(). */ - -void -extend_psymbol_list (struct psymbol_allocation_list *listp, - struct objfile *objfile) -{ - int new_size; - - if (listp->size == 0) - { - new_size = 255; - listp->list = (struct partial_symbol **) - xmalloc (new_size * sizeof (struct partial_symbol *)); - } - else - { - new_size = listp->size * 2; - listp->list = (struct partial_symbol **) - xrealloc ((char *) listp->list, - new_size * sizeof (struct partial_symbol *)); - } - /* Next assumes we only went one over. Should be good if - program works correctly */ - listp->next = listp->list + listp->size; - listp->size = new_size; -} - void diff --git a/gdb/symfile.h b/gdb/symfile.h index 58153542db0..58ab786182b 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -382,22 +382,6 @@ extern struct symfile_segment_data *default_symfile_segments (bfd *abfd); extern bfd_byte *default_symfile_relocate (struct objfile *objfile, asection *sectp, bfd_byte *buf); -extern void extend_psymbol_list (struct psymbol_allocation_list *, - struct objfile *); - -/* Add any kind of symbol to a psymbol_allocation_list. */ - -/* #include "demangle.h" */ - -extern const -struct partial_symbol *add_psymbol_to_list (char *, int, int, domain_enum, - enum address_class, - struct psymbol_allocation_list *, - long, CORE_ADDR, - enum language, struct objfile *); - -extern void init_psymbol_list (struct objfile *, int); - extern struct symtab *allocate_symtab (char *, struct objfile *); extern void add_symtab_fns (struct sym_fns *); @@ -455,12 +439,6 @@ extern struct section_addr_info extern void free_section_addr_info (struct section_addr_info *); -extern struct partial_symtab *start_psymtab_common (struct objfile *, - struct section_offsets *, - const char *, CORE_ADDR, - struct partial_symbol **, - struct partial_symbol **); - /* Make a copy of the string at PTR with SIZE characters in the symbol obstack (and add a null character at the end in the copy). Returns the address of the copy. */ @@ -500,11 +478,6 @@ extern int auto_solib_limit; extern void set_initial_language (void); -extern struct partial_symtab *allocate_psymtab (const char *, - struct objfile *); - -extern void discard_psymtab (struct partial_symtab *); - extern void find_lowest_section (bfd *, asection *, void *); extern bfd *symfile_bfd_open (char *); -- 2.30.2