diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2012-03-08 19:52:03 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2012-03-08 19:52:03 +0000 |
commit | 6c24f4f90b23e8c4536281d31461adfe5a15b739 (patch) | |
tree | 29f6c4af8052800cc7d0eafb9650c6be8e90a2e5 /debugger/command_line.ml | |
parent | 1fb4007ece64b1d59e16d7a84639fce1dd69ed45 (diff) |
merge version 3.12 from 3.12.1 to r12205
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12210 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'debugger/command_line.ml')
-rw-r--r-- | debugger/command_line.ml | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/debugger/command_line.ml b/debugger/command_line.ml index 3f84ea7b2..9b0084daf 100644 --- a/debugger/command_line.ml +++ b/debugger/command_line.ml @@ -230,6 +230,22 @@ let instr_shell ppf lexbuf = if (err != 0) then eprintf "Shell command %S failed with exit code %d\n%!" cmd err +let instr_env ppf lexbuf = + let cmdarg = argument_list_eol argument lexbuf in + let cmdarg = string_trim (String.concat " " cmdarg) in + if cmdarg <> "" then + try + if (String.index cmdarg '=') > 0 then + Debugger_config.environment := cmdarg :: !Debugger_config.environment + else + eprintf "Environment variables should not have an empty name\n%!" + with Not_found -> + eprintf "Environment variables should have the \"name=value\" format\n%!" + else + List.iter + (printf "%s\n%!") + (List.rev !Debugger_config.environment) + let instr_pwd ppf lexbuf = eol lexbuf; fprintf ppf "%s@." (Sys.getcwd ()) @@ -454,7 +470,7 @@ let instr_help ppf lexbuf = fprintf ppf "Ambiguous command \"%s\" : %a@." x pr_instrs l end | None -> - fprintf ppf "List of commands :%a@." pr_instrs !instruction_list + fprintf ppf "List of commands : %a@." pr_instrs !instruction_list (* Printing values *) @@ -962,6 +978,9 @@ With no argument, reset the search path." }; { instr_name = "shell"; instr_prio = false; instr_action = instr_shell; instr_repeat = true; instr_help = "Execute a given COMMAND thru the system shell." }; + { instr_name = "environment"; instr_prio = false; + instr_action = instr_env; instr_repeat = false; instr_help = +"environment variable to give to program being debugged when it is started." }; (* Displacements *) { instr_name = "run"; instr_prio = true; instr_action = instr_run; instr_repeat = true; instr_help = |