From 7f6cb62ee6bb03d33729ca8a27e3946591efc1f1 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Sat, 27 Jun 1998 00:45:20 +0000 Subject: * symtab.h (enum namespace): Add new namespaces FUNCTIONS_NAMESPACE, TYPES_NAMESPACE, METHODS_NAMESPACE, and VARIABLES_NAMESPACE used by new search_symbols. Add prototype for search_symbols and free_search_symbols. * symtab.c (list_symbols): Rewrite to use new search_symbols. (file_matches): New helper function for search_symbols. (free_search_symbols): New function which frees data returned from search_symbols. (print_symbol_info): New helper function which prints info about a matched symbol to stdout. Extracted from old list_symbols. (print_msymbol_info): New helper function which prints info about a matched msymbol to stdout. Extracted from old list_symbols. (symtab_symbol_info): Extracted from old list_symbols. (variables_info): Use symtab_symbol_info. (functions_info): Use symtab_symbol_info. (types_info): Use symtab_symbol_info. (rbreak_command): Rewrite to use new search_symbols. * gdbtk.c: Change all references to static global "interp" to "gdbtk_interp" and export this global. (gdbtk_init): If gdbtk_source_filename is not NULL, source this file into the interpreter when it goes idle. Add new command "gdb_search". (gdb_search): New function which searches the symbol table. (gdbtk_test): New function called by main when the --tclcommand option is used. * main.c (main): Add a new option "--tclcommand" which is used by the testsuite to source a file into the interpreter when it goes idle. --- gdb/main.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gdb/main.c') diff --git a/gdb/main.c b/gdb/main.c index 00d4695..57353df 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -61,6 +61,9 @@ extern void gdb_init PARAMS ((char *)); extern void cygwin32_conv_to_posix_path (const char *, char *); #endif +extern void (*pre_add_symbol_hook) PARAMS ((char *)); +extern void (*post_add_symbol_hook) PARAMS ((void)); + int main (argc, argv) int argc; @@ -176,6 +179,9 @@ main (argc, argv) {"command", required_argument, 0, 'x'}, {"version", no_argument, &print_version, 1}, {"x", required_argument, 0, 'x'}, +/* start-sanitize-gdbtk */ + {"tclcommand", required_argument, 0, 'z'}, +/* end-sanitize-gdbtk */ {"directory", required_argument, 0, 'd'}, {"cd", required_argument, 0, 11}, {"tty", required_argument, 0, 't'}, @@ -250,6 +256,19 @@ main (argc, argv) cmdsize * sizeof (*cmdarg)); } break; + /* start-sanitize-gdbtk */ + case 'z': + { + extern int gdbtk_test PARAMS ((char *)); + if (!gdbtk_test (optarg)) + { + fprintf_unfiltered (gdb_stderr, "%s: unable to load tclcommand file \"%s\"", + argv[0], optarg); + exit (1); + } + break; + } + /* end-sanitize-gdbtk */ case 'd': dirarg[ndir++] = optarg; if (ndir >= dirsize) @@ -445,8 +464,12 @@ main (argc, argv) it, better only print one error message. */ if (!SET_TOP_LEVEL ()) { + if (pre_add_symbol_hook) + pre_add_symbol_hook (symarg); exec_file_command (execarg, !batch); symbol_file_command (symarg, 0); + if (post_add_symbol_hook) + post_add_symbol_hook (); } } else -- cgit v1.1