Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "-- CUT HERE --" marker to exception output #7369

Merged
merged 1 commit into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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