Skip to content
Success

Changes

Summary

  1. Better stack backtraces for C calls in bytecode (#8641) (details)
Commit 23e5bfa3bb2beefe49b3e32d9a18b0e1624ca737 by xavier.leroy
Better stack backtraces for C calls in bytecode (#8641)
The previous mechanism worked for C calls that raise an exception, but
not for C calls that call back into OCaml code which raises an
exception.
This commit addresses the issue by saving the PC in the interpreter
stack before a C call, so that the backtrace mechanism always sees it.
However, if an external is declared in the .ml file and exposed in the
.mli file as a val, then ocamlc generates a wrapper that adds a spurious
entry in the stack frame. In this PR, this change in behavior results in
the re-declaration of Printexc.get_callstack as an external instead of a
val, so that the spurious stack frame does not appear in call stacks
obtained from Printexc.get_callstack.
The file was modifiedtestsuite/tests/statmemprof/arrays_in_major.ml (diff)
The file was modifiedruntime/backtrace_byt.c (diff)
The file was removedtestsuite/tests/statmemprof/lists_in_minor.byte.reference
The file was modifiedruntime/meta.c (diff)
The file was addedtestsuite/tests/statmemprof/arrays_in_major.reference
The file was removedtestsuite/tests/statmemprof/arrays_in_minor.byte.reference
The file was modifiedstdlib/printexc.mli (diff)
The file was addedtestsuite/tests/statmemprof/arrays_in_minor.reference
The file was modifiedruntime/caml/backtrace.h (diff)
The file was modifiedruntime/interp.c (diff)
The file was removedtestsuite/tests/statmemprof/arrays_in_minor.opt.reference
The file was removedtestsuite/tests/statmemprof/arrays_in_major.byte.reference
The file was modifiedChanges (diff)
The file was modifiedtestsuite/tests/backtrace/callstack.reference (diff)
The file was addedtestsuite/tests/statmemprof/lists_in_minor.reference
The file was modifiedtestsuite/tests/backtrace/callstack.ml (diff)
The file was modifiedtestsuite/tests/statmemprof/arrays_in_minor.ml (diff)
The file was modifiedtestsuite/tests/statmemprof/intern.byte.reference (diff)
The file was modifiedtestsuite/tests/statmemprof/lists_in_minor.ml (diff)
The file was removedtestsuite/tests/statmemprof/arrays_in_major.opt.reference