Clean up some function comments in symtab.[ch].

gdb/ChangeLog:

	* symtab.h (struct field_of_this_result): Fix typo in comment.
	(lookup_symbol_in_language): Move function comment here.
	(lookup_symbol): Improve function comment.
	(basic_lookup_symbol_nonlocal): Ditto.
	(lookup_symbol_static, lookup_symbol_global): Ditto.
	(lookup_symbol_aux_block): Ditto.
	(lookup_language_this): Add function comment.
	(lookup_static_symbol_aux): Explicitly mark as extern.  Improve
	function comment.
	(lookup_block_symbol): Improve function comment.
	(lookup_struct): Fix capitalization in function comment.
	(lookup_transparent_type): Add function comment.
	(lookup_global_symbol_from_objfile): Explicitly mark as extern.
	Improve function comment.
	(lookup_objfile_from_block): Add function comment.
	* symtab.c (lookup_symbol_in_language): Update function comment.
	(lookup_symbol, lookup_language_this): Ditto.
	(lookup_static_symbol_aux, lookup_objfile_from_block): Ditto.
	(lookup_symbol_aux_block, lookup_global_symbol_from_objfile): Ditto.
	(basic_lookup_symbol_nonlocal): Ditto.
	(lookup_symbol_static, lookup_symbol_global): Ditto.
	(lookup_transparent_type, lookup_block_symbol): Ditto.
This commit is contained in:
Doug Evans
2014-10-26 09:35:53 -07:00
parent ff6c39cf9c
commit cf901d3bba
3 changed files with 91 additions and 58 deletions

View File

@ -1,3 +1,28 @@
2014-10-26 Doug Evans <xdje42@gmail.com>
* symtab.h (struct field_of_this_result): Fix typo in comment.
(lookup_symbol_in_language): Move function comment here.
(lookup_symbol): Improve function comment.
(basic_lookup_symbol_nonlocal): Ditto.
(lookup_symbol_static, lookup_symbol_global): Ditto.
(lookup_symbol_aux_block): Ditto.
(lookup_language_this): Add function comment.
(lookup_static_symbol_aux): Explicitly mark as extern. Improve
function comment.
(lookup_block_symbol): Improve function comment.
(lookup_struct): Fix capitalization in function comment.
(lookup_transparent_type): Add function comment.
(lookup_global_symbol_from_objfile): Explicitly mark as extern.
Improve function comment.
(lookup_objfile_from_block): Add function comment.
* symtab.c (lookup_symbol_in_language): Update function comment.
(lookup_symbol, lookup_language_this): Ditto.
(lookup_static_symbol_aux, lookup_objfile_from_block): Ditto.
(lookup_symbol_aux_block, lookup_global_symbol_from_objfile): Ditto.
(basic_lookup_symbol_nonlocal): Ditto.
(lookup_symbol_static, lookup_symbol_global): Ditto.
(lookup_transparent_type, lookup_block_symbol): Ditto.
2014-10-25 Doug Evans <xdje42@gmail.com> 2014-10-25 Doug Evans <xdje42@gmail.com>
* symtab.c (types_info): Delete forward decl. * symtab.c (types_info): Delete forward decl.

View File

@ -71,7 +71,7 @@ static struct symbol *lookup_symbol_aux (const char *name,
const struct block *block, const struct block *block,
const domain_enum domain, const domain_enum domain,
enum language language, enum language language,
struct field_of_this_result *is_a_field_of_this); struct field_of_this_result *);
static static
struct symbol *lookup_symbol_aux_local (const char *name, struct symbol *lookup_symbol_aux_local (const char *name,
@ -1291,16 +1291,9 @@ demangle_for_lookup (const char *name, enum language lang,
return cleanup; return cleanup;
} }
/* Find the definition for a specified symbol name NAME /* See symtab.h.
in domain DOMAIN, visible from lexical block BLOCK.
Returns the struct symbol pointer, or zero if no symbol is found.
C++: if IS_A_FIELD_OF_THIS is nonzero on entry, check to see if
NAME is a field of the current implied argument `this'. If so set
*IS_A_FIELD_OF_THIS to 1, otherwise set it to zero.
BLOCK_FOUND is set to the block in which NAME is found (in the case of
a field of `this', value_of_this sets BLOCK_FOUND to the proper value.) */
/* This function (or rather its subordinates) have a bunch of loops and This function (or rather its subordinates) have a bunch of loops and
it would seem to be attractive to put in some QUIT's (though I'm not really it would seem to be attractive to put in some QUIT's (though I'm not really
sure whether it can run long enough to be really important). But there sure whether it can run long enough to be really important). But there
are a few calls for which it would appear to be bad news to quit are a few calls for which it would appear to be bad news to quit
@ -1326,8 +1319,7 @@ lookup_symbol_in_language (const char *name, const struct block *block,
return returnval; return returnval;
} }
/* Behave like lookup_symbol_in_language, but performed with the /* See symtab.h. */
current language. */
struct symbol * struct symbol *
lookup_symbol (const char *name, const struct block *block, lookup_symbol (const char *name, const struct block *block,
@ -1339,8 +1331,7 @@ lookup_symbol (const char *name, const struct block *block,
is_a_field_of_this); is_a_field_of_this);
} }
/* Look up the `this' symbol for LANG in BLOCK. Return the symbol if /* See symtab.h. */
found, or NULL if not found. */
struct symbol * struct symbol *
lookup_language_this (const struct language_defn *lang, lookup_language_this (const struct language_defn *lang,
@ -1483,10 +1474,7 @@ lookup_symbol_aux (const char *name, const struct block *block,
return lookup_static_symbol_aux (name, domain); return lookup_static_symbol_aux (name, domain);
} }
/* Search all static file-level symbols for NAME from DOMAIN. Do the symtabs /* See symtab.h. */
first, then check the psymtabs. If a psymtab indicates the existence of the
desired name as a file-level static, then do psymtab-to-symtab conversion on
the fly and return the found symbol. */
struct symbol * struct symbol *
lookup_static_symbol_aux (const char *name, const domain_enum domain) lookup_static_symbol_aux (const char *name, const domain_enum domain)
@ -1549,7 +1537,7 @@ lookup_symbol_aux_local (const char *name, const struct block *block,
return NULL; return NULL;
} }
/* Look up OBJFILE to BLOCK. */ /* See symtab.h. */
struct objfile * struct objfile *
lookup_objfile_from_block (const struct block *block) lookup_objfile_from_block (const struct block *block)
@ -1574,8 +1562,7 @@ lookup_objfile_from_block (const struct block *block)
return NULL; return NULL;
} }
/* Look up a symbol in a block; if found, fixup the symbol, and set /* See symtab.h. */
block_found appropriately. */
struct symbol * struct symbol *
lookup_symbol_aux_block (const char *name, const struct block *block, lookup_symbol_aux_block (const char *name, const struct block *block,
@ -1593,8 +1580,7 @@ lookup_symbol_aux_block (const char *name, const struct block *block,
return NULL; return NULL;
} }
/* Check all global symbols in OBJFILE in symtabs and /* See symtab.h. */
psymtabs. */
struct symbol * struct symbol *
lookup_global_symbol_from_objfile (const struct objfile *main_objfile, lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
@ -1765,9 +1751,7 @@ lookup_symbol_aux_quick (struct objfile *objfile, int kind,
return fixup_symbol_section (sym, objfile); return fixup_symbol_section (sym, objfile);
} }
/* A default version of lookup_symbol_nonlocal for use by languages /* See symtab.h. */
that can't think of anything better to do. This implements the C
lookup rules. */
struct symbol * struct symbol *
basic_lookup_symbol_nonlocal (const char *name, basic_lookup_symbol_nonlocal (const char *name,
@ -1811,8 +1795,7 @@ basic_lookup_symbol_nonlocal (const char *name,
return lookup_symbol_global (name, block, domain); return lookup_symbol_global (name, block, domain);
} }
/* Lookup a symbol in the static block associated to BLOCK, if there /* See symtab.h. */
is one; do nothing if BLOCK is NULL or a global block. */
struct symbol * struct symbol *
lookup_symbol_static (const char *name, lookup_symbol_static (const char *name,
@ -1867,8 +1850,7 @@ lookup_symbol_global_iterator_cb (struct objfile *objfile,
return (data->result != NULL); return (data->result != NULL);
} }
/* Lookup a symbol in all files' global blocks (searching psymtabs if /* See symtab.h. */
necessary). */
struct symbol * struct symbol *
lookup_symbol_global (const char *name, lookup_symbol_global (const char *name,
@ -1917,9 +1899,7 @@ symbol_matches_domain (enum language symbol_language,
return (symbol_domain == domain); return (symbol_domain == domain);
} }
/* Look up a type named NAME in the struct_domain. The type returned /* See symtab.h. */
must not be opaque -- i.e., must have at least one field
defined. */
struct type * struct type *
lookup_transparent_type (const char *name) lookup_transparent_type (const char *name)
@ -1960,7 +1940,7 @@ basic_lookup_transparent_type_quick (struct objfile *objfile, int kind,
/* The standard implementation of lookup_transparent_type. This code /* The standard implementation of lookup_transparent_type. This code
was modeled on lookup_symbol -- the parts not relevant to looking was modeled on lookup_symbol -- the parts not relevant to looking
up types were just left out. In particular it's assumed here that up types were just left out. In particular it's assumed here that
types are available in struct_domain and only at file-static or types are available in STRUCT_DOMAIN and only in file-static or
global blocks. */ global blocks. */
struct type * struct type *
@ -2030,7 +2010,7 @@ basic_lookup_transparent_type (const char *name)
return (struct type *) 0; return (struct type *) 0;
} }
/* Search BLOCK for symbol NAME in DOMAIN. /* See symtab.h.
Note that if NAME is the demangled form of a C++ symbol, we will fail Note that if NAME is the demangled form of a C++ symbol, we will fail
to find a match during the binary search of the non-encoded names, but to find a match during the binary search of the non-encoded names, but

View File

@ -1043,13 +1043,22 @@ struct field_of_this_result
struct field *field; struct field *field;
/* If the symbol was found as an function field of 'this', then this /* If the symbol was found as a function field of 'this', then this
is non-NULL and points to the particular field. */ is non-NULL and points to the particular field. */
struct fn_fieldlist *fn_field; struct fn_fieldlist *fn_field;
}; };
/* lookup a symbol by name (optional block) in language. */ /* Find the definition for a specified symbol name NAME
in domain DOMAIN in language LANGUAGE, visible from lexical block BLOCK
if non-NULL or from global/static blocks if BLOCK is NULL.
Returns the struct symbol pointer, or NULL if no symbol is found.
C++: if IS_A_FIELD_OF_THIS is non-NULL on entry, check to see if
NAME is a field of the current implied argument `this'. If so fill in the
fields of IS_A_FIELD_OF_THIS, otherwise the fields are set to NULL.
BLOCK_FOUND is set to the block in which NAME is found (in the case of
a field of `this', value_of_this sets BLOCK_FOUND to the proper value).
The symbol's section is fixed up if necessary. */
extern struct symbol *lookup_symbol_in_language (const char *, extern struct symbol *lookup_symbol_in_language (const char *,
const struct block *, const struct block *,
@ -1057,15 +1066,15 @@ extern struct symbol *lookup_symbol_in_language (const char *,
enum language, enum language,
struct field_of_this_result *); struct field_of_this_result *);
/* lookup a symbol by name (optional block, optional symtab) /* Same as lookup_symbol_in_language, but using the current language. */
in the current language. */
extern struct symbol *lookup_symbol (const char *, const struct block *, extern struct symbol *lookup_symbol (const char *, const struct block *,
const domain_enum, const domain_enum,
struct field_of_this_result *); struct field_of_this_result *);
/* A default version of lookup_symbol_nonlocal for use by languages /* A default version of lookup_symbol_nonlocal for use by languages
that can't think of anything better to do. */ that can't think of anything better to do.
This implements the C lookup rules. */
extern struct symbol *basic_lookup_symbol_nonlocal (const char *, extern struct symbol *basic_lookup_symbol_nonlocal (const char *,
const struct block *, const struct block *,
@ -1075,42 +1084,49 @@ extern struct symbol *basic_lookup_symbol_nonlocal (const char *,
lookup_symbol_nonlocal functions. */ lookup_symbol_nonlocal functions. */
/* Lookup a symbol in the static block associated to BLOCK, if there /* Lookup a symbol in the static block associated to BLOCK, if there
is one; do nothing if BLOCK is NULL or a global block. */ is one; do nothing if BLOCK is NULL or a global block.
Upon success sets BLOCK_FOUND and fixes up the symbol's section
if necessary. */
extern struct symbol *lookup_symbol_static (const char *name, extern struct symbol *lookup_symbol_static (const char *name,
const struct block *block, const struct block *block,
const domain_enum domain); const domain_enum domain);
/* Lookup a symbol in all files' global blocks (searching psymtabs if /* Lookup a symbol in all files' global blocks.
necessary). */ Upon success sets BLOCK_FOUND and fixes up the symbol's section
if necessary. */
extern struct symbol *lookup_symbol_global (const char *name, extern struct symbol *lookup_symbol_global (const char *name,
const struct block *block, const struct block *block,
const domain_enum domain); const domain_enum domain);
/* Lookup a symbol within the block BLOCK. This, unlike /* Lookup a symbol within the block BLOCK.
lookup_symbol_block, will set SYMTAB and BLOCK_FOUND correctly, and Upon success sets BLOCK_FOUND and fixes up the symbol's section
will fix up the symbol if necessary. */ if necessary. */
extern struct symbol *lookup_symbol_aux_block (const char *name, extern struct symbol *lookup_symbol_aux_block (const char *name,
const struct block *block, const struct block *block,
const domain_enum domain); const domain_enum domain);
/* Look up the `this' symbol for LANG in BLOCK. Return the symbol if
found, or NULL if not found. */
extern struct symbol *lookup_language_this (const struct language_defn *lang, extern struct symbol *lookup_language_this (const struct language_defn *lang,
const struct block *block); const struct block *block);
/* Lookup a symbol only in the file static scope of all the objfiles. */ /* Search all static file-level symbols for NAME from DOMAIN.
Upon success sets BLOCK_FOUND and fixes up the symbol's section
if necessary. */
struct symbol *lookup_static_symbol_aux (const char *name, extern struct symbol *lookup_static_symbol_aux (const char *name,
const domain_enum domain); const domain_enum domain);
/* Search BLOCK for symbol NAME in DOMAIN. */
/* lookup a symbol by name, within a specified block. */
extern struct symbol *lookup_block_symbol (const struct block *, const char *, extern struct symbol *lookup_block_symbol (const struct block *, const char *,
const domain_enum); const domain_enum);
/* lookup a [struct, union, enum] by name, within a specified block. */ /* Lookup a [struct, union, enum] by name, within a specified block. */
extern struct type *lookup_struct (const char *, const struct block *); extern struct type *lookup_struct (const char *, const struct block *);
@ -1157,9 +1173,13 @@ extern int find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
extern void reread_symbols (void); extern void reread_symbols (void);
extern struct type *lookup_transparent_type (const char *); /* Look up a type named NAME in STRUCT_DOMAIN in the current language.
extern struct type *basic_lookup_transparent_type (const char *); The type returned must not be opaque -- i.e., must have at least one field
defined. */
extern struct type *lookup_transparent_type (const char *);
extern struct type *basic_lookup_transparent_type (const char *);
/* Macro for name of symbol to indicate a file compiled with gcc. */ /* Macro for name of symbol to indicate a file compiled with gcc. */
#ifndef GCC_COMPILED_FLAG_SYMBOL #ifndef GCC_COMPILED_FLAG_SYMBOL
@ -1369,10 +1389,16 @@ extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search
extern /*const */ char *main_name (void); extern /*const */ char *main_name (void);
extern enum language main_language (void); extern enum language main_language (void);
/* Check global symbols in objfile. */ /* Lookup symbol NAME from DOMAIN in MAIN_OBJFILE's global blocks.
struct symbol *lookup_global_symbol_from_objfile (const struct objfile *, This searches MAIN_OBJFILE as well as any associated separate debug info
const char *name, objfiles of MAIN_OBJFILE.
const domain_enum domain); Upon success sets BLOCK_FOUND and fixes up the symbol's section
if necessary. */
extern struct symbol *
lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
const char *name,
const domain_enum domain);
/* Return 1 if the supplied producer string matches the ARM RealView /* Return 1 if the supplied producer string matches the ARM RealView
compiler (armcc). */ compiler (armcc). */
@ -1381,6 +1407,8 @@ int producer_is_realview (const char *producer);
void fixup_section (struct general_symbol_info *ginfo, void fixup_section (struct general_symbol_info *ginfo,
CORE_ADDR addr, struct objfile *objfile); CORE_ADDR addr, struct objfile *objfile);
/* Look up objfile containing BLOCK. */
struct objfile *lookup_objfile_from_block (const struct block *block); struct objfile *lookup_objfile_from_block (const struct block *block);
extern unsigned int symtab_create_debug; extern unsigned int symtab_create_debug;