public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Insight List <insight@sourceware.cygnus.com>
Subject: Patch: save inferior command line arguments
Date: Tue, 17 Apr 2001 17:54:00 -0000	[thread overview]
Message-ID: <87oftv819o.fsf@creche.redhat.com> (raw)

This patch makes it so that command line arguments to the inferior are
saved in the session.  Fernando wrote the code in infcmd.c to allow
this, but the Insight piece was never written (or at least never
checked in).

Ok to commit?

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.

Tom

Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.28
diff -u -r1.28 gdbtk-cmds.c
--- gdbtk-cmds.c	2001/04/12 19:46:41	1.28
+++ gdbtk-cmds.c	2001/04/18 00:54:13
@@ -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 @@
 			 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 @@
 			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 @@
 	       (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;
@@ -983,6 +979,33 @@
     result = 1;
 
   Tcl_SetBooleanObj (result_ptr->obj_ptr, result);
+  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;
 }
 
Index: library/session.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/session.tcl,v
retrieving revision 1.4
diff -u -r1.4 session.tcl
--- session.tcl	2000/12/13 22:59:03	1.4
+++ session.tcl	2001/04/18 00:54:13
@@ -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 @@
   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

             reply	other threads:[~2001-04-17 17:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-17 17:54 Tom Tromey [this message]
2001-04-18  8:35 ` Keith Seitz
2001-04-18  9:14   ` Fernando Nasser
2001-04-18  9:16     ` Keith Seitz
2001-04-18  9:22       ` Fernando Nasser
2001-04-18  9:26         ` Keith Seitz
2001-04-18  9:50           ` Tom Tromey
2001-04-18 10:03     ` Tom Tromey
2001-04-18 10:08       ` Keith Seitz
2001-04-18 10:43         ` Tom Tromey
2001-04-18 10:47           ` Keith Seitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oftv819o.fsf@creche.redhat.com \
    --to=tromey@redhat.com \
    --cc=insight@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).