On Wednesday 13 January 2010 18:49:15 Pedro Alves wrote: > > -void > > -tty_command (char *file, int from_tty) > > -{ > > - if (file == 0) > > - error_no_arg (_("terminal name for running target process")); > > - > > - set_inferior_io_terminal (file); > > -} > > If you're removing this, please delete the declaration in > inferior.h as well. > > > A generic comment: it is good (and the common practice) to name > the FOO command callbacks as "FOO_command" or > "set_FOO_command"/"show_FOO_command", so that we can find a command > implementation easily by just guessing and grepping. I am not sure I follow you. tty_command, although named as FOO_command, was not actually used as command anywhere I can see. Or do you refer to some other function? > > /* Common actions to take after creating any sort of inferior, by any > > means (running, attaching, connecting, et cetera). The target > > should be stopped. */ > > @@ -536,10 +534,7 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main) > > > > /* If there were other args, beside '&', process them. */ > > if (args) > > - { > > - char *old_args = set_inferior_args (xstrdup (args)); > > - xfree (old_args); > > - } > > + set_inferior_args (xstrdup (args)); > > There's inconsistency in the `args' memory managent. set_inferior_args > already xstrdups the incoming argument. What should stay? Can we have a > short comment in set_inferior_args's decription mentioning > who's supposed to manage the args' memory? /me wishes for std::string (and/or boost::shared_ptr) Fixed. > > @@ -2646,14 +2640,17 @@ _initialize_infcmd (void) > > > > /* add the filename of the terminal connected to inferior I/O */ > > add_setshow_filename_cmd ("inferior-tty", class_run, > > - &inferior_io_terminal, _("\ > > + &inferior_io_terminal_scratch, _("\ > > Set terminal for future runs of program being debugged."), _("\ > > Show terminal for future runs of program being debugged."), _("\ > > -Usage: set inferior-tty /dev/pts/1"), NULL, NULL, &setlist, &showlist); > > +Usage: set inferior-tty /dev/pts/1"), > > + notice_inferior_io_terminal_set, > > + show_inferior_io_terminal, > > + &setlist, &showlist); > > add_com_alias ("tty", "set inferior-tty", class_alias, 0); > > > > add_setshow_optional_filename_cmd ("args", class_run, > > - &inferior_args, _("\ > > + &inferior_args_scratch, _("\ > > Set argument list to give program being debugged when it is started."), _("\ > > Show argument list to give program being debugged when it is started."), _("\ > > Follow this command with any number of args, to be passed to the program."), > > diff --git a/gdb/inferior.h b/gdb/inferior.h > > index 9798ef1..048fc11 100644 > > --- a/gdb/inferior.h > > +++ b/gdb/inferior.h > > @@ -261,7 +261,7 @@ extern void attach_command (char *, int); > > > > extern char *get_inferior_args (void); > > > > -extern char *set_inferior_args (char *); > > +extern void set_inferior_args (char *); > > > > extern void set_inferior_args_vector (int, char **); > > > > @@ -427,6 +427,18 @@ struct inferior > > /* The program space bound to this inferior. */ > > struct program_space *pspace; > > > > + /* The arguments string to use when running. */ > > + char *args; > > + > > + /* The size of elements in argv. */ > > + int argc; > > + > > + /* The vector version of arguments. */ > > + char **argv; > > + > > + /* The name of terminal device to use for I/O. */ > > + char *terminal; > > + > > These are all leaking when the inferior is deleted. Here's a revised version. - Volodya