Commit Graph

50 Commits (c550f4b8583596b4b59662960371943e7f750fdf)

Author SHA1 Message Date
Xavier Leroy b868c05ec9 PR#6517: use ISO C99 types {,u}int{32,64}_t in preference to our homegrown
types {,u}int{32,64}.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15131 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-27 09:58:33 +00:00
Damien Doligez cbfe627f92 merge changes from branch 4.02 from branching (rev 14852) to 4.02.0+rc1 (rev 15121)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15125 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-22 13:45:02 +00:00
Mark Shinwell dd3a286bbe PR 6439 part 1: fix mistake in backtrace.c
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14923 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-30 09:52:05 +00:00
Gabriel Scherer 4f913f2498 reinstate the deprecated primitive caml_get_exception_backtrace
Jacques-Henri initially removed the primitive, which is deprecated
since 4.01, but I suspect there still are uses in the wild. I guess we
should wait for a few more versions.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14780 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-10 19:19:53 +00:00
Gabriel Scherer ebd3778122 factor the pointers-into-ints cleverness through pair of macros
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14779 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-10 19:19:52 +00:00
Gabriel Scherer 0b50a80ab2 cleanup cmp_ev_info
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14778 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-10 19:19:50 +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
Gabriel Scherer 2b9f94b69b PR#6270: remove need for -I directives to ocamldebug in common case
(patch by Josh Watzman)

Add absolute directory names to bytecode format for ocamldebug to use

The need for a long list of -I directives makes interactively using
ocamldebug a pain in the butt. Many folks have solved this with various
`find` invocations or even Python wrappers, but those lead to other
problems when it might include files you weren't expecting (or miss
things you were). But all of this is really annoying since the tooling
should be able to figure out itself, even heuristically, where your
source files are -- gdb gets this right, why can't we?

This patch implements one of the more important heuristics from gdb: you
typically debug on the same machine you built on, so looking for the
source files and built artifacts in the absolute paths where they were
during compilation is a good first try. We write out absolute paths into
a new structure at the beginning of the debug section and then
automatically append those directories into the load path.

This means mean that if you happen to be debugging on a machine
where the original source and build artifacts are *not* available in
their original absolute locations, things will work as before, using the
standard load path mechanism. You can also explicitly use -I to prepend
directories to the load path and override the defaults located by this
new mechanism.

I personally find this makes using ocamldebug much more pleasant :)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14533 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-06 15:06:22 +00:00
Alain Frisch c4513e1011 Recognize reraises in handlers.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14224 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-10-14 13:21:53 +00:00
Alain Frisch f31325cbaf #6203, #5935: variants of raise. 'reraise' is currently only inserted by the compiler when an handler does not catch the exception. The default 'raise' always start with a fresh backtrace. There is also 'raise_nostack' which does not trigger the stack trace recording. Bytecode only for now.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14223 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-10-14 12:31:50 +00:00
Damien Doligez 7844495624 Merge branch 4.01 from branching point to 4.01.0+rc1
Command line used:
  svn merge --accept postpone -r 13776:14055 $REPO/version/4.01 .


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14060 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-04 15:12:37 +00:00
Gabriel Scherer b06701e207 implement a caml_stash_current_backtrace primitive to save the call stack at any point
This commit only implements runtime support in asmrun/ and byterun/.
The more subjective Printexc interface will come separately.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13813 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-19 14:12:02 +00:00
Gabriel Scherer be7dca95f5 make ocamlopt pretty-print uncaught exceptions just as ocamlc and Printexc
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13809 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-19 14:03:51 +00:00
Damien Doligez af0796ea30 fix C compiler warnings and bug introduced by commit 13436
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13437 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-22 18:36:22 +00:00
Damien Doligez 8d921d62a3 fix whitespace and over-long lines
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13436 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-22 18:22:51 +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
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
Fabrice Le Fessant 808d083b9f Revert commit r12756 containing unwanted changes
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12757 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-07-22 15:15:55 +00:00
Fabrice Le Fessant 5e74e6f0cc Fix PR#5695
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12756 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-07-22 15:12:43 +00:00
Damien Doligez e7f5b858c2 More renaming to OCaml
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12149 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-02-10 16:15:24 +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
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
Xavier Leroy 4b5512c74c Stack backtraces on uncaught exceptions in native code (merge of the opt_backtrace branch)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7812 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2007-01-29 12:11:18 +00:00
Damien Doligez 736d2cfe14 PR#3809 wrong line numbers in backtrace
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7162 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2005-10-25 16:22:38 +00:00
Damien Doligez 47d37cc125 PR#3809 wrong line numbers in backtrace (partial) [typo]
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7161 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2005-10-25 16:03:25 +00:00
Damien Doligez 64666f7de7 PR#3809 wrong line numbers in backtrace (partial)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7160 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2005-10-25 15:56:45 +00:00
Damien Doligez 0c7aecb88d depollution suite (et fin?) (PR#1914 et PR#1956)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6047 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2004-01-02 19:23:29 +00:00
Damien Doligez 5a678d29f5 depollution suite (PR#1914 et PR#1956)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6045 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2004-01-01 16:42:43 +00:00
Damien Doligez 331b2d89c3 depollution suite (PR#1914, PR#1956)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6044 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-12-31 14:20:40 +00:00
Damien Doligez 31943bac1d depollution suite (PR#1914 et PR#1956); byterun/weak.c: PR#1929 suite
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6041 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-12-29 22:15:02 +00:00
Damien Doligez 501d64ea6a PR#1554
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5401 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-02-24 16:44:48 +00:00
Damien Doligez 1f716a7b5b suppression de quelques GCCismes
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5354 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-12-16 16:42:13 +00:00
Xavier Leroy 1ca0e80c73 Ameliore backtrace dans le cas ou l'exception est levee par une primitive C (PR#654)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5299 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-11-26 10:47:21 +00:00
Damien Doligez 04a0377a58 petit changement de l'affichage
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5237 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-11-04 13:57:21 +00:00
Damien Doligez 219d03a647 changement des locations, suite...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5234 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-11-04 12:39:57 +00:00
Xavier Leroy 1446383b74 Typo dans message
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5011 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-07-22 08:22:27 +00:00
Xavier Leroy 429efbf7c2 Ajout Sys.executable_name, laisser Sys.argv.(0) inchange (PR#817)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4375 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-02-11 13:51:40 +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 fce4bbc16a \n manquant dans un message
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4044 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-11-26 15:54:33 +00:00
Xavier Leroy 320487c59f Revu gestion des backtrace; suppression de RERAISE, utiliser l'adresse de l'objet exception a la place
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4040 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-11-26 12:47:03 +00:00
Xavier Leroy 2f7123618c Ajout de flush_all + modifs pour Cash (Bruno Verlyck)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3872 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-10-09 15:14:01 +00:00
Xavier Leroy 53124fce8c Imprimer un petit message si pas d'infos de debug
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3865 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-10-09 14:02:23 +00:00
Xavier Leroy d4a8bd81f6 Suppression variables inutiles
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3780 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-09-24 12:45:55 +00:00
Xavier Leroy ddd99c7e5d Chargement dynamique de primitives C
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3677 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-08-28 14:47:48 +00:00
Xavier Leroy f0e7035637 Revu backtrace pour que ca marche avec des threads. Ajout et utilisation de printexc.h
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3526 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-06-15 14:22:38 +00:00
Xavier Leroy 4b84fcf843 Ajout du backtrace
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3422 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-02-19 12:29:00 +00:00