pw_log_android: Make PW_LOG_LEVEL_FATAL fatal again Since https://pwrev.dev/295040, invoking PW_HANDLE_LOG(PW_LOG_LEVEL_FATAL, ...) would no longer abort the process, and would continue executing. Making matters even worse, the pw_assert_log implementation of PW_HANDLE_CRASH() follows that up with a dubious PW_UNREACHABLE, which means that the compiler likely stopped emitting code at that point (in the branch or function). As a result, execution continues at whatever arbitrary code happens to follow! If you're lucky, this results in a SIGSEGV. This corrects the problem by routing PW_LOG_LEVEL_FATAL to __android_log_assert() which properly aborts (and is even annotated as noreturn). This also replaces the constexpr convert_pigweed_to_android_log_level() function with a 'static inline' function, since PW_LOG should be usable in C. In the common case of a constant log level, the compiler should still be able to optimize it away. Finally, ths changes the conversion default from ANDROID_LOG_DEBUG to ANDROID_LOG_WARN. This should never be used since we handle all current PW_LOG_LEVEL_* values, but ensures that such a log is visible in case a different level is added. Test: Verified (`logcat -s DEBUG`) that processes now crash with SIGABRT at the intended location. Bug: 543566936 Change-Id: Idd06077f0f4570d868ad0971fbaad84a986a558a Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/452252
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.