gdbstub.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * gdbstub.h
8  *
9  * @author: 2019 - Mikee47 <mike@sillyhouse.net>
10  *
11  ****/
12 
13 #pragma once
14 
15 #include "gdbstub-internal.h"
16 #include <gdb/gdb_hooks.h>
17 #include "BitManipulations.h"
18 
19 // GDB_xx macro versions required to ensure no flash access if requested
20 #if GDBSTUB_FORCE_IRAM
21 #define GDB_F(str) str
22 #define GDB_PROGMEM
23 #else
24 #define GDB_F(str) _F(str)
25 #define GDB_PROGMEM PROGMEM
26 #endif
27 
28 #define gdbstub_break_internal(flag) \
29  { \
30  bitSet(gdb_state.flags, flag); \
31  gdb_do_break(); \
32  }
33 
34 // Additional debugging flags mainly used to qualify reason for a debugging break
41 };
42 
47 };
48 
49 // State information in shared global structure
50 struct gdb_state_t {
51  bool attached;
52  bool enabled;
54  uint8_t flags;
55 };
56 
57 extern volatile gdb_state_t gdb_state;
58 extern const uint8_t gdb_exception_signals[];
59 
60 void gdbstub_init();
62 
63 #if GDBSTUB_ENABLE_DEBUG == 0
64 // Optimise GDB stub code for size, regardless of application settings
65 #pragma GCC optimize("Os")
66 #endif
void gdbstub_handle_exception()
const uint8_t gdb_exception_signals[]
GdbDebugFlag
Definition: gdbstub.h:35
@ DBGFLAG_RESTART
Breaking into debugger because of unexpected system restart.
Definition: gdbstub.h:40
@ DBGFLAG_PACKET_STARTED
Incoming packet detected by uart interrupt handler.
Definition: gdbstub.h:39
@ DBGFLAG_DEBUG_EXCEPTION
For debug exceptions, cause is DBGCAUSE (see DebugCause bits)
Definition: gdbstub.h:36
@ DBGFLAG_SYSTEM_EXCEPTION
For system exceptions, cause is EXCCAUSE (see EXCCAUSE_* values)
Definition: gdbstub.h:37
@ DBGFLAG_CTRL_BREAK
Break caused by call to gdbstub_ctrl_break()
Definition: gdbstub.h:38
volatile gdb_state_t gdb_state
SyscallState
Definition: gdbstub.h:43
@ syscall_ready
Ready for new syscall.
Definition: gdbstub.h:44
@ syscall_pending
Syscall queued but not yet sent to GDB.
Definition: gdbstub.h:45
@ syscall_active
Syscall executing, awaiting response from GDB.
Definition: gdbstub.h:46
void gdbstub_init()
Definition: gdbstub.h:50
uint8_t flags
Combination of GdbDebugFlag.
Definition: gdbstub.h:54
bool enabled
Debugging may be disabled via gdb_enable()
Definition: gdbstub.h:52
bool attached
true if GDB is attached to stub
Definition: gdbstub.h:51
SyscallState syscall
State of system call.
Definition: gdbstub.h:53