diff --git a/cores/esp8266/core_esp8266_main.cpp b/cores/esp8266/core_esp8266_main.cpp index 0c1eb02bf..80d5294ca 100644 --- a/cores/esp8266/core_esp8266_main.cpp +++ b/cores/esp8266/core_esp8266_main.cpp @@ -127,6 +127,9 @@ static void do_global_ctors(void) { extern "C" void __gdb_init() {} extern "C" void gdb_init(void) __attribute__ ((weak, alias("__gdb_init"))); +extern "C" void __gdb_do_break(){} +extern "C" void gdb_do_break(void) __attribute__ ((weak, alias("__gdb_do_break"))); + void init_done() { system_set_os_print(1); gdb_init(); diff --git a/cores/esp8266/core_esp8266_postmortem.c b/cores/esp8266/core_esp8266_postmortem.c index 1af8f57ca..407ede2e2 100644 --- a/cores/esp8266/core_esp8266_postmortem.c +++ b/cores/esp8266/core_esp8266_postmortem.c @@ -29,6 +29,8 @@ #include "cont.h" extern void __real_system_restart_local(); +extern void gdb_do_break(); + extern cont_t g_cont; static const char* s_panic_file = 0; @@ -184,11 +186,14 @@ void __assert_func(const char *file, int line, const char *func, const char *wha s_panic_file = file; s_panic_line = line; s_panic_func = func; + gdb_do_break(); } void __panic_func(const char* file, int line, const char* func) { s_panic_file = file; s_panic_line = line; s_panic_func = func; + gdb_do_break(); abort(); } + diff --git a/libraries/GDBStub/src/internal/gdbstub.c b/libraries/GDBStub/src/internal/gdbstub.c index 7ca195ea7..5c0bfc252 100644 --- a/libraries/GDBStub/src/internal/gdbstub.c +++ b/libraries/GDBStub/src/internal/gdbstub.c @@ -787,4 +787,9 @@ void ATTR_GDBINIT gdbstub_init() { #endif } +void ATTR_GDBFN gdbstub_do_break_wrapper() { + gdbstub_do_break(); +} + +extern void gdb_do_break() __attribute__((weak, alias("gdbstub_do_break_wrapper"))); extern void gdb_init() __attribute__((weak, alias("gdbstub_init")));