OSDN Git Service

* library/interface.tcl (run_executable): Use
authorTom Tromey <tromey@redhat.com>
Wed, 18 Apr 2001 17:44:00 +0000 (17:44 +0000)
committerTom Tromey <tromey@redhat.com>
Wed, 18 Apr 2001 17:44:00 +0000 (17:44 +0000)
gdb_set_inferior_args.
* library/session.tcl (session_load): Use gdb_set_inferior_args.
* generic/gdbtk-cmds.c (Gdbtk_Init): Register
gdb_set_inferior_args.
(gdb_get_inferior_args): New function.

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

index 72b325e..566b9d9 100644 (file)
@@ -1,3 +1,12 @@
+2001-04-18  Tom Tromey  <tromey@redhat.com>
+
+       * library/interface.tcl (run_executable): Use
+       gdb_set_inferior_args.
+       * library/session.tcl (session_load): Use gdb_set_inferior_args.
+       * generic/gdbtk-cmds.c (Gdbtk_Init): Register
+       gdb_set_inferior_args.
+       (gdb_get_inferior_args): New function.
+
 2001-04-17  Tom Tromey  <tromey@redhat.com>
 
        * library/session.tcl (session_save): Use gdb_get_inferior_args.
index 35f2695..e97cc2b 100644 (file)
@@ -236,6 +236,9 @@ static int gdb_load_disassembly (ClientData clientData, Tcl_Interp
 static int gdb_get_inferior_args (ClientData clientData,
                                  Tcl_Interp *interp,
                                  int objc, Tcl_Obj * CONST objv[]);
+static int gdb_set_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[]);
@@ -421,6 +424,8 @@ Gdbtk_Init (interp)
                        gdb_block_vars, NULL);
   Tcl_CreateObjCommand (interp, "gdb_get_inferior_args", call_wrapper,
                        gdb_get_inferior_args, NULL);
+  Tcl_CreateObjCommand (interp, "gdb_set_inferior_args", call_wrapper,
+                       gdb_set_inferior_args, NULL);
 
   Tcl_LinkVar (interp, "gdb_selected_frame_level",
               (char *) &selected_frame_level,
@@ -1009,6 +1014,43 @@ gdb_get_inferior_args (clientData, interp, objc, objv)
   return TCL_OK;
 }
 
+/* This implements the tcl command "gdb_set_inferior_args"
+
+ * Sets inferior command line arguments
+ *
+ * Tcl Arguments:
+ *    A string containing the inferior command line arguments
+ * Tcl Result:
+ *    None
+ */
+
+static int
+gdb_set_inferior_args (clientData, interp, objc, objv)
+     ClientData clientData;
+     Tcl_Interp *interp;
+     int objc;
+     Tcl_Obj *CONST objv[];
+{
+  char *args;
+
+  if (objc != 2)
+    {
+      Tcl_WrongNumArgs (interp, 1, objv, "argument");
+      return TCL_ERROR;
+    }
+
+  args = Tcl_GetStringFromObj (objv[1], NULL);
+
+  /* The xstrdup/xfree stuff is so that we maintain a coherent picture
+     for gdb.  I would expect the accessors to do this, but they
+     don't.  */
+  args = xstrdup (args);
+  args = set_inferior_args (args);
+  xfree (args);
+
+  return TCL_OK;
+}
+
 /* This implements the tcl command "gdb_load_info"
 
  * It returns information about the file about to be downloaded.
index 69eded1..b95f57e 100644 (file)
@@ -1114,7 +1114,7 @@ proc run_executable { {auto_start 1} } {
       set gdb_args [pref getd gdb/load/$gdb_target_name-opts]
       if { $gdb_args != ""} {
        debug "set args $gdb_args"
-       catch {gdb_cmd "set args $gdb_args"}
+       gdb_set_inferior_args $gdb_args
       }
     }
 
index e9de8d7..50f2c3d 100644 (file)
@@ -79,7 +79,7 @@ proc session_load {name} {
   }
 
   if {[info exists values(args)]} {
-    gdb_cmd "set args $values(args)"
+    gdb_set_inferior_args $values(args)
   }
 
   if {[info exists values(executable)]} {