1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

If GDBStub library is used, break into gdb on assert and panic

This commit is contained in:
Ivan Grokhotkov 2016-05-10 21:30:53 +08:00
parent 5b264af1d6
commit 542b05e543
3 changed files with 13 additions and 0 deletions

View File

@ -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();

View File

@ -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();
}

View File

@ -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")));