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:
parent
5b264af1d6
commit
542b05e543
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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")));
|
||||
|
Loading…
x
Reference in New Issue
Block a user