This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFA/RFC: Patch: make `inferior_args' visible to gdbtk (2nd try)
- To: gdb-patches at sources dot redhat dot com
- Subject: RFA/RFC: Patch: make `inferior_args' visible to gdbtk (2nd try)
- From: Fernando Nasser <fnasser at cygnus dot com>
- Date: Fri, 08 Dec 2000 15:14:12 -0500
- Organization: Red Hat , Inc. - Toronto
The UIs to gdb need to access some gdb variables. Both the GUI and the
new CLI (which is outside libgdb) must have access to some information
that can be changed or must be displayed at user request.
Instead of making the variable global, the following patch creates a pair
of accessor routines compatible with the way the CLI uses the variables,
so instead of specifying a variable you can give the GUI a pair of accessor
functions.
I admit we can (and should) devise some more clever scheme to deal with these
gdb internal values that must be shared, but we would like to check the one
below in so that some important enhancements to the GUI can become operational.
So, this message asks two things:
1) RFA: OK to commit the one below?
2) RFC: What do you suggest to solve these problems in a generic way?
Thanks.
Fernando
ChangeLog:
* infcmd.c (get_inferior_args, set_inferior_args): New functions.
Accessor functions for inferior_args.
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.13
diff -c -p -r1.13 infcmd.c
*** infcmd.c 2000/11/10 19:27:45 1.13
--- infcmd.c 2000/12/08 19:40:49
*************** 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
*************** 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);
}
--- 1961,1967 ----
add_info ("float", float_info,
"Print the status of the floating point unit\n");
! set_inferior_args (savestring ("", 1)); /* Initially no args */
inferior_environ = make_environ ();
init_environ (inferior_environ);
}
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9