Skip to content

Commit

Permalink
Add a "-- CUT HERE --" marker to exception output (#7369)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
earlephilhower authored Jun 11, 2020
1 parent fe673cc commit a70e834
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cores/esp8266/core_esp8266_postmortem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ static void ets_printf_P(const char *str, ...) {
}
}

static void cut_here() {
ets_putc('\n');
for (auto i = 0; i < 15; i++ ) {
ets_putc('-');
}
ets_printf_P(PSTR(" CUT HERE FOR EXCEPTION DECODER "));
for (auto i = 0; i < 15; i++ ) {
ets_putc('-');
}
ets_putc('\n');
}

void __wrap_system_restart_local() {
register uint32_t sp asm("a1");
uint32_t sp_dump = sp;
Expand All @@ -113,6 +125,8 @@ void __wrap_system_restart_local() {

ets_install_putc1(&uart_write_char_d);

cut_here();

if (s_panic_line) {
ets_printf_P(PSTR("\nPanic %S:%d %S"), s_panic_file, s_panic_line, s_panic_func);
if (s_panic_what) {
Expand Down Expand Up @@ -193,6 +207,8 @@ void __wrap_system_restart_local() {
#endif
}

cut_here();

custom_crash_callback( &rst_info, sp_dump + offset, stack_end );

ets_delay_us(10000);
Expand Down
4 changes: 4 additions & 0 deletions doc/faq/a02-my-esp-crashes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ out in which line of application it is triggered. Please refer to `Check
Where the Code Crashes <#check-where-the-code-crashes>`__ point below
for a quick example how to do it.

**NOTE:** When decoding exceptions be sure to include all lines between
the ``---- CUT HERE ----`` marks in the output to allow the decoder to also
provide the line of code that's actually causing the exception.

Watchdog
^^^^^^^^

Expand Down

0 comments on commit a70e834

Please sign in to comment.