OSDN Git Service

* gdbtk-cmds.c (Gdbtk_Init): Create gdb_current_directory,
authortromey <tromey>
Thu, 7 Dec 2000 22:33:27 +0000 (22:33 +0000)
committertromey <tromey>
Thu, 7 Dec 2000 22:33:27 +0000 (22:33 +0000)
gdb_inferior_args, and gdb_source_path variables.

gdb/gdbtk/generic/ChangeLog
gdb/gdbtk/generic/gdbtk-cmds.c

index 6fdf075..54033c0 100644 (file)
@@ -1,5 +1,10 @@
 2000-11-29  Tom Tromey  <tromey@cygnus.com>
 
+       * gdbtk-cmds.c (Gdbtk_Init): Create gdb_current_directory,
+       gdb_inferior_args, and gdb_source_path variables.
+
+2000-11-29  Tom Tromey  <tromey@cygnus.com>
+
        * gdbtk-cmds.c (call_wrapper): Don't reset result if wrapped
        command returned error.
 
index 4e20d08..c213d38 100644 (file)
 #include "annotate.h"
 #include <sys/time.h>
 
+/* Various globals we reference.  */
+extern char *source_path;
+/* FIXME: this must be `extern'.  But to do that we need a patch to
+   infcmd.c.  */
+static char *inferior_args = "";
+
 static void setup_architecture_data (void);
 static int tracepoint_exists (char *args);
 
@@ -418,6 +424,28 @@ Gdbtk_Init (interp)
               (char *) &gdb_context,
               TCL_LINK_INT | TCL_LINK_READ_ONLY);
 
+  /* Make gdb's notion of the pwd visible.  This is read-only because
+     (1) it doesn't make sense to change it directly and (2) it is
+     allocated using xmalloc and not Tcl_Alloc.  You might think we
+     could just use the Tcl `pwd' command.  However, Tcl (erroneously,
+     imho) maintains a cache of the current directory name, and
+     doesn't provide a way for gdb to invalidate the cache.  */
+  Tcl_LinkVar (interp, "gdb_current_directory",
+              (char *) &current_directory,
+              TCL_LINK_STRING | TCL_LINK_READ_ONLY);
+
+  /* Current gdb source file search path.  This is read-only for
+     reasons similar to those for gdb_current_directory.  */
+  Tcl_LinkVar (interp, "gdb_source_path",
+              (char *) &source_path,
+              TCL_LINK_STRING | TCL_LINK_READ_ONLY);
+
+  /* Current inferior command-line arguments.  This is read-only for
+     reasons similar to those for gdb_current_directory.  */
+  Tcl_LinkVar (interp, "gdb_inferior_args",
+              (char *) &inferior_args,
+              TCL_LINK_STRING | TCL_LINK_READ_ONLY);
+
   /* Init variable interface... */
   if (gdb_variable_init (interp) != TCL_OK)
     return TCL_ERROR;