home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / gdb / symfile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-26  |  7.7 KB  |  238 lines

  1. /* Definitions for reading symbol files into GDB.
  2.    Copyright (C) 1990, 1991, 1992, 1993, 1994  Free Software Foundation, Inc.
  3.  
  4. This file is part of GDB.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #if !defined (SYMFILE_H)
  21. #define SYMFILE_H
  22.  
  23. /* This file requires that you first include "bfd.h".  */
  24.  
  25. struct psymbol_allocation_list {
  26.   struct partial_symbol *list;
  27.   struct partial_symbol *next;
  28.   int size;
  29. };
  30.  
  31. /* Structure to keep track of symbol reading functions for various
  32.    object file types.  */
  33.  
  34. struct sym_fns {
  35.  
  36.   /* BFD flavour that we handle, or (as a special kludge, see xcoffread.c,
  37.      (enum bfd_flavour)-1 for xcoff).  */
  38.  
  39.   enum bfd_flavour sym_flavour;
  40.  
  41.   /* Initializes anything that is global to the entire symbol table.  It is
  42.      called during symbol_file_add, when we begin debugging an entirely new
  43.      program. */
  44.  
  45.   void (*sym_new_init) PARAMS ((struct objfile *));
  46.  
  47.   /* Reads any initial information from a symbol file, and initializes the
  48.      struct sym_fns SF in preparation for sym_read().  It is called every
  49.      time we read a symbol file for any reason. */
  50.  
  51.   void (*sym_init) PARAMS ((struct objfile *));
  52.  
  53.   /* sym_read (objfile, addr, mainline)
  54.      Reads a symbol file into a psymtab (or possibly a symtab).
  55.      OBJFILE is the objfile struct for the file we are reading.
  56.      SECTION_OFFSETS
  57.      are the offset between the file's specified section addresses and
  58.      their true addresses in memory.
  59.      MAINLINE is 1 if this is the
  60.      main symbol table being read, and 0 if a secondary
  61.      symbol file (e.g. shared library or dynamically loaded file)
  62.      is being read.  */
  63.  
  64.   void (*sym_read) PARAMS ((struct objfile *, struct section_offsets *, int));
  65.  
  66.   /* Called when we are finished with an objfile.  Should do all cleanup
  67.      that is specific to the object file format for the particular objfile. */
  68.  
  69.   void (*sym_finish) PARAMS ((struct objfile *));
  70.  
  71.   /* This function produces a file-dependent section_offsets structure,
  72.      allocated in the objfile's storage, and based on the parameter.
  73.      The parameter is currently a CORE_ADDR (FIXME!) for backward compatibility
  74.      with the higher levels of GDB.  It should probably be changed to
  75.      a string, where NULL means the default, and others are parsed in a file
  76.      dependent way.  The result of this function is handed in to sym_read.  */
  77.  
  78.   struct section_offsets *(*sym_offsets) PARAMS ((struct objfile *, CORE_ADDR));
  79.  
  80.   /* Finds the next struct sym_fns.  They are allocated and initialized
  81.      in whatever module implements the functions pointed to; an 
  82.      initializer calls add_symtab_fns to add them to the global chain.  */
  83.  
  84.   struct sym_fns *next;
  85.  
  86. };
  87.  
  88. extern void
  89. extend_psymbol_list PARAMS ((struct psymbol_allocation_list *,
  90.                  struct objfile *));
  91.  
  92. /* Add any kind of symbol to a psymbol_allocation_list. */
  93.  
  94. #ifndef INLINE_ADD_PSYMBOL
  95. #define INLINE_ADD_PSYMBOL 1
  96. #endif
  97.  
  98. #if !INLINE_ADD_PSYMBOL
  99.  
  100. /* Since one arg is a struct, we have to pass in a ptr and deref it (sigh) */
  101.  
  102. #define    ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \
  103.   add_psymbol_to_list (name, namelength, namespace, class, &list, value, language, objfile)
  104.  
  105. #define    ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \
  106.   add_psymbol_addr_to_list (name, namelength, namespace, class, &list, value, language, objfile)
  107.  
  108. #else    /* !INLINE_ADD_PSYMBOL */
  109.  
  110. #include "demangle.h"
  111.  
  112. #define    ADD_PSYMBOL_VT_TO_LIST(NAME,NAMELENGTH,NAMESPACE,CLASS,LIST,VALUE,VT,LANGUAGE, OBJFILE) \
  113.   do {                                        \
  114.     register struct partial_symbol *psym;                \
  115.     if ((LIST).next >= (LIST).list + (LIST).size)            \
  116.       extend_psymbol_list (&(LIST),(OBJFILE));                \
  117.     psym = (LIST).next++;                        \
  118.     SYMBOL_NAME (psym) =                        \
  119.       (char *) obstack_alloc (&objfile->psymbol_obstack,        \
  120.                   (NAMELENGTH) + 1);            \
  121.     memcpy (SYMBOL_NAME (psym), (NAME), (NAMELENGTH));            \
  122.     SYMBOL_NAME (psym)[(NAMELENGTH)] = '\0';                \
  123.     SYMBOL_NAMESPACE (psym) = (NAMESPACE);                \
  124.     PSYMBOL_CLASS (psym) = (CLASS);                    \
  125.     VT (psym) = (VALUE);                         \
  126.     SYMBOL_LANGUAGE (psym) = (LANGUAGE);                \
  127.     SYMBOL_INIT_LANGUAGE_SPECIFIC (psym, LANGUAGE);            \
  128.   } while (0)
  129.  
  130. /* Add a symbol with an integer value to a psymtab. */
  131.  
  132. #define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \
  133.   ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE, language, objfile)
  134.  
  135. /* Add a symbol with a CORE_ADDR value to a psymtab. */
  136.  
  137. #define    ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value, language, objfile)\
  138.   ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE_ADDRESS, language, objfile)
  139.  
  140. #endif    /* INLINE_ADD_PSYMBOL */
  141.  
  142.             /*   Functions   */
  143.  
  144. extern void
  145. sort_pst_symbols PARAMS ((struct partial_symtab *));
  146.  
  147. extern struct symtab *
  148. allocate_symtab PARAMS ((char *, struct objfile *));
  149.  
  150. extern int
  151. free_named_symtabs PARAMS ((char *));
  152.  
  153. extern void
  154. fill_in_vptr_fieldno PARAMS ((struct type *));
  155.  
  156. extern void
  157. add_symtab_fns PARAMS ((struct sym_fns *));
  158.  
  159. extern void
  160. init_entry_point_info PARAMS ((struct objfile *));
  161.  
  162. extern void
  163. syms_from_objfile PARAMS ((struct objfile *, CORE_ADDR, int, int));
  164.  
  165. extern void
  166. new_symfile_objfile PARAMS ((struct objfile *, int, int));
  167.  
  168. extern struct partial_symtab *
  169. start_psymtab_common PARAMS ((struct objfile *, struct section_offsets *,
  170.                   char *, CORE_ADDR,
  171.                   struct partial_symbol *,
  172.                   struct partial_symbol *));
  173.  
  174. /* Sorting your symbols for fast lookup or alphabetical printing.  */
  175.  
  176. extern void
  177. sort_block_syms PARAMS ((struct block *));
  178.  
  179. extern void
  180. sort_symtab_syms PARAMS ((struct symtab *));
  181.  
  182. /* Make a copy of the string at PTR with SIZE characters in the symbol obstack
  183.    (and add a null character at the end in the copy).
  184.    Returns the address of the copy.  */
  185.  
  186. extern char *
  187. obsavestring PARAMS ((char *, int, struct obstack *));
  188.  
  189. /* Concatenate strings S1, S2 and S3; return the new string.
  190.    Space is found in the symbol_obstack.  */
  191.  
  192. extern char *
  193. obconcat PARAMS ((struct obstack *obstackp, const char *, const char *,
  194.           const char *));
  195.  
  196.             /*   Variables   */
  197.  
  198. /* From symfile.c */
  199.  
  200. extern struct partial_symtab *
  201. allocate_psymtab PARAMS ((char *, struct objfile *));
  202.  
  203. /* Remote targets may wish to use this as their load function.  */
  204. extern void generic_load PARAMS ((char *name, int from_tty));
  205.  
  206. /* From dwarfread.c */
  207.  
  208. extern void
  209. dwarf_build_psymtabs PARAMS ((struct objfile *, struct section_offsets *, int,
  210.                   file_ptr, unsigned int, file_ptr, unsigned int));
  211.  
  212. /* From mdebugread.c */
  213.  
  214. /* Hack to force structures to exist before use in parameter list.  */
  215. struct ecoff_debug_hack
  216. {
  217.   struct ecoff_debug_swap *a;
  218.   struct ecoff_debug_info *b;
  219. };
  220. extern void
  221. mdebug_build_psymtabs PARAMS ((struct objfile *,
  222.                    const struct ecoff_debug_swap *,
  223.                    struct ecoff_debug_info *,
  224.                    struct section_offsets *));
  225.  
  226. extern void
  227. elfmdebug_build_psymtabs PARAMS ((struct objfile *,
  228.                   const struct ecoff_debug_swap *,
  229.                   asection *,
  230.                   struct section_offsets *));
  231.  
  232. /* From demangle.c */
  233.  
  234. extern void
  235. set_demangling_style PARAMS ((char *));
  236.  
  237. #endif    /* !defined(SYMFILE_H) */
  238.