This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFA: Patch: make `inferior_args' visible to gdbtk (3rd try)
- To: gdb-patches at sources dot redhat dot com, Andrew Cagney <cagney at cygnus dot com>
- Subject: RFA: Patch: make `inferior_args' visible to gdbtk (3rd try)
- From: Fernando Nasser <fnasser at cygnus dot com>
- Date: Mon, 22 Jan 2001 23:31:09 +0000
- Organization: Red Hat Canada Ltd. - Toronto
I posted this patch in Dec 8, 2000. The only comment I got (on Dec 14, 2000)
was that I should replace the (previously existent) savestring() call with
a call to xstrdup() when changing the line that had that call.
I have already made the required change. I have also eliminated the calls
to the cli code (execute_command) as they are not any longer necessary.
OK to commit?
* 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
functions to set the inferior program arguments.
* inferior.h: Add definitions to the accessor functions above.
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.12
diff -c -p -r1.12 inferior.h
*** inferior.h 2000/11/10 19:27:45 1.12
--- inferior.h 2001/01/22 22:24:31
*************** extern void tty_command (char *, int);
*** 285,290 ****
--- 285,294 ----
extern void attach_command (char *, int);
+ extern char *get_inferior_arg (void);
+
+ extern char *set_inferior_arg (char *);
+
/* Last signal that the inferior received (why it stopped). */
extern enum target_signal stop_signal;
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.16
diff -c -p -r1.16 infcmd.c
*** infcmd.c 2001/01/18 16:11:22 1.16
--- infcmd.c 2001/01/22 22:24:32
*************** int step_multi;
*** 191,197 ****
--- 191,214 ----
struct environ *inferior_environ;
+ /* Accessor routines. */
+ char *
+ get_inferior_args (void)
+ {
+ return inferior_args;
+ }
+
+ char *
+ set_inferior_args (char *newargs)
+ {
+ char *saved_args = inferior_args;
+
+ inferior_args = newargs;
+
+ return saved_args;
+ }
+
/* This function detects whether or not a '&' character (indicating
background execution) has been added as *the last* of the arguments ARGS
of a command. If it has, it removes it and returns 1. Otherwise it
*************** Start it from the beginning? "))
*** 280,286 ****
}
else
{
- char *cmd;
int async_exec = strip_bg_char (&args);
/* If we get a request for running in the bg but the target
--- 297,302 ----
*************** Start it from the beginning? "))
*** 299,307 ****
/* If there were other args, beside '&', process them. */
if (args)
{
! cmd = concat ("set args ", args, NULL);
! make_cleanup (xfree, cmd);
! execute_command (cmd, from_tty);
}
}
--- 315,322 ----
/* If there were other args, beside '&', process them. */
if (args)
{
! char *old_args = set_inferior_args (xstrdup (args));
! xfree (old_args);
}
}
*************** Start it from the beginning? "))
*** 335,342 ****
static void
run_no_args_command (char *args, int from_tty)
{
! execute_command ("set args", from_tty);
! run_command ((char *) NULL, from_tty);
}
--- 350,357 ----
static void
run_no_args_command (char *args, int from_tty)
{
! char *old_args = set_inferior_args (xstrdup (""));
! xfree (old_args);
}
*************** Register name as argument means describe
*** 1944,1950 ****
add_info ("float", float_info,
"Print the status of the floating point unit\n");
! inferior_args = savestring ("", 1); /* Initially no args */
inferior_environ = make_environ ();
init_environ (inferior_environ);
}
--- 1959,1965 ----
add_info ("float", float_info,
"Print the status of the floating point unit\n");
! set_inferior_args (xstrdup ("")); /* Initially no args */
inferior_environ = make_environ ();
init_environ (inferior_environ);
}