aboutsummaryrefslogtreecommitdiffstats
path: root/cparser
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2017-01-17 12:13:28 +0100
committerBernhard Schommer <bernhardschommer@gmail.com>2017-01-17 12:13:28 +0100
commitb34cdb445c74268309ab74cd63793c6b70da11fc (patch)
tree7aec36096b096694115958ec14cca4ce3481a413 /cparser
parent629b90d8d88128bab1cb4ad5e533d8f3c82730f3 (diff)
downloadcompcert-b34cdb445c74268309ab74cd63793c6b70da11fc.tar.gz
compcert-b34cdb445c74268309ab74cd63793c6b70da11fc.zip
Safe the backtrace earlier. Bug 20681
Diffstat (limited to 'cparser')
-rw-r--r--cparser/Cerrors.ml25
1 files changed, 13 insertions, 12 deletions
diff --git a/cparser/Cerrors.ml b/cparser/Cerrors.ml
index e7b21dbb..c8fc65db 100644
--- a/cparser/Cerrors.ml
+++ b/cparser/Cerrors.ml
@@ -323,17 +323,18 @@ let raise_on_errors () =
raise Abort
let crash exn =
- if Version.buildnr <> "" && Version.tag <> "" then begin
- eprintf "%tThis is CompCert, Release:%s, Build:%s, Tag:%s%t\n"
- bc Version.version Version.buildnr Version.tag rsc;
- eprintf "Backtrace (please include this in your support request):\n%s"
- (Printexc.get_backtrace ());
- eprintf "%tUncaught exception:%s.\n\
+ if Version.buildnr <> "" && Version.tag <> "" then begin
+ let backtrace = Printexc.get_backtrace () in
+ eprintf "%tThis is CompCert, Release:%s, Build:%s, Tag:%s%t\n"
+ bc Version.version Version.buildnr Version.tag rsc;
+ eprintf "Backtrace (please include this in your support request):\n%s"
+ backtrace;
+ eprintf "%tUncaught exception:%s.\n\
\ Please report this problem to our support.\n\
\ Error occurred in Build: %s, Tag: %s.\n%t"
- rc (Printexc.to_string exn) Version.buildnr Version.tag rsc;
- exit 2
- end else begin
- Printexc.print_backtrace stderr;
- exit 2
- end
+ rc (Printexc.to_string exn) Version.buildnr Version.tag rsc;
+ exit 2
+ end else begin
+ Printexc.print_backtrace stderr;
+ exit 2
+ end