Changes in kernel/generic/include/udebug/udebug.h [9c81703:8af9950] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/udebug/udebug.h
r9c81703 r8af9950 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 36 36 #define KERN_UDEBUG_H_ 37 37 38 # define UDEBUG_EVMASK(event) (1 << ((event) - 1))38 #include <ipc/ipc.h> 39 39 40 40 typedef enum { /* udebug_method_t */ 41 42 /** Start debugging the recipient. 43 * 44 * Causes all threads in the receiving task to stop. When they 45 * are all stoped, an answer with retval 0 is generated. 46 * 47 */ 48 UDEBUG_M_BEGIN = 1, 49 50 /** Finish debugging the recipient. 51 * 52 * Answers all pending GO and GUARD messages. 53 * 54 */ 55 UDEBUG_M_END, 56 57 /** Set which events should be captured. */ 58 UDEBUG_M_SET_EVMASK, 59 60 /** Make sure the debugged task is still there. 61 * 62 * This message is answered when the debugged task dies 63 * or the debugging session ends. 64 * 65 */ 66 UDEBUG_M_GUARD, 67 68 /** Run a thread until a debugging event occurs. 69 * 70 * This message is answered when the thread stops 71 * in a debugging event. 72 * 73 * - ARG2 - id of the thread to run 74 * 75 */ 76 UDEBUG_M_GO, 77 78 /** Stop a thread being debugged. 79 * 80 * Creates a special STOP event in the thread, causing 81 * it to answer a pending GO message (if any). 82 * 83 */ 84 UDEBUG_M_STOP, 85 86 /** Read arguments of a syscall. 87 * 88 * - ARG2 - thread identification 89 * - ARG3 - destination address in the caller's address space 90 * 91 */ 92 UDEBUG_M_ARGS_READ, 93 94 /** Read thread's userspace register state (istate_t). 95 * 96 * - ARG2 - thread identification 97 * - ARG3 - destination address in the caller's address space 98 * 99 * or, on error, retval will be 100 * - ENOENT - thread does not exist 101 * - EBUSY - register state not available 102 */ 103 UDEBUG_M_REGS_READ, 104 105 /** Read the list of the debugged tasks's threads. 106 * 107 * - ARG2 - destination address in the caller's address space 108 * - ARG3 - size of receiving buffer in bytes 109 * 110 * The kernel fills the buffer with a series of sysarg_t values 111 * (thread ids). On answer, the kernel will set: 112 * 113 * - ARG2 - number of bytes that were actually copied 114 * - ARG3 - number of bytes of the complete data 115 * 116 */ 117 UDEBUG_M_THREAD_READ, 118 119 /** Read the name of the debugged task. 120 * 121 * - ARG2 - destination address in the caller's address space 122 * - ARG3 - size of receiving buffer in bytes 123 * 124 * The kernel fills the buffer with a non-terminated string. 125 * 126 * - ARG2 - number of bytes that were actually copied 127 * - ARG3 - number of bytes of the complete data 128 * 129 */ 130 UDEBUG_M_NAME_READ, 131 132 /** Read the list of the debugged task's address space areas. 133 * 134 * - ARG2 - destination address in the caller's address space 135 * - ARG3 - size of receiving buffer in bytes 136 * 137 * The kernel fills the buffer with a series of as_area_info_t structures. 138 * Upon answer, the kernel will set: 139 * 140 * - ARG2 - number of bytes that were actually copied 141 * - ARG3 - number of bytes of the complete data 142 * 143 */ 144 UDEBUG_M_AREAS_READ, 145 146 /** Read the debugged tasks's memory. 147 * 148 * - ARG2 - destination address in the caller's address space 149 * - ARG3 - source address in the recipient's address space 150 * - ARG4 - size of receiving buffer in bytes 151 * 152 */ 153 UDEBUG_M_MEM_READ 41 42 /** Start debugging the recipient. 43 * Causes all threads in the receiving task to stop. When they 44 * are all stoped, an answer with retval 0 is generated. 45 */ 46 UDEBUG_M_BEGIN = 1, 47 48 /** Finish debugging the recipient. 49 * Answers all pending GO and GUARD messages. 50 */ 51 UDEBUG_M_END, 52 53 /** Set which events should be captured. 54 */ 55 UDEBUG_M_SET_EVMASK, 56 57 /** Make sure the debugged task is still there. 58 * This message is answered when the debugged task dies 59 * or the debugging session ends. 60 */ 61 UDEBUG_M_GUARD, 62 63 /** Run a thread until a debugging event occurs. 64 * This message is answered when the thread stops 65 * in a debugging event. 66 * 67 * - ARG2 - id of the thread to run 68 */ 69 UDEBUG_M_GO, 70 71 /** Stop a thread being debugged. 72 * Creates a special STOP event in the thread, causing 73 * it to answer a pending GO message (if any). 74 */ 75 UDEBUG_M_STOP, 76 77 /** Read arguments of a syscall. 78 * 79 * - ARG2 - thread identification 80 * - ARG3 - destination address in the caller's address space 81 * 82 */ 83 UDEBUG_M_ARGS_READ, 84 85 /** Read the list of the debugged tasks's threads. 86 * 87 * - ARG2 - destination address in the caller's address space 88 * - ARG3 - size of receiving buffer in bytes 89 * 90 * The kernel fills the buffer with a series of sysarg_t values 91 * (thread ids). On answer, the kernel will set: 92 * 93 * - ARG2 - number of bytes that were actually copied 94 * - ARG3 - number of bytes of the complete data 95 * 96 */ 97 UDEBUG_M_THREAD_READ, 98 99 /** Read the debugged tasks's memory. 100 * 101 * - ARG2 - destination address in the caller's address space 102 * - ARG3 - source address in the recipient's address space 103 * - ARG4 - size of receiving buffer in bytes 104 * 105 */ 106 UDEBUG_M_MEM_READ, 107 154 108 } udebug_method_t; 155 109 110 156 111 typedef enum { 157 UDEBUG_EVENT_FINISHED = 1, 158 UDEBUG_EVENT_STOP, 159 UDEBUG_EVENT_SYSCALL_B, 160 UDEBUG_EVENT_SYSCALL_E, 161 UDEBUG_EVENT_THREAD_B, 162 UDEBUG_EVENT_THREAD_E 112 UDEBUG_EVENT_FINISHED = 1, /**< Debuging session has finished */ 113 UDEBUG_EVENT_STOP, /**< Stopped on DEBUG_STOP request */ 114 UDEBUG_EVENT_SYSCALL_B, /**< Before beginning syscall execution */ 115 UDEBUG_EVENT_SYSCALL_E, /**< After finishing syscall execution */ 116 UDEBUG_EVENT_THREAD_B, /**< The task created a new thread */ 117 UDEBUG_EVENT_THREAD_E /**< A thread exited */ 163 118 } udebug_event_t; 164 119 120 #define UDEBUG_EVMASK(event) (1 << ((event) - 1)) 121 165 122 typedef enum { 166 UDEBUG_EM_FINISHED 167 UDEBUG_EM_STOP 168 UDEBUG_EM_SYSCALL_B 169 UDEBUG_EM_SYSCALL_E 170 UDEBUG_EM_THREAD_B 171 UDEBUG_EM_THREAD_E 172 UDEBUG_EM_ALL 173 (UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED) |174 175 176 177 178 UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E))123 UDEBUG_EM_FINISHED = UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED), 124 UDEBUG_EM_STOP = UDEBUG_EVMASK(UDEBUG_EVENT_STOP), 125 UDEBUG_EM_SYSCALL_B = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B), 126 UDEBUG_EM_SYSCALL_E = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E), 127 UDEBUG_EM_THREAD_B = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B), 128 UDEBUG_EM_THREAD_E = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E), 129 UDEBUG_EM_ALL = 130 UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED) | 131 UDEBUG_EVMASK(UDEBUG_EVENT_STOP) | 132 UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B) | 133 UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E) | 134 UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B) | 135 UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E) 179 136 } udebug_evmask_t; 180 137 181 138 #ifdef KERNEL 182 139 183 #include <ipc/ipc.h>184 140 #include <synch/mutex.h> 185 #include <synch/condvar.h>186 141 #include <arch/interrupt.h> 187 142 #include <atomic.h> … … 202 157 mutex_t lock; 203 158 char *lock_owner; 204 159 205 160 udebug_task_state_t dt_state; 206 161 call_t *begin_call; … … 215 170 /** Synchronize debug ops on this thread / access to this structure. */ 216 171 mutex_t lock; 217 172 218 173 waitq_t go_wq; 219 174 call_t *go_call; 220 sysarg_t syscall_args[6];175 unative_t syscall_args[6]; 221 176 istate_t *uspace_state; 222 177 223 178 /** What type of event are we stopped in or 0 if none. */ 224 179 udebug_event_t cur_event; 225 bool go; /**< Thread is GO */ 226 bool stoppable; /**< Thread is stoppable */ 227 bool active; /**< Thread is in a debugging session */ 228 condvar_t active_cv; 180 bool go; /**< thread is GO */ 181 bool stoppable; /**< thread is stoppable */ 182 bool active; /**< thread is in a debugging session */ 229 183 } udebug_thread_t; 230 184 … … 232 186 struct thread; 233 187 234 void udebug_task_init(udebug_task_t *); 235 void udebug_thread_initialize(udebug_thread_t *); 236 237 void udebug_syscall_event(sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 238 sysarg_t, sysarg_t, sysarg_t, bool); 239 240 void udebug_thread_b_event_attach(struct thread *, struct task *); 188 void udebug_task_init(udebug_task_t *ut); 189 void udebug_thread_initialize(udebug_thread_t *ut); 190 191 void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3, 192 unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc, 193 bool end_variant); 194 195 void udebug_thread_b_event_attach(struct thread *t, struct task *ta); 241 196 void udebug_thread_e_event(void); 242 197 … … 246 201 void udebug_before_thread_runs(void); 247 202 248 int udebug_task_cleanup(struct task *); 249 void udebug_thread_fault(void); 203 int udebug_task_cleanup(struct task *ta); 250 204 251 205 #endif
Note:
See TracChangeset
for help on using the changeset viewer.