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` did not activate stack printing by default. Given the documentation of the `-g` flag, this is a reasonable expectation:

-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 `OCAMLRUNPARAM="b=0"`.

Something like that would improve a lot average bug report when classical users are not necessarily familiar with
OCaml and you can't expect user to come back providing more informations. This kind of situation is common on
linux distribution bug trackers.

(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.)

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.