diff options
author | Fred Fish <fnf@specifix.com> | 1992-03-19 21:57:15 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1992-03-19 21:57:15 +0000 |
commit | 80d68b1d49a92b6ea0b5b79d9be413f0002ae200 (patch) | |
tree | 6a042b0583d1b178e375b6288dc7d2811c763d90 /gdb/symfile.h | |
parent | dc52fc71183fc32594388a619c4fa55e83648ced (diff) | |
download | gdb-80d68b1d49a92b6ea0b5b79d9be413f0002ae200.zip gdb-80d68b1d49a92b6ea0b5b79d9be413f0002ae200.tar.gz gdb-80d68b1d49a92b6ea0b5b79d9be413f0002ae200.tar.bz2 |
* coffread.c, mipsread.c, xcoffread.c, coffread.c, dbxread.c,
elfread.c (coff_symfile_finish): Add function, prototype, and
add to the xxxx_sym_fns struct for each file type. Also reformat
the xxxx_sym_fns vector to a standard format and add comments.
* coffread.c, mipsread.c, xcoffread.c, coffread.c, dbxread.c,
elfread.c (xxx_symfile_new_init, xxx_symfile_init, xxx_symfile_read):
Pass pointer to struct objfile rather than pointer to sym_fns.
Change references inside each function accordingly. Allocate any
symbol file specific info in the per-objfile memory region.
* dbxread.c (free_and_init_header_files): Break function into
free_header_files(), called from dbx_symfile_finish(), and
init_header_files(), called from dbx_new_init().
* dbxread.c (dbx_new_init): Move deallocation things to new
dbx_symfile_finish function.
* elfread.c (elf_new_init): Call buildsym_new_init().
* objfiles.c (free_objfile): Call the appropriate symfile_finish()
routine for the objfile before deallocating other stuff.
* sparc-tdep.c (get_longjmp_target): Cast target_read_memory arg.
* symfile.h: Move struct sym_fns to before struct objfile def.
Add sym_finish function pointer and change prototypes of other
function pointers to reflect passing struct objfile pointer rather
than struct sym_fns pointer.
* symfile.c: Remove now obsolete symtab_fns pointer.
* symfile.c (symfile_init): Renamed to find_sym_fns, and now only
locates the correct sym_fns struct for the given objfile.
* symfile.c (syms_from_objfile, symbol_file_add): Restructured
for better support of mapped symbol tables.
* symfile.c (symbol_file_command): Remove obsolete code using
symfile_fns.
* symfile.h: Remove duplicate declarations for symfile_objfile,
entry_point, and object_files.
* target.c (target_info): Compare symfile_objfile to NULL.
* xcoffread.c (aixcoff_new_init): Move deallocation stuff to
aixcoff_symfile_finish().
Diffstat (limited to 'gdb/symfile.h')
-rw-r--r-- | gdb/symfile.h | 147 |
1 files changed, 68 insertions, 79 deletions
diff --git a/gdb/symfile.h b/gdb/symfile.h index 6dbd2d7..1d9b7dd 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -28,6 +28,60 @@ struct psymbol_allocation_list { int size; }; +/* Structure to keep track of symbol reading functions for various + object file types. */ + +struct sym_fns { + + /* is the name, or name prefix, of the BFD "target type" that this + set of functions handles. E.g. "a.out" or "sunOs" or "coff" or "elf". */ + + char *sym_name; + + /* counts how many bytes of sym_name should be checked against the + BFD target type of the file being read. If an exact match is + desired, specify the number of characters in sym_name plus 1 for the + NUL. If a prefix match is desired, specify the number of characters in + sym_name. */ + + int sym_namelen; + + /* Initializes anything that is global to the entire symbol table. It is + called during symbol_file_add, when we begin debugging an entirely new + program. */ + + void (*sym_new_init) PARAMS ((struct objfile *)); + + /* Reads any initial information from a symbol file, and initializes the + struct sym_fns SF in preparation for sym_read(). It is called every + time we read a symbol file for any reason. */ + + void (*sym_init) PARAMS ((struct objfile *)); + + /* sym_read (objfile, addr, mainline) + Reads a symbol file into a psymtab (or possibly a symtab). + OBJFILE is the objfile struct for the file we are reading. ADDR + is the offset between the file's specified start address and + its true address in memory. MAINLINE is 1 if this is the + main symbol table being read, and 0 if a secondary + symbol file (e.g. shared library or dynamically loaded file) + is being read. */ + + void (*sym_read) PARAMS ((struct objfile *, CORE_ADDR, int)); + + /* Called when we are finished with an objfile. Should do all cleanup + that is specific to the object file format for the particular objfile. */ + + void (*sym_finish) PARAMS ((struct objfile *)); + + /* Finds the next struct sym_fns. They are allocated and initialized + in whatever module implements the functions pointed to; an + initializer calls add_symtab_fns to add them to the global chain. */ + + struct sym_fns *next; + +}; + /* Master structure for keeping track of each input file from which gdb reads symbols. One of these is allocated for each such file we access, e.g. the exec_file, symbol_file, and any shared library object @@ -117,7 +171,20 @@ struct objfile the memory mapped malloc() package to manage storage for this objfile's data. NULL if we are not. */ - void *md; + PTR md; + + /* Structure which keeps track of functions that manipulate objfile's + of the same type as this objfile. I.E. the function to read partial + symbols for example. Note that this structure is in statically + allocated memory, and is shared by all objfiles that use the + object module reader of this type. */ + + struct sym_fns *sf; + + /* Hook for information which is shared by sym_init and sym_read for + this objfile. It is typically a pointer to malloc'd memory. */ + + PTR sym_private; }; @@ -133,69 +200,6 @@ struct objfile #define OBJF_MAPPED (1 << 0) /* Objfile data is mmap'd */ -/* Structure to keep track of symbol reading functions for various - object file types. */ - -struct sym_fns { - - /* is the name, or name prefix, of the BFD "target type" that this - set of functions handles. E.g. "a.out" or "sunOs" or "coff" or "elf". */ - - char *sym_name; - - /* counts how many bytes of sym_name should be checked against the - BFD target type of the file being read. If an exact match is - desired, specify the number of characters in sym_name plus 1 for the - NUL. If a prefix match is desired, specify the number of characters in - sym_name. */ - - int sym_namelen; - - /* initializes anything that is global to the entire - symbol table. It is called during symbol_file_add, when - we begin debugging an entirely new program. */ - - void (*sym_new_init) PARAMS ((void)); - - /* sym_init (sf) - reads any initial information from a symbol file, and - initializes the struct sym_fns SF in preparation for sym_read(). - It is called every time we read a symbol file for any reason. */ - - void (*sym_init) PARAMS ((struct sym_fns *)); - - /* sym_read (sf, addr, mainline) - reads a symbol file into a psymtab (or possibly a symtab). - SF is the struct sym_fns that sym_init initialized. ADDR - is the offset between the file's specified start address and - its true address in memory. MAINLINE is 1 if this is the - main symbol table being read, and 0 if a secondary - symbol file (e.g. shared library or dynamically loaded file) - is being read. */ - - void (*sym_read) PARAMS ((struct sym_fns *, CORE_ADDR, int)); - - /* is the accessor for the symbol file being read. */ - - bfd *sym_bfd; - - /* is where information can be shared among sym_init and sym_read. - It is typically a pointer to malloc'd memory. */ - - char *sym_private; /* Should be void * */ - - /* is the "struct objfile" for the object file being read. */ - - struct objfile *objfile; - - /* finds the next struct sym_fns. They are allocated and initialized - in whatever module implements the functions pointed to; an - initializer calls add_symtab_fns to add them to the global chain. */ - - struct sym_fns *next; - -}; - extern void extend_psymbol_list PARAMS ((struct psymbol_allocation_list *, struct objfile *)); @@ -343,21 +347,6 @@ struct complaint { extern struct complaint complaint_root[1]; -/* Externally visible variables defined in symfile.c */ - -/* The object file that the main symbol table was loaded from (e.g. the - argument to the "symbol-file" or "file" command). */ - -extern struct objfile *symfile_objfile; - -/* Where execution starts in symfile */ - -extern CORE_ADDR entry_point; - -/* Root of object file struct chain. */ - -extern struct objfile *object_files; - /* Functions that handle complaints. (in symfile.c) */ extern void |