Subversion Repositories HelenOS

Rev

Rev 2818 | Rev 2838 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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