OSDN Git Service

* library/session.tcl (session_save): Use gdb_get_inferior_args.
authorTom Tromey <tromey@redhat.com>
Wed, 18 Apr 2001 16:49:38 +0000 (16:49 +0000)
committerTom Tromey <tromey@redhat.com>
Wed, 18 Apr 2001 16:49:38 +0000 (16:49 +0000)
* generic/gdbtk-cmds.c (inferior_args): Removed.
(Gdbtk_Init): Don't register gdb_inferior_args variable.  Do
register gdb_get_inferior_args function.
(gdb_get_inferior_args): New function.

gdb/gdbtk/ChangeLog
gdb/gdbtk/generic/gdbtk-cmds.c
gdb/gdbtk/library/session.tcl

index 7b19f33..72b325e 100644 (file)
@@ -1,3 +1,11 @@
+2001-04-17  Tom Tromey  <tromey@redhat.com>
+
+       * library/session.tcl (session_save): Use gdb_get_inferior_args.
+       * generic/gdbtk-cmds.c (inferior_args): Removed.
+       (Gdbtk_Init): Don't register gdb_inferior_args variable.  Do
+       register gdb_get_inferior_args function.
+       (gdb_get_inferior_args): New function.
+
 2001-04-17  Fernando Nasser  <fnasser@redhat.com>
 
        * library/variables.tcl (update): Temporary fix to the detection of
index a4960fb..35f2695 100644 (file)
@@ -64,9 +64,6 @@
 
 /* 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);
@@ -236,6 +233,9 @@ static int gdb_loadfile (ClientData, Tcl_Interp *, int,
                         Tcl_Obj * CONST objv[]);
 static int gdb_load_disassembly (ClientData clientData, Tcl_Interp
                                 * interp, int objc, Tcl_Obj * CONST objv[]);
+static int gdb_get_inferior_args (ClientData clientData,
+                                 Tcl_Interp *interp,
+                                 int objc, Tcl_Obj * CONST objv[]);
 static int gdb_load_info (ClientData, Tcl_Interp *, int,
                          Tcl_Obj * CONST objv[]);
 static int gdb_loc (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]);
@@ -419,6 +419,8 @@ Gdbtk_Init (interp)
                        gdb_get_blocks, NULL);
   Tcl_CreateObjCommand (interp, "gdb_block_variables", call_wrapper,
                        gdb_block_vars, NULL);
+  Tcl_CreateObjCommand (interp, "gdb_get_inferior_args", call_wrapper,
+                       gdb_get_inferior_args, NULL);
 
   Tcl_LinkVar (interp, "gdb_selected_frame_level",
               (char *) &selected_frame_level,
@@ -445,12 +447,6 @@ Gdbtk_Init (interp)
               (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;
@@ -986,6 +982,33 @@ gdb_target_has_execution_command (clientData, interp, objc, objv)
   return TCL_OK;
 }
 
+/* This implements the tcl command "gdb_get_inferior_args"
+
+ * Returns inferior command line arguments as a string
+ *
+ * Tcl Arguments:
+ *    None
+ * Tcl Result:
+ *    A string containing the inferior command line arguments
+ */
+
+static int
+gdb_get_inferior_args (clientData, interp, objc, objv)
+     ClientData clientData;
+     Tcl_Interp *interp;
+     int objc;
+     Tcl_Obj *CONST objv[];
+{
+  if (objc != 1)
+    {
+      Tcl_WrongNumArgs (interp, 1, objv, NULL);
+      return TCL_ERROR;
+    }
+
+  Tcl_SetStringObj (result_ptr->obj_ptr, get_inferior_args (), -1);
+  return TCL_OK;
+}
+
 /* This implements the tcl command "gdb_load_info"
 
  * It returns information about the file about to be downloaded.
index d4f3ec6..e9de8d7 100644 (file)
@@ -21,7 +21,7 @@
 #
 proc session_save {} {
   global gdb_exe_name gdb_target_name
-  global gdb_current_directory gdb_source_path gdb_inferior_args
+  global gdb_current_directory gdb_source_path
 
   # gdb sessions are named after the executable.
   set name $gdb_exe_name
@@ -34,7 +34,7 @@ proc session_save {} {
   set values(executable) $gdb_exe_name
 
   # Some simple state the user wants.
-  set values(args) $gdb_inferior_args
+  set values(args) [gdb_get_inferior_args]
   set values(dirs) $gdb_source_path
   set values(pwd) $gdb_current_directory
   set values(target) $gdb_target_name