mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-20 01:56:15 +00:00
debug(core): make C impl of __fatal_error print to stderr
Previously, any C assertion or other case of __fatal_error would only show the RSOD, but not print to emulator output. That is (a) mildly annoying, and (b) would not work in the weird case in Rust unit tests where graphics are not available.
This commit is contained in:
parent
863dee1a43
commit
52333d5b04
@ -18,6 +18,9 @@
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#ifdef TREZOR_EMULATOR
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include "display.h"
|
||||
@ -65,6 +68,13 @@ void __attribute__((noreturn)) error_shutdown(const char *message) {
|
||||
|
||||
void __attribute__((noreturn))
|
||||
__fatal_error(const char *msg, const char *file, int line) {
|
||||
#ifdef TREZOR_EMULATOR
|
||||
fprintf(stderr, "FATAL ERROR: %s\n", msg);
|
||||
if (file) {
|
||||
fprintf(stderr, "file: %s:%d\n", file, line);
|
||||
}
|
||||
fflush(stderr);
|
||||
#endif
|
||||
#ifdef FANCY_FATAL_ERROR
|
||||
if (msg == NULL) {
|
||||
char buf[128] = {0};
|
||||
|
Loading…
Reference in New Issue
Block a user