New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling in debug mode should turn on caml_record_backtrace by default #5855
Comments
Comment author: @ygrek -g adds debug information which can be useful without wasting time recording backtraces of all exceptions, e.g. for sampling profiling. |
Comment author: @gasche I came to submit the exact same feature wish, which has been suggested to me by a programmer unfamiliar with OCaml, which was surprised -g Record debugging information for exception backtrace As ygrek says, there are other uses of -g that don't need or want the corresponding overhead, but I think we should make the common case the simpler to use, and let expert with other use cases use |
Comment author: @chambart Something like that would improve a lot average bug report when classical users are not necessarily familiar with |
Comment author: @gasche (Eating a previous suggestion about treating unhandled exceptions differently from the others. Indeed, with dynamically filtering exception handlers, it's impossible to know which exceptions will be handled by the stack of existing handlers without executing them, at which point the stack is already discarded unless b=1.) |
Comment author: @damiendoligez What is the best way to implement this? |
Comment author: @ygrek I am against this behavior change. When this gets implemented suddenly all -g enabled libraries experience a performance hit. Running with OCAMLRUNPARAM=b=0 is not an option, how do you expect this to happen - wrap every program start in shell script? OCaml is different from other languages wrt exceptions, so it is not unreasonable to expect another behavior of -g. The arguments like "same feature wish, which has been suggested to me by a programmer unfamiliar with OCaml" are not valid, programmers unfamiliar with OCaml will find many strange things to complain about - polymorphic variants, labeled arguments (just had to deal with this one today), etc, etc - it is not a valid reason to change anything. OCaml is different, starting with syntax - because it has some objective reasons behind this decisions. The cost of printing backtrace is different - that's why it is not enabled by default. Why should we adopt the practice from other systems where it has totally different performance cost? If this is getting to be implemented I am strongly for another option, -gg or whatever, not changing the semantics of current option. |
Comment author: @jhjourdan One solution could be to activate it only when linking the final executable with -g... |
Comment author: @damiendoligez I'd rather add a new option -gg than introduce a subtle difference in -g used for compiling or linking. |
Comment author: @mshinwell Compile-time flags for debugging-related options will need revising in the light of the GDB work that will hopefully be merged in time for 4.05. We could consider having this kind of backtrace control as one of those options, perhaps. |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
Original bug ID: 5855
Reporter: thelema
Assigned to: @mshinwell
Status: assigned (set by @mshinwell on 2016-12-08T09:59:32Z)
Resolution: open
Priority: normal
Severity: feature
Version: 4.00.1
Category: runtime system and C interface
Related to: #6728
Monitored by: @chambart
Bug description
At the moment, the OCAMLRUNPARAM=b and compiling in debug mode with '-g' are orthogonal. Is there any reason that programs compiled with '-g' shouldn't have 'b' enabled by default?
Steps to reproduce
Compile a program with -g and set OCAMLRUNPARAM="", and see the lack of backtraces.
The text was updated successfully, but these errors were encountered: