gdb/
Code cleanup. * symtab.c (search_symbols): Reorder the KIND description in the function comment. Remove the unused 4th element of types, types2, types3 and types4. New gdb_assert on KIND. (symtab_symbol_info): Remove the unused 4th element of classnames. New gdb_assert on KIND. * symtab.h (enum search_domain): New warning in the enum comment. Assign numbers to the elements VARIABLES_DOMAIN, FUNCTIONS_DOMAIN and TYPES_DOMAIN.
This commit is contained in:
parent
9f973f2842
commit
e8930875fb
3 changed files with 28 additions and 11 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2011-04-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
Code cleanup.
|
||||||
|
* symtab.c (search_symbols): Reorder the KIND description in the
|
||||||
|
function comment. Remove the unused 4th element of types, types2,
|
||||||
|
types3 and types4. New gdb_assert on KIND.
|
||||||
|
(symtab_symbol_info): Remove the unused 4th element of classnames.
|
||||||
|
New gdb_assert on KIND.
|
||||||
|
* symtab.h (enum search_domain): New warning in the enum comment.
|
||||||
|
Assign numbers to the elements VARIABLES_DOMAIN, FUNCTIONS_DOMAIN and
|
||||||
|
TYPES_DOMAIN.
|
||||||
|
|
||||||
2011-04-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
2011-04-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
Fix crash of gdb save-index on a STABS file.
|
Fix crash of gdb save-index on a STABS file.
|
||||||
|
|
18
gdb/symtab.c
18
gdb/symtab.c
|
@ -2970,10 +2970,10 @@ search_symbols_name_matches (const char *symname, void *user_data)
|
||||||
returning the results in *MATCHES.
|
returning the results in *MATCHES.
|
||||||
|
|
||||||
Only symbols of KIND are searched:
|
Only symbols of KIND are searched:
|
||||||
|
VARIABLES_DOMAIN - search all symbols, excluding functions, type names,
|
||||||
|
and constants (enums)
|
||||||
FUNCTIONS_DOMAIN - search all functions
|
FUNCTIONS_DOMAIN - search all functions
|
||||||
TYPES_DOMAIN - search all type names
|
TYPES_DOMAIN - search all type names
|
||||||
VARIABLES_DOMAIN - search all symbols, excluding functions, type names,
|
|
||||||
and constants (enums)
|
|
||||||
|
|
||||||
free_search_symbols should be called when *MATCHES is no longer needed.
|
free_search_symbols should be called when *MATCHES is no longer needed.
|
||||||
|
|
||||||
|
@ -2996,13 +2996,13 @@ search_symbols (char *regexp, enum search_domain kind,
|
||||||
char *val;
|
char *val;
|
||||||
int found_misc = 0;
|
int found_misc = 0;
|
||||||
static const enum minimal_symbol_type types[]
|
static const enum minimal_symbol_type types[]
|
||||||
= {mst_data, mst_text, mst_abs, mst_unknown};
|
= {mst_data, mst_text, mst_abs};
|
||||||
static const enum minimal_symbol_type types2[]
|
static const enum minimal_symbol_type types2[]
|
||||||
= {mst_bss, mst_file_text, mst_abs, mst_unknown};
|
= {mst_bss, mst_file_text, mst_abs};
|
||||||
static const enum minimal_symbol_type types3[]
|
static const enum minimal_symbol_type types3[]
|
||||||
= {mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown};
|
= {mst_file_data, mst_solib_trampoline, mst_abs};
|
||||||
static const enum minimal_symbol_type types4[]
|
static const enum minimal_symbol_type types4[]
|
||||||
= {mst_file_bss, mst_text_gnu_ifunc, mst_abs, mst_unknown};
|
= {mst_file_bss, mst_text_gnu_ifunc, mst_abs};
|
||||||
enum minimal_symbol_type ourtype;
|
enum minimal_symbol_type ourtype;
|
||||||
enum minimal_symbol_type ourtype2;
|
enum minimal_symbol_type ourtype2;
|
||||||
enum minimal_symbol_type ourtype3;
|
enum minimal_symbol_type ourtype3;
|
||||||
|
@ -3013,6 +3013,8 @@ search_symbols (char *regexp, enum search_domain kind,
|
||||||
struct cleanup *old_chain = NULL;
|
struct cleanup *old_chain = NULL;
|
||||||
struct search_symbols_data datum;
|
struct search_symbols_data datum;
|
||||||
|
|
||||||
|
gdb_assert (kind <= TYPES_DOMAIN);
|
||||||
|
|
||||||
ourtype = types[kind];
|
ourtype = types[kind];
|
||||||
ourtype2 = types2[kind];
|
ourtype2 = types2[kind];
|
||||||
ourtype3 = types3[kind];
|
ourtype3 = types3[kind];
|
||||||
|
@ -3311,13 +3313,15 @@ static void
|
||||||
symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
|
symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
|
||||||
{
|
{
|
||||||
static const char * const classnames[] =
|
static const char * const classnames[] =
|
||||||
{"variable", "function", "type", "method"};
|
{"variable", "function", "type"};
|
||||||
struct symbol_search *symbols;
|
struct symbol_search *symbols;
|
||||||
struct symbol_search *p;
|
struct symbol_search *p;
|
||||||
struct cleanup *old_chain;
|
struct cleanup *old_chain;
|
||||||
char *last_filename = NULL;
|
char *last_filename = NULL;
|
||||||
int first = 1;
|
int first = 1;
|
||||||
|
|
||||||
|
gdb_assert (kind <= TYPES_DOMAIN);
|
||||||
|
|
||||||
/* Must make sure that if we're interrupted, symbols gets freed. */
|
/* Must make sure that if we're interrupted, symbols gets freed. */
|
||||||
search_symbols (regexp, kind, 0, (char **) NULL, &symbols);
|
search_symbols (regexp, kind, 0, (char **) NULL, &symbols);
|
||||||
old_chain = make_cleanup_free_search_symbols (symbols);
|
old_chain = make_cleanup_free_search_symbols (symbols);
|
||||||
|
|
|
@ -398,19 +398,20 @@ typedef enum domain_enum_tag
|
||||||
LABEL_DOMAIN
|
LABEL_DOMAIN
|
||||||
} domain_enum;
|
} domain_enum;
|
||||||
|
|
||||||
/* Searching domains, used for `search_symbols'. */
|
/* Searching domains, used for `search_symbols'. Element numbers are
|
||||||
|
hardcoded in GDB, check all enum uses before changing it. */
|
||||||
|
|
||||||
enum search_domain
|
enum search_domain
|
||||||
{
|
{
|
||||||
/* Everything in VAR_DOMAIN minus FUNCTIONS_DOMAIN and
|
/* Everything in VAR_DOMAIN minus FUNCTIONS_DOMAIN and
|
||||||
TYPES_DOMAIN. */
|
TYPES_DOMAIN. */
|
||||||
VARIABLES_DOMAIN,
|
VARIABLES_DOMAIN = 0,
|
||||||
|
|
||||||
/* All functions -- for some reason not methods, though. */
|
/* All functions -- for some reason not methods, though. */
|
||||||
FUNCTIONS_DOMAIN,
|
FUNCTIONS_DOMAIN = 1,
|
||||||
|
|
||||||
/* All defined types */
|
/* All defined types */
|
||||||
TYPES_DOMAIN
|
TYPES_DOMAIN = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* An address-class says where to find the value of a symbol. */
|
/* An address-class says where to find the value of a symbol. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue