~ubuntu-branches/debian/sid/ocaml/sid

« back to all changes in this revision

Viewing changes to debugger/command_line.ml

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-04-21 21:35:08 UTC
  • mfrom: (1.1.11 upstream) (12.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110421213508-kg34453aqmb0moha
* Fixes related to -output-obj with g++ (in debian/patches):
  - add Declare-primitive-name-table-as-const-char
  - add Avoid-multiple-declarations-in-generated-.c-files-in
  - fix Embed-bytecode-in-C-object-when-using-custom: the closing
    brace for extern "C" { ... } was missing in some cases

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
(*                                                                     *)
12
12
(***********************************************************************)
13
13
 
14
 
(* $Id: command_line.ml 9299 2009-06-17 08:15:39Z xclerc $ *)
 
14
(* $Id: command_line.ml 10287 2010-04-20 15:47:15Z doligez $ *)
15
15
 
16
16
(************************ Reading and executing commands ***************)
17
17
 
77
77
  raise Toplevel
78
78
 
79
79
let check_not_windows feature =
80
 
  match Sys.os_type with 
 
80
  match Sys.os_type with
81
81
  | "Win32" ->
82
82
      error ("'"^feature^"' feature not supported on Windows")
83
 
  | _ -> 
 
83
  | _ ->
84
84
      ()
85
85
 
86
86
let eol =
227
227
  let cmd = String.concat " " cmdarg in
228
228
  (* perhaps we should use $SHELL -c ? *)
229
229
  let err = Sys.command cmd in
230
 
  if (err != 0) then 
 
230
  if (err != 0) then
231
231
    eprintf "Shell command %S failed with exit code %d\n%!" cmd err
232
232
 
233
233
let instr_pwd ppf lexbuf =
363
363
 
364
364
let instr_complete ppf lexbuf =
365
365
  let ppf = Format.err_formatter in
366
 
  let rec print_list l = 
367
 
    try 
 
366
  let rec print_list l =
 
367
    try
368
368
      eol lexbuf;
369
369
      List.iter (function i -> fprintf ppf "%s@." i) l
370
370
    with _ ->
395
395
                  | [i] -> if i.info_name = ident then [] else [i.info_name]
396
396
                  | l   -> List.map (fun i -> i.info_name) l
397
397
                  end
398
 
              | None -> 
 
398
              | None ->
399
399
                  List.map (fun i -> i.info_name) !info_list
400
400
            end
401
401
            else ["info"]
807
807
      find loading_modes;
808
808
      fprintf ppf "@."
809
809
 
 
810
let follow_fork_variable =
 
811
  (function lexbuf ->
 
812
     let mode =
 
813
       match identifier_eol Lexer.lexeme lexbuf with
 
814
       | "child" -> Fork_child
 
815
       | "parent" -> Fork_parent
 
816
       | _ -> error "Syntax error."
 
817
     in
 
818
       fork_mode := mode;
 
819
       if !loaded then update_follow_fork_mode ()),
 
820
  function ppf ->
 
821
    fprintf ppf "%s@."
 
822
      (match !fork_mode with
 
823
         Fork_child -> "child"
 
824
       | Fork_parent -> "parent")
 
825
 
810
826
(** Infos. **)
811
827
 
812
828
let pr_modules ppf mods =
1065
1081
       var_action = loading_mode_variable ppf;
1066
1082
       var_help =
1067
1083
"mode of loading.\n\
1068
 
It can be either :
 
1084
It can be either :\n\
1069
1085
  direct : the program is directly called by the debugger.\n\
1070
1086
  runtime : the debugger execute `ocamlrun programname arguments'.\n\
1071
1087
  manual : the program is not launched by the debugger,\n\
1075
1091
                                     checkpoint_max_count;
1076
1092
       var_help =
1077
1093
"maximum number of process to keep." };
1078
 
     { var_name = "checkpoints"; 
 
1094
     { var_name = "checkpoints";
1079
1095
       var_action = boolean_variable false make_checkpoints;
1080
1096
       var_help =
1081
1097
"whether to make checkpoints or not." };
1106
1122
       var_action = integer_variable false 1 "Must be at least 1"
1107
1123
                                     max_printer_steps;
1108
1124
       var_help =
1109
 
"maximal number of value nodes printed." }];
 
1125
"maximal number of value nodes printed." };
 
1126
     { var_name = "follow_fork_mode";
 
1127
       var_action = follow_fork_variable;
 
1128
       var_help =
 
1129
"process to follow after forking.\n\
 
1130
It can be either :
 
1131
  child : the newly created process.\n\
 
1132
  parent : the process that called fork.\n" }];
1110
1133
 
1111
1134
  info_list :=
1112
1135
    (* info name, function, help *)