📄 symtab.h
字号:
/* This component says how to free the data we point to: free_contents => do a tree walk and free each object. free_nothing => do nothing; some other symtab will free the data this one uses. free_linetable => free just the linetable. */ enum free_code {free_nothing, free_contents, free_linetable} free_code; /* Pointer to one block of storage to be freed, if nonzero. */ /* This is IN ADDITION to the action indicated by free_code. */ char *free_ptr; /* Total number of lines found in source file. */ int nlines; /* Array mapping line number to character position. */ int *line_charpos; /* Language of this source file. */ enum language language; /* String of version information. May be zero. */ char *version; /* Full name of file as found by searching the source path. 0 if not yet known. */ char *fullname; /* Object file from which this symbol information was read. */ struct objfile *objfile; /* Anything extra for this symtab. This is for target machines with special debugging info of some sort (which cannot just be represented in a normal symtab). */#if defined (EXTRA_SYMTAB_INFO) EXTRA_SYMTAB_INFO#endif };/* Each source file that has not been fully read in is represented by a partial_symtab. This contains the information on where in the executable the debugging symbols for a specific file are, and a list of names of global symbols which are located in this file. They are all chained on partial symtab lists. Even after the source file has been read into a symtab, the partial_symtab remains around. They are allocated on an obstack, psymbol_obstack. FIXME, this is bad for dynamic linking or VxWorks- style execution of a bunch of .o's. */struct partial_symtab{ /* Chain of all existing partial symtabs. */ struct partial_symtab *next; /* Name of the source file which this partial_symtab defines */ char *filename; /* Information about the object file from which symbols should be read. */ struct objfile *objfile; /* Set of relocation offsets to apply to each section. */ struct section_offsets *section_offsets; /* Range of text addresses covered by this file; texthigh is the beginning of the next section. */ CORE_ADDR textlow, texthigh; /* Array of pointers to all of the partial_symtab's which this one depends on. Since this array can only be set to previous or the current (?) psymtab, this dependency tree is guaranteed not to have any loops. */ struct partial_symtab **dependencies; int number_of_dependencies; /* Global symbol list. This list will be sorted after readin to improve access. Binary search will be the usual method of finding a symbol within it. globals_offset is an integer offset within global_psymbols[]. */ int globals_offset, n_global_syms; /* Static symbol list. This list will *not* be sorted after readin; to find a symbol in it, exhaustive search must be used. This is reasonable because searches through this list will eventually lead to either the read in of a files symbols for real (assumed to take a *lot* of time; check) or an error (and we don't care how long errors take). This is an offset and size within static_psymbols[]. */ int statics_offset, n_static_syms; /* Pointer to symtab eventually allocated for this source file, 0 if !readin or if we haven't looked for the symtab after it was readin. */ struct symtab *symtab; /* Pointer to function which will read in the symtab corresponding to this psymtab. */ void (*read_symtab) PARAMS ((struct partial_symtab *)); /* Information that lets read_symtab() locate the part of the symbol table that this psymtab corresponds to. This information is private to the format-dependent symbol reading routines. For further detail examine the various symbol reading modules. Should really be (void *) but is (char *) as with other such gdb variables. (FIXME) */ char *read_symtab_private; /* Non-zero if the symtab corresponding to this psymtab has been readin */ unsigned char readin;};/* A fast way to get from a psymtab to its symtab (after the first time). */#define PSYMTAB_TO_SYMTAB(pst) ((pst)->symtab? \ (pst)->symtab: \ psymtab_to_symtab (pst) )/* This symtab variable specifies the current file for printing source lines */extern struct symtab *current_source_symtab;/* This is the next line to print for listing source lines. */extern int current_source_line;#define BLOCKVECTOR(symtab) (symtab)->blockvector#define LINETABLE(symtab) (symtab)->linetable/* Macros normally used to access components of symbol table structures. */#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]#define BLOCK_START(bl) (bl)->startaddr#define BLOCK_END(bl) (bl)->endaddr#define BLOCK_NSYMS(bl) (bl)->nsyms#define BLOCK_SYM(bl, n) (bl)->sym[n]#define BLOCK_FUNCTION(bl) (bl)->function#define BLOCK_SUPERBLOCK(bl) (bl)->superblock#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag/* Nonzero if symbols of block BL should be sorted alphabetically. */#define BLOCK_SHOULD_SORT(bl) ((bl)->nsyms >= 40)#define SYMBOL_NAME(symbol) (symbol)->name#define SYMBOL_NAMESPACE(symbol) (symbol)->namespace#define SYMBOL_CLASS(symbol) (symbol)->class#define SYMBOL_VALUE(symbol) (symbol)->value.value#define SYMBOL_VALUE_ADDRESS(symbol) (symbol)->value.address#define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain#define SYMBOL_TYPE(symbol) (symbol)->type#define SYMBOL_LINE(symbol) (symbol)->line#if 0/* This currently fails because some symbols are not being initialized to zero on allocation, and no code is currently setting this value. Basereg handling will probably change significantly in the next release. FIXME -fnf */#define SYMBOL_BASEREG_VALID(symbol) (symbol)->aux_value.basereg.regno_valid#else#define SYMBOL_BASEREG_VALID(symbol) 0#endif#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg.regno/* The virtual function table is now an array of structures which have the form { int16 offset, delta; void *pfn; }. In normal virtual function tables, OFFSET is unused. DELTA is the amount which is added to the apparent object's base address in order to point to the actual object to which the virtual function should be applied. PFN is a pointer to the virtual function. */ #define VTBL_FNADDR_OFFSET 2/* Macro that yields non-zero value iff NAME is the prefix for C++ operator names. If you leave out the parenthesis here you will lose! Currently 'o' 'p' CPLUS_MARKER is used for both the symbol in the symbol-file and the names in gdb's symbol table. */#define OPNAME_PREFIX_P(NAME) ((NAME)[0] == 'o' && (NAME)[1] == 'p' \ && (NAME)[2] == CPLUS_MARKER)#define VTBL_PREFIX_P(NAME) ((NAME)[3] == CPLUS_MARKER \ && !strncmp ((NAME), "_vt", 3))/* Functions that work on the objects described above */extern struct symtab *lookup_symtab PARAMS ((char *));extern struct symbol *lookup_symbol PARAMS ((const char *, const struct block *, const enum namespace, int *, struct symtab **));extern struct symbol *lookup_block_symbol PARAMS ((const struct block *, const char *, const enum namespace));extern struct type *lookup_struct PARAMS ((char *, struct block *));extern struct type *lookup_union PARAMS ((char *, struct block *));extern struct type *lookup_enum PARAMS ((char *, struct block *));extern struct symbol *block_function PARAMS ((struct block *));extern struct symbol *find_pc_function PARAMS ((CORE_ADDR));extern intfind_pc_partial_function PARAMS ((CORE_ADDR, char **, CORE_ADDR *));extern voidclear_pc_function_cache PARAMS ((void));extern struct partial_symtab *lookup_partial_symtab PARAMS ((char *));extern struct partial_symtab *find_pc_psymtab PARAMS ((CORE_ADDR));extern struct symtab *find_pc_symtab PARAMS ((CORE_ADDR));extern struct partial_symbol *find_pc_psymbol PARAMS ((struct partial_symtab *, CORE_ADDR));extern intfind_pc_line_pc_range PARAMS ((CORE_ADDR, CORE_ADDR *, CORE_ADDR *));extern intcontained_in PARAMS ((struct block *, struct block *));extern voidreread_symbols PARAMS ((void));/* Functions for dealing with the minimal symbol table, really a misc address<->symbol mapping for things we don't have debug symbols for. */extern voidprim_record_minimal_symbol PARAMS ((const char *, CORE_ADDR, enum minimal_symbol_type));extern voidprim_record_minimal_symbol_and_info PARAMS ((const char *, CORE_ADDR, enum minimal_symbol_type, char *info));extern struct minimal_symbol *lookup_minimal_symbol PARAMS ((const char *, struct objfile *));extern struct minimal_symbol *lookup_minimal_symbol_by_pc PARAMS ((CORE_ADDR));extern voidinit_minimal_symbol_collection PARAMS ((void));extern voiddiscard_minimal_symbols PARAMS ((int));extern voidinstall_minimal_symbols PARAMS ((struct objfile *));struct symtab_and_line{ struct symtab *symtab; int line; CORE_ADDR pc; CORE_ADDR end;};struct symtabs_and_lines{ struct symtab_and_line *sals; int nelts;};/* Given a pc value, return line number it is in. Second arg nonzero means if pc is on the boundary use the previous statement's line number. */extern struct symtab_and_linefind_pc_line PARAMS ((CORE_ADDR, int));/* Given a symtab and line number, return the pc there. */extern CORE_ADDRfind_line_pc PARAMS ((struct symtab *, int));extern int find_line_pc_range PARAMS ((struct symtab *, int, CORE_ADDR *, CORE_ADDR *));extern voidresolve_sal_pc PARAMS ((struct symtab_and_line *));/* Given a string, return the line specified by it. For commands like "list" and "breakpoint". */extern struct symtabs_and_linesdecode_line_spec PARAMS ((char *, int));extern struct symtabs_and_linesdecode_line_spec_1 PARAMS ((char *, int));extern struct symtabs_and_linesdecode_line_1 PARAMS ((char **, int, struct symtab *, int));/* Symmisc.c */#if MAINTENANCE_CMDSvoidmaintenance_print_symbols PARAMS ((char *, int));voidmaintenance_print_psymbols PARAMS ((char *, int));voidmaintenance_print_msymbols PARAMS ((char *, int));voidmaintenance_print_objfiles PARAMS ((char *, int));#endifextern voidfree_symtab PARAMS ((struct symtab *));/* Symbol-reading stuff in symfile.c and solib.c. */extern struct symtab *psymtab_to_symtab PARAMS ((struct partial_symtab *));extern voidclear_solib PARAMS ((void));extern struct objfile *symbol_file_add PARAMS ((char *, int, CORE_ADDR, int, int, int));/* source.c */extern intidentify_source_line PARAMS ((struct symtab *, int, int));extern voidprint_source_lines PARAMS ((struct symtab *, int, int, int));extern voidforget_cached_source_info PARAMS ((void));extern voidselect_source_symtab PARAMS ((struct symtab *));extern char **make_symbol_completion_list PARAMS ((char *));/* symtab.c */extern voidclear_symtab_users_once PARAMS ((void));extern struct partial_symtab *find_main_psymtab PARAMS ((void));/* blockframe.c */extern struct blockvector *blockvector_for_pc PARAMS ((CORE_ADDR, int *));/* symfile.c */extern enum languagededuce_language_from_filename PARAMS ((char *));#endif /* !defined(SYMTAB_H) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -