-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add CMake option to enable the debugging of floating point exceptions #3687
Add CMake option to enable the debugging of floating point exceptions #3687
Conversation
Add a new CMake option WANT_DEBUG_FPE which adds the define LMMS_DEBUG_FPE if activated. Extend lmmsconfig.h.in with regards to that define. Include information about development options to the CMake output. Install a signal handler to trap floating point exceptions when starting LMMS in case it is compiled using the option described above. The current implementation of the signal handler prints a stack trace and then exits the application. Currently this option is only enabled for Linux builds due to uncertainty with regards to which of the needed headers are supported by Windows and Apple.
Not for the faint of heart... ;-) I'm not really cmake literate but I think when you set |
👍 Just echo a warning if the appropriate debug flags are off and force them on.
That sounds even better. Do best practices permit making a custom |
I don't think that it really is a new build type. It's just an option that can be activated and likely only makes sense for certain builds. How about we just terminate CMake with an error in case it is enabled for non-debug builds? It's disabled by default anyway and in my opinion we only need to make sure that packagers are not able to enable it in release builds that are intended for distribution. |
Mass distribution, probably, but who cares? If you want to distribute a binary with additional debug symbols, that should be welcome, no? We really struggle to get usable output from our non-developers because they can't fulfill this "gathering logs" role for us. I'd like to see debug builds for all platforms, I think it's critical to the success of the project as a whole. |
@tresf Yes, I was talking about mass distribution, e.g. the packaging for the Ubuntu repositories. I guess we don't want LMMS to exit whenever a random plugin creates NaNs or other floating point exceptions. So we have to make sure that this option cannot be enabled for production builds. |
Isn't this the same mutual exclusion problem/solution described here, just reversed? But I don't see cmake flags as something that get accidentally enabled, so I'm not even sure we need to safeguard this. |
It seems that I have named the flag in an unfortunate way as it will also do its work in Release mode. It might make sense to call it INSTALL_FP_EXCEPTION_HANDLER instead and to change the help text to something similar, e.g. "Install handler to trap floating point exception (development only!)". What do you think? |
The name is fine. You can create a release with debug symbols. They're not mutually exclusive. From cmake.org:
I think it's a good name? :) |
@tresf I know What this PR adds is a function that is triggered when a floating point exception occurs, i.e. on NaNs, denormals, etc. If this situation occurs a stack trace is printed and the application exits. You can also use it to set break points in case one wants to debug a certain situation where floating points exceptions are triggered. However, as the behavior is quite drastic it should only be used during development which is why you can/have to activate this option in CMake and why it should not be used in official releases. |
Perhaps I misunderstood the question. This is what I read...
I don't see a problem with the name.
I would advise against using the
I think we can document the severity of this in our wiki. I'm not sure why someone would arbitrarily turn on flags when building. It sounds like you're trying to capture the edge-case of a |
So I assume that we can merge this as is. P.S.: I did not start the discussion to change anything. 😉 |
Rebased and merged into |
We perform division with some Envelope and LFO variables so they mustn't be zero. They are given a minimum value of one frame ( f_cnt_t ). Since LMMS#3687 we have a compile flag to turn on debugging of floating point operations. This will currently not let you pass the Envelope/LFO initiation and this is also fixed by this PR.
We perform division with some Envelope and LFO variables so they mustn't be zero. They are given a minimum value of one frame ( f_cnt_t ). Since LMMS#3687 we have a compile flag to turn on debugging of floating point operations. This will currently not let you pass the Envelope/LFO initiation and this is also fixed by this PR.
We perform division with some Envelope and LFO variables so they mustn't be zero. They are given a minimum value of one frame ( f_cnt_t ). Since #3687 we have a compile flag to turn on debugging of floating point operations. This will currently not let you pass the Envelope/LFO initiation and this is also fixed by this PR.
Allow LMMS#3687 to work on Mac
We perform division with some Envelope and LFO variables so they mustn't be zero. They are given a minimum value of one frame ( f_cnt_t ). Since LMMS#3687 we have a compile flag to turn on debugging of floating point operations. This will currently not let you pass the Envelope/LFO initiation and this is also fixed by this PR.
Allow LMMS#3687 to work on Mac
Add a new CMake option
WANT_DEBUG_FPE
which adds the defineLMMS_DEBUG_FPE
if activated. Extendlmmsconfig.h.in
with regards to thatdefine. Include information about development options to the CMake
output.
Install a signal handler to trap floating point exceptions when starting
LMMS in case it is compiled using the option described above. The
current implementation of the signal handler prints a stack trace and
then exits the application.
Currently this option is only enabled for Linux builds due to
uncertainty with regards to which of the needed headers are supported by
Windows and Apple.
Edit: @tresf 2018-03-04
To Use
cd build cmake .. -DWANT_DEBUG_FPE=True -DCMAKE_BUILD_TYPE=Debug