Commit Graph

43 Commits (b02d9ae2fa3b36226ae171c5df154cf92039433f)

Author SHA1 Message Date
Damien Doligez 520fb2df50 Merge tag 4.03.0 into trunk. 2016-04-28 16:13:21 +02:00
Alain Frisch 8557a86477 Also enable more warnings in stdlib/ and fix them. 2016-03-15 22:47:26 +01:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
Gabriel Scherer 755b19650b Reformulation of the user-facing slot-access API
- The internal [backtrace_slot] type is not exposed anymore, instead
  accessors function return orthogonal information
  (is_raise, location). This is both more extensible and more
  user-friendly.

- The [raw_backtrace_slot] is exposed separately as a low-level type
  that most users should never use. The unsafety of marshalling is
  documented. Instead of defining
  [raw_backtrace = raw_backtrace_slot array], I kept [raw_backtrace]
  an abstract type with [length] and [get] functions for
  random-access. This should allow us to change the implementation in
  the future to be more robust wrt. marshalling (boxing the trace in
  a Custom block, or even possibly the raw slots at access time).

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14784 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-10 19:20:00 +00:00
Gabriel Scherer cc6b2ca107 expose Printexc.format_backtrace_slot to facilitate testing
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14781 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-10 19:19:55 +00:00
Gabriel Scherer 1fdea57c4c Printexc: OCaml-friendly access to individual backtrace slots
(Patch by Jacques-Henri Jourdan)

There are several changes:

- `raw_backtrace` is no longer an abstract type, but rather an
  `raw_backtrace_slot array`, where `raw_backtrace_slot` is a new
  abstract type. `raw_backtrace_slot` elements are hashable and
  comparable. At runtime, values of this type contain either
  a bytecode pointer or a frame_descr pointer. In order to prevent the
  GC from walking through this pointer, the low-order bit is set to
  1 when stored in the array.

- The old `loc_info` type is know public, renamed into `backtrace_slot`:

      type backtrace_slot =
        | Known_location of bool   (* is_raise *)
                          * string (* filename *)
                          * int    (* line number *)
                          * int    (* start char *)
                          * int    (* end char *)
        | Unknown_location of bool (*is_raise*)

- new primitive :

    val convert_raw_backtrace_slot: raw_backtrace_slot -> backtrace_slot

  Rather than returning an option, it raises Failure when it is not
  possible to get the debugging information. It seems more idiomatic,
  especially because the exceptional case cannot appear only for a part
  of the executable.

- the caml_convert_raw_backtrace primitive is removed; it is more
  difficult to implement in the C side because of the new exception
  interface described above.

- In the bytecode runtime, the events are no longer deserialized once
  for each conversion, but once and for all at the first conversion,
  and stored in a global array (*outside* the OCaml heap), sorted by
  program counter value. I believe this information should not take
  much memory in practice (it uses the same order of magnitude memory
  as the bytecode executable). It also makes location lookup much more
  efficient, as a dichomoty is used instead of linear search as
  previously.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14776 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-10 19:19:47 +00:00
Jérémie Dimino d3ec5feb26 PR#5941: add Printexc.set_uncaught_exception_handler
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14643 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-18 15:36:08 +00:00
Alain Frisch 7bb3e64160 Do not introduce Obj.raw_tag.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14270 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-06 10:57:20 +00:00
Alain Frisch 5ef2ee909f Support for exception values allocated in the static area (e.g. out of bound exception in native code).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14242 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-10-23 15:17:05 +00:00
Alain Frisch be3c4d6882 Add two functions to get the exception slot id and name from an exception value.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14240 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-10-23 14:35:43 +00:00
Alain Frisch 0f6f367ad4 Change the representation of exception slots: instead of being represented as 'string ref', they are now blocks
of size 2, with tag = Object_tag, the first field being the pointer to the string, and second one being a unique id, generated
from the same sequence as for object values.  Special case for predefined exceptions, represented with a negative id.

The unique id generator is moved from camlinternalOO to the C runtime system.

Also fix some bugs.



git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14239 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-10-23 14:28:31 +00:00
Alain Frisch 7334bb026a #5899: expose Printexc.get_callstack. (Cherry-picked 13884, 13885 from trunk.)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13886 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-11 12:37:10 +00:00
Gabriel Scherer 725da3dcc9 user-exposed abstract type for raw backtraces in Printexc.ml (original patch from Jacques-Henri Jourdan)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13394 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-11 19:04:12 +00:00
Damien Doligez c63f9e0957 fix a few problems with whitespace and over-long lines
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13393 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-09 22:38:52 +00:00
Alain Frisch ba00d09386 Revert bad commit.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13268 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-01-23 08:41:02 +00:00
Alain Frisch 20a4b99758 #5902: adapt standard ppx driver to support extra arguments.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13267 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-01-23 08:37:01 +00:00
Damien Doligez def31744f9 remove all $Id keywords
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13013 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-15 17:50:56 +00:00
Alain Frisch 1cc8f999d8 Document that a dummy declaration is here to avoid a warning.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12505 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-05-29 12:37:01 +00:00
Alain Frisch a0a14c08fa Enable and fix more warnings.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12498 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-05-29 11:47:28 +00:00
Xavier Clerc cb7818e6de PR#5344: some predifined exceptions need special printing
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11187 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-09-08 08:34:43 +00:00
Damien Doligez 3b507dd1aa renaming of Objective Caml to OCaml and cleanup of copyright headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11156 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-07-27 14:17:02 +00:00
Alain Frisch e178c1ab62 Fix #5003: document the fact that expressions raised by exception printers are just ignored; custom printers are tried before hard-coded ones.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10272 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-04-19 12:25:46 +00:00
Damien Doligez 04b1656222 clean up spaces and tabs
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9547 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-01-22 12:48:24 +00:00
Damien Doligez bdc0fadee2 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
2010-01-20 16:26:46 +00:00
Xavier Leroy 640b24249d Ability to print and capture exception backtraces (see stdlib module Printexc)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8839 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2008-03-14 13:47:24 +00:00
Damien Doligez 776a8d59b7 suppression support MacOS9
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6074 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2004-01-16 15:24:03 +00:00
Damien Doligez 306f79785d points-virgules mal places
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5386 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-01-21 12:57:33 +00:00
Damien Doligez ed3123ee87 changement des locations, premiere tranche
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5224 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-11-01 17:06:47 +00:00
Pierre Weis 6df4c2b6de Introducing (and using) string and string format coercions.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5211 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-10-31 10:00:02 +00:00
Pierre Weis a829d1d7d6 Using formats %S and %C.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4959 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-06-27 09:27:14 +00:00
Xavier Leroy 7501784c80 MAJ en-tetes pour mentionner la 'special exception' sur la LGPL
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4144 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-12-07 13:41:02 +00:00
Xavier Leroy cc0f32b054 Changement de la licence
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2553 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1999-11-17 18:59:06 +00:00
Xavier Leroy 67971438ee Noms symboliques pour les tags speciaux
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2107 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1998-10-01 12:34:32 +00:00
Damien Doligez 9704b7a5f5 Ajout de Printexc.to_string.
Suppression de Printexc.print_exn qui est redondant.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1589 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-06-12 15:29:01 +00:00
Damien Doligez da05d1bb63 bug stupide
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1582 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-06-07 12:56:13 +00:00
Damien Doligez 28a67e328e exportation de Printexc.print_exn et customisation Mac
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1581 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-06-06 14:54:09 +00:00
Xavier Leroy 1f808f4492 pervasives: grouper les 3 arguments de Assert_failure, ca permet une
meilleure propagation des constantes.
pervasives.mli: documentation de Stack_overflow
printexc.ml: affichage de Stack_overflow.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1558 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-05-15 13:28:08 +00:00
Damien Doligez 81712f86b8 pervasives, printexc: Ajout assert
format: changement de l'ordre des declarations


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1542 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-05-13 18:27:27 +00:00
Xavier Leroy 2301d778e7 Renommage en Objective Caml
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@782 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1996-04-30 14:53:58 +00:00
Xavier Leroy 042febb925 On flushe dans print
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@446 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1995-11-15 09:33:15 +00:00
Xavier Leroy e4066357b1 Ajout des notices de copyright
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@195 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1995-08-09 15:06:35 +00:00
Xavier Leroy 8e0d4fd44c MAJ du tag des chaines.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@166 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1995-07-28 12:23:42 +00:00
Xavier Leroy 61bd8ace6b Passage a la version bootstrappee (franchissement du Rubicon)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1995-05-04 10:15:53 +00:00