Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005855OCamlOCaml runtime systempublic2012-12-14 17:452013-12-16 13:44
Reporterthelema 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version4.00.1 
Target VersionFixed in Version 
Summary0005855: Compiling in debug mode should turn on caml_record_backtrace by default
DescriptionAt 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 ReproduceCompile a program with -g and set OCAMLRUNPARAM="", and see the lack of backtraces.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0008611)
ygrek (reporter)
2012-12-14 17:49

-g adds debug information which can be useful without wasting time recording backtraces of all exceptions, e.g. for sampling profiling.
(0008835)
gasche (developer)
2013-02-10 09:35

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"`.
(0008836)
chambart (developer)
2013-02-11 10:52

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.
(0008837)
gasche (developer)
2013-02-11 11:39
edited on: 2013-02-11 14:04

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

(0009577)
doligez (administrator)
2013-06-19 20:40

What is the best way to implement this?
(0009582)
ygrek (reporter)
2013-06-20 04:17

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.
(0009583)
jacques-henri.jourdan (manager)
2013-06-20 07:58

One solution could be to activate it only when linking the final executable with -g...
(0010719)
doligez (administrator)
2013-12-16 13:44

I'd rather add a new option -gg than introduce a subtle difference in -g used for compiling or linking.

- Issue History
Date Modified Username Field Change
2012-12-14 17:45 thelema New Issue
2012-12-14 17:49 ygrek Note Added: 0008611
2013-02-10 09:35 gasche Note Added: 0008835
2013-02-11 10:52 chambart Note Added: 0008836
2013-02-11 11:39 gasche Note Added: 0008837
2013-02-11 14:04 gasche Note Edited: 0008837 View Revisions
2013-06-19 20:40 doligez Note Added: 0009577
2013-06-19 20:40 doligez Status new => confirmed
2013-06-20 04:17 ygrek Note Added: 0009582
2013-06-20 07:58 jacques-henri.jourdan Note Added: 0009583
2013-12-16 13:44 doligez Note Added: 0010719


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker