You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4880 Reporter: daweil Assigned to:@xavierleroy Status: closed (set by @xavierleroy on 2012-09-25T18:07:21Z) Resolution: fixed Priority: normal Severity: block Platform: Windows OS: Windows XP + VC8 OS Version: CXP, SP3 Version: 3.11.1 Fixed in version: 3.13.0+dev Category: ~DO NOT USE (was: OCaml general) Monitored by:@glondu@hcarty daweil
Bug description
This is a regression with 3.10.0.
When program is in CAML, call of "Printexc.record_backtrace true" triggers the printing of stack when exception are uncaught.
When main program is C or C++, backtrace are not printed anymore.
for bytecode compiler, it is not a regression : printing backtrace from c never worked. (unzip attach file caml_from_c2.zip and type make byte_dll.exe)
for native compiler, I was able to print backtrace with the toy example. Within the whole application, I found a hack to print the back trace : just after caml_startup, I'v added the folowwing line "caml_backtrace_active = 1;", which replace the call to "//caml_init_backtrace();" in ocaml3.10
call "Printexc.record_backtrace true" from your Caml code, e.g. in the initialization of one of your Caml modules,
or call "caml_record_backtrace(Val_int(1));" from your C code.
In native code, this will produce backtraces even if your Caml code is embedded in C.
Seeting "caml_backtrace_active = 1;" is a little bit less safe than calling "caml_record_backtrace". The stakes are low (a re-raise of an exception can be confused for an initial raise), but better go through the function.
In bytecode, this is not supported: the C object file produced by ocamlc -output-obj does not contain the debugging information associated to the corresponding bytecode.
Finally, your example shows that the exception raising in an "assert" construct lacks debugging information when compiled with the native-code compiler, which results in a less precise backtrace than for a regular "raise". In other terms, your example works better if "assert false" is replaced by "raise (Failure "foo")". I'll investigate this further.
Mentioned the backtrace trick in the manual (commit 11892).
Fixed the compiler so that "assert" constructs carry the debugging info needed for them to appear properly in stack backtraces (commit 11891 in SVN trunk).
Original bug ID: 4880
Reporter: daweil
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2012-09-25T18:07:21Z)
Resolution: fixed
Priority: normal
Severity: block
Platform: Windows
OS: Windows XP + VC8
OS Version: CXP, SP3
Version: 3.11.1
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @glondu @hcarty daweil
Bug description
This is a regression with 3.10.0.
When program is in CAML, call of "Printexc.record_backtrace true" triggers the printing of stack when exception are uncaught.
When main program is C or C++, backtrace are not printed anymore.
File attachments
The text was updated successfully, but these errors were encountered: