From 1adeb98a32c1291fbc8cb812bdc8d39d221c6fe5 Mon Sep 17 00:00:00 2001 From: Fernando Nasser Date: Sat, 27 Jan 2001 00:43:26 +0000 Subject: 2001-01-26 Fernando Nasser Fix double parsing of filenames passed as command line arguments to GDB (causes weird handling of escape characters). Also, remove dependencies on the CLI from libgdb. * call-cmds.h: Remove declaration of exec_file_command(). * gdbcore.h: Remove declaration of exec_file_command(). Add declarations for exec_open() and exec_file_clear(). * symfile.h: Add declarations for symbol_file_add_main() and symbol_file_clear(). * exec.c (exec_open): New function. Implements to_open for exec targets. (exec_file_clear): New function. Makes GDB forget about a previously specified executable file. (exec_file_attach): Move parsing of arguments from here ... (exec_file_command): ... to here. (init_exec_ops): Use exec_open(), not exec_file_command() to implement to_open for exec targets. * symfile.c (symbol_file_add_main): New function. Call symbol_file_add() with default values. Used when the file name has already been parsed. (symbol_file_clear): New function. Makes GDB forget about previously read symbols. (symbol_file_command): Call the above function instead of inline code. * main.c: Include "symfile.h" and "gdbcore.h" instead of the deprecated "call-cmds.h". (captured_main): Call exec_file_attach() and symbol_file_add_main() instead of exec_file_command() and symbol_file_command(). (captured_main): Add comment. * corefile.c: Include "symfile.h". (core_file_command): Call symbol_file_add_main() instead of symbol_file_command(). (reopen_exec_file): Call exec_open() instead of exec_file_command(). * infcmd.c: Include "symfile.h". (attach_command): Call symbol_file_add_main() instead of symbol_file_command(). * infrun.c: Remove comment about the inclusion of "symfile.h", not any longer appropriate. (follow_exec): Call symbol_file_add_main() instead of symbol_file_command(). * remote-es.c: Include "symfile.h". (es1800_load): Call symbol_file_add_main() instead of symbol_file_command(). * remote-vx.c: Remove comment about the inclusion of "symfile.h", not any longer appropriate. (vx-wait): Call symbol_file_add_main() instead of symbol_file_command(). * solib-svr4.c (open_symbol_file_object): Call symbol_file_add_main() instead of symbol_file_command(). * v850ice.c (ice_file): Call exec_open(), exec_file_attach() and symbol_file_add_main() instead of exec_file_command() and symbol_file_command(). * Makefile.in: Update dependencies. --- gdb/symfile.c | 57 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 21 deletions(-) (limited to 'gdb/symfile.c') diff --git a/gdb/symfile.c b/gdb/symfile.c index b0ae6e2..abeca3c 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -897,6 +897,41 @@ symbol_file_add (char *name, int from_tty, struct section_addr_info *addrs, return (objfile); } +/* Just call the above with default values. + Used when the file is supplied in the gdb command line. */ + +void +symbol_file_add_main (char *args, int from_tty) +{ + symbol_file_add (args, from_tty, NULL, 1, 0); +} + +void +symbol_file_clear (int from_tty) +{ + if ((have_full_symbols () || have_partial_symbols ()) + && from_tty + && !query ("Discard symbol table from `%s'? ", + symfile_objfile->name)) + error ("Not confirmed."); + free_all_objfiles (); + + /* solib descriptors may have handles to objfiles. Since their + storage has just been released, we'd better wipe the solib + descriptors as well. + */ +#if defined(SOLIB_RESTART) + SOLIB_RESTART (); +#endif + + symfile_objfile = NULL; + if (from_tty) + printf_unfiltered ("No symbol file now.\n"); +#ifdef HPUXHPPA + RESET_HP_UX_GLOBALS (); +#endif +} + /* This is the symbol-file command. Read the file, analyze its symbols, and add a struct symtab to a symtab list. The syntax of the command is rather bizarre--(1) buildargv implements various @@ -923,27 +958,7 @@ symbol_file_command (char *args, int from_tty) if (args == NULL) { - if ((have_full_symbols () || have_partial_symbols ()) - && from_tty - && !query ("Discard symbol table from `%s'? ", - symfile_objfile->name)) - error ("Not confirmed."); - free_all_objfiles (); - - /* solib descriptors may have handles to objfiles. Since their - storage has just been released, we'd better wipe the solib - descriptors as well. - */ -#if defined(SOLIB_RESTART) - SOLIB_RESTART (); -#endif - - symfile_objfile = NULL; - if (from_tty) - printf_unfiltered ("No symbol file now.\n"); -#ifdef HPUXHPPA - RESET_HP_UX_GLOBALS (); -#endif + symbol_file_clear (from_tty); } else { -- cgit v1.1