"J. Johnston" wrote: > > Elena Zannoni wrote: > > > > J. Johnston writes: > > > Elena Zannoni wrote: > > > > > > > > J. Johnston writes: > > > > > The following solves a number of problems with the mi -environment commands. > > > > > For starters, each command now has an mi cmd wrapper so arguments may use the > > > > > syntax of adding double-quotes to handle extraneous characters such as spaces. > > > > > > > > > > The -environment-pwd command now lists the output in mi syntax: > > > > > > > > > > e.g. > > > > > -environment-pwd > > > > > ^done,cwd="...." > > > > > > > > > > The -environment-directory command has been changed to output in mi format. > > > > > It also has been changed to allow for no arguments being passed. > > > > > If no arguments are passed, it behaves like the gdb dir command and resets the > > > > > source search path to the default, however, no confirmation query is performed. If an empty > > > > > string "" is passed, it is ignored so this can be used to display the current > > > > > search path without modifying it. > > > > > > > > > > e.g. > > > > > -environment-directory /usr/bin /usr/local/bin > > > > > ^done,source-path="/usr/bin:/usr/local/bin:$cdir:$cwd" > > > > > > > > > > The -environment-path command has been changed to output in mi format. > > > > > It also has been changed to allow for no arguments being passed. When > > > > > no arguments are passed, the current object search path is displayed. > > > > > > > > > > e.g. > > > > > -environment-path > > > > > ^done,path="....." > > > > > > > > > > For mi1 or below, the previous behavior is preserved by rerouting the commands > > > > > to their old cli counterparts. > > > > > > > > Hmmm, I think the testsuite changes are ok. Also the addition of the > > > > new file is fine. However I don't think we should be duplicating the > > > > mod_path() code. Would it be possible to maybe split mod_path() in 2 > > > > or more functions, and have MI call one of them? > > > > I mean > > > > > > > > mod_path() > > > > { > > > > do_cli_specific_stuff; > > > > call add_path(args1); > > > > .... > > > > } > > > > > > > > mi_env_path() > > > > { > > > > do_mi_specific_stuff; > > > > call add_path(args2); > > > > ..... > > > > } > > > > > > > > similarly for other code that may have been duplicated. > > > > > > > > Thanks > > > > Elena > > > > > > I have taken your advice and have added a new interface: add_path which takes > > > an additional argument. The mod_path() routine calls it one way, the mi code > > > calls it another. Of the other code I copied, there is no value add in trying > > > to make it common as I copied a few lines here and there. > > > > > > I found I had to modify the tilde_expand() prototype in defs.h to get my > > > build working. I have a combined source tree and there was a conflict with > > > tilde.h found in the readline directory. The defs.h prototype was not > > > declaring the argument as const. > > > > > > > Ah, right. readline has changed tilde_expand. You must have a newer > > version of realine installed? We cannot make that change yet, because > > we need to build with the readline in our source tree, unfortunately. > > But the upgrade of readline is coming soon. (which reminds me...) > > > > Ok, maybe I am bit confused. I thought the readline directory containing the > header file is from my latest sourceware gdb checkout. > > > I don't like one minor thing. The inconsistent meaning of the 'no argument' > > for env-path and env-dir. I would think it would be more intuitive if both > > would behave the same w/o argument: display the current values. > > Maybe have a "--reset" or something like that to restore the defaults? > > (suggestions welcome). > > > > The proposed behavior is mimicking the gdb command line which resets > when you do a dir with no arguments (sans prompt) and shows the current > path when you do a path with no arguments. I have no problem with > adding an option to the env-dir command to make it a more explicit operation. > > > Otherwise the patch is ok, except for a couple of little things. The > > comments. They need to start with a capital letter and end with a > > period, and 2 spaces after periods. (I know, it's a pain) No externs > > in .c files: include inferior.h (update Makefile) and add source_path > > to defs.h. > > > > Done. I will resubmit when I add the reset option and > yes, I will remember to put the PR number in the ChangeLogs. > Ok, hopefully the last iteration of this. Eli, the doc has changed because of the new reset option. gdb/ChangeLog: 2002-11-11 Jeff Johnston * defs.h (init_last_source_visited): New prototype. (add_path): Ditto. * source.c (add_path): New function that adds to a specified path. (mod_path): Change to call add_path. (init_last_source_visited): New function to allow interfaces to initialize static variable: last_source_visited. Part of fix for PR gdb/741. * Makefile.in: Add support for mi/mi-cmd-env.c. gdb/mi/ChangeLog: 2002-11-11 Jeff Johnston * mi-cmds.c (-environment-directory) Change to use mi_cmd_env_dir, (-environment-cd): Change to use mi_cmd_env_cd,. (-environment-pwd): Change to use mi_cmd_env_pwd. (-environment-path): Change to use mi_cmd_env_path. * mi-cmds.h (mi_cmd_env_cd, mi_cmd_env_dir): New prototypes. (mi_cmd_env_path, mi_cmd_env_pwd): Ditto. * mi-cmd-env.c: New file. Part of fix for PR gdb/741. * gdbmi.texinfo (environment-cd): Update output and example. (environment-pwd): Ditto. (environment-dir): Update output, description, and examples. (environment-path): Ditto. gdb/testsuite/gdb.mi/ChangeLog: 2002-11-11 Jeff Johnston * mi-basics.exp: Change tests for -environment-directory. Also add tests for -environment-cd and -environment-pwd. Part of fix for PR gdb/741.