Skip to content

Commit

Permalink
Use pack in ocamldebug
Browse files Browse the repository at this point in the history
  • Loading branch information
sonologico committed May 18, 2021
1 parent 5fbd6e1 commit 938fb26
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
9 changes: 6 additions & 3 deletions debugger/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ libraries = $(ROOTDIR)/compilerlibs/ocamlcommon.cma \

all: ocamldebug$(EXE)

ocamldebug$(EXE): $(libraries) $(all_objects)
Ocamldebug.cmo: $(all_objects)
$(CAMLC) -pack $(COMPFLAGS) -o $@ $^

ocamldebug$(EXE): $(libraries) Ocamldebug.cmo
$(CAMLC) $(LINKFLAGS) -o $@ -linkall $^

install:
Expand All @@ -63,10 +66,10 @@ clean::
rm -f *.cmo *.cmi

%.cmo: %.ml
$(CAMLC) -c $(COMPFLAGS) $<
$(CAMLC) -c $(COMPFLAGS) -for-pack Ocamldebug $<

%.cmi: %.mli
$(CAMLC) -c $(COMPFLAGS) $<
$(CAMLC) -c $(COMPFLAGS) -for-pack Ocamldebug $<

depend: beforedepend
$(CAMLDEP) $(DEPFLAGS) $(DEPINCLUDES) *.mli *.ml \
Expand Down
7 changes: 7 additions & 0 deletions testsuite/tests/tool-debugger/module_named_main/input_script
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load_printer main.cmo
install_printer Main.Submodule.pp
goto 0
break @ Main 26
run
print value
quit
30 changes: 30 additions & 0 deletions testsuite/tests/tool-debugger/module_named_main/main.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(* TEST
flags += " -g "
ocamldebug_script = "${test_source_directory}/input_script"
* debugger
** shared-libraries
*** setup-ocamlc.byte-build-env
**** ocamlc.byte
***** check-ocamlc.byte-output
****** ocamldebug
******* check-program-output
*)

module Submodule = struct

type t = unit

let value = ()

let pp (fmt : Format.formatter) (_ : t) : unit =
Format.fprintf fmt "DEBUG: Aux.Submodule.pp"

end

let debug () =
let value = Submodule.value in
ignore value

;;

debug ();
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
File main.cmo loaded
Loading program... done.
Beginning of program.
Breakpoint: 1
26 <|b|>ignore value
value: unit = DEBUG: Aux.Submodule.pp

0 comments on commit 938fb26

Please sign in to comment.