Skip to content

Commit a70e834

Browse files
Add a "-- CUT HERE --" marker to exception output (#7369)
Users aren't reporting/seeing the actual PC of failures because they are only copying the >>stack<< into the decoder and not the Exception line. Add an ALL CAPS "CUT HERE FOR EXCEPTION DECODER" line to the output to make it blindingly obvious to include the full crashdump both in bug reports as well as exception decodes.
1 parent fe673cc commit a70e834

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

cores/esp8266/core_esp8266_postmortem.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ static void ets_printf_P(const char *str, ...) {
9292
}
9393
}
9494

95+
static void cut_here() {
96+
ets_putc('\n');
97+
for (auto i = 0; i < 15; i++ ) {
98+
ets_putc('-');
99+
}
100+
ets_printf_P(PSTR(" CUT HERE FOR EXCEPTION DECODER "));
101+
for (auto i = 0; i < 15; i++ ) {
102+
ets_putc('-');
103+
}
104+
ets_putc('\n');
105+
}
106+
95107
void __wrap_system_restart_local() {
96108
register uint32_t sp asm("a1");
97109
uint32_t sp_dump = sp;
@@ -113,6 +125,8 @@ void __wrap_system_restart_local() {
113125

114126
ets_install_putc1(&uart_write_char_d);
115127

128+
cut_here();
129+
116130
if (s_panic_line) {
117131
ets_printf_P(PSTR("\nPanic %S:%d %S"), s_panic_file, s_panic_line, s_panic_func);
118132
if (s_panic_what) {
@@ -193,6 +207,8 @@ void __wrap_system_restart_local() {
193207
#endif
194208
}
195209

210+
cut_here();
211+
196212
custom_crash_callback( &rst_info, sp_dump + offset, stack_end );
197213

198214
ets_delay_us(10000);

doc/faq/a02-my-esp-crashes.rst

+4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ out in which line of application it is triggered. Please refer to `Check
113113
Where the Code Crashes <#check-where-the-code-crashes>`__ point below
114114
for a quick example how to do it.
115115

116+
**NOTE:** When decoding exceptions be sure to include all lines between
117+
the ``---- CUT HERE ----`` marks in the output to allow the decoder to also
118+
provide the line of code that's actually causing the exception.
119+
116120
Watchdog
117121
^^^^^^^^
118122

0 commit comments

Comments
 (0)