MCPcopy Create free account
hub / github.com/FastLED/FastLED / crash_handler

Function crash_handler

tests/crash_handler_execinfo.h:36–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36inline void crash_handler(int sig) {
37 // Prevent recursion if handler crashes
38 static volatile sig_atomic_t already_dumping = 0;
39 if (already_dumping) {
40 // Recursive crash - bail out immediately
41 signal(sig, SIG_DFL);
42 raise(sig);
43 return;
44 }
45 already_dumping = 1;
46
47 fprintf(stderr, "\n=== INTERNAL CRASH HANDLER (SIGNAL %d) ===\n", sig);
48
49 // Internal stack trace dump
50 print_stacktrace_execinfo();
51
52 fprintf(stderr, "=== END INTERNAL HANDLER ===\n\n");
53 fflush(stdout);
54 fflush(stderr);
55
56 // CHAINING: Uninstall our handler and re-raise signal
57 // This allows external debuggers to catch the signal
58 fprintf(stderr, "Uninstalling crash handler and re-raising signal %d for external debugger...\n", sig);
59 fflush(stderr);
60
61 // Restore default handler
62 signal(sig, SIG_DFL);
63
64 // Re-raise the signal - will now go to default handler or external debugger
65 raise(sig);
66
67 // If we get here, signal didn't terminate us - exit manually
68 exit(1);
69}
70
71inline void setup_crash_handler() {
72 // Check if crash handler should be disabled (for debugger attachment)

Callers

nothing calls this directly

Calls 3

fflushFunction · 0.85
exitFunction · 0.85

Tested by

no test coverage detected