Doing a verbose build indicates that -fexceptions is correctly being passed to the compiler, but -fno-exceptions is also passed by default, so that needs to be turned off. To unset that flag, use build_unflags.
Thank you! It works. Would be nice to cover this in the docs as well, or at least include this in the error message. Also, it’s unclear what for is it done - I mean why this flag is set by default
OK, now I have exceptions enabled. But when I throw one and try to catch and handle it I got scary dump message:
User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Abort called
From what I have googled around I am not sure if it is possible to use exceptions with ESP8266 with Arduino platform. But why would you solve problems with exceptions flags, when the exceptions mechanism would not be working?
EDIT: Interesting, in Arduino IDE when Tools->Exceptions set to Enable the exception is properly caught and handled.
does not work for me:
in platform.ini:
build_flags = -fexceptions
build_unflags = -fno-exceptions
and in platformio-build.py I changed under LIBS=[] the stdc++ to stdc+±exc
If I copy the exception message to the window from the exception decoder, there is no decoded info available
Are you sure you’re not mixing up two different things? C++ exceptions with try/catch are completely separate from the exception log or decoder that is outputted when the application crashes.
The exception decoder is builtin to PlatformIO, I don’t know where you get the “Windows from the exception decoder”. It can’t do anything too when it doesn’t know about the .elf firmware file which contains all the symbol information needed for decoding.
If you just want to decode an exception log thrown during runtime, you must build in debug mode and activate the exception log decoder. This is done by adding