Subversion Repositories HelenOS

Rev

Rev 2870 | Rev 2894 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2801 svoboda 1
/** @addtogroup generic
2
 * @{
3
 */
4
/** @file
5
 */
6
 
7
#ifndef KERN_UDEBUG_H_
8
#define KERN_UDEBUG_H_
9
 
2812 svoboda 10
typedef enum { /* udebug_method_t */
11
 
12
/** Start debugging the recipient.
13
 * Causes all threads in the receiving task to stop. When they
14
 * are all stoped, an answer with retval 0 is generated.
15
 */
16
UDEBUG_M_BEGIN = 1,
17
 
18
/** Finish debugging the recipient.
19
 * Answers all pending GO and GUARD messages.
20
 */
21
UDEBUG_M_END,
22
 
23
/** Make sure the debugged task is still there.
24
 * This message is answered when the debugged task dies
25
 * or the debugging session ends.
26
 */
27
UDEBUG_M_GUARD,
28
 
29
/** Run a thread until a debugging event occurs.
30
 * This message is answered when the thread stops
31
 * in a debugging event.
32
 *
33
 * - ARG2 - id of the thread to run
34
 */
35
UDEBUG_M_GO,
36
 
37
/** Stop a thread being debugged.
38
 * Creates a special STOP event in the thread, causing
39
 * it to answer a pending GO message (if any).
40
 */
41
UDEBUG_M_STOP,
42
 
43
/** Read arguments of a syscall.
44
 *
45
 * - ARG2 - thread identification
46
 * - ARG3 - destination address in the caller's address space
47
 *
48
 */
49
UDEBUG_M_ARGS_READ,
50
 
2817 svoboda 51
/** Read thread's userspace register state (istate_t).
52
 *
53
 * - ARG2 - thread identification
54
 * - ARG3 - destination address in the caller's address space
55
 * - ARG4 - size of receiving buffer in bytes
56
 *
57
 * on answer, the kernel will set:
58
 *
59
 * - ARG1 - actual size in bytes of data read
60
 * - ARG2 - total size in bytes of data available
61
 *
62
 * or, on error, retval will be
63
 * - ENOENT - thread does not exist
64
 * - EBUSY - register state not available
65
 */
66
UDEBUG_M_REGS_READ,
67
 
68
/** Write thread's userspace register state (istate_t).
69
 *
70
 * - ARG2 - thread identification
71
 * - ARG3 - source address in the caller's address space
72
 * - ARG4 - size of source data in bytes
73
 *
74
 * on answer, the kernel will set:
75
 *
76
 * - ARG1 - actual size in bytes of data copied
77
 * - ARG2 - max size in bytes that could have been copied
78
 *
79
 * or, on error, retval will be
80
 * - ENOENT - thread does not exist
81
 * - EBUSY - register state not available
82
 */
83
UDEBUG_M_REGS_WRITE,
84
 
2812 svoboda 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
 *
2885 svoboda 93
 * - ARG2 - number of bytes that were actually copied
94
 * - ARG3 - number of bytes of the complete data
2812 svoboda 95
 *
96
 */
97
UDEBUG_M_THREAD_READ,
98
 
2818 svoboda 99
/** Read the debugged tasks's memory.
2812 svoboda 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
 */
2818 svoboda 106
UDEBUG_M_MEM_READ,
2812 svoboda 107
 
2818 svoboda 108
/** Write the debugged tasks's memory.
109
 *
110
 * - ARG2 - source address in the caller's address space
111
 * - ARG3 - destination address in the recipient's address space
112
 * - ARG4 - size of receiving buffer in bytes
113
 *
114
 */
115
UDEBUG_M_MEM_WRITE
116
 
117
 
2812 svoboda 118
} udebug_method_t;
119
 
2838 svoboda 120
 
2805 svoboda 121
typedef enum {
2866 svoboda 122
    UDEBUG_EVENT_FINISHED = 1/**< Debuging session has finished */
2867 svoboda 123
    UDEBUG_EVENT_SYSCALL,       /**< A syscall has been executed */
124
    UDEBUG_EVENT_NEW_THREAD     /**< The task created a new thread */
2805 svoboda 125
} udebug_event_t;
126
 
2812 svoboda 127
#ifdef KERNEL
128
 
2825 svoboda 129
typedef enum {
130
    /** Task is not being debugged */
131
    UDEBUG_TS_INACTIVE,
132
    /** BEGIN operation in progress (waiting for threads to stop) */
133
    UDEBUG_TS_BEGINNING,
134
    /** Debugger fully connected */
135
    UDEBUG_TS_ACTIVE,
136
    /** Task is shutting down, no more debug activities allowed */
137
    UDEBUG_TS_SHUTDOWN
138
} udebug_task_state_t;
139
 
2870 svoboda 140
struct task;
141
struct thread;
142
 
2805 svoboda 143
void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3,
144
    unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc);
2867 svoboda 145
void udebug_new_thread_event(struct thread *t);
146
 
2804 svoboda 147
void udebug_stoppable_begin(void);
148
void udebug_stoppable_end(void);
2801 svoboda 149
 
2870 svoboda 150
int udebug_task_cleanup(struct task *ta);
151
 
2801 svoboda 152
#endif
153
 
2812 svoboda 154
#endif
155
 
2801 svoboda 156
/** @}
157
 */