[FL-3286] Don't reboot on crash in debug builds (#2613)
* furi: never reboot on furi_crash in debug builds * furi: crash info: added registers * furi: check and assert optimization, split registers and stack info dump * furi: macro uppercase Co-authored-by: SG <who.just.the.doctor@gmail.com>
This commit is contained in:
@@ -21,6 +21,10 @@ extern "C" {
|
||||
#define FURI_NORETURN noreturn
|
||||
#endif
|
||||
|
||||
// Flags instead of pointers will save ~4 bytes on furi_assert and furi_check calls.
|
||||
#define __FURI_ASSERT_MESSAGE_FLAG (0x01)
|
||||
#define __FURI_CHECK_MESSAGE_FLAG (0x02)
|
||||
|
||||
/** Crash system */
|
||||
FURI_NORETURN void __furi_crash();
|
||||
|
||||
@@ -44,20 +48,20 @@ FURI_NORETURN void __furi_halt();
|
||||
} while(0)
|
||||
|
||||
/** Check condition and crash if check failed */
|
||||
#define furi_check(__e) \
|
||||
do { \
|
||||
if(!(__e)) { \
|
||||
furi_crash("furi_check failed\r\n"); \
|
||||
} \
|
||||
#define furi_check(__e) \
|
||||
do { \
|
||||
if(!(__e)) { \
|
||||
furi_crash(__FURI_ASSERT_MESSAGE_FLAG); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/** Only in debug build: Assert condition and crash if assert failed */
|
||||
#ifdef FURI_DEBUG
|
||||
#define furi_assert(__e) \
|
||||
do { \
|
||||
if(!(__e)) { \
|
||||
furi_crash("furi_assert failed\r\n"); \
|
||||
} \
|
||||
#define furi_assert(__e) \
|
||||
do { \
|
||||
if(!(__e)) { \
|
||||
furi_crash(__FURI_CHECK_MESSAGE_FLAG); \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define furi_assert(__e) \
|
||||
|
||||
Reference in New Issue
Block a user