Proper backtraces upon compiler failure#358
Conversation
|
Looks ok to me. |
|
Looking more at this, I feel that this PR does not completely solve the problem and could be improved. I would still be in favor of merging it in its current state as I believe that it is already a good step forward. My first frustration was about not being told in the PR what was this "earlier version of the patch" mentioned: it is MPR#6574, and the present PR should contain a Changes entry about it as merging it would let us close this issue report. My second frustration was looking at the code of the new primitive added: it is extremely similar to the existing My third issue with the proposed PR is that it feels like a bucket of exceptionless water in a see of reraises. Running Is this even the right approach to get high-quality backtraces? Should we rewrite the |
|
@chambart will have to comment on the details as to why Sys.remove_file in particular seemed to be the place to fix in order to help solve this problem. However, I don't think we should delay for such comment, as he is away for two weeks. This patch is a good incremental improvement to a significant deficiency in the compiler that hinders day-to-day development. It may not be perfect, but in practice it seems to be adequate. I think we should be careful not to fall into the trap of overthinking issues like this: a certain amount of mediocrity will mean that we have more time to spend on more important things. |
|
instead of duplicating C stubs, we could have this in let no_backtrace f =
let status = Printexc.backtrace_status () in
Printexc.record_backtrace false;
let result =
match f () with
| x -> Ok x
| exception e -> Error e
in
Printexc.record_backtrace status;
result
let ignore_errors f = ignore (no_backtrace f : (unit, exn) result) |
|
@diml I think that will not work since modifying I forgot to write a reduced version of #293 that just add |
|
I argue that we should merge this smaller change for 4.03 and consider larger changes for the next release. |
|
I don't really see how it can be argued that MPR#6574 is more satisfactory than this patch (which was actually written in conjunction with the original author of MPR#6574). |
|
I've merged MPR#6574. |
fix up bad CFI information in amd64.S
* 2.0 -> 3.1.0
The current situation where compiler failure can lead to unhelpful backtraces can be frustrating. This patch aims to prevent code in the compiler from destroying backtraces on their way out.
I understand that a previous version of this patch involved an unsatisfactory fix to Misc.remove_file. This version provides a fix that does not suffer from any (extra) race conditions.
Tested with a forced assertion failure in translcore.ml.