This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFC: Fix to double parsing of filenames in GDB command line


For those who asked, this is the CLI fix to the double parsing of
filenames
when supplied as command line arguments to gdb.  For the one who do not
know,
we currently do a very funky processing of escape characters in this
case
(we process then twice).  This is caused by improper calls to CLI code.

I fixed this by doing one more round of libgdb -x- cli separation.

The changes affect several files, but it is mostly CLI code that is
still scattered 
everywhere.  I had to adjust 3 target files to call the appropriate
libgdb calls instead
of CLI code though.

There are no testsuite regressions.  My plan is to check those changes
in on Friday.
Please take a look, if possible try the patch.  Feedback is appreciated.

Thanks.


        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.

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9
? DIFF
? gdb.proj
? .snprj
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.903
diff -c -p -r1.903 ChangeLog
*** ChangeLog	2001/01/24 16:28:19	1.903
--- ChangeLog	2001/01/25 03:44:44
***************
*** 1,5 ****
--- 1,58 ----
  2001-01-24  Fernando Nasser  <fnasser@redhat.com>
  
+ 	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.
+ 
+ 2001-01-24  Fernando Nasser  <fnasser@redhat.com>
+ 
  	* infcmd.c (get_inferior_args, set_inferior_args): Accessor functions
  	for the inferior program arguments.
  	(run_command, run_no_args_command, init_infcmd)): Use accessor
Index: call-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/call-cmds.h,v
retrieving revision 1.4
diff -c -p -r1.4 call-cmds.h
*** call-cmds.h	2000/12/21 16:08:52	1.4
--- call-cmds.h	2001/01/25 03:44:44
***************
*** 25,32 ****
  
  extern void initialize_all_files (void);
  
- extern void exec_file_command (char *, int);
- 
  extern void core_file_command (char *, int);
  
  extern void break_command (char *, int);
--- 25,30 ----
Index: corefile.c
===================================================================
RCS file: /cvs/src/src/gdb/corefile.c,v
retrieving revision 1.9
diff -c -p -r1.9 corefile.c
*** corefile.c	2000/12/15 01:01:46	1.9
--- corefile.c	2001/01/25 03:44:44
***************
*** 29,34 ****
--- 29,35 ----
  #include "symtab.h"
  #include "command.h"
  #include "gdbcmd.h"
+ #include "symfile.h"
  #include "bfd.h"
  #include "target.h"
  #include "gdbcore.h"
*************** core_file_command (char *filename, int f
*** 92,98 ****
  		char *symfile_copy = xstrdup (symfile);
  
  		make_cleanup (xfree, symfile_copy);
! 		symbol_file_command (symfile_copy, from_tty);
  	      }
  	    else
  	      warning ("Unknown symbols for '%s'; use the 'symbol-file' command.", filename);
--- 93,99 ----
  		char *symfile_copy = xstrdup (symfile);
  
  		make_cleanup (xfree, symfile_copy);
! 		symbol_file_add_main (symfile_copy, from_tty);
  	      }
  	    else
  	      warning ("Unknown symbols for '%s'; use the 'symbol-file' command.", filename);
*************** reopen_exec_file (void)
*** 188,194 ****
    res = stat (filename, &st);
  
    if (mtime && mtime != st.st_mtime)
!     exec_file_command (filename, 0);
  #endif
  }
  
--- 189,197 ----
    res = stat (filename, &st);
  
    if (mtime && mtime != st.st_mtime)
!     {
!       exec_open (filename, 0);
!     }
  #endif
  }
  
Index: exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.9
diff -c -p -r1.9 exec.c
*** exec.c	2001/01/23 22:48:55	1.9
--- exec.c	2001/01/25 03:44:44
*************** CORE_ADDR text_end = 0;
*** 94,99 ****
--- 94,106 ----
  
  struct vmap *vmap;
  
+ void
+ exec_open (char *args, int from_tty)
+ {
+   target_preopen (from_tty);
+   exec_file_attach (args, from_tty);
+ }
+ 
  /* ARGSUSED */
  static void
  exec_close (int quitting)
*************** exec_close (int quitting)
*** 150,155 ****
--- 157,172 ----
      }
  }
  
+ void
+ exec_file_clear (int from_tty)
+ {
+   /* Remove exec file.  */
+   unpush_target (&exec_ops);
+ 
+   if (from_tty)
+     printf_unfiltered ("No executable file now.\n");
+ }
+ 
  /*  Process the first arg in ARGS as the new exec file.
  
     This function is intended to be behave essentially the same
*************** exec_close (int quitting)
*** 165,206 ****
     given a pid but not a exec pathname, and the attach command could
     figure out the pathname from the pid.  (In this case, we shouldn't
     ask the user whether the current target should be shut down --
!    we're supplying the exec pathname late for good reason.) */
  
  void
! exec_file_attach (char *args, int from_tty)
  {
-   char **argv;
-   char *filename;
- 
    /* Remove any previous exec file.  */
    unpush_target (&exec_ops);
  
    /* Now open and digest the file the user requested, if any.  */
  
!   if (args)
      {
        char *scratch_pathname;
        int scratch_chan;
  
-       /* Scan through the args and pick up the first non option arg
-          as the filename.  */
- 
-       argv = buildargv (args);
-       if (argv == NULL)
- 	nomem (0);
- 
-       make_cleanup_freeargv (argv);
- 
-       for (; (*argv != NULL) && (**argv == '-'); argv++)
- 	{;
- 	}
-       if (*argv == NULL)
- 	error ("No executable file name was specified");
- 
-       filename = tilde_expand (*argv);
-       make_cleanup (xfree, filename);
- 
        scratch_chan = openp (getenv ("PATH"), 1, filename,
  		   write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY, 0,
  			    &scratch_pathname);
--- 182,209 ----
     given a pid but not a exec pathname, and the attach command could
     figure out the pathname from the pid.  (In this case, we shouldn't
     ask the user whether the current target should be shut down --
!    we're supplying the exec pathname late for good reason.)
!    
!    ARGS is assumed to be the filename. */
  
  void
! exec_file_attach (char *filename, int from_tty)
  {
    /* Remove any previous exec file.  */
    unpush_target (&exec_ops);
  
    /* Now open and digest the file the user requested, if any.  */
  
!   if (!filename)
!     {
!       if (from_tty)
!         printf_unfiltered ("No executable file now.\n");
!     }
!   else
      {
        char *scratch_pathname;
        int scratch_chan;
  
        scratch_chan = openp (getenv ("PATH"), 1, filename,
  		   write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY, 0,
  			    &scratch_pathname);
*************** exec_file_attach (char *args, int from_t
*** 298,318 ****
        if (exec_file_display_hook)
  	(*exec_file_display_hook) (filename);
      }
-   else if (from_tty)
-     printf_unfiltered ("No executable file now.\n");
  }
  
  /*  Process the first arg in ARGS as the new exec file.
  
     Note that we have to explicitly ignore additional args, since we can
     be called from file_command(), which also calls symbol_file_command()
!    which can take multiple args. */
  
! void
  exec_file_command (char *args, int from_tty)
  {
    target_preopen (from_tty);
!   exec_file_attach (args, from_tty);
  }
  
  /* Set both the exec file and the symbol file, in one command.  
--- 301,347 ----
        if (exec_file_display_hook)
  	(*exec_file_display_hook) (filename);
      }
  }
  
  /*  Process the first arg in ARGS as the new exec file.
  
     Note that we have to explicitly ignore additional args, since we can
     be called from file_command(), which also calls symbol_file_command()
!    which can take multiple args.
!    
!    If ARGS is NULL, we just want to close the exec file. */
  
! static void
  exec_file_command (char *args, int from_tty)
  {
+   char **argv;
+   char *filename;
+   
    target_preopen (from_tty);
! 
!   if (args)
!     {
!       /* Scan through the args and pick up the first non option arg
!          as the filename.  */
! 
!       argv = buildargv (args);
!       if (argv == NULL)
!         nomem (0);
! 
!       make_cleanup_freeargv (argv);
! 
!       for (; (*argv != NULL) && (**argv == '-'); argv++)
!         {;
!         }
!       if (*argv == NULL)
!         error ("No executable file name was specified");
! 
!       filename = tilde_expand (*argv);
!       make_cleanup (xfree, filename);
!       exec_file_attach (filename, from_tty);
!     }
!   else
!     exec_file_attach (NULL, from_tty);
  }
  
  /* Set both the exec file and the symbol file, in one command.  
*************** init_exec_ops (void)
*** 666,672 ****
    exec_ops.to_longname = "Local exec file";
    exec_ops.to_doc = "Use an executable file as a target.\n\
  Specify the filename of the executable file.";
!   exec_ops.to_open = exec_file_command;
    exec_ops.to_close = exec_close;
    exec_ops.to_attach = find_default_attach;
    exec_ops.to_require_attach = find_default_require_attach;
--- 695,701 ----
    exec_ops.to_longname = "Local exec file";
    exec_ops.to_doc = "Use an executable file as a target.\n\
  Specify the filename of the executable file.";
!   exec_ops.to_open = exec_open;
    exec_ops.to_close = exec_close;
    exec_ops.to_attach = find_default_attach;
    exec_ops.to_require_attach = find_default_require_attach;
Index: gdbcore.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbcore.h,v
retrieving revision 1.4
diff -c -p -r1.4 gdbcore.h
*** gdbcore.h	2000/06/04 00:41:09	1.4
--- gdbcore.h	2001/01/25 03:44:44
*************** extern int write_files;
*** 98,106 ****
  
  extern void core_file_command (char *filename, int from_tty);
  
  extern void exec_file_attach (char *filename, int from_tty);
  
! extern void exec_file_command (char *filename, int from_tty);
  
  extern void validate_files (void);
  
--- 98,108 ----
  
  extern void core_file_command (char *filename, int from_tty);
  
+ extern void exec_open (char *filename, int from_tty);
+ 
  extern void exec_file_attach (char *filename, int from_tty);
  
! extern void exec_file_clear (int from_tty);
  
  extern void validate_files (void);
  
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.17
diff -c -p -r1.17 infcmd.c
*** infcmd.c	2001/01/24 16:28:20	1.17
--- infcmd.c	2001/01/25 03:44:44
***************
*** 29,34 ****
--- 29,35 ----
  #include "environ.h"
  #include "value.h"
  #include "gdbcmd.h"
+ #include "symfile.h"
  #include "gdbcore.h"
  #include "target.h"
  #include "language.h"
*************** attach_command (char *args, int from_tty
*** 1701,1707 ****
  	    full_exec_path = savestring (exec_file, strlen (exec_file));
  
  	  exec_file_attach (full_exec_path, from_tty);
! 	  symbol_file_command (full_exec_path, from_tty);
  	}
      }
  
--- 1702,1708 ----
  	    full_exec_path = savestring (exec_file, strlen (exec_file));
  
  	  exec_file_attach (full_exec_path, from_tty);
! 	  symbol_file_add_main (full_exec_path, from_tty);
  	}
      }
  
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.23
diff -c -p -r1.23 infrun.c
*** infrun.c	2000/12/15 01:01:47	1.23
--- infrun.c	2001/01/25 03:44:45
***************
*** 31,37 ****
  #include "target.h"
  #include "gdbthread.h"
  #include "annotate.h"
! #include "symfile.h"		/* for overlay functions */
  #include "top.h"
  #include <signal.h>
  #include "inf-loop.h"
--- 31,37 ----
  #include "target.h"
  #include "gdbthread.h"
  #include "annotate.h"
! #include "symfile.h"
  #include "top.h"
  #include <signal.h>
  #include "inf-loop.h"
*************** follow_vfork (int parent_pid, int child_
*** 650,655 ****
--- 650,657 ----
      }
  }
  
+ /* EXECD_PATHNAME is assumed to be non-NULL. */
+ 
  static void
  follow_exec (int pid, char *execd_pathname)
  {
*************** follow_exec (int pid, char *execd_pathna
*** 727,733 ****
    exec_file_attach (execd_pathname, 0);
  
    /* And also is where symbols can be found. */
!   symbol_file_command (execd_pathname, 0);
  
    /* Reset the shared library package.  This ensures that we get
       a shlib event when the child reaches "_start", at which point
--- 729,735 ----
    exec_file_attach (execd_pathname, 0);
  
    /* And also is where symbols can be found. */
!   symbol_file_add_main (execd_pathname, 0);
  
    /* Reset the shared library package.  This ensures that we get
       a shlib event when the child reaches "_start", at which point
Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.5
diff -c -p -r1.5 main.c
*** main.c	2000/12/15 01:01:48	1.5
--- main.c	2001/01/25 03:44:45
***************
*** 22,28 ****
  #include "top.h"
  #include "target.h"
  #include "inferior.h"
! #include "call-cmds.h"
  
  #include "getopt.h"
  
--- 22,29 ----
  #include "top.h"
  #include "target.h"
  #include "inferior.h"
! #include "symfile.h"
! #include "gdbcore.h"
  
  #include "getopt.h"
  
*************** extern int gdbtk_test (char *);
*** 474,479 ****
--- 475,481 ----
  	  execarg = argv[optind];
  	  break;
  	case 2:
+ 	  /* FIXME: The documentation says this can be a "ProcID". as well. */
  	  corearg = argv[optind];
  	  break;
  	case 3:
*************** extern int gdbtk_test (char *);
*** 592,606 ****
        /* The exec file and the symbol-file are the same.  If we can't
           open it, better only print one error message.
           catch_command_errors returns non-zero on success! */
!       if (catch_command_errors (exec_file_command, execarg, !batch, RETURN_MASK_ALL))
! 	catch_command_errors (symbol_file_command, symarg, 0, RETURN_MASK_ALL);
      }
    else
      {
        if (execarg != NULL)
! 	catch_command_errors (exec_file_command, execarg, !batch, RETURN_MASK_ALL);
        if (symarg != NULL)
! 	catch_command_errors (symbol_file_command, symarg, 0, RETURN_MASK_ALL);
      }
  
    /* After the symbol file has been read, print a newline to get us
--- 594,608 ----
        /* The exec file and the symbol-file are the same.  If we can't
           open it, better only print one error message.
           catch_command_errors returns non-zero on success! */
!       if (catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL))
! 	catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL);
      }
    else
      {
        if (execarg != NULL)
! 	catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL);
        if (symarg != NULL)
! 	catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL);
      }
  
    /* After the symbol file has been read, print a newline to get us
Index: remote-es.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-es.c,v
retrieving revision 1.9
diff -c -p -r1.9 remote-es.c
*** remote-es.c	2001/01/23 22:48:55	1.9
--- remote-es.c	2001/01/25 03:44:46
***************
*** 106,111 ****
--- 106,112 ----
  #include "target.h"
  #include "gdb_wait.h"
  #include "command.h"
+ #include "symfile.h"
  #include "remote-utils.h"
  #include "gdbcore.h"
  #include "serial.h"
*************** es1800_load (char *filename, int from_tt
*** 1318,1324 ****
        system (buf);
      }
  
!   symbol_file_command (filename, from_tty);	/* reading symbol table */
    immediate_quit--;
  }
  
--- 1319,1325 ----
        system (buf);
      }
  
!   symbol_file_add_main (filename, from_tty);	/* reading symbol table */
    immediate_quit--;
  }
  
Index: remote-vx.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-vx.c,v
retrieving revision 1.11
diff -c -p -r1.11 remote-vx.c
*** remote-vx.c	2001/01/23 22:48:55	1.11
--- remote-vx.c	2001/01/25 03:44:46
***************
*** 30,36 ****
  #include "complaints.h"
  #include "gdbcmd.h"
  #include "bfd.h"		/* Required by objfiles.h.  */
! #include "symfile.h"		/* Required by objfiles.h.  */
  #include "objfiles.h"
  #include "gdb-stabs.h"
  
--- 30,36 ----
  #include "complaints.h"
  #include "gdbcmd.h"
  #include "bfd.h"		/* Required by objfiles.h.  */
! #include "symfile.h"
  #include "objfiles.h"
  #include "gdb-stabs.h"
  
*************** vx_wait (int pid_to_wait_for, struct tar
*** 1039,1045 ****
  static int
  symbol_stub (char *arg)
  {
!   symbol_file_command (arg, 0);
    return 1;
  }
  
--- 1039,1045 ----
  static int
  symbol_stub (char *arg)
  {
!   symbol_file_add_main (arg, 0);
    return 1;
  }
  
Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.6
diff -c -p -r1.6 solib-svr4.c
*** solib-svr4.c	2000/12/15 02:04:59	1.6
--- solib-svr4.c	2001/01/25 03:44:46
*************** open_symbol_file_object (void *from_ttyp
*** 940,946 ****
  
    make_cleanup (xfree, filename);
    /* Have a pathname: read the symbol file.  */
!   symbol_file_command (filename, from_tty);
  
    return 1;
  }
--- 940,946 ----
  
    make_cleanup (xfree, filename);
    /* Have a pathname: read the symbol file.  */
!   symbol_file_add_main (filename, from_tty);
  
    return 1;
  }
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.23
diff -c -p -r1.23 symfile.c
*** symfile.c	2001/01/19 08:01:46	1.23
--- symfile.c	2001/01/25 03:44:47
*************** symbol_file_add (char *name, int from_tt
*** 897,902 ****
--- 897,937 ----
    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
*************** symbol_file_command (char *args, int fro
*** 923,949 ****
  
    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
      }
    else
      {
--- 958,964 ----
  
    if (args == NULL)
      {
!       symbol_file_clear (from_tty);
      }
    else
      {
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.7
diff -c -p -r1.7 symfile.h
*** symfile.h	2000/12/05 18:28:25	1.7
--- symfile.h	2001/01/25 03:44:47
*************** extern CORE_ADDR overlay_unmapped_addres
*** 273,278 ****
--- 273,284 ----
  /* convert an address in an overlay section (force into VMA range) */
  extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
  
+ /* Load symbols from a file. */
+ extern void symbol_file_add_main (char *args, int from_tty);
+ 
+ /* Clear GDB symbol tables. */
+ extern void symbol_file_clear (int from_tty);
+ 
  /* From dwarfread.c */
  
  extern void
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.26
diff -c -p -r1.26 top.c
*** top.c	2000/12/20 21:24:26	1.26
--- top.c	2001/01/25 03:44:47
*************** print_gdb_version (struct ui_file *strea
*** 1394,1400 ****
  
    /* Second line is a copyright notice. */
  
!   fprintf_filtered (stream, "Copyright 2000 Free Software Foundation, Inc.\n");
  
    /* Following the copyright is a brief statement that the program is
       free software, that users are free to copy and change it on
--- 1394,1400 ----
  
    /* Second line is a copyright notice. */
  
!   fprintf_filtered (stream, "Copyright 2001 Free Software Foundation, Inc.\n");
  
    /* Following the copyright is a brief statement that the program is
       free software, that users are free to copy and change it on
Index: v850ice.c
===================================================================
RCS file: /cvs/src/src/gdb/v850ice.c,v
retrieving revision 1.6
diff -c -p -r1.6 v850ice.c
*** v850ice.c	2000/11/06 04:53:14	1.6
--- v850ice.c	2001/01/25 03:44:47
*************** ice_file (char *arg)
*** 794,804 ****
    /* Must supress from_tty, otherwise we could start asking if the
       user really wants to load a new symbol table, etc... */
    printf_unfiltered ("Reading symbols from %s...", arg);
!   exec_file_command (arg, 0);
!   symbol_file_command (arg, 0);
    printf_unfiltered ("done\n");
  
!   /* exec_file_command will kill our target, so reinstall the ICE as
       the target. */
    v850ice_open (NULL, 0);
  
--- 794,804 ----
    /* Must supress from_tty, otherwise we could start asking if the
       user really wants to load a new symbol table, etc... */
    printf_unfiltered ("Reading symbols from %s...", arg);
!   exec_open (arg, 0);
!   symbol_file_add_main (arg, 0);
    printf_unfiltered ("done\n");
  
!   /* exec_open will kill our target, so reinstall the ICE as
       the target. */
    v850ice_open (NULL, 0);
  
Index: gdbtk/generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.16
diff -c -p -r1.16 gdbtk-cmds.c
*** gdbtk-cmds.c	2000/12/07 22:33:27	1.16
--- gdbtk-cmds.c	2001/01/25 03:44:50
*************** gdb_clear_file (clientData, interp, objc
*** 635,642 ****
      pop_target ();
  
    delete_command (NULL, 0);
!   exec_file_command (NULL, 0);
!   symbol_file_command (NULL, 0);
  
    return TCL_OK;
  }
--- 635,642 ----
      pop_target ();
  
    delete_command (NULL, 0);
!   exec_file_clear (0);
!   symbol_file_clear (0);
  
    return TCL_OK;
  }
*************** gdb_find_file_command (clientData, inter
*** 1344,1350 ****
      filename = st->fullname;
  
    if (filename == NULL)
!     Tcl_SetStringObj (result_ptr->obj_ptr, "", 0);
    else
      Tcl_SetStringObj (result_ptr->obj_ptr, filename, -1);
  
--- 1344,1353 ----
      filename = st->fullname;
  
    if (filename == NULL)
!     {
!       Tcl_SetStringObj ( result_ptr->obj_ptr, "File not found in symtab (2)", -1);
!       return TCL_ERROR;
!     }
    else
      Tcl_SetStringObj (result_ptr->obj_ptr, filename, -1);
  
*************** gdbtk_dis_asm_read_memory (memaddr, myad
*** 3112,3118 ****
    int res;
  
    errno = 0;
!   res = xfer_memory (memaddr, myaddr, len, 0, &exec_ops);
  
    if (res == len)
      return 0;
--- 3115,3121 ----
    int res;
  
    errno = 0;
!   res = xfer_memory (memaddr, myaddr, len, 0, 0, &exec_ops);
  
    if (res == len)
      return 0;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]