File indexing completed on 2025-05-11 08:24:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #ifndef _RTEMS_DEBUGGER_SERVER_h
0032 #define _RTEMS_DEBUGGER_SERVER_h
0033
0034 #include <rtems.h>
0035 #include <rtems/printer.h>
0036
0037 #include <rtems/rtems-debugger.h>
0038
0039 #ifdef __cplusplus
0040 extern "C" {
0041 #endif
0042
0043
0044
0045
0046 #define RTEMS_DEBUGGER_NUMOF(_d) (sizeof(_d) / sizeof(_d[0]))
0047
0048
0049
0050
0051 #define DB_UINT uint32_t
0052
0053
0054
0055
0056 #define RTEMS_DEBUGGER_SIGNAL_HUP 1
0057 #define RTEMS_DEBUGGER_SIGNAL_INT 2
0058 #define RTEMS_DEBUGGER_SIGNAL_QUIT 3
0059 #define RTEMS_DEBUGGER_SIGNAL_ILL 4
0060 #define RTEMS_DEBUGGER_SIGNAL_TRAP 5
0061 #define RTEMS_DEBUGGER_SIGNAL_ABRT 6
0062 #define RTEMS_DEBUGGER_SIGNAL_EMT 7
0063 #define RTEMS_DEBUGGER_SIGNAL_FPE 8
0064 #define RTEMS_DEBUGGER_SIGNAL_KILL 9
0065 #define RTEMS_DEBUGGER_SIGNAL_BUS 10
0066 #define RTEMS_DEBUGGER_SIGNAL_SEGV 11
0067 #define RTEMS_DEBUGGER_SIGNAL_SYS 12
0068 #define RTEMS_DEBUGGER_SIGNAL_PIPE 13
0069 #define RTEMS_DEBUGGER_SIGNAL_ALRM 14
0070 #define RTEMS_DEBUGGER_SIGNAL_TERM 15
0071 #define RTEMS_DEBUGGER_SIGNAL_URG 16
0072 #define RTEMS_DEBUGGER_SIGNAL_STOP 17
0073 #define RTEMS_DEBUGGER_SIGNAL_TSTP 18
0074 #define RTEMS_DEBUGGER_SIGNAL_CONT 19
0075
0076
0077
0078
0079 #define RTEMS_DEBUGGER_TIMEOUT_STOP (5 * 1000 * 1000)
0080
0081
0082
0083
0084 #define RTEMS_DEBUGGER_POLL_WAIT (10000)
0085
0086
0087
0088
0089 #define RTEMS_DEBUGGER_STACKSIZE (16 * 1024)
0090
0091
0092
0093
0094 #define RTEMS_DEBUGGER_BUFFER_SIZE (4 * 1024)
0095
0096
0097
0098
0099 #define RTEMS_DEBUGGER_FLAG_VERBOSE (1 << 0)
0100 #define RTEMS_DEBUGGER_FLAG_RESET (1 << 1)
0101 #define RTEMS_DEBUGGER_FLAG_NON_STOP (1 << 2)
0102 #define RTEMS_DEBUGGER_FLAG_VCONT (1 << 3)
0103 #define RTEMS_DEBUGGER_FLAG_MULTIPROCESS (1 << 4)
0104 #define RTEMS_DEBUGGER_FLAG_VERBOSE_LOCK (1 << 5)
0105 #define RTEMS_DEBUGGER_FLAG_VERBOSE_CMDS (1 << 6)
0106 #define RTEMS_DEBUGGER_FLAG_BREAK_WAITER (1 << 7)
0107
0108
0109
0110
0111 typedef struct rtems_debugger_remote rtems_debugger_remote;
0112 typedef struct rtems_debugger_threads rtems_debugger_threads;
0113 typedef struct rtems_debugger_target rtems_debugger_target;
0114
0115
0116
0117
0118 typedef struct _Condition_Control rtems_rx_cond;
0119 typedef struct _Mutex_recursive_Control rtems_rx_mutex;
0120
0121
0122
0123
0124 typedef struct
0125 {
0126 int port;
0127 int timeout;
0128 rtems_task_priority priority;
0129 rtems_rx_mutex lock;
0130 rtems_debugger_remote* remote;
0131 rtems_id server_task;
0132 rtems_rx_cond server_cond;
0133 volatile bool server_running;
0134 volatile bool server_finished;
0135 rtems_id events_task;
0136 volatile bool events_running;
0137 volatile bool events_finished;
0138 rtems_printer printer;
0139 uint32_t flags;
0140 pid_t pid;
0141 bool remote_debug;
0142 bool ack_pending;
0143 size_t output_level;
0144 uint8_t input[RTEMS_DEBUGGER_BUFFER_SIZE];
0145 uint8_t output[RTEMS_DEBUGGER_BUFFER_SIZE];
0146 rtems_debugger_threads* threads;
0147 rtems_chain_control exception_threads;
0148 int signal;
0149 rtems_debugger_target* target;
0150 } rtems_debugger_server;
0151
0152
0153
0154
0155 extern rtems_debugger_server* rtems_debugger;
0156
0157
0158
0159
0160 extern int rtems_debugger_printf(const char* format, ...) RTEMS_PRINTFLIKE(1, 2);
0161 extern int rtems_debugger_clean_printf(const char* format, ...) RTEMS_PRINTFLIKE(1, 2);
0162 extern void rtems_debugger_printk_lock(rtems_interrupt_lock_context* lock_context);
0163 extern void rtems_debugger_printk_unlock(rtems_interrupt_lock_context* lock_context);
0164
0165
0166
0167
0168 extern void rtems_debugger_lock(void);
0169
0170
0171
0172
0173 extern void rtems_debugger_unlock(void);
0174
0175
0176
0177
0178 extern bool rtems_debugger_server_running(void);
0179
0180
0181
0182
0183 extern void rtems_debugger_server_crash(void);
0184
0185
0186
0187
0188 extern rtems_debugger_remote* rtems_debugger_remote_handle(void);
0189
0190
0191
0192
0193 extern bool rtems_debugger_connected(void);
0194
0195
0196
0197
0198 extern bool rtems_debugger_server_events_running(void);
0199
0200
0201
0202
0203 extern void rtems_debugger_server_events_signal(void);
0204
0205
0206
0207
0208 extern bool rtems_debugger_verbose(void);
0209
0210
0211
0212
0213 static inline bool rtems_debugger_server_flag(uint32_t mask)
0214 {
0215 return (rtems_debugger->flags & mask) != 0;
0216 }
0217
0218 #ifdef __cplusplus
0219 }
0220 #endif
0221
0222
0223 #endif