summaryrefslogtreecommitdiffstats
path: root/debugger/command_line_interpreter.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1997-02-14 16:30:00 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1997-02-14 16:30:00 +0000
commitc49cbe678ad3f976bb88652180dc982b366de990 (patch)
tree79a7a873fac29094c888b9a7abbd602d70e346e5 /debugger/command_line_interpreter.ml
parentd0c1f4366bb3d74edbc48778df86092cec3e2ed5 (diff)
Ajout de load_printer, install_printer, remove_printer.
Program_loading: utiliser setsid() pour detacher le debuggee du terminal. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1267 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'debugger/command_line_interpreter.ml')
-rw-r--r--debugger/command_line_interpreter.ml39
1 files changed, 37 insertions, 2 deletions
diff --git a/debugger/command_line_interpreter.ml b/debugger/command_line_interpreter.ml
index ad6f13755..b1d2f2cad 100644
--- a/debugger/command_line_interpreter.ml
+++ b/debugger/command_line_interpreter.ml
@@ -842,6 +842,29 @@ let info_events lexbuf =
| Event_after _ -> "after"))
(events_in_module mdle)
+(** User-defined printers **)
+
+let instr_load_printer lexbuf =
+ let filename = argument_eol argument lexbuf in
+ try
+ Loadprinter.loadfile filename
+ with Loadprinter.Error e ->
+ Loadprinter.report_error e; raise Toplevel
+
+let instr_install_printer lexbuf =
+ let lid = longident_eol Lexer.lexeme lexbuf in
+ try
+ Loadprinter.install_printer lid
+ with Loadprinter.Error e ->
+ Loadprinter.report_error e; raise Toplevel
+
+let instr_remove_printer lexbuf =
+ let lid = longident_eol Lexer.lexeme lexbuf in
+ try
+ Loadprinter.remove_printer lid
+ with Loadprinter.Error e ->
+ Loadprinter.report_error e; raise Toplevel
+
(** Initialization. **)
let _ =
instruction_list := [
@@ -925,7 +948,7 @@ To delete all breakpoints, give no argument." };
(* Frames *)
{ instr_name = "frame"; instr_prio = false;
instr_action = instr_frame; instr_repeat = true; instr_help =
-"Select and print a stack frame.\n\
+"select and print a stack frame.\n\
With no argument, print the selected stack frame.\n\
An argument specifies the frame to select." };
{ instr_name = "backtrace"; instr_prio = false;
@@ -949,7 +972,19 @@ An argument says how many frames down to go." };
"go back to previous time." };
{ instr_name = "list"; instr_prio = false;
instr_action = instr_list; instr_repeat = true; instr_help =
-"list the source code." }
+"list the source code." };
+ (* User-defined printers *)
+ { instr_name = "load_printer"; instr_prio = false;
+ instr_action = instr_load_printer; instr_repeat = false; instr_help =
+"load in the debugger a .cmo or .cma file containing printing functions." };
+ { instr_name = "install_printer"; instr_prio = false;
+ instr_action = instr_install_printer; instr_repeat = false; instr_help =
+"use the given function for printing values of its input type.\n\
+The code for the function must have previously been loaded in the debugger\n\
+using \"load_printer\"." };
+ { instr_name = "remove_printer"; instr_prio = false;
+ instr_action = instr_remove_printer; instr_repeat = false; instr_help =
+"stop using the given function for printing values of its input type." }
];
variable_list := [
(* variable name, (writing, reading), help reading, help writing *)