Browse files

merge changes from release/3.11.1 to release/3.11.2

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9540 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
1 parent b709b6a commit cff40c4f2829cf30b4e05d7a39e8566440892d3f doligez committed Jan 20, 2010
Showing with 1,400 additions and 864 deletions.
  1. +55 −2 Changes
  2. +9 −6 INSTALL
  3. +5 −4 Makefile
  4. +15 −14 README.win32
  5. +1 −1 VERSION
  6. +2 −0 _tags
  7. +2 −2 asmcomp/alpha/emit.mlp
  8. +22 −26 asmcomp/amd64/emit.mlp
  9. +1 −2 asmcomp/amd64/proc.ml
  10. +3 −0 asmcomp/arm/emit.mlp
  11. +1 −0 asmcomp/asmlink.ml
  12. +21 −0 asmcomp/emitaux.ml
  13. +3 −0 asmcomp/emitaux.mli
  14. +5 −3 asmcomp/hppa/emit.mlp
  15. +7 −4 asmcomp/i386/emit.mlp
  16. +2 −2 asmcomp/ia64/emit.mlp
  17. +2 −3 asmcomp/mips/emit.mlp
  18. +11 −4 asmcomp/power/emit.mlp
  19. +4 −3 asmcomp/sparc/emit.mlp
  20. +3 −10 asmrun/ia64.S
  21. +1 −0 boot/.cvsignore
  22. BIN boot/ocamlc
  23. BIN boot/ocamldep
  24. BIN boot/ocamllex
  25. +1 −3 build/boot-c-parts-windows.sh
  26. +1 −2 build/install.sh
  27. +1 −0 build/mkmyocamlbuild_config.sh
  28. +54 −6 bytecomp/bytelink.ml
  29. +3 −11 bytecomp/symtable.ml
  30. +18 −22 bytecomp/typeopt.ml
  31. +2 −0 byterun/.cvsignore
  32. +6 −6 byterun/.depend
  33. +6 −1 byterun/backtrace.c
  34. +1 −0 byterun/backtrace.h
  35. +1 −1 byterun/gc_ctrl.c
  36. +2 −1 byterun/interp.c
  37. +4 −0 byterun/obj.c
  38. +28 −4 byterun/startup.c
  39. +1 −1 camlp4/Makefile.ml
  40. +7 −3 config/Makefile-templ
  41. +2 −2 config/Makefile.mingw
  42. +5 −5 config/Makefile.msvc
  43. +2 −2 config/Makefile.msvc64
  44. +12 −8 configure
  45. +121 −121 debugger/.depend
  46. +4 −3 debugger/Makefile.shared
  47. +23 −11 debugger/command_line.ml
  48. +3 −1 debugger/frames.ml
  49. +2 −2 debugger/frames.mli
  50. +34 −2 debugger/main.ml
  51. +8 −1 debugger/show_information.ml
  52. +9 −7 debugger/show_source.ml
  53. +5 −0 debugger/source.ml
  54. +3 −0 debugger/source.mli
  55. +7 −0 debugger/symbols.ml
  56. +1 −1 driver/main_args.ml
  57. +1 −1 driver/optmain.ml
  58. +4 −4 emacs/caml-types.el
  59. +32 −32 lex/.depend
  60. +2 −0 lex/Makefile.nt
  61. +3 −3 myocamlbuild.ml
  62. +1 −0 myocamlbuild_config.mli
  63. +1 −1 ocamlbuild/_tags
  64. +1 −1 ocamlbuild/command.ml
  65. +4 −1 ocamlbuild/ocaml_specific.ml
  66. +4 −1 ocamlbuild/ocaml_utils.ml
  67. +1 −1 ocamlbuild/ocamlbuild-presentation.rslide
  68. +1 −0 ocamlbuild/ocamlbuild_plugin.ml
  69. +1 −0 ocamlbuild/ocamlbuild_unix_plugin.ml
  70. +4 −3 ocamlbuild/options.ml
  71. +11 −4 ocamlbuild/plugin.ml
  72. +3 −2 ocamlbuild/rule.ml
  73. +1 −0 ocamlbuild/rule.mli
  74. +4 −0 ocamlbuild/signatures.mli
  75. +1 −0 ocamldoc/.cvsignore
  76. +114 −114 ocamldoc/.depend
  77. +2 −2 ocamldoc/odoc.ml
  78. +2 −2 ocamldoc/odoc_ast.ml
  79. +2 −1 ocamldoc/remove_DEBUG
  80. +2 −0 otherlibs/bigarray/.cvsignore
  81. +3 −3 otherlibs/bigarray/.depend
  82. +2 −0 otherlibs/dbm/.cvsignore
  83. +3 −3 otherlibs/dbm/.depend
  84. +1 −0 otherlibs/dynlink/.cvsignore
  85. +2 −0 otherlibs/graph/.cvsignore
  86. +6 −6 otherlibs/graph/.depend
  87. +1 −0 otherlibs/labltk/frx/.cvsignore
  88. +1 −0 otherlibs/labltk/jpf/.cvsignore
  89. +1 −1 otherlibs/labltk/lib/.cvsignore
  90. +2 −0 otherlibs/labltk/support/.cvsignore
  91. +2 −0 otherlibs/labltk/tkanim/.cvsignore
  92. +2 −0 otherlibs/num/.cvsignore
  93. +21 −21 otherlibs/num/.depend
  94. +12 −2 otherlibs/num/nat_stubs.c
  95. +2 −0 otherlibs/str/.cvsignore
  96. +3 −3 otherlibs/str/.depend
  97. +2 −0 otherlibs/systhreads/.cvsignore
  98. +19 −19 otherlibs/systhreads/.depend
  99. +2 −0 otherlibs/threads/.cvsignore
  100. +21 −21 otherlibs/threads/.depend
  101. +2 −0 otherlibs/unix/.cvsignore
  102. +29 −6 otherlibs/unix/.depend
  103. +6 −0 otherlibs/unix/socketaddr.c
  104. +4 −1 otherlibs/win32unix/channels.c
  105. +3 −0 otherlibs/win32unix/unixsupport.c
  106. +1 −1 otherlibs/win32unix/unixsupport.h
  107. +1 −0 stdlib/.cvsignore
  108. +140 −138 stdlib/.depend
  109. +8 −0 stdlib/buffer.ml
  110. +9 −0 stdlib/buffer.mli
  111. +6 −6 stdlib/filename.ml
  112. +7 −2 stdlib/filename.mli
  113. +41 −3 stdlib/format.mli
  114. +3 −0 stdlib/obj.ml
  115. +4 −1 stdlib/obj.mli
  116. +9 −5 stdlib/pervasives.mli
  117. +14 −3 stdlib/printexc.ml
  118. +10 −0 stdlib/printexc.mli
  119. +11 −7 stdlib/scanf.mli
  120. +34 −33 stdlib/stdlib.mllib
  121. +15 −1 test/Moretest/tscanf.ml
  122. +15 −0 testlabl/bugs/pr4933.ml
  123. +58 −0 testlabl/private.ml
  124. +1 −0 tools/.cvsignore
  125. +38 −38 tools/.depend
  126. +13 −9 tools/ocamlmklib.mlp
  127. +35 −34 typing/ctype.ml
  128. +2 −1 typing/includecore.ml
  129. +8 −5 typing/typedecl.ml
  130. +9 −4 typing/typetexp.ml
  131. +1 −0 typing/typetexp.mli
  132. +1 −1 utils/warnings.ml
View
57 Changes
@@ -22,8 +22,10 @@ Language features:
"let [rec] <ident> : 'a1 ... 'an. <typexp> = ..."
- First-class packages modules.
New kind of type expression, for packaged modules: (module PT).
- New kind of expression, to pack a module as a first-class value: (module MODEXPR : PT).
- New kind of module expression, to unpack a first-class value as a module: (val EXPR : PT).
+ New kind of expression, to pack a module as a first-class value:
+ (module MODEXPR : PT).
+ New kind of module expression, to unpack a first-class value as a module:
+ (val EXPR : PT).
PT is a package type of the form "S" or
"S with type t1 = ... and ... and type tn = ..." (S refers to a module type).
- Local opening of modules in a subexpression.
@@ -58,6 +60,55 @@ Bug Fixes:
- PR#4775: compiler crash on crazy types (temporary fix)
+Objective Caml 3.11.2:
+----------------------
+
+Bug fixes:
+- PR#4151: better documentation for min and max w.r.t. NaN
+- PR#4421: ocamlbuild uses wrong compiler for C files
+- PR#4710, PR#4720: ocamlbuild does not use properly configuration information
+- PR#4750: under some Windows installations, high start-up times for Unix lib
+- PR#4777: problem with scanf and CRLF
+- PR#4783: ocamlmklib problem under Windows
+- PR#4810: BSD problem with socket addresses, e.g. in Unix.getnameinfo
+- PR#4813: issue with parsing of float literals by the GNU assembler
+- PR#4816: problem with modules and private types
+- PR#4818: missed opportunity for type-based optimization of bigarray accesses
+- PR#4821: check for duplicate method names in classes
+- PR#4823: build problem on Mac OS X
+- PR#4836: spurious errors raised by Unix.single_write under Windows
+- PR#4841, PR#4860, PR#4930: problem with ocamlopt -output-obj under Mac OS X
+- PR#4847: C compiler error with ocamlc -output-obj under Win64
+- PR#4856: ocamlbuild uses ocamlrun to execute a native plugin
+- PR#4867, PR#4760: ocamlopt -shared fails on Mac OS X 64bit
+- PR#4873: ocamlbuild ignores "thread" tag when building a custom toplevel
+- PR#4890: ocamlbuild tries to use native plugin on bytecode-only arch
+- PR#4896: ocamlbuild should always pass -I to tools for external libraries
+- PR#4900: small bug triggering automatic compaction even if max_overhead = 1M
+- PR#4902: bug in %.0F printf format
+- PR#4910: problem with format concatenation
+- PR#4922: ocamlbuild recompiles too many files
+- PR#4923: missing \xff for scanf %S
+- PR#4933: functors not handling private types correctly
+- PR#4940: problem with end-of-line in DOS text mode, tentative fix
+- PR#4953: problem compiling bytecode interpreter on ARM in Thumb mode.
+- PR#4955: compiler crash when typing recursive type expression with constraint
+- Module Printf: the simple conversion %F (without width indication) was not
+ treated properly.
+- Makefile: problem with cygwin, flexdll, and symbolic links
+- Various build problems with ocamlbuild under Windows with msvc
+
+Feature wishes:
+- PR#9: (tentative implementation) make ocamldebug use #linenum annotations
+- PR#123, PR#4477: custom exception printers
+- PR#3456: Obj.double_field and Obj.set_double_field functions
+- PR#4003: destination directory can be given to Filename.[open_]temp_file
+- PR#4647: Buffer.blit function
+- PR#4685: access to Filename.dir_sep
+- PR#4703: support for debugging embedded applications
+- PR#4723: "clear_rules" function to empty the set of ocamlbuild rules
+- PR#4921: configure option to help cross-compilers
+
Objective Caml 3.11.1:
----------------------
@@ -113,6 +164,7 @@ Other changes:
(contributed by Jonathan Davies, Citrix).
- Support for 64-bit mode in Solaris/x86 (PR#4670).
+
Objective Caml 3.11.0:
----------------------
@@ -261,6 +313,7 @@ Bug fixes:
- Small bugs in the make-package-macosx script
- Bug in typing of polymorphic variants (reported on caml-list)
+
Objective Caml 3.10.1:
----------------------
View
15 INSTALL
@@ -109,7 +109,7 @@ The "configure" script accepts the following options:
-as <assembler and options> (default: determined automatically)
The assembler to use for assembling ocamlopt-generated code.
--aspp <assembler and options> (default: determined automatically>
+-aspp <assembler and options> (default: determined automatically)
The assembler to use for assembling the parts of the
run-time system manually written in assembly language.
This assembler must preprocess its input with the C preprocessor.
@@ -126,10 +126,13 @@ Examples:
Installation in /usr, man pages in section "l":
./configure -bindir /usr/bin -libdir /usr/lib/ocaml -mandir /usr/man/manl
- On a MacOSX/Intel Core 2 or MacOSX/PowerPC host, to build a 64-bit version
- of OCaml:
+ On a MacOSX 10.5/Intel Core 2 or MacOSX 10.5/PowerPC host,
+ to build a 64-bit version of OCaml:
./configure -cc "gcc -m64"
+ On a MacOSX 10.6/Intel Core 2, to build a 32-bit version of OCaml:
+ ./configure -cc "gcc -m32" -as "as -arch i386" -aspp "gcc -m32 -c"
+
On a Linux x86/64 bits host, to build a 32-bit version of OCaml:
./configure -cc "gcc -m32" -as "as --32" -aspp "gcc -m32 -c"
@@ -188,9 +191,9 @@ or:
make opt > log.opt 2>&1 # in sh
make opt >& log.opt # in csh
-5- (Optional) If you want to compile fast versions of the Objective
-Caml compilers, you can compile them with the native-code compiler
-(they are compiled to bytecode by default). Just do:
+5- Compile fast versions of the Objective Caml compilers, by
+compiling them with the native-code compiler (you have only compiled
+them to bytecode so far). Just do:
make opt.opt
View
9 Makefile
@@ -567,10 +567,11 @@ alldepend::
# The runtime system for the native-code compiler
-runtimeopt:
+runtimeopt: makeruntimeopt
+ cp asmrun/libasmrun.a stdlib/libasmrun.a
+
+makeruntimeopt:
cd asmrun; $(MAKE) all
- if test -f stdlib/libasmrun.a; then :; else \
- ln -s ../asmrun/libasmrun.a stdlib/libasmrun.a; fi
clean::
cd asmrun; $(MAKE) clean
@@ -762,6 +763,6 @@ distclean:
.PHONY: ocamldoc.opt ocamllex ocamllex.opt ocamltools ocamltools.opt
.PHONY: ocamlyacc opt-core opt opt.opt otherlibraries
.PHONY: otherlibrariesopt package-macosx promote promote-cross
-.PHONY: restore runtime runtimeopt world world.opt
+.PHONY: restore runtime runtimeopt makeruntimeopt world world.opt
include .depend
View
29 README.win32
@@ -61,7 +61,7 @@ Microsoft Visual C++ compiler (items [1] and [2] in the section
The native-code compiler (ocamlopt) requires Visual C++ (items [1], [2]),
the Microsoft assembler MASM (item [3]) and the flexdll tool (item [5]).
-The LablTk GUI requires Tcl/Tk 8.4 (item [4]).
+The LablTk GUI requires Tcl/Tk 8.5 (item [4]).
INSTALLATION:
@@ -70,33 +70,34 @@ The binary distribution is a self-installing executable archive.
Just run it and it should install OCaml automatically.
To run programs that use the LablTK GUI, the directory where the
-DLLs tk84.dll and tcl84.dll were installed (by the Tcl/Tk
+DLLs tk85.dll and tcl85.dll were installed (by the Tcl/Tk
installer) must be added to the PATH environment variable.
To compile programs that use the LablTK GUI, the directory where the
-libraries tk84.lib and tcl84.lib were installed (by the Tcl/Tk
+libraries tk85.lib and tcl85.lib were installed (by the Tcl/Tk
installer) must be added to the library search path in the LIB
environment variable. E.g. if Tcl/Tk was installed in C:\tcl, add
"C:\tcl\lib" to the LIB environment variable.
THIRD-PARTY SOFTWARE:
-[1] Visual C++ version 2005, 2003, or 6.
- We use Visual C++ 2005 Express Edition, which can be downloaded for free
+[1] Visual C++ version 2008, 2005, 2003, or 6.
+ We use Visual C++ 2008 Express Edition, which can be downloaded for free
from http://www.microsoft.com.
-[2] Windows header files and development libraries. We found them in
- the Microsoft Windows Server 2003 SP1 Platform SDK, which can
- be downloaded for free from http://www.microsoft.com/.
+[2] Windows header files and development libraries. They are included
+ in the Visual C++ 2008 Express Edition distribution.
+ Otherwise, you can find them in the Windows Platform SDK,
+ which can be downloaded for free from http://www.microsoft.com/.
[3] MASM version 6.11 or later. The full distribution of Visual C++ 2005
- contains MASM version 8. Users of the Express Edition of Visual C++
+ or 2008 contains MASM version 8. Users of the Express Edition of Visual C++
2005 can download MASM version 8 from
http://www.microsoft.com/downloads/details.aspx?FamilyID=7A1C9DA0-0510-44A2-B042-7EF370530C64&displaylang=en
To obtain MASM version 6.11, see
http://users.easystreet.com/jkirwan/new/pctools.html.
-[4] TCL/TK version 8.4. Windows binaries are available as part of the
+[4] TCL/TK version 8.5. Windows binaries are available as part of the
ActiveTCL distribution at http://www.activestate.com/products/ActiveTcl/
[5] flexdll.
@@ -190,7 +191,7 @@ Do *not* install the Mingw/MSYS development tools from www.mingw.org:
these are not compatible with this Caml port (@responsefile not
recognized on the command line).
-The LablTk GUI requires Tcl/Tk 8.4. Windows binaries are available
+The LablTk GUI requires Tcl/Tk 8.5. Windows binaries are available
as part of the ActiveTCL distribution at
http://www.activestate.com/products/ActiveTcl/
@@ -200,11 +201,11 @@ The binary distribution is a self-installing executable archive.
Just run it and it should install OCaml automatically.
To run programs that use the LablTK GUI, the directory where the
-DLLs tk84.dll and tcl84.dll were installed (by the Tcl/Tk
+DLLs tk85.dll and tcl85.dll were installed (by the Tcl/Tk
installer) must be added to the PATH environment variable.
To compile programs that use the LablTK GUI, the directory where the
-libraries tk84.lib and tcl84.lib were installed (by the Tcl/Tk
+libraries tk85.lib and tcl85.lib were installed (by the Tcl/Tk
installer) must be added to the library search path in the LIB
environment variable. E.g. if Tcl/Tk was installed in C:\tcl, add
"C:\tcl\lib" to the LIB environment variable.
@@ -217,7 +218,7 @@ You will need the following software components to perform the recompilation:
- Cygwin: http://sourceware.cygnus.com/cygwin/
Install at least the following packages: binutils, diffutils,
gcc-core, gcc-mingw-core, make, mingw-runtime, ncurses, w32-api.
-- TCL/TK version 8.4 (see above).
+- TCL/TK version 8.5 (see above).
- The flexdll tool (see above).
Do *not* install the standalone distribution of MinGW, nor the
View
2 VERSION
@@ -1,4 +1,4 @@
-3.12.0+dev16 (2010-01-07)
+3.12.0+dev17 (2010-01-20)
# The version string is the first line of this file.
# It must be in the format described in stdlib/sys.mli
View
2 _tags
@@ -55,6 +55,7 @@ true: use_stdlib
<otherlibs/num/nums.cm{,x}a> or <otherlibs/dbm/dbm.cm{,x}a>: ocamlmklib
<otherlibs/{,win32}graph/graphics.cm{,x}a>: ocamlmklib
<otherlibs/threads/threads.cm{,x}a>: ocamlmklib
+"otherlibs/threads/unix.cma": ocamlmklib
<otherlibs/bigarray/bigarray.cm{,x}a>: ocamlmklib
<otherlibs/{bigarray,systhreads}/**.ml*>: include_unix
@@ -70,6 +71,7 @@ true: use_stdlib
<otherlibs/bigarray/**>: otherlibs_bigarray
<otherlibs/num/**>: otherlibs_num
<otherlibs/threads/**>: otherlibs_threads
+"otherlibs/threads/unix.cma": -otherlibs_threads
<otherlibs/systhreads/**>: otherlibs_systhreads
<otherlibs/dbm/**>: otherlibs_dbm
<otherlibs/graph/**>: otherlibs_graph
View
4 asmcomp/alpha/emit.mlp
@@ -793,9 +793,9 @@ let emit_item = function
long decimal constants *)
` .quad 0x{emit_string(Nativeint.format "%x" n)}\n`
| Csingle f ->
- ` .float {emit_string f}\n`
+ emit_float32_directive ".long" f
| Cdouble f ->
- ` .double {emit_string f}\n`
+ emit_float64_directive ".quad" f
| Csymbol_address s ->
` .quad {emit_symbol s}\n`
| Clabel_address lbl ->
View
48 asmcomp/amd64/emit.mlp
@@ -575,33 +575,26 @@ let emit_instr fallthrough i =
end
| Lswitch jumptbl ->
let lbl = new_label() in
- if !pic_code || !Clflags.dlcode then begin
- (* PR#4424: r11 is known to be clobbered by the Lswitch,
- meaning that no variable that is live across the Lswitch
- is assigned to r11. However, the argument to Lswitch
- can still be assigned to r11, so we need to special-case
- this situation. *)
- if i.arg.(0).loc = Reg 9 (* ie r11, cf amd64/proc.ml *) then begin
- ` salq $3, %r11\n`;
- ` pushq %r11\n`;
- ` leaq {emit_label lbl}(%rip), %r11\n`;
- ` addq 0(%rsp), %r11\n`;
- ` addq $8, %rsp\n`;
- ` jmp *(%r11)\n`
- end else begin
- ` leaq {emit_label lbl}(%rip), %r11\n`;
- ` jmp *(%r11, {emit_reg i.arg.(0)}, 8)\n`
- end
- end else begin
- ` jmp *{emit_label lbl}(, {emit_reg i.arg.(0)}, 8)\n`
- end;
+ (* rax and rdx are clobbered by the Lswitch,
+ meaning that no variable that is live across the Lswitch
+ is assigned to rax or rdx. However, the argument to Lswitch
+ can still be assigned to one of these two registers, so
+ we must be careful not to clobber it before use. *)
+ let (tmp1, tmp2) =
+ if i.arg.(0).loc = Reg 0 (* rax *)
+ then (phys_reg 4 (*rdx*), phys_reg 0 (*rax*))
+ else (phys_reg 0 (*rax*), phys_reg 4 (*rdx*)) in
+ ` leaq {emit_label lbl}(%rip), {emit_reg tmp1}\n`;
+ ` movslq ({emit_reg tmp1}, {emit_reg i.arg.(0)}, 4), {emit_reg tmp2}\n`;
+ ` addq {emit_reg tmp2}, {emit_reg tmp1}\n`;
+ ` jmp *{emit_reg tmp1}\n`;
if macosx
then ` .const\n`
else ` .section .rodata\n`;
- emit_align 8;
+ emit_align 4;
`{emit_label lbl}:`;
for i = 0 to Array.length jumptbl - 1 do
- ` .quad {emit_label jumptbl.(i)}\n`
+ ` .long {emit_label jumptbl.(i)} - {emit_label lbl}\n`
done;
` .text\n`
| Lsetuptrap lbl ->
@@ -634,7 +627,8 @@ let rec emit_all fallthrough i =
(* Emission of the floating-point constants *)
let emit_float_constant (lbl, cst) =
- `{emit_label lbl}: .double {emit_string cst}\n`
+ `{emit_label lbl}:`;
+ emit_float64_directive ".quad" cst
(* Emission of the profiling prelude *)
@@ -667,7 +661,9 @@ let fundecl fundecl =
bound_error_call := 0;
` .text\n`;
emit_align 16;
- if macosx && is_generic_function fundecl.fun_name
+ if macosx
+ && not !Clflags.output_c_object
+ && is_generic_function fundecl.fun_name
then (* PR#4690 *)
` .private_extern {emit_symbol fundecl.fun_name}\n`
else
@@ -712,9 +708,9 @@ let emit_item = function
| Cint n ->
` .quad {emit_nativeint n}\n`
| Csingle f ->
- ` .float {emit_string f}\n`
+ emit_float32_directive ".long" f
| Cdouble f ->
- ` .double {emit_string f}\n`
+ emit_float64_directive ".quad" f
| Csymbol_address s ->
` .quad {emit_symbol s}\n`
| Clabel_address lbl ->
View
3 asmcomp/amd64/proc.ml
@@ -92,7 +92,6 @@ let phys_reg n =
let rax = phys_reg 0
let rcx = phys_reg 5
let rdx = phys_reg 4
-let r11 = phys_reg 9
let rxmm15 = phys_reg 115
let stack_slot slot ty =
@@ -170,7 +169,7 @@ let destroyed_at_oper = function
| Iop(Istore(Single, _)) -> [| rxmm15 |]
| Iop(Ialloc _ | Iintop(Icomp _) | Iintop_imm((Idiv|Imod|Icomp _), _))
-> [| rax |]
- | Iswitch(_, _) when !pic_code || !Clflags.dlcode -> [| r11 |]
+ | Iswitch(_, _) -> [| rax; rdx |]
| _ -> [||]
let destroyed_at_raise = all_phys_regs
View
3 asmcomp/arm/emit.mlp
@@ -585,6 +585,9 @@ let emit_item = function
| Csingle f ->
` .float {emit_string f}\n`
| Cdouble f ->
+ (* FIXME: this version of the ARM port is mixed-endian, so we
+ use .double instead of emit_float64_directive. The next
+ version is little-endian, so we'll use emit_float64 then. *)
` .align 0\n`;
` .double {emit_string f}\n`
| Csymbol_address s ->
View
1 asmcomp/asmlink.ml
@@ -259,6 +259,7 @@ let link_shared ppf objfiles output_name =
(fun (info, file_name, crc) -> check_consistency file_name info crc)
units_tolink;
Clflags.ccobjs := !Clflags.ccobjs @ !lib_ccobjs;
+ Clflags.ccopts := !lib_ccopts @ !Clflags.ccopts;
let objfiles = List.rev (List.map object_file_name objfiles) @
!Clflags.ccobjs in
View
21 asmcomp/emitaux.ml
@@ -93,6 +93,27 @@ let emit_bytes_directive directive s =
done;
if !pos > 0 then emit_char '\n'
+(* PR#4813: assemblers do strange things with float literals indeed,
+ so we convert to IEEE representation ourselves and emit float
+ literals as 32- or 64-bit integers. *)
+
+let emit_float64_directive directive f =
+ let x = Int64.bits_of_float (float_of_string f) in
+ emit_printf "\t%s\t0x%Lx\n" directive x
+
+let emit_float64_split_directive directive f =
+ let x = Int64.bits_of_float (float_of_string f) in
+ let lo = Int64.logand x 0xFFFF_FFFFL
+ and hi = Int64.shift_right_logical x 32 in
+ emit_printf "\t%s\t0x%Lx, 0x%Lx\n"
+ directive
+ (if Arch.big_endian then hi else lo)
+ (if Arch.big_endian then lo else hi)
+
+let emit_float32_directive directive f =
+ let x = Int32.bits_of_float (float_of_string f) in
+ emit_printf "\t%s\t0x%lx\n" directive x
+
(* Record live pointers at call points *)
type frame_descr =
View
3 asmcomp/emitaux.mli
@@ -25,6 +25,9 @@ val emit_char: char -> unit
val emit_string_literal: string -> unit
val emit_string_directive: string -> string -> unit
val emit_bytes_directive: string -> string -> unit
+val emit_float64_directive: string -> string -> unit
+val emit_float64_split_directive: string -> string -> unit
+val emit_float32_directive: string -> string -> unit
type frame_descr =
{ fd_lbl: int; (* Return address *)
View
8 asmcomp/hppa/emit.mlp
@@ -299,7 +299,9 @@ let emit_float_constants () =
` .text\n`;
emit_align 8;
List.iter
- (fun (lbl, cst) -> `{emit_label lbl}: .double {emit_string cst}\n`)
+ (fun (lbl, cst) ->
+ `{emit_label lbl}:`;
+ emit_float64_split_directive ".long" cst)
!float_constants;
float_constants := []
@@ -972,9 +974,9 @@ let emit_item = function
| Cint n ->
` .long {emit_nativeint n}\n`
| Csingle f ->
- ` .float {emit_string f}\n`
+ emit_float32_directive ".long" f
| Cdouble f ->
- ` .double {emit_string f}\n`
+ emit_float64_split_directive ".long" f
| Csymbol_address s ->
use_symbol s;
` .long {emit_symbol s}\n`
View
11 asmcomp/i386/emit.mlp
@@ -815,7 +815,8 @@ let rec emit_all fallthrough i =
let emit_float_constant (lbl, cst) =
` .data\n`;
- `{emit_label lbl}: .double {emit_string cst}\n`
+ `{emit_label lbl}:`;
+ emit_float64_split_directive ".long" cst
(* Emission of external symbol references (for MacOSX) *)
@@ -888,7 +889,9 @@ let fundecl fundecl =
bound_error_call := 0;
` .text\n`;
emit_align 16;
- if macosx && is_generic_function fundecl.fun_name
+ if macosx
+ && not !Clflags.output_c_object
+ && is_generic_function fundecl.fun_name
then (* PR#4690 *)
` .private_extern {emit_symbol fundecl.fun_name}\n`
else
@@ -928,9 +931,9 @@ let emit_item = function
| Cint n ->
` .long {emit_nativeint n}\n`
| Csingle f ->
- ` .float {emit_string f}\n`
+ emit_float32_directive ".long" f
| Cdouble f ->
- ` .double {emit_string f}\n`
+ emit_float64_split_directive ".long" f
| Csymbol_address s ->
` .long {emit_symbol s}\n`
| Clabel_address lbl ->
View
4 asmcomp/ia64/emit.mlp
@@ -1287,9 +1287,9 @@ let emit_item = function
| Cint n ->
` data8 {emit_nativeint n}\n`
| Csingle f ->
- ` real4 {emit_string f}\n`
+ emit_float32_directive "data4" f
| Cdouble f ->
- ` real8 {emit_string f}\n`
+ emit_float64_directive "data8" f
| Csymbol_address s ->
` data8 {emit_symbol s}#\n`
| Clabel_address lbl ->
View
5 asmcomp/mips/emit.mlp
@@ -527,10 +527,9 @@ let emit_item = function
| Cint n ->
` .word {emit_nativeint n}\n`
| Csingle f ->
- ` .float {emit_string f}\n`
+ emit_float32_directive ".word" f
| Cdouble f ->
- ` .align 0\n`; (* Prevent alignment on 8-byte boundary *)
- ` .double {emit_string f}\n`
+ emit_float64_split_directive ".word" f
| Csymbol_address s ->
` .word {emit_symbol s}\n`
| Clabel_address lbl ->
View
15 asmcomp/power/emit.mlp
@@ -835,7 +835,9 @@ let fundecl fundecl =
call_gc_label := 0;
float_literals := [];
int_literals := [];
- if Config.system = "rhapsody" && is_generic_function fundecl.fun_name
+ if Config.system = "rhapsody"
+ && not !Clflags.output_c_object
+ && is_generic_function fundecl.fun_name
then (* PR#4690 *)
` .private_extern {emit_symbol fundecl.fun_name}\n`
else
@@ -871,7 +873,10 @@ let fundecl fundecl =
` .align 3\n`;
List.iter
(fun (f, lbl) ->
- `{emit_label lbl}: .double 0d{emit_string f}\n`)
+ `{emit_label lbl}:`;
+ if ppc64
+ then emit_float64_directive ".quad" f
+ else emit_float64_split_directive ".long" f)
!float_literals;
List.iter
(fun (n, lbl) ->
@@ -902,9 +907,11 @@ let emit_item = function
| Cint n ->
` {emit_string datag} {emit_nativeint n}\n`
| Csingle f ->
- ` .float 0d{emit_string f}\n`
+ emit_float32_directive ".long" f
| Cdouble f ->
- ` .double 0d{emit_string f}\n`
+ if ppc64
+ then emit_float64_directive ".quad" f
+ else emit_float64_split_directive ".long" f
| Csymbol_address s ->
` {emit_string datag} {emit_symbol s}\n`
| Clabel_address lbl ->
View
7 asmcomp/sparc/emit.mlp
@@ -195,7 +195,8 @@ let float_constants = ref ([] : (int * string) list)
let emit_float_constant (lbl, cst) =
rodata ();
` .align 8\n`;
- `{emit_label lbl}: .double 0r{emit_string cst}\n`
+ `{emit_label lbl}:`;
+ emit_float64_split_directive ".word" cst
(* Emission of the profiling prelude *)
let emit_profile () =
@@ -723,9 +724,9 @@ let emit_item = function
| Cint n ->
` .word {emit_nativeint n}\n`
| Csingle f ->
- ` .single 0r{emit_string f}\n`
+ emit_float32_directive ".word" f
| Cdouble f ->
- ` .double 0r{emit_string f}\n`
+ emit_float64_split_directive ".word" f
| Csymbol_address s ->
` .word {emit_symbol s}\n`
| Clabel_address lbl ->
View
13 asmrun/ia64.S
@@ -12,7 +12,7 @@
/* $Id$ */
-/* Asm part of the runtime system, Alpha processor */
+/* Asm part of the runtime system, IA64 processor */
#undef BROKEN_POSTINCREMENT
@@ -68,15 +68,8 @@ caml_allocN:
sub r4 = r4, r2 ;;
cmp.ltu p0, p6 = r4, r5
(p6) br.ret.sptk b0 ;;
- /* Stash return address at sp (in stack scratch area) */
- mov r3 = b0 ;;
- st8 [sp] = r3
- /* Call GC */
- br.call.sptk b0 = caml_call_gc# ;;
- /* Return to caller */
- ld8 r3 = [sp] ;;
- mov b0 = r3 ;;
- br.ret.sptk b0
+ /* Fall through caml_call_gc */
+ br.sptk.many caml_call_gc#
.endp caml_allocN#
View
1 boot/.cvsignore
@@ -4,3 +4,4 @@ ocamlyacc
camlheader
myocamlbuild
myocamlbuild.native
+libcamlrun.a
View
BIN boot/ocamlc
Binary file not shown.
View
BIN boot/ocamldep
Binary file not shown.
View
BIN boot/ocamllex
Binary file not shown.
View
4 build/boot-c-parts-windows.sh
@@ -13,13 +13,11 @@ set -ex
mkdir -p _build/boot
cp -f byterun/ocamlrun.exe \
byterun/libcamlrun.$A \
- byterun/ocamlrun.dll \
asmrun/libasmrun.$A \
yacc/ocamlyacc.exe \
boot/ocamlc \
boot/ocamllex \
boot/ocamldep \
_build/boot
mkdir -p _build/byterun
-cp -f byterun/ocamlrun.exe byterun/ocamlrun.dll boot
-cp -f byterun/ocamlrun.$A _build/byterun
+cp -f byterun/ocamlrun.exe boot
View
3 build/install.sh
@@ -132,15 +132,14 @@ cd ..
WIN32=""
if [ "x$EXE" = "x.exe" ]; then
installbin win32caml/ocamlwin.exe $PREFIX/OCamlWin.exe
- installdir byterun/ocamlrun.dll $BINDIR
WIN32=win32
fi
installdir otherlibs/"$WIN32"unix/unixsupport.h \
otherlibs/bigarray/bigarray.h \
$LIBDIR/caml
-installdir yacc/ocamlyacc byterun/ocamlrun $BINDIR
+installdir yacc/ocamlyacc$EXE byterun/ocamlrun$EXE $BINDIR
installdir config/Makefile $LIBDIR/Makefile.config
installdir byterun/ld.conf $LIBDIR
View
1 build/mkmyocamlbuild_config.sh
@@ -19,6 +19,7 @@ cd `dirname $0`/..
sed \
-e 's/^.*FLEXDIR.*$//g' \
-e 's/^#ml \(.*\)/\1/' \
+ -e 's/^\([^"][^"]*\("[^"]*"[^"]*\)*\)#.*$/\1/' \
-e 's/^\(#.*\)$/(* \1 *)/' \
-e 's/^\(.*\$([0-9]).*\)$/(* \1 *)/' \
-e 's/^\([^(=]*\)=\([^"]*\)$/let <:lower<\1>> = "\2";;/' \
View
60 bytecomp/bytelink.ml
@@ -377,14 +377,40 @@ let output_data_string outchan data =
end
done
+(* Output a debug stub *)
+
+let output_cds_file outfile =
+ Misc.remove_file outfile;
+ let outchan =
+ open_out_gen [Open_wronly; Open_trunc; Open_creat; Open_binary]
+ 0o777 outfile in
+ try
+ Bytesections.init_record outchan;
+ (* The map of global identifiers *)
+ Symtable.output_global_map outchan;
+ Bytesections.record outchan "SYMB";
+ (* Debug info *)
+ output_debug_info outchan;
+ Bytesections.record outchan "DBUG";
+ (* The table of contents and the trailer *)
+ Bytesections.write_toc_and_trailer outchan;
+ close_out outchan
+ with x ->
+ close_out outchan;
+ remove_file outfile;
+ raise x
+
(* Output a bytecode executable as a C file *)
let link_bytecode_as_c tolink outfile =
let outchan = open_out outfile in
- try
+ begin try
(* The bytecode *)
- output_string outchan "#include <caml/mlvalues.h>\n";
output_string outchan "\
+#ifdef __cplusplus\n\
+extern \"C\" {\n\
+#endif\n\
+#include <caml/mlvalues.h>\n\
CAMLextern void caml_startup_code(\n\
code_t code, asize_t code_size,\n\
char *data, asize_t data_size,\n\
@@ -393,8 +419,11 @@ CAMLextern void caml_startup_code(\n\
output_string outchan "static int caml_code[] = {\n";
Symtable.init();
Consistbl.clear crc_interfaces;
- let output_fun = output_code_string outchan
- and currpos_fun () = 0 in
+ let currpos = ref 0 in
+ let output_fun code =
+ output_code_string outchan code;
+ currpos := !currpos + String.length code
+ and currpos_fun () = !currpos in
List.iter (link_file output_fun currpos_fun) tolink;
(* The final STOP instruction *)
Printf.fprintf outchan "\n0x%x};\n\n" Opcodes.opSTOP;
@@ -422,18 +451,24 @@ void caml_startup(char ** argv)\n\
caml_data, sizeof(caml_data),\n\
caml_sections, sizeof(caml_sections),\n\
argv);\n\
-}\n";
+}\n\
+#ifdef __cplusplus\n\
+}\n\
+#endif\n";
close_out outchan
with x ->
close_out outchan;
raise x
+ end;
+ if !Clflags.debug then
+ output_cds_file ((Filename.chop_extension outfile) ^ ".cds")
(* Build a custom runtime *)
let build_custom_runtime prim_name exec_name =
Ccomp.call_linker Ccomp.Exe exec_name
([prim_name] @ List.rev !Clflags.ccobjs @ ["-lcamlrun"])
- Config.bytecomp_c_libraries
+ (Clflags.std_include_flag "-I" ^ " " ^ Config.bytecomp_c_libraries)
let append_bytecode_and_cleanup bytecode_name exec_name prim_name =
let oc = open_out_gen [Open_wronly; Open_append; Open_binary] 0 exec_name in
@@ -472,7 +507,20 @@ let link objfiles output_name =
try
link_bytecode tolink bytecode_name false;
let poc = open_out prim_name in
+ output_string poc "\
+ #ifdef __cplusplus\n\
+ extern \"C\" {\n\
+ #endif\n\
+ #ifdef _WIN64\n\
+ typedef __int64 value;\n\
+ #else\n\
+ typedef long value;\n\
+ #endif\n";
Symtable.output_primitive_table poc;
+ output_string poc "\
+ #ifdef __cplusplus\n\
+ }\n\
+ #endif\n";
close_out poc;
let exec_name = fix_exec_name output_name in
if not (build_custom_runtime prim_name exec_name)
View
14 bytecomp/symtable.ml
@@ -114,14 +114,10 @@ open Printf
let output_primitive_table outchan =
let prim = all_primitives() in
- fprintf outchan "\
- #ifdef __cplusplus\n\
- extern \"C\" {\n\
- #endif\n";
for i = 0 to Array.length prim - 1 do
- fprintf outchan "extern long %s();\n" prim.(i)
+ fprintf outchan "extern value %s();\n" prim.(i)
done;
- fprintf outchan "typedef long (*primitive)();\n";
+ fprintf outchan "typedef value (*primitive)();\n";
fprintf outchan "primitive caml_builtin_cprim[] = {\n";
for i = 0 to Array.length prim - 1 do
fprintf outchan " %s,\n" prim.(i)
@@ -131,11 +127,7 @@ let output_primitive_table outchan =
for i = 0 to Array.length prim - 1 do
fprintf outchan " \"%s\",\n" prim.(i)
done;
- fprintf outchan " (char *) 0 };\n";
- fprintf outchan "\
- #ifdef __cplusplus\n\
- }\n\
- #endif\n"
+ fprintf outchan " (char *) 0 };\n"
(* Initialization for batch linking *)
View
40 bytecomp/typeopt.ml
@@ -22,18 +22,17 @@ open Types
open Typedtree
open Lambda
+let scrape env ty =
+ (Ctype.repr (Ctype.expand_head_opt env (Ctype.correct_levels ty))).desc
+
let has_base_type exp base_ty_path =
- let exp_ty =
- Ctype.expand_head_opt exp.exp_env (Ctype.correct_levels exp.exp_type) in
- match Ctype.repr exp_ty with
- {desc = Tconstr(p, _, _)} -> Path.same p base_ty_path
+ match scrape exp.exp_env exp.exp_type with
+ | Tconstr(p, _, _) -> Path.same p base_ty_path
| _ -> false
let maybe_pointer exp =
- let exp_ty =
- Ctype.expand_head_opt exp.exp_env (Ctype.correct_levels exp.exp_type) in
- match (Ctype.repr exp_ty).desc with
- Tconstr(p, args, abbrev) ->
+ match scrape exp.exp_env exp.exp_type with
+ | Tconstr(p, args, abbrev) ->
not (Path.same p Predef.path_int) &&
not (Path.same p Predef.path_char) &&
begin try
@@ -50,9 +49,8 @@ let maybe_pointer exp =
| _ -> true
let array_element_kind env ty =
- let ty = Ctype.repr (Ctype.expand_head_opt env ty) in
- match ty.desc with
- Tvar | Tunivar ->
+ match scrape env ty with
+ | Tvar | Tunivar ->
Pgenarray
| Tconstr(p, args, abbrev) ->
if Path.same p Predef.path_int || Path.same p Predef.path_char then
@@ -85,9 +83,8 @@ let array_element_kind env ty =
Paddrarray
let array_kind_gen ty env =
- let array_ty = Ctype.expand_head_opt env (Ctype.correct_levels ty) in
- match (Ctype.repr array_ty).desc with
- Tconstr(p, [elt_ty], _) | Tpoly({desc = Tconstr(p, [elt_ty], _)}, _)
+ match scrape env ty with
+ | Tconstr(p, [elt_ty], _) | Tpoly({desc = Tconstr(p, [elt_ty], _)}, _)
when Path.same p Predef.path_array ->
array_element_kind env elt_ty
| _ ->
@@ -98,9 +95,9 @@ let array_kind exp = array_kind_gen exp.exp_type exp.exp_env
let array_pattern_kind pat = array_kind_gen pat.pat_type pat.pat_env
-let bigarray_decode_type ty tbl dfl =
- match (Ctype.repr ty).desc with
- Tconstr(Pdot(Pident mod_id, type_name, _), [], _)
+let bigarray_decode_type env ty tbl dfl =
+ match scrape env ty with
+ | Tconstr(Pdot(Pident mod_id, type_name, _), [], _)
when Ident.name mod_id = "Bigarray" ->
begin try List.assoc type_name tbl with Not_found -> dfl end
| _ ->
@@ -125,10 +122,9 @@ let layout_table =
"fortran_layout", Pbigarray_fortran_layout]
let bigarray_kind_and_layout exp =
- let ty = Ctype.repr (Ctype.expand_head_opt exp.exp_env exp.exp_type) in
- match ty.desc with
- Tconstr(p, [caml_type; elt_type; layout_type], abbrev) ->
- (bigarray_decode_type elt_type kind_table Pbigarray_unknown,
- bigarray_decode_type layout_type layout_table Pbigarray_unknown_layout)
+ match scrape exp.exp_env exp.exp_type with
+ | Tconstr(p, [caml_type; elt_type; layout_type], abbrev) ->
+ (bigarray_decode_type exp.exp_env elt_type kind_table Pbigarray_unknown,
+ bigarray_decode_type exp.exp_env layout_type layout_table Pbigarray_unknown_layout)
| _ ->
(Pbigarray_unknown, Pbigarray_unknown_layout)
View
2 byterun/.cvsignore
@@ -15,3 +15,5 @@ interp.a.lst
*.[sd]obj
*.lib
.gdb_history
+*.so
+*.a
View
12 byterun/.depend
@@ -105,13 +105,13 @@ printexc.o: printexc.c backtrace.h mlvalues.h compatibility.h config.h \
roots.o: roots.c finalise.h roots.h misc.h compatibility.h config.h \
../config/m.h ../config/s.h memory.h gc.h mlvalues.h major_gc.h \
freelist.h minor_gc.h globroots.h stacks.h
-signals_byt.o: signals_byt.c config.h ../config/m.h ../config/s.h \
- compatibility.h memory.h gc.h mlvalues.h misc.h major_gc.h freelist.h \
- minor_gc.h osdeps.h signals.h signals_machdep.h
signals.o: signals.c alloc.h compatibility.h misc.h config.h \
../config/m.h ../config/s.h mlvalues.h callback.h fail.h memory.h gc.h \
major_gc.h freelist.h minor_gc.h roots.h signals.h signals_machdep.h \
sys.h
+signals_byt.o: signals_byt.c config.h ../config/m.h ../config/s.h \
+ compatibility.h memory.h gc.h mlvalues.h misc.h major_gc.h freelist.h \
+ minor_gc.h osdeps.h signals.h signals_machdep.h
stacks.o: stacks.c config.h ../config/m.h ../config/s.h compatibility.h \
fail.h misc.h mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h \
minor_gc.h
@@ -243,13 +243,13 @@ printexc.d.o: printexc.c backtrace.h mlvalues.h compatibility.h config.h \
roots.d.o: roots.c finalise.h roots.h misc.h compatibility.h config.h \
../config/m.h ../config/s.h memory.h gc.h mlvalues.h major_gc.h \
freelist.h minor_gc.h globroots.h stacks.h
-signals_byt.d.o: signals_byt.c config.h ../config/m.h ../config/s.h \
- compatibility.h memory.h gc.h mlvalues.h misc.h major_gc.h freelist.h \
- minor_gc.h osdeps.h signals.h signals_machdep.h
signals.d.o: signals.c alloc.h compatibility.h misc.h config.h \
../config/m.h ../config/s.h mlvalues.h callback.h fail.h memory.h gc.h \
major_gc.h freelist.h minor_gc.h roots.h signals.h signals_machdep.h \
sys.h
+signals_byt.d.o: signals_byt.c config.h ../config/m.h ../config/s.h \
+ compatibility.h memory.h gc.h mlvalues.h misc.h major_gc.h freelist.h \
+ minor_gc.h osdeps.h signals.h signals_machdep.h
stacks.d.o: stacks.c config.h ../config/m.h ../config/s.h compatibility.h \
fail.h misc.h mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h \
minor_gc.h
View
7 byterun/backtrace.c
@@ -39,6 +39,7 @@ CAMLexport int caml_backtrace_active = 0;
CAMLexport int caml_backtrace_pos = 0;
CAMLexport code_t * caml_backtrace_buffer = NULL;
CAMLexport value caml_backtrace_last_exn = Val_unit;
+CAMLexport char * caml_cds_file = NULL;
#define BACKTRACE_BUFFER_SIZE 1024
/* Location of fields in the Instruct.debug_event record */
@@ -135,7 +136,11 @@ static value read_debug_info(void)
uint32 num_events, orig, i;
value evl, l;
- exec_name = caml_exe_name;
+ if (caml_cds_file != NULL) {
+ exec_name = caml_cds_file;
+ } else {
+ exec_name = caml_exe_name;
+ }
fd = caml_attempt_open(&exec_name, &trail, 1);
if (fd < 0) CAMLreturn(Val_false);
caml_read_section_descriptors(fd, &trail);
View
1 byterun/backtrace.h
@@ -22,6 +22,7 @@ CAMLextern int caml_backtrace_active;
CAMLextern int caml_backtrace_pos;
CAMLextern code_t * caml_backtrace_buffer;
CAMLextern value caml_backtrace_last_exn;
+CAMLextern char * caml_cds_file;
CAMLprim value caml_record_backtrace(value vflag);
#ifndef NATIVE_CODE
View
2 byterun/gc_ctrl.c
@@ -419,7 +419,7 @@ static void test_and_compact (void)
fp = 100.0 * caml_fl_cur_size
/ (Wsize_bsize (caml_stat_heap_size) - caml_fl_cur_size);
- if (fp > 1000000.0) fp = 1000000.0;
+ if (fp > 999999.0) fp = 999999.0;
caml_gc_message (0x200, "Estimated overhead (lower bound) = %"
ARCH_INTNAT_PRINTF_FORMAT "u%%\n",
(uintnat) fp);
View
3 byterun/interp.c
@@ -157,7 +157,8 @@ sp is a local copy of the global variable caml_extern_sp. */
#define SP_REG asm("a4")
#define ACCU_REG asm("d7")
#endif
-#ifdef __arm__
+/* PR#4953: these specific registers not available in Thumb mode */
+#if defined (__arm__) && !defined(__thumb__)
#define PC_REG asm("r6")
#define SP_REG asm("r8")
#define ACCU_REG asm("r7")
View
4 byterun/obj.c
@@ -165,6 +165,10 @@ CAMLprim value caml_obj_truncate (value v, value newsize)
return Val_unit;
}
+CAMLprim value caml_obj_add_offset (value v, value offset)
+{
+ return v + Int32_val (offset);
+}
/* The following functions are used in stdlib/lazy.ml.
They are not written in O'Caml because they must be atomic with respect
View
32 byterun/startup.c
@@ -439,12 +439,18 @@ CAMLexport void caml_startup_code(
char **argv)
{
value res;
+ char* cds_file;
caml_init_ieee_floats();
caml_init_custom_operations();
#ifdef DEBUG
caml_verb_gc = 63;
#endif
+ cds_file = getenv("CAML_DEBUG_FILE");
+ if (cds_file != NULL) {
+ caml_cds_file = caml_stat_alloc(strlen(cds_file) + 1);
+ strcpy(caml_cds_file, cds_file);
+ }
parse_camlrunparam();
caml_external_raise = NULL;
/* Initialize the abstract machine */
@@ -454,8 +460,17 @@ CAMLexport void caml_startup_code(
init_atoms();
/* Initialize the interpreter */
caml_interprete(NULL, 0);
+ /* Initialize the debugger, if needed */
+ caml_debugger_init();
/* Load the code */
caml_start_code = code;
+ caml_code_size = code_size;
+ if (caml_debugger_in_use) {
+ int len, i;
+ len = code_size / sizeof(opcode_t);
+ caml_saved_code = (unsigned char *) caml_stat_alloc(len);
+ for (i = 0; i < len; i++) caml_saved_code[i] = caml_start_code[i];
+ }
#ifdef THREADED_CODE
caml_thread_code(caml_start_code, code_size);
#endif
@@ -469,10 +484,19 @@ CAMLexport void caml_startup_code(
/* Record the sections (for caml_get_section_table in meta.c) */
caml_section_table = section_table;
caml_section_table_size = section_table_size;
- /* Run the code */
+ /* Initialize system libraries */
caml_init_exceptions();
caml_sys_init("", argv);
- res = caml_interprete(caml_start_code, code_size);
- if (Is_exception_result(res))
- caml_fatal_uncaught_exception(Extract_exception(res));
+ /* Execute the program */
+ caml_debugger(PROGRAM_START);
+ res = caml_interprete(caml_start_code, caml_code_size);
+ if (Is_exception_result(res)) {
+ caml_exn_bucket = Extract_exception(res);
+ if (caml_debugger_in_use) {
+ caml_extern_sp = &caml_exn_bucket; /* The debugger needs the
+ exception value.*/
+ caml_debugger(UNCAUGHT_EXC);
+ }
+ caml_fatal_uncaught_exception(caml_exn_bucket);
+ }
}
View
2 camlp4/Makefile.ml
@@ -90,7 +90,7 @@ let may_define_unix = if windows then [] else ["-D UNIX"]
let () =
!options.ocaml_Flags ^= "-w Aler -warn-error Aler"^^
- (if getenv "DTYPES" "" <> "" then "-dtypes"
+ (if getenv "DTYPES" "" <> "" then "-annot"
else "");
!options.ocaml_P4 := camlp4boot_may_debug may_define_unix;
!options.ocaml_P4_opt := camlp4boot_may_debug ("-D OPT" :: may_define_unix);
View
10 config/Makefile-templ
@@ -78,10 +78,14 @@ SHARPBANGSCRIPTS=true
# Under FreeBSD:
#CPP=cpp -P
+### Magic declarations for ocamlbuild -- leave unchanged
+#ml let syslib x = "-l"^x;;
+#ml let mklib out files opts = Printf.sprintf "ar rc %s %s %s; ranlib %s" out opts files out;;
+
### How to invoke ranlib
-# BSD-style:
-#RANLIB=ranlib
-#RANLIBCMD=ranlib
+RANLIB=ranlib
+RANLIBCMD=ranlib
+
# If ranlib is not needed:
#RANLIB=ar rs
#RANLIBCMD=
View
4 config/Makefile.mingw
@@ -145,11 +145,11 @@ BNG_ARCH=ia32
BNG_ASM_LEVEL=1
### Configuration for LablTk
-# Set TK_ROOT to the directory where you installed TCL/TK 8.4
+# Set TK_ROOT to the directory where you installed TCL/TK 8.5
# There must be no spaces or special characters in $(TK_ROOT)
TK_ROOT=c:/tcl
TK_DEFS=-I$(TK_ROOT)/include
-TK_LINK=$(TK_ROOT)/bin/tk84.dll $(TK_ROOT)/bin/tcl84.dll -lws2_32
+TK_LINK=$(TK_ROOT)/bin/tk85.dll $(TK_ROOT)/bin/tcl85.dll -lws2_32
############# Aliases for common commands
View
10 config/Makefile.msvc
@@ -80,7 +80,7 @@ BYTECC=cl /nologo -D_CRT_SECURE_NO_DEPRECATE
BYTECCCOMPOPTS=/Ox /MD
### Additional link-time options for $(BYTECC). (For static linking.)
-BYTECCLINKOPTS=/MD /F16777216
+BYTECCLINKOPTS=
### Additional compile-time options for $(BYTECC). (For building a DLL.)
DLLCCCOMPOPTS=/Ox /MD
@@ -131,7 +131,7 @@ NATIVECC=cl /nologo -D_CRT_SECURE_NO_DEPRECATE
NATIVECCCOMPOPTS=/Ox /MD
### Additional link-time options for $(NATIVECC)
-NATIVECCLINKOPTS=/MD /F16777216
+NATIVECCLINKOPTS=
### Build partially-linked object file
PACKLD=link /lib /nologo /out:# there must be no space after this '/out:'
@@ -145,17 +145,17 @@ BNG_ARCH=generic
BNG_ASM_LEVEL=0
### Configuration for LablTk
-# Set TK_ROOT to the directory where you installed TCL/TK 8.3
+# Set TK_ROOT to the directory where you installed TCL/TK 8.5
TK_ROOT=c:/tcl
TK_DEFS=-I$(TK_ROOT)/include
# The following definition avoids hard-wiring $(TK_ROOT) in the libraries
# produced by OCaml, and is therefore required for binary distribution
# of these libraries. However, $(TK_ROOT)/lib must be added to the LIB
# environment variable, as described in README.win32.
-TK_LINK=tk84.lib tcl84.lib ws2_32.lib
+TK_LINK=tk85.lib tcl85.lib ws2_32.lib
# An alternative definition that avoids mucking with the LIB variable,
# but hard-wires the Tcl/Tk location in the binaries
-# TK_LINK=$(TK_ROOT)/tk84.lib $(TK_ROOT)/tcl84.lib ws2_32.lib
+# TK_LINK=$(TK_ROOT)/tk85.lib $(TK_ROOT)/tcl85.lib ws2_32.lib
############# Aliases for common commands
View
4 config/Makefile.msvc64
@@ -83,7 +83,7 @@ BYTECCCOMPOPTS=/Ox /MD
BYTECCDBGCOMPOPTS=-DDEBUG /Zi /W3 /Wp64
### Additional link-time options for $(BYTECC). (For static linking.)
-BYTECCLINKOPTS=/MD /F33554432
+BYTECCLINKOPTS=
### Additional compile-time options for $(BYTECC). (For building a DLL.)
DLLCCCOMPOPTS=/Ox /MD
@@ -135,7 +135,7 @@ NATIVECC=cl /nologo
NATIVECCCOMPOPTS=/Ox /MD
### Additional link-time options for $(NATIVECC)
-NATIVECCLINKOPTS=/MD /F33554432
+NATIVECCLINKOPTS=
### Build partially-linked object file
PACKLD=link /lib /nologo /machine:AMD64 /out:# there must be no space after this '/out:'
View
20 configure
@@ -95,6 +95,8 @@ while : ; do
pthread_wanted=no;;
-no-tk|--no-tk)
tk_wanted=no;;
+ -partialld|--partialld)
+ partialld="$2"; shift;;
-tkdefs*|--tkdefs*)
tk_defs=$2; shift;;
-tklibs*|--tklibs*)
@@ -303,14 +305,16 @@ case "$bytecc,$host" in
gcc*,*-*-cygwin*)
bytecccompopts="-fno-defer-pop $gcc_warnings -U_WIN32"
dllccompopts="-D_WIN32 -DCAML_DLL"
- flexlink="flexlink -chain cygwin -merge-manifest"
- flexdir=`$flexlink -where | dos2unix`
- if test -z "$flexdir"; then
- echo "flexlink not found: native shared libraries won't be available"
- withsharedlibs=no
- else
- iflexdir="-I\"$flexdir\""
- mkexe="$flexlink -exe"
+ if test $withsharedlibs = yes; then
+ flexlink="flexlink -chain cygwin -merge-manifest"
+ flexdir=`$flexlink -where | dos2unix`
+ if test -z "$flexdir"; then
+ echo "flexlink not found: native shared libraries won't be available"
+ withsharedlibs=no
+ else
+ iflexdir="-I\"$flexdir\""
+ mkexe="$flexlink -exe"
+ fi
fi
exe=".exe"
ostype="Cygwin";;
View
242 debugger/.depend
@@ -1,46 +1,46 @@
-breakpoints.cmi: primitives.cmi ../bytecomp/instruct.cmi
-checkpoints.cmi: primitives.cmi debugcom.cmi
-command_line.cmi:
-debugcom.cmi: primitives.cmi
-debugger_config.cmi:
-dynlink.cmi:
-envaux.cmi: ../typing/path.cmi ../bytecomp/instruct.cmi ../typing/env.cmi
+breakpoints.cmi: primitives.cmi ../bytecomp/instruct.cmi
+checkpoints.cmi: primitives.cmi debugcom.cmi
+command_line.cmi:
+debugcom.cmi: primitives.cmi
+debugger_config.cmi:
+dynlink.cmi:
+envaux.cmi: ../typing/path.cmi ../bytecomp/instruct.cmi ../typing/env.cmi
eval.cmi: ../typing/types.cmi ../typing/path.cmi parser_aux.cmi \
../parsing/longident.cmi ../bytecomp/instruct.cmi ../typing/ident.cmi \
- ../typing/env.cmi debugcom.cmi
-events.cmi: ../bytecomp/instruct.cmi
-exec.cmi:
-frames.cmi: primitives.cmi ../bytecomp/instruct.cmi
-history.cmi:
-input_handling.cmi: primitives.cmi
-int64ops.cmi:
-lexer.cmi: parser.cmi
-loadprinter.cmi: ../parsing/longident.cmi dynlink.cmi
-parameters.cmi:
-parser.cmi: parser_aux.cmi ../parsing/longident.cmi
-parser_aux.cmi: primitives.cmi ../parsing/longident.cmi
-pattern_matching.cmi: ../typing/typedtree.cmi parser_aux.cmi debugcom.cmi
-pos.cmi: ../bytecomp/instruct.cmi
-primitives.cmi: ../otherlibs/unix/unix.cmi
+ ../typing/env.cmi debugcom.cmi
+events.cmi: ../bytecomp/instruct.cmi
+exec.cmi:
+frames.cmi: primitives.cmi ../bytecomp/instruct.cmi
+history.cmi:
+input_handling.cmi: primitives.cmi
+int64ops.cmi:
+lexer.cmi: parser.cmi
+loadprinter.cmi: ../parsing/longident.cmi dynlink.cmi
+parameters.cmi:
+parser.cmi: parser_aux.cmi ../parsing/longident.cmi
+parser_aux.cmi: primitives.cmi ../parsing/longident.cmi
+pattern_matching.cmi: ../typing/typedtree.cmi parser_aux.cmi debugcom.cmi
+pos.cmi: ../bytecomp/instruct.cmi
+primitives.cmi: $(UNIXDIR)/unix.cmi
printval.cmi: ../typing/types.cmi ../typing/path.cmi parser_aux.cmi \
- ../typing/env.cmi debugcom.cmi
-program_loading.cmi: primitives.cmi
-program_management.cmi:
-question.cmi:
-show_information.cmi: ../bytecomp/instruct.cmi
-show_source.cmi: ../bytecomp/instruct.cmi
-source.cmi:
-symbols.cmi: ../bytecomp/instruct.cmi
-time_travel.cmi: primitives.cmi
-trap_barrier.cmi:
-unix_tools.cmi: ../otherlibs/unix/unix.cmi
+ ../typing/env.cmi debugcom.cmi
+program_loading.cmi: primitives.cmi
+program_management.cmi:
+question.cmi:
+show_information.cmi: ../bytecomp/instruct.cmi
+show_source.cmi: ../bytecomp/instruct.cmi
+source.cmi:
+symbols.cmi: ../bytecomp/instruct.cmi
+time_travel.cmi: primitives.cmi
+trap_barrier.cmi:
+unix_tools.cmi: $(UNIXDIR)/unix.cmi
breakpoints.cmo: symbols.cmi primitives.cmi pos.cmi ../bytecomp/instruct.cmi \
- exec.cmi debugcom.cmi checkpoints.cmi breakpoints.cmi
+ exec.cmi debugcom.cmi checkpoints.cmi breakpoints.cmi
breakpoints.cmx: symbols.cmx primitives.cmx pos.cmx ../bytecomp/instruct.cmx \
- exec.cmx debugcom.cmx checkpoints.cmx breakpoints.cmi
-checkpoints.cmo: primitives.cmi int64ops.cmi debugcom.cmi checkpoints.cmi
-checkpoints.cmx: primitives.cmx int64ops.cmx debugcom.cmx checkpoints.cmi
-command_line.cmo: unix_tools.cmi ../otherlibs/unix/unix.cmi \
+ exec.cmx debugcom.cmx checkpoints.cmx breakpoints.cmi
+checkpoints.cmo: primitives.cmi int64ops.cmi debugcom.cmi checkpoints.cmi
+checkpoints.cmx: primitives.cmx int64ops.cmx debugcom.cmx checkpoints.cmi
+command_line.cmo: unix_tools.cmi $(UNIXDIR)/unix.cmi \
../typing/types.cmi time_travel.cmi symbols.cmi source.cmi \
show_source.cmi show_information.cmi question.cmi program_management.cmi \
program_loading.cmi printval.cmi primitives.cmi pos.cmi parser_aux.cmi \
@@ -49,8 +49,8 @@ command_line.cmo: unix_tools.cmi ../otherlibs/unix/unix.cmi \
../bytecomp/instruct.cmi input_handling.cmi history.cmi frames.cmi \
events.cmi eval.cmi envaux.cmi debugger_config.cmi debugcom.cmi \
../typing/ctype.cmi ../utils/config.cmi checkpoints.cmi breakpoints.cmi \
- command_line.cmi
-command_line.cmx: unix_tools.cmx ../otherlibs/unix/unix.cmx \
+ command_line.cmi
+command_line.cmx: unix_tools.cmx $(UNIXDIR)/unix.cmx \
../typing/types.cmx time_travel.cmx symbols.cmx source.cmx \
show_source.cmx show_information.cmx question.cmx program_management.cmx \
program_loading.cmx printval.cmx primitives.cmx pos.cmx parser_aux.cmi \
@@ -59,154 +59,154 @@ command_line.cmx: unix_tools.cmx ../otherlibs/unix/unix.cmx \
../bytecomp/instruct.cmx input_handling.cmx history.cmx frames.cmx \
events.cmx eval.cmx envaux.cmx debugger_config.cmx debugcom.cmx \
../typing/ctype.cmx ../utils/config.cmx checkpoints.cmx breakpoints.cmx \
- command_line.cmi
+ command_line.cmi
debugcom.cmo: primitives.cmi ../utils/misc.cmi int64ops.cmi \
- input_handling.cmi debugcom.cmi
+ input_handling.cmi debugcom.cmi
debugcom.cmx: primitives.cmx ../utils/misc.cmx int64ops.cmx \
- input_handling.cmx debugcom.cmi
-debugger_config.cmo: int64ops.cmi debugger_config.cmi
-debugger_config.cmx: int64ops.cmx debugger_config.cmi
+ input_handling.cmx debugcom.cmi
+debugger_config.cmo: int64ops.cmi debugger_config.cmi
+debugger_config.cmx: int64ops.cmx debugger_config.cmi
dynlink.cmo: ../bytecomp/symtable.cmi ../bytecomp/opcodes.cmo \
../utils/misc.cmi ../bytecomp/meta.cmi ../bytecomp/dll.cmi \
../utils/consistbl.cmi ../utils/config.cmi ../bytecomp/cmo_format.cmi \
- dynlink.cmi
+ dynlink.cmi
dynlink.cmx: ../bytecomp/symtable.cmx ../bytecomp/opcodes.cmx \
../utils/misc.cmx ../bytecomp/meta.cmx ../bytecomp/dll.cmx \
../utils/consistbl.cmx ../utils/config.cmx ../bytecomp/cmo_format.cmi \
- dynlink.cmi
+ dynlink.cmi
envaux.cmo: ../typing/types.cmi ../typing/subst.cmi ../typing/printtyp.cmi \
../typing/path.cmi ../typing/mtype.cmi ../utils/misc.cmi \
- ../bytecomp/instruct.cmi ../typing/env.cmi envaux.cmi
+ ../bytecomp/instruct.cmi ../typing/env.cmi envaux.cmi
envaux.cmx: ../typing/types.cmx ../typing/subst.cmx ../typing/printtyp.cmx \
../typing/path.cmx ../typing/mtype.cmx ../utils/misc.cmx \
- ../bytecomp/instruct.cmx ../typing/env.cmx envaux.cmi
+ ../bytecomp/instruct.cmx ../typing/env.cmx envaux.cmi
eval.cmo: ../typing/types.cmi ../bytecomp/symtable.cmi ../typing/subst.cmi \
printval.cmi ../typing/printtyp.cmi ../typing/predef.cmi \
../typing/path.cmi parser_aux.cmi ../utils/misc.cmi \
../parsing/longident.cmi ../bytecomp/instruct.cmi ../typing/ident.cmi \
frames.cmi ../typing/env.cmi debugcom.cmi ../typing/ctype.cmi \
- ../typing/btype.cmi eval.cmi
+ ../typing/btype.cmi eval.cmi
eval.cmx: ../typing/types.cmx ../bytecomp/symtable.cmx ../typing/subst.cmx \
printval.cmx ../typing/printtyp.cmx ../typing/predef.cmx \
../typing/path.cmx parser_aux.cmi ../utils/misc.cmx \
../parsing/longident.cmx ../bytecomp/instruct.cmx ../typing/ident.cmx \
frames.cmx ../typing/env.cmx debugcom.cmx ../typing/ctype.cmx \
- ../typing/btype.cmx eval.cmi
-events.cmo: ../parsing/location.cmi ../bytecomp/instruct.cmi events.cmi
-events.cmx: ../parsing/location.cmx ../bytecomp/instruct.cmx events.cmi
-exec.cmo: exec.cmi
-exec.cmx: exec.cmi
+ ../typing/btype.cmx eval.cmi
+events.cmo: ../parsing/location.cmi ../bytecomp/instruct.cmi events.cmi
+events.cmx: ../parsing/location.cmx ../bytecomp/instruct.cmx events.cmi
+exec.cmo: exec.cmi
+exec.cmx: exec.cmi
frames.cmo: symbols.cmi ../utils/misc.cmi ../bytecomp/instruct.cmi events.cmi \
- debugcom.cmi frames.cmi
+ debugcom.cmi frames.cmi
frames.cmx: symbols.cmx ../utils/misc.cmx ../bytecomp/instruct.cmx events.cmx \
- debugcom.cmx frames.cmi
+ debugcom.cmx frames.cmi
history.cmo: primitives.cmi int64ops.cmi debugger_config.cmi checkpoints.cmi \
- history.cmi
+ history.cmi
history.cmx: primitives.cmx int64ops.cmx debugger_config.cmx checkpoints.cmx \
- history.cmi
-input_handling.cmo: ../otherlibs/unix/unix.cmi primitives.cmi \
- input_handling.cmi
-input_handling.cmx: ../otherlibs/unix/unix.cmx primitives.cmx \
- input_handling.cmi
-int64ops.cmo: int64ops.cmi
-int64ops.cmx: int64ops.cmi
-lexer.cmo: parser.cmi lexer.cmi
-lexer.cmx: parser.cmx lexer.cmi
+ history.cmi
+input_handling.cmo: $(UNIXDIR)/unix.cmi primitives.cmi \
+ input_handling.cmi
+input_handling.cmx: $(UNIXDIR)/unix.cmx primitives.cmx \
+ input_handling.cmi
+int64ops.cmo: int64ops.cmi
+int64ops.cmx: int64ops.cmi
+lexer.cmo: parser.cmi lexer.cmi
+lexer.cmx: parser.cmx lexer.cmi
loadprinter.cmo: ../typing/types.cmi ../bytecomp/symtable.cmi printval.cmi \
../typing/printtyp.cmi ../typing/path.cmi ../utils/misc.cmi \
../parsing/longident.cmi ../typing/ident.cmi ../typing/env.cmi \
- dynlink.cmi ../typing/ctype.cmi ../utils/config.cmi loadprinter.cmi
+ dynlink.cmi ../typing/ctype.cmi ../utils/config.cmi loadprinter.cmi
loadprinter.cmx: ../typing/types.cmx ../bytecomp/symtable.cmx printval.cmx \
../typing/printtyp.cmx ../typing/path.cmx ../utils/misc.cmx \
../parsing/longident.cmx ../typing/ident.cmx ../typing/env.cmx \
- dynlink.cmx ../typing/ctype.cmx ../utils/config.cmx loadprinter.cmi
-main.cmo: unix_tools.cmi ../otherlibs/unix/unix.cmi time_travel.cmi \
- show_information.cmi question.cmi program_management.cmi parameters.cmi \
- ../utils/misc.cmi input_handling.cmi frames.cmi exec.cmi \
+ dynlink.cmx ../typing/ctype.cmx ../utils/config.cmx loadprinter.cmi
+main.cmo: unix_tools.cmi $(UNIXDIR)/unix.cmi time_travel.cmi \
+ show_information.cmi question.cmi program_management.cmi primitives.cmi \
+ parameters.cmi ../utils/misc.cmi input_handling.cmi frames.cmi exec.cmi \
../typing/env.cmi debugger_config.cmi ../utils/config.cmi \
- command_line.cmi ../utils/clflags.cmi checkpoints.cmi
-main.cmx: unix_tools.cmx ../otherlibs/unix/unix.cmx time_travel.cmx \
- show_information.cmx question.cmx program_management.cmx parameters.cmx \
- ../utils/misc.cmx input_handling.cmx frames.cmx exec.cmx \
+ command_line.cmi ../utils/clflags.cmi checkpoints.cmi
+main.cmx: unix_tools.cmx $(UNIXDIR)/unix.cmx time_travel.cmx \
+ show_information.cmx question.cmx program_management.cmx primitives.cmx \
+ parameters.cmx ../utils/misc.cmx input_handling.cmx frames.cmx exec.cmx \
../typing/env.cmx debugger_config.cmx ../utils/config.cmx \
- command_line.cmx ../utils/clflags.cmx checkpoints.cmx
+ command_line.cmx ../utils/clflags.cmx checkpoints.cmx
parameters.cmo: primitives.cmi envaux.cmi debugger_config.cmi \
- ../utils/config.cmi parameters.cmi
+ ../utils/config.cmi parameters.cmi
parameters.cmx: primitives.cmx envaux.cmx debugger_config.cmx \
- ../utils/config.cmx parameters.cmi
+ ../utils/config.cmx parameters.cmi
parser.cmo: parser_aux.cmi ../parsing/longident.cmi int64ops.cmi \
- input_handling.cmi parser.cmi
+ input_handling.cmi parser.cmi
parser.cmx: parser_aux.cmi ../parsing/longident.cmx int64ops.cmx \
- input_handling.cmx parser.cmi
+ input_handling.cmx parser.cmi
pattern_matching.cmo: ../typing/typedtree.cmi parser_aux.cmi \
../utils/misc.cmi debugger_config.cmi debugcom.cmi ../typing/ctype.cmi \
- pattern_matching.cmi
+ pattern_matching.cmi
pattern_matching.cmx: ../typing/typedtree.cmx parser_aux.cmi \
../utils/misc.cmx debugger_config.cmx debugcom.cmx ../typing/ctype.cmx \
- pattern_matching.cmi
+ pattern_matching.cmi
pos.cmo: source.cmi primitives.cmi ../parsing/location.cmi \
- ../bytecomp/instruct.cmi pos.cmi
+ ../bytecomp/instruct.cmi pos.cmi
pos.cmx: source.cmx primitives.cmx ../parsing/location.cmx \
- ../bytecomp/instruct.cmx pos.cmi
-primitives.cmo: ../otherlibs/unix/unix.cmi primitives.cmi
-primitives.cmx: ../otherlibs/unix/unix.cmx primitives.cmi
+ ../bytecomp/instruct.cmx pos.cmi
+primitives.cmo: $(UNIXDIR)/unix.cmi primitives.cmi
+primitives.cmx: $(UNIXDIR)/unix.cmx primitives.cmi
printval.cmo: ../typing/types.cmi ../bytecomp/symtable.cmi \
../typing/printtyp.cmi ../typing/path.cmi parser_aux.cmi \
../typing/outcometree.cmi ../typing/oprint.cmi \
- ../toplevel/genprintval.cmi debugcom.cmi printval.cmi
+ ../toplevel/genprintval.cmi debugcom.cmi printval.cmi
printval.cmx: ../typing/types.cmx ../bytecomp/symtable.cmx \
../typing/printtyp.cmx ../typing/path.cmx parser_aux.cmi \
../typing/outcometree.cmi ../typing/oprint.cmx \
- ../toplevel/genprintval.cmx debugcom.cmx printval.cmi
-program_loading.cmo: unix_tools.cmi ../otherlibs/unix/unix.cmi primitives.cmi \
- parameters.cmi input_handling.cmi debugger_config.cmi program_loading.cmi
-program_loading.cmx: unix_tools.cmx ../otherlibs/unix/unix.cmx primitives.cmx \
- parameters.cmx input_handling.cmx debugger_config.cmx program_loading.cmi
-program_management.cmo: unix_tools.cmi ../otherlibs/unix/unix.cmi \
+ ../toplevel/genprintval.cmx debugcom.cmx printval.cmi
+program_loading.cmo: unix_tools.cmi $(UNIXDIR)/unix.cmi primitives.cmi \
+ parameters.cmi input_handling.cmi debugger_config.cmi program_loading.cmi
+program_loading.cmx: unix_tools.cmx $(UNIXDIR)/unix.cmx primitives.cmx \
+ parameters.cmx input_handling.cmx debugger_config.cmx program_loading.cmi
+program_management.cmo: unix_tools.cmi $(UNIXDIR)/unix.cmi \
time_travel.cmi symbols.cmi question.cmi program_loading.cmi \
primitives.cmi parameters.cmi int64ops.cmi input_handling.cmi history.cmi \
- debugger_config.cmi breakpoints.cmi program_management.cmi
-program_management.cmx: unix_tools.cmx ../otherlibs/unix/unix.cmx \
+ debugger_config.cmi breakpoints.cmi program_management.cmi
+program_management.cmx: unix_tools.cmx $(UNIXDIR)/unix.cmx \
time_travel.cmx symbols.cmx question.cmx program_loading.cmx \
primitives.cmx parameters.cmx int64ops.cmx input_handling.cmx history.cmx \
- debugger_config.cmx breakpoints.cmx program_management.cmi
-question.cmo: primitives.cmi lexer.cmi input_handling.cmi question.cmi
-question.cmx: primitives.cmx lexer.cmx input_handling.cmx question.cmi
-show_information.cmo: symbols.cmi show_source.cmi printval.cmi \
+ debugger_config.cmx breakpoints.cmx program_management.cmi
+question.cmo: primitives.cmi lexer.cmi input_handling.cmi question.cmi
+question.cmx: primitives.cmx lexer.cmx input_handling.cmx question.cmi
+show_information.cmo: symbols.cmi source.cmi show_source.cmi printval.cmi \
../utils/misc.cmi ../bytecomp/instruct.cmi frames.cmi events.cmi \
- debugcom.cmi checkpoints.cmi breakpoints.cmi show_information.cmi
-show_information.cmx: symbols.cmx show_source.cmx printval.cmx \
+ debugcom.cmi checkpoints.cmi breakpoints.cmi show_information.cmi
+show_information.cmx: symbols.cmx source.cmx show_source.cmx printval.cmx \
../utils/misc.cmx ../bytecomp/instruct.cmx frames.cmx events.cmx \
- debugcom.cmx checkpoints.cmx breakpoints.cmx show_information.cmi
+ debugcom.cmx checkpoints.cmx breakpoints.cmx show_information.cmi
show_source.cmo: source.cmi primitives.cmi parameters.cmi \
../parsing/location.cmi ../bytecomp/instruct.cmi events.cmi \
- debugger_config.cmi show_source.cmi
+ debugger_config.cmi show_source.cmi
show_source.cmx: source.cmx primitives.cmx parameters.cmx \
../parsing/location.cmx ../bytecomp/instruct.cmx events.cmx \
- debugger_config.cmx show_source.cmi
+ debugger_config.cmx show_source.cmi
source.cmo: primitives.cmi ../utils/misc.cmi debugger_config.cmi \
- ../utils/config.cmi source.cmi
+ ../utils/config.cmi source.cmi
source.cmx: primitives.cmx ../utils/misc.cmx debugger_config.cmx \
- ../utils/config.cmx source.cmi
-symbols.cmo: ../bytecomp/symtable.cmi ../bytecomp/instruct.cmi events.cmi \
- debugger_config.cmi debugcom.cmi checkpoints.cmi \
- ../bytecomp/bytesections.cmi symbols.cmi
-symbols.cmx: ../bytecomp/symtable.cmx ../bytecomp/instruct.cmx events.cmx \
- debugger_config.cmx debugcom.cmx checkpoints.cmx \
- ../bytecomp/bytesections.cmx symbols.cmi
+ ../utils/config.cmx source.cmi
+symbols.cmo: ../bytecomp/symtable.cmi program_loading.cmi \
+ ../bytecomp/instruct.cmi events.cmi debugger_config.cmi debugcom.cmi \
+ checkpoints.cmi ../bytecomp/bytesections.cmi symbols.cmi
+symbols.cmx: ../bytecomp/symtable.cmx program_loading.cmx \
+ ../bytecomp/instruct.cmx events.cmx debugger_config.cmx debugcom.cmx \
+ checkpoints.cmx ../bytecomp/bytesections.cmx symbols.cmi
time_travel.cmo: trap_barrier.cmi symbols.cmi question.cmi \
program_loading.cmi primitives.cmi ../utils/misc.cmi int64ops.cmi \
../bytecomp/instruct.cmi input_handling.cmi exec.cmi events.cmi \
debugger_config.cmi debugcom.cmi checkpoints.cmi breakpoints.cmi \
- time_travel.cmi
+ time_travel.cmi
time_travel.cmx: trap_barrier.cmx symbols.cmx question.cmx \
program_loading.cmx primitives.cmx ../utils/misc.cmx int64ops.cmx \
../bytecomp/instruct.cmx input_handling.cmx exec.cmx events.cmx \
debugger_config.cmx debugcom.cmx checkpoints.cmx breakpoints.cmx \
- time_travel.cmi
-trap_barrier.cmo: exec.cmi debugcom.cmi checkpoints.cmi trap_barrier.cmi
-trap_barrier.cmx: exec.cmx debugcom.cmx checkpoints.cmx trap_barrier.cmi
-unix_tools.cmo: ../otherlibs/unix/unix.cmi primitives.cmi ../utils/misc.cmi \
- unix_tools.cmi
-unix_tools.cmx: ../otherlibs/unix/unix.cmx primitives.cmx ../utils/misc.cmx \
- unix_tools.cmi
+ time_travel.cmi
+trap_barrier.cmo: exec.cmi debugcom.cmi checkpoints.cmi trap_barrier.cmi
+trap_barrier.cmx: exec.cmx debugcom.cmx checkpoints.cmx trap_barrier.cmi
+unix_tools.cmo: $(UNIXDIR)/unix.cmi primitives.cmi ../utils/misc.cmi \
+ unix_tools.cmi
+unix_tools.cmx: $(UNIXDIR)/unix.cmx primitives.cmx ../utils/misc.cmx \
+ unix_tools.cmi
View
7 debugger/Makefile.shared
@@ -60,19 +60,19 @@ OBJS=\
pos.cmo \
checkpoints.cmo \
events.cmo \
+ program_loading.cmo \
symbols.cmo \
breakpoints.cmo \
trap_barrier.cmo \
history.cmo \
- program_loading.cmo \
printval.cmo \
show_source.cmo \
time_travel.cmo \
program_management.cmo \
frames.cmo \
eval.cmo \
show_information.cmo \
- loadprinter.cmo \
+ loadprinter.cmo \
parser.cmo \
command_line.cmo \
main.cmo
@@ -99,7 +99,8 @@ clean::
$(CAMLC) -c $(COMPFLAGS) $<
depend: beforedepend
- $(CAMLDEP) $(DEPFLAGS) *.mli *.ml > .depend
+ $(CAMLDEP) $(DEPFLAGS) *.mli *.ml \
+ | sed -e 's,$(UNIXDIR)/,$$(UNIXDIR)/,' > .depend
lexer.ml: lexer.mll
$(CAMLLEX) lexer.mll
View
34 debugger/command_line.ml
@@ -705,26 +705,30 @@ let instr_last ppf lexbuf =
let instr_list ppf lexbuf =
let (mo, beg, e) = list_arguments_eol Lexer.lexeme lexbuf in
- let (curr_mod, point) =
+ let (curr_mod, line, column) =
try
selected_point ()
with
| Not_found ->
- ("", -1)
+ ("", -1, -1)
in
let mdle = convert_module (module_of_longident mo) in
let pos = Lexing.dummy_pos in
+ let buffer =
+ try get_buffer pos mdle with
+ | Not_found -> error ("No source file for " ^ mdle ^ ".") in
+ let point =
+ if column <> -1 then
+ (point_of_coord buffer line 1) + column
+ else
+ -1 in
let beginning =
match beg with
- | None when (mo <> None) || (point = -1) ->
+ | None when (mo <> None) || (line = -1) ->
1
| None ->
- let buffer =
- try get_buffer pos mdle with
- | Not_found -> error ("No source file for " ^ mdle ^ ".")
- in
begin try
- max 1 ((snd (line_of_pos buffer point)) - 10)
+ max 1 (line - 10)
with Out_of_range ->
1
end
@@ -861,11 +865,19 @@ let info_events ppf lexbuf =
print_endline " Address Characters Kind Repr.";
List.iter
(function ev ->
- Printf.printf
+ let start_char, end_char =
+ try
+ let buffer = get_buffer (Events.get_pos ev) ev.ev_module in
+ (snd (start_and_cnum buffer ev.ev_loc.Location.loc_start)),
+ (snd (start_and_cnum buffer ev.ev_loc.Location.loc_end))
+ with _ ->
+ ev.ev_loc.Location.loc_start.Lexing.pos_cnum,
+ ev.ev_loc.Location.loc_end.Lexing.pos_cnum in
+ Printf.printf
"%10d %6d-%-6d %10s %10s\n"
ev.ev_pos
- ev.ev_loc.Location.loc_start.Lexing.pos_cnum
- ev.ev_loc.Location.loc_end.Lexing.pos_cnum
+ start_char
+ end_char
((match ev.ev_kind with
Event_before -> "before"
| Event_after _ -> "after"
View
4 debugger/frames.ml
@@ -33,7 +33,9 @@ let selected_point () =
None ->
raise Not_found
| Some ev ->
- (ev.ev_module, (Events.get_pos ev).Lexing.pos_cnum)
+ (ev.ev_module,
+ (Events.get_pos ev).Lexing.pos_lnum,
+ (Events.get_pos ev).Lexing.pos_cnum - (Events.get_pos ev).Lexing.pos_bol)
let selected_event_is_before () =
match !selected_event with
View
4 debugger/frames.mli
@@ -24,9 +24,9 @@ val current_frame : int ref
(* Event at selected position. *)
val selected_event : debug_event option ref
-(* Selected position in source. *)
+(* Selected position in source (module, line, column). *)
(* Raise `Not_found' if not on an event. *)
-val selected_point : unit -> string * int
+val selected_point : unit -> string * int * int
val selected_event_is_before : unit -> bool
View
36 debugger/main.ml
@@ -24,6 +24,7 @@ open Program_management
open Frames
open Show_information
open Format
+open Primitives
let line_buffer = Lexing.from_function read_user_input
@@ -107,7 +108,39 @@ let rec protect ppf restart loop =
kill_program ();
raise x
-let toplevel_loop () = protect Format.std_formatter loop loop
+let execute_file_if_any () =
+ let buffer = Buffer.create 128 in
+ begin
+ try
+ let base = ".ocamldebug" in
+ let file =
+ if Sys.file_exists base then
+ base
+ else
+ Filename.concat (Sys.getenv "HOME") base in
+ let ch = open_in file in
+ fprintf Format.std_formatter "Executing file %s@." file;
+ while true do
+ let line = string_trim (input_line ch) in
+ if line <> "" && line.[0] <> '#' then begin
+ Buffer.add_string buffer line;
+ Buffer.add_char buffer '\n'
+ end
+ done;
+ with _ -> ()
+ end;
+ let len = Buffer.length buffer in
+ if len > 0 then
+ let commands = Buffer.sub buffer 0 (pred len) in
+ line_loop Format.std_formatter (Lexing.from_string commands)
+
+let toplevel_loop () =
+ interactif := false;
+ current_prompt := "";
+ execute_file_if_any ();
+ interactif := true;
+ current_prompt := debugger_prompt;
+ protect Format.std_formatter loop loop
(* Parsing of command-line arguments *)