From e74acce48c1b4efc29fd1e9e84639b77383aa002 Mon Sep 17 00:00:00 2001 From: Mark Alexander Date: Wed, 3 Jul 1996 05:11:40 +0000 Subject: [PATCH] * coffread.c, dbxread.c, elfread.c, mipsread.c, nlmread.c, os9kread.c: Replace identical sym_offsets functions with default_symfile_offsets. * somread.c (som_symfile_offsets): Use new SIZEOF_SECTION_OFFSETS macro to allocate section_offsets. * symfile.c (default_symfile_offsets): New function. * symfile.h: Declare default_symfile_offsets. * symtab.h: Define SIZEOF_SECTION_OFFSETS macro to simplify allocation of section_offsets. --- gdb/ChangeLog | 12 +++++++ gdb/coffread.c | 67 ++++++++++++++++++++++---------------- gdb/dbxread.c | 32 ++++--------------- gdb/elfread.c | 31 ++---------------- gdb/mipsread.c | 64 +++++++++++++++++-------------------- gdb/nlmread.c | 34 ++------------------ gdb/os9kread.c | 26 ++------------- gdb/somread.c | 4 +-- gdb/symfile.c | 29 +++++++++++++++-- gdb/symfile.h | 87 +++++++++++++++++++------------------------------- gdb/symtab.h | 12 +++++++ 11 files changed, 164 insertions(+), 234 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 79aeb168d1..605bae329a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +Tue Jul 02 21:41:20 1996 Mark Alexander + + * coffread.c, dbxread.c, elfread.c, mipsread.c, nlmread.c, + os9kread.c: Replace identical sym_offsets functions with + default_symfile_offsets. + * somread.c (som_symfile_offsets): Use new SIZEOF_SECTION_OFFSETS + macro to allocate section_offsets. + * symfile.c (default_symfile_offsets): New function. + * symfile.h: Declare default_symfile_offsets. + * symtab.h: Define SIZEOF_SECTION_OFFSETS macro to + simplify allocation of section_offsets. + Tue Jul 2 15:04:20 1996 Michael Meissner * config/powerpc/{linux.mh,xm-linux.h}: New files, for Linux on diff --git a/gdb/coffread.c b/gdb/coffread.c index ec7aef2434..c2a96a8f7b 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 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994 + Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu). @@ -17,7 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "defs.h" #include "symtab.h" @@ -25,7 +25,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "breakpoint.h" #include "bfd.h" -#include +#include "obstack.h" #include "gdb_string.h" #include @@ -139,6 +139,12 @@ static struct symbol *opaque_type_chain[HASHSIZE]; struct complaint ef_complaint = {"Unmatched .ef symbol(s) ignored starting at symnum %d", 0, 0}; +struct complaint ef_stack_complaint = + {"`.ef' symbol without matching `.bf' symbol ignored starting at symnum %d", 0, 0}; + +struct complaint eb_stack_complaint = + {"`.eb' symbol without matching `.bb' symbol ignored starting at symnum %d", 0, 0}; + struct complaint bf_no_aux_complaint = {"`.bf' symbol %d has no aux entry", 0, 0}; @@ -510,9 +516,7 @@ coff_end_symtab (objfile) subfiles->line_vector = line_vector; subfiles->name = last_source_file; - /* sort_pending is needed for amdcoff, at least. - sort_linevec is needed for the SCO compiler. */ - symtab = end_symtab (current_source_end_addr, 1, 1, objfile, 0); + symtab = end_symtab (current_source_end_addr, objfile, 0); if (symtab != NULL) free_named_symtabs (symtab->filename); @@ -568,6 +572,11 @@ coff_symfile_init (objfile) memset (objfile->sym_private, 0, sizeof (struct coff_symfile_info)); + /* COFF objects may be reordered, so set OBJF_REORDERED. If we + find this causes a significant slowdown in gdb then we could + set it in the debug symbol readers only when necessary. */ + objfile->flags |= OBJF_REORDERED; + init_entry_point_info (objfile); } @@ -892,6 +901,10 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile) in_source_file = 1; break; + /* C_LABEL is used for labels and static functions. Including + it here allows gdb to see static functions when no debug + info is available. */ + case C_LABEL: case C_STAT: if (cs->c_name[0] == '.') { @@ -1029,6 +1042,14 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile) not useful for gdb. */ /* { main_aux.x_sym.x_misc.x_lnsz.x_lnno contains number of lines to '}' */ + + if (context_stack_depth <= 0) + { /* We attempted to pop an empty context stack */ + complain (&ef_stack_complaint, cs->c_symnum); + within_function = 0; + break; + } + new = pop_context (); /* Stack must be empty now. */ if (context_stack_depth > 0 || new == NULL) @@ -1082,6 +1103,12 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile) } else if (STREQ (cs->c_name, ".eb")) { + if (context_stack_depth <= 0) + { /* We attempted to pop an empty context stack */ + complain (&eb_stack_complaint, cs->c_symnum); + break; + } + new = pop_context (); if (depth-- != new->depth) { @@ -1182,7 +1209,7 @@ init_stringtab (abfd, offset) val = bfd_read ((char *)lengthbuf, sizeof lengthbuf, 1, abfd); length = bfd_h_get_32 (symfile_bfd, lengthbuf); - + /* If no string table is needed, then the file may end immediately after the symbols. Just return with `stringtab' set to null. */ if (val != sizeof lengthbuf || length < sizeof lengthbuf) @@ -1802,6 +1829,9 @@ decode_base_type (cs, c_type, aux) case T_DOUBLE: return lookup_fundamental_type (current_objfile, FT_DBL_PREC_FLOAT); + case T_LNGDBL: + return lookup_fundamental_type (current_objfile, FT_EXT_PREC_FLOAT); + case T_STRUCT: if (cs->c_naux != 1) { @@ -2098,26 +2128,6 @@ coff_read_enum_type (index, length, lastsym) return type; } -struct section_offsets * -coff_symfile_offsets (objfile, addr) - struct objfile *objfile; - CORE_ADDR addr; -{ - struct section_offsets *section_offsets; - int i; - - objfile->num_sections = SECT_OFF_MAX; - section_offsets = (struct section_offsets *) - obstack_alloc (&objfile -> psymbol_obstack, - sizeof (struct section_offsets) - + sizeof (section_offsets->offsets) * SECT_OFF_MAX); - - for (i = 0; i < SECT_OFF_MAX; i++) - ANOFFSET (section_offsets, i) = addr; - - return section_offsets; -} - /* Register our ability to parse symbols for coff BFD files. */ static struct sym_fns coff_sym_fns = @@ -2127,7 +2137,8 @@ static struct sym_fns coff_sym_fns = coff_symfile_init, /* sym_init: read initial info, setup for sym_read() */ coff_symfile_read, /* sym_read: read a symbol file into symtab */ coff_symfile_finish, /* sym_finish: finished with file, cleanup */ - coff_symfile_offsets, /* sym_offsets: xlate external to internal form */ + default_symfile_offsets, + /* sym_offsets: xlate external to internal form */ NULL /* next: pointer to next struct sym_fns */ }; diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 720c6b4fc2..e7091c0dc3 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -66,7 +66,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "aout/stab_gnu.h" /* We always use GNU stabs, not native, now */ /* defined in stabsread.c; used for completing cfront stabs strings */ -extern void resolve_cont PARAMS((struct objfile * objfile, struct symbol * sym, char * p)); +extern void +resolve_cfront_continuation PARAMS((struct objfile * objfile, + struct symbol * sym, char * p)); /* We put a pointer to this structure in the read_symtab_private field @@ -798,7 +800,7 @@ process_now(objfile) symbuf_idx = cont_list[i].sym_idx; /* statics used by gdb */ symbuf_end = cont_list[i].sym_end; symnum = cont_list[i].symnum; - resolve_cont(objfile,cont_list[i].sym,cont_list[i].stabs); + resolve_cfront_continuation(objfile,cont_list[i].sym,cont_list[i].stabs); } /* restore original state */ symbuf_idx = save_symbuf_idx; @@ -2584,29 +2586,6 @@ stabsect_build_psymtabs (objfile, section_offsets, mainline, stab_name, dbx_symfile_read (objfile, section_offsets, 0); } -/* Parse the user's idea of an offset for dynamic linking, into our idea - of how to represent it for fast symbol reading. */ - -static struct section_offsets * -dbx_symfile_offsets (objfile, addr) - struct objfile *objfile; - CORE_ADDR addr; -{ - struct section_offsets *section_offsets; - int i; - - objfile->num_sections = SECT_OFF_MAX; - section_offsets = (struct section_offsets *) - obstack_alloc (&objfile -> psymbol_obstack, - sizeof (struct section_offsets) - + sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1)); - - for (i = 0; i < SECT_OFF_MAX; i++) - ANOFFSET (section_offsets, i) = addr; - - return section_offsets; -} - static struct sym_fns aout_sym_fns = { bfd_target_aout_flavour, @@ -2614,7 +2593,8 @@ static struct sym_fns aout_sym_fns = dbx_symfile_init, /* sym_init: read initial info, setup for sym_read() */ dbx_symfile_read, /* sym_read: read a symbol file into symtab */ dbx_symfile_finish, /* sym_finish: finished with file, cleanup */ - dbx_symfile_offsets, /* sym_offsets: parse user's offsets to internal form */ + default_symfile_offsets, + /* sym_offsets: parse user's offsets to internal form */ NULL /* next: pointer to next struct sym_fns */ }; diff --git a/gdb/elfread.c b/gdb/elfread.c index 9a7a0fe3e1..a38a5f4f97 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -78,9 +78,6 @@ elf_symtab_read PARAMS ((bfd *, CORE_ADDR, struct objfile *, int)); static void free_elfinfo PARAMS ((void *)); -static struct section_offsets * -elf_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR)); - static struct minimal_symbol * record_minimal_symbol_and_info PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type, char *, @@ -714,31 +711,6 @@ elf_symfile_init (objfile) objfile->flags |= OBJF_REORDERED; } -/* ELF specific parsing routine for section offsets. - - Plain and simple for now. */ - -static -struct section_offsets * -elf_symfile_offsets (objfile, addr) - struct objfile *objfile; - CORE_ADDR addr; -{ - struct section_offsets *section_offsets; - int i; - - objfile->num_sections = SECT_OFF_MAX; - section_offsets = (struct section_offsets *) - obstack_alloc (&objfile -> psymbol_obstack, - sizeof (struct section_offsets) - + sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1)); - - for (i = 0; i < SECT_OFF_MAX; i++) - ANOFFSET (section_offsets, i) = addr; - - return section_offsets; -} - /* When handling an ELF file that contains Sun STABS debug info, some of the debug info is relative to the particular chunk of the section that was generated in its individual .o file. E.g. @@ -815,7 +787,8 @@ static struct sym_fns elf_sym_fns = elf_symfile_init, /* sym_init: read initial info, setup for sym_read() */ elf_symfile_read, /* sym_read: read a symbol file into symtab */ elf_symfile_finish, /* sym_finish: finished with file, cleanup */ - elf_symfile_offsets, /* sym_offsets: Translate ext. to int. relocation */ + default_symfile_offsets, + /* sym_offsets: Translate ext. to int. relocation */ NULL /* next: pointer to next struct sym_fns */ }; diff --git a/gdb/mipsread.c b/gdb/mipsread.c index 80fcec7d5e..8e7d19d33d 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -1,5 +1,5 @@ /* Read a symbol table in MIPS' format (Third-Eye). - Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994 + Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor at Cygnus Support. @@ -18,7 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Read symbols from an ECOFF file. Most of the work is done in mdebugread.c. */ @@ -54,9 +54,6 @@ mipscoff_symfile_read PARAMS ((struct objfile *, struct section_offsets *, static void mipscoff_symfile_finish PARAMS ((struct objfile *)); -static struct section_offsets * -mipscoff_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR)); - static void read_alphacoff_dynamic_symtab PARAMS ((struct section_offsets *, struct objfile *objfile)); @@ -108,16 +105,33 @@ mipscoff_symfile_read (objfile, section_offsets, mainline) mdebug_build_psymtabs (objfile, &ecoff_backend (abfd)->debug_swap, &ecoff_data (abfd)->debug_info, section_offsets); - /* Add the dynamic symbols if we are reading the main symbol table. */ + /* Add alpha coff dynamic symbols. */ - if (mainline) - read_alphacoff_dynamic_symtab (section_offsets, objfile); + read_alphacoff_dynamic_symtab (section_offsets, objfile); /* Install any minimal symbols that have been collected as the current minimal symbols for this objfile. */ install_minimal_symbols (objfile); + /* If the entry_file bounds are still unknown after processing the + partial symbols, then try to set them from the minimal symbols + surrounding the entry_point. */ + + if (mainline + && objfile->ei.entry_point != INVALID_ENTRY_POINT + && objfile->ei.entry_file_lowpc == INVALID_ENTRY_LOWPC) + { + struct minimal_symbol *m; + + m = lookup_minimal_symbol_by_pc (objfile->ei.entry_point); + if (m && SYMBOL_NAME (m + 1)) + { + objfile->ei.entry_file_lowpc = SYMBOL_VALUE_ADDRESS (m); + objfile->ei.entry_file_highpc = SYMBOL_VALUE_ADDRESS (m + 1); + } + } + do_cleanups (back_to); } @@ -130,29 +144,6 @@ mipscoff_symfile_finish (objfile) { } -/* Fake up identical offsets for all sections. */ - -static struct section_offsets * -mipscoff_symfile_offsets (objfile, addr) - struct objfile *objfile; - CORE_ADDR addr; -{ - struct section_offsets *section_offsets; - int i; - - objfile->num_sections = SECT_OFF_MAX; - section_offsets = ((struct section_offsets *) - obstack_alloc (&objfile->psymbol_obstack, - (sizeof (struct section_offsets) - + (sizeof (section_offsets->offsets) - * (SECT_OFF_MAX - 1))))); - - for (i = 0; i < SECT_OFF_MAX; i++) - ANOFFSET (section_offsets, i) = addr; - - return section_offsets; -} - /* Alpha OSF/1 encapsulates the dynamic symbols in ELF format in a standard coff section. The ELF format for the symbols differs from the format defined in elf/external.h. It seems that a normal ELF 32 bit @@ -309,12 +300,15 @@ read_alphacoff_dynamic_symtab (section_offsets, objfile) break; else if (dyn_tag == DT_MIPS_LOCAL_GOTNO) { - dt_mips_local_gotno = bfd_h_get_32 (abfd, - (bfd_byte *) x_dynp->d_un.d_val); + if (dt_mips_local_gotno < 0) + dt_mips_local_gotno + = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->d_un.d_val); } else if (dyn_tag == DT_MIPS_GOTSYM) { - dt_mips_gotsym = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->d_un.d_val); + if (dt_mips_gotsym < 0) + dt_mips_gotsym + = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->d_un.d_val); } } if (dt_mips_local_gotno < 0 || dt_mips_gotsym < 0) @@ -446,7 +440,7 @@ static struct sym_fns ecoff_sym_fns = mipscoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */ mipscoff_symfile_read, /* sym_read: read a symbol file into symtab */ mipscoff_symfile_finish, /* sym_finish: finished with file, cleanup */ - mipscoff_symfile_offsets, /* sym_offsets: dummy FIXME til implem sym reloc */ + default_symfile_offsets, /* sym_offsets: dummy FIXME til implem sym reloc */ NULL /* next: pointer to next struct sym_fns */ }; diff --git a/gdb/nlmread.c b/gdb/nlmread.c index b61dc97d94..bc16d004a7 100644 --- a/gdb/nlmread.c +++ b/gdb/nlmread.c @@ -43,9 +43,6 @@ nlm_symfile_finish PARAMS ((struct objfile *)); static void nlm_symtab_read PARAMS ((bfd *, CORE_ADDR, struct objfile *)); -static struct section_offsets * -nlm_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR)); - static void record_minimal_symbol PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type, struct objfile *)); @@ -260,34 +257,6 @@ nlm_symfile_finish (objfile) } } -/* NLM specific parsing routine for section offsets. - FIXME: This may or may not be necessary. All the symbol readers seem - to have similar code. See if it can be generalized and moved elsewhere. */ - -static -struct section_offsets * -nlm_symfile_offsets (objfile, addr) - struct objfile *objfile; - CORE_ADDR addr; -{ - struct section_offsets *section_offsets; - int i; - - objfile->num_sections = SECT_OFF_MAX; - section_offsets = (struct section_offsets *) - obstack_alloc (&objfile -> psymbol_obstack, - sizeof (struct section_offsets) + - sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1)); - - for (i = 0; i < SECT_OFF_MAX; i++) - { - ANOFFSET (section_offsets, i) = addr; - } - - return (section_offsets); -} - - /* Register that we are able to handle NLM file format. */ static struct sym_fns nlm_sym_fns = @@ -297,7 +266,8 @@ static struct sym_fns nlm_sym_fns = nlm_symfile_init, /* sym_init: read initial info, setup for sym_read() */ nlm_symfile_read, /* sym_read: read a symbol file into symtab */ nlm_symfile_finish, /* sym_finish: finished with file, cleanup */ - nlm_symfile_offsets, /* sym_offsets: Translate ext. to int. relocation */ + default_symfile_offsets, + /* sym_offsets: Translate ext. to int. relocation */ NULL /* next: pointer to next struct sym_fns */ }; diff --git a/gdb/os9kread.c b/gdb/os9kread.c index f80cb1b86b..44ae0be36e 100644 --- a/gdb/os9kread.c +++ b/gdb/os9kread.c @@ -1617,30 +1617,7 @@ os9k_process_one_symbol (type, desc, valu, name, section_offsets, objfile) } previous_stab_code = type; } - -/* Parse the user's idea of an offset for dynamic linking, into our idea - of how to represent it for fast symbol reading. */ - -static struct section_offsets * -os9k_symfile_offsets (objfile, addr) - struct objfile *objfile; - CORE_ADDR addr; -{ - struct section_offsets *section_offsets; - int i; - - objfile->num_sections = SECT_OFF_MAX; - section_offsets = (struct section_offsets *) - obstack_alloc (&objfile -> psymbol_obstack, - sizeof (struct section_offsets) - + sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1)); - for (i = 0; i < SECT_OFF_MAX; i++) - ANOFFSET (section_offsets, i) = addr; - - return section_offsets; -} - static struct sym_fns os9k_sym_fns = { bfd_target_os9k_flavour, @@ -1648,7 +1625,8 @@ static struct sym_fns os9k_sym_fns = os9k_symfile_init, /* sym_init: read initial info, setup for sym_read() */ os9k_symfile_read, /* sym_read: read a symbol file into symtab */ os9k_symfile_finish, /* sym_finish: finished with file, cleanup */ - os9k_symfile_offsets, /* sym_offsets: parse user's offsets to internal form*/ + default_symfile_offsets, + /* sym_offsets: parse user's offsets to internal form*/ NULL /* next: pointer to next struct sym_fns */ }; diff --git a/gdb/somread.c b/gdb/somread.c index ab8d531cc2..4951f109e4 100644 --- a/gdb/somread.c +++ b/gdb/somread.c @@ -435,9 +435,7 @@ som_symfile_offsets (objfile, addr) objfile->num_sections = SECT_OFF_MAX; section_offsets = (struct section_offsets *) - obstack_alloc (&objfile -> psymbol_obstack, - sizeof (struct section_offsets) - + sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1)); + obstack_alloc (&objfile -> psymbol_obstack, SIZEOF_SECTION_OFFSETS); /* First see if we're a shared library. If so, get the section offsets from the library, else get them from addr. */ diff --git a/gdb/symfile.c b/gdb/symfile.c index f9a99ae49f..2850af3c54 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -34,10 +34,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "complaints.h" #include "demangle.h" #include "inferior.h" /* for write_pc */ - +#include "gdb-stabs.h" #include "obstack.h" -#include +#include #include #include #include "gdb_string.h" @@ -365,6 +365,31 @@ find_lowest_section (abfd, sect, obj) *lowest = sect; } +/* Parse the user's idea of an offset for dynamic linking, into our idea + of how to represent it for fast symbol reading. This is the default + version of the sym_fns.sym_offsets function for symbol readers that + don't need to do anything special. It allocates a section_offsets table + for the objectfile OBJFILE and stuffs ADDR into all of the offsets. */ + +struct section_offsets * +default_symfile_offsets (objfile, addr) + struct objfile *objfile; + CORE_ADDR addr; +{ + struct section_offsets *section_offsets; + int i; + + objfile->num_sections = SECT_OFF_MAX; + section_offsets = (struct section_offsets *) + obstack_alloc (&objfile -> psymbol_obstack, SIZEOF_SECTION_OFFSETS); + + for (i = 0; i < SECT_OFF_MAX; i++) + ANOFFSET (section_offsets, i) = addr; + + return section_offsets; +} + + /* Process a symbol file, as either the main file or as a dynamically loaded file. diff --git a/gdb/symfile.h b/gdb/symfile.h index 3c968f64ba..5921cbbaae 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -32,9 +32,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ to the single saved instance. */ struct psymbol_allocation_list { - struct partial_symbol **list; /* Pointer to first partial symbol pointer*/ - struct partial_symbol **next; /* Pointer to next avail storage for pointer */ - int size; /* Number of symbols */ + + /* 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; }; /* Structure to keep track of symbol reading functions for various @@ -94,65 +109,25 @@ struct sym_fns { }; +/* The default version of sym_fns.sym_offsets for readers that don't + do anything special. */ + +extern struct section_offsets * +default_symfile_offsets PARAMS ((struct objfile *objfile, CORE_ADDR addr)); + + extern void extend_psymbol_list PARAMS ((struct psymbol_allocation_list *, struct objfile *)); /* Add any kind of symbol to a psymbol_allocation_list. */ -#ifndef INLINE_ADD_PSYMBOL -/* Default this to off for now, and probably eventually remove support for inlining via - macros. Real world tests show no performance improvements by inlining, and the macros - just make debugging gdb more complicated and make gdb larger by up to 150 Kb. */ -#define INLINE_ADD_PSYMBOL 0 -#endif - -#include "demangle.h" - -#if !INLINE_ADD_PSYMBOL +/* #include "demangle.h" */ -/* Since one arg is a struct, we have to pass in a ptr and deref it (sigh) */ - -#define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \ - add_psymbol_to_list (name, namelength, namespace, class, &list, value, language, objfile) - -#define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \ - add_psymbol_addr_to_list (name, namelength, namespace, class, &list, value, language, objfile) - -#else /* !INLINE_ADD_PSYMBOL */ - -#define ADD_PSYMBOL_VT_TO_LIST(NAME,NAMELENGTH,NAMESPACE,CLASS,LIST,VALUE,VT,LANGUAGE, OBJFILE) \ - do { \ - register struct partial_symbol *psym; \ - char *buf = alloca ((NAMELENGTH) + 1); \ - struct partial_symbol psymbol; \ - memcpy (buf, (NAME), (NAMELENGTH)); \ - buf[(NAMELENGTH)] = '\0'; \ - SYMBOL_NAME (&psymbol) = bcache (buf, (NAMELENGTH) + 1, &(OBJFILE)->psymbol_cache); \ - VT (&psymbol) = (VALUE); \ - SYMBOL_SECTION (&psymbol) = 0; \ - SYMBOL_LANGUAGE (&psymbol) = (LANGUAGE); \ - PSYMBOL_NAMESPACE (&psymbol) = (NAMESPACE); \ - PSYMBOL_CLASS (&psymbol) = (CLASS); \ - SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, (LANGUAGE)); \ - psym = bcache (&psymbol, sizeof (struct partial_symbol), &(OBJFILE)->psymbol_cache); \ - if ((LIST).next >= (LIST).list + (LIST).size) \ - extend_psymbol_list (&(LIST), (OBJFILE)); \ - *(LIST).next++ = psym; \ - OBJSTAT ((OBJFILE), n_psyms++); \ - } while (0) - -/* Add a symbol with an integer value to a psymtab. */ - -#define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \ - ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE, language, objfile) - -/* Add a symbol with a CORE_ADDR value to a psymtab. */ - -#define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value, language, objfile)\ - ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE_ADDRESS, language, objfile) - -#endif /* INLINE_ADD_PSYMBOL */ +extern void +add_psymbol_to_list PARAMS ((char *, int, namespace_enum, enum address_class, + struct psymbol_allocation_list *, long, CORE_ADDR, + enum language, struct objfile *)); extern void init_psymbol_list PARAMS ((struct objfile *, int)); @@ -219,6 +194,8 @@ extern int auto_solib_add; extern struct partial_symtab * allocate_psymtab PARAMS ((char *, struct objfile *)); +extern void find_lowest_section PARAMS ((bfd *, asection *, PTR)); + /* Remote targets may wish to use this as their load function. */ extern void generic_load PARAMS ((char *name, int from_tty)); diff --git a/gdb/symtab.h b/gdb/symtab.h index c7703dd7fd..6d1b22e7e0 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -717,6 +717,13 @@ struct section_offsets #define ANOFFSET(secoff, whichone) (secoff->offsets[whichone]) +/* The maximum possible size of a section_offsets table. */ + +#define SIZEOF_SECTION_OFFSETS \ + (sizeof (struct section_offsets) \ + + sizeof (((struct section_offsets *) 0)->offsets) * (SECT_OFF_MAX-1)) + + /* Each source file or header is represented by a struct symtab. These objects are chained through the `next' field. */ @@ -1062,6 +1069,11 @@ lookup_minimal_symbol PARAMS ((const char *, const char *, struct objfile *)); extern struct minimal_symbol * lookup_minimal_symbol_text PARAMS ((const char *, const char *, struct objfile *)); +struct minimal_symbol * +lookup_minimal_symbol_solib_trampoline PARAMS ((const char *, + const char *, + struct objfile *)); + extern struct minimal_symbol * lookup_minimal_symbol_by_pc PARAMS ((CORE_ADDR)); -- 2.34.1