Skip to content

Commit 8c7d1b7

Browse files
d-a-vigrr
authored andcommitted
automate crash for GDBStub
1 parent 1c4a48d commit 8c7d1b7

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

cores/esp8266/core_esp8266_postmortem.c

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ static void uart1_write_char_d(char c);
4545
static void print_stack(uint32_t start, uint32_t end);
4646
//static void print_pcs(uint32_t start, uint32_t end);
4747

48+
bool __attribute((weak)) crash_for_gdb = 0;
49+
4850
extern void __custom_crash_callback( struct rst_info * rst_info, uint32_t stack, uint32_t stack_end ) {
4951
(void) rst_info;
5052
(void) stack;
@@ -54,6 +56,7 @@ extern void __custom_crash_callback( struct rst_info * rst_info, uint32_t stack,
5456
extern void custom_crash_callback( struct rst_info * rst_info, uint32_t stack, uint32_t stack_end ) __attribute__ ((weak, alias("__custom_crash_callback")));
5557

5658
void __wrap_system_restart_local() {
59+
if (crash_for_gdb) *((int*)0) = 0;
5760
register uint32_t sp asm("a1");
5861

5962
struct rst_info rst_info = {0};

libraries/GDBStub/src/GDBStub.h

+2
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33

44
// this header is intentionally left blank
55

6+
bool crash_for_gdb = 1;
7+
68
#endif //GDBSTUB_H

0 commit comments

Comments
 (0)