xref: /haiku/headers/os/kernel/debugger.h (revision fccd8899fcb583bfb73c5c26c9fcd714b963959b)
1 /*
2  * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _DEBUGGER_H
6 #define _DEBUGGER_H
7 
8 
9 #include <signal.h>
10 
11 #include <image.h>
12 #include <OS.h>
13 
14 // include architecture specific definitions
15 #include <arch/x86/arch_debugger.h>
16 #include <arch/ppc/arch_debugger.h>
17 #include <arch/m68k/arch_debugger.h>
18 #include <arch/mipsel/arch_debugger.h>
19 #include <arch/arm/arch_debugger.h>
20 
21 
22 #ifdef __INTEL__
23 	typedef struct x86_debug_cpu_state debug_cpu_state;
24 #elif __POWERPC__
25 	typedef struct ppc_debug_cpu_state debug_cpu_state;
26 #elif __M68K__
27 	typedef struct m68k_debug_cpu_state debug_cpu_state;
28 #elif __MIPSEL__
29 	typedef struct mipsel_debug_cpu_state debug_cpu_state;
30 #elif __ARM__
31 	typedef struct arm_debug_cpu_state debug_cpu_state;
32 #else
33 	#error unsupported architecture
34 #endif
35 
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 extern status_t	install_default_debugger(port_id debuggerPort);
42 extern port_id	install_team_debugger(team_id team, port_id debuggerPort);
43 extern status_t	remove_team_debugger(team_id team);
44 extern status_t	debug_thread(thread_id thread);
45 extern void		wait_for_debugger(void);
46 
47 // EXPERIMENTAL: Self-debugging functions. Will fail when a team debugger is
48 // installed. A breakpoint/watchpoint hit will cause the default debugger to
49 // be installed for the team.
50 extern status_t	set_debugger_breakpoint(void *address);
51 extern status_t	clear_debugger_breakpoint(void *address);
52 extern status_t	set_debugger_watchpoint(void *address, uint32 type,
53 					int32 length);
54 extern status_t	clear_debugger_watchpoint(void *address);
55 
56 
57 // team debugging flags
58 enum {
59 	// event mask: If a flag is set, any of the team's threads will stop when
60 	// the respective event occurs. None of the flags are enabled by default.
61 	// Always enabled are debugger() calls and hardware exceptions, as well as
62 	// the deletion of the debugged team.
63 	B_TEAM_DEBUG_SIGNALS						= 0x00010000,
64 	B_TEAM_DEBUG_PRE_SYSCALL					= 0x00020000,
65 	B_TEAM_DEBUG_POST_SYSCALL					= 0x00040000,
66 	B_TEAM_DEBUG_TEAM_CREATION					= 0x00080000,
67 	B_TEAM_DEBUG_THREADS						= 0x00100000,
68 	B_TEAM_DEBUG_IMAGES							= 0x00200000,
69 	B_TEAM_DEBUG_PREVENT_EXIT					= 0x00400000,
70 
71 	// new thread handling
72 	B_TEAM_DEBUG_STOP_NEW_THREADS				= 0x01000000,
73 
74 	B_TEAM_DEBUG_USER_FLAG_MASK					= 0xffff0000,
75 };
76 
77 // per-thread debugging flags
78 enum {
79 	// event mask: If a flag is set, the thread will stop when the respective
80 	// event occurs. If there is a corresponding team flag, it is sufficient,
81 	// if either is set. Per default none of the flags is set.
82 	B_THREAD_DEBUG_PRE_SYSCALL					= 0x00010000,
83 	B_THREAD_DEBUG_POST_SYSCALL					= 0x00020000,
84 
85 	// child thread handling
86 	B_THREAD_DEBUG_STOP_CHILD_THREADS			= 0x00100000,
87 	B_THREAD_DEBUG_SYSCALL_TRACE_CHILD_THREADS	= 0x00200000,
88 
89 	B_THREAD_DEBUG_USER_FLAG_MASK				= 0xffff0000,
90 };
91 
92 // in case of a B_EXCEPTION_OCCURRED event: the type of the exception
93 typedef enum {
94 	B_NON_MASKABLE_INTERRUPT	= 0,
95 	B_MACHINE_CHECK_EXCEPTION,
96 	B_SEGMENT_VIOLATION,
97 	B_ALIGNMENT_EXCEPTION,
98 	B_DIVIDE_ERROR,
99 	B_OVERFLOW_EXCEPTION,
100 	B_BOUNDS_CHECK_EXCEPTION,
101 	B_INVALID_OPCODE_EXCEPTION,
102 	B_SEGMENT_NOT_PRESENT,
103 	B_STACK_FAULT,
104 	B_GENERAL_PROTECTION_FAULT,
105 	B_FLOATING_POINT_EXCEPTION,
106 } debug_exception_type;
107 
108 // Value indicating how a stopped thread shall continue.
109 enum {
110 	B_THREAD_DEBUG_HANDLE_EVENT = 0,	// handle the event normally
111 										// (e.g. a signal is delivered, a
112 										// CPU fault kills the team,...)
113 	B_THREAD_DEBUG_IGNORE_EVENT,		// ignore the event and continue as if
114 										// it didn't occur (e.g. a signal or
115 										// a CPU fault will be ignored)
116 };
117 
118 // watchpoint types (ToDo: Check PPC support.)
119 enum {
120 	B_DATA_READ_WATCHPOINT = 0,			// !x86
121 	B_DATA_WRITE_WATCHPOINT,
122 	B_DATA_READ_WRITE_WATCHPOINT,
123 };
124 
125 // how to apply signal ignore masks
126 typedef enum {
127 	B_DEBUG_SIGNAL_MASK_AND	= 0,
128 	B_DEBUG_SIGNAL_MASK_OR,
129 	B_DEBUG_SIGNAL_MASK_SET,
130 } debug_signal_mask_op;
131 
132 #define B_DEBUG_SIGNAL_TO_MASK(signal) (1ULL << ((signal) - 1))
133 
134 // maximal number of bytes to read/write via B_DEBUG_MESSAGE_{READ,WRITE]_MEMORY
135 enum {
136 	B_MAX_READ_WRITE_MEMORY_SIZE	= 1024,
137 };
138 
139 // messages to the debug nub thread
140 typedef enum {
141 	B_DEBUG_MESSAGE_READ_MEMORY	= 0,	// read from the team's memory
142 	B_DEBUG_MESSAGE_WRITE_MEMORY,		// write to the team's memory
143 	B_DEBUG_MESSAGE_SET_TEAM_FLAGS,		// set the team's debugging flags
144 	B_DEBUG_MESSAGE_SET_THREAD_FLAGS,	// set a thread's debugging flags
145 	B_DEBUG_MESSAGE_CONTINUE_THREAD,	// continue a stopped thread
146 	B_DEBUG_MESSAGE_SET_CPU_STATE,		// change a stopped thread's CPU state
147 	B_DEBUG_MESSAGE_GET_CPU_STATE,		// get the thread's current CPU state
148 	B_DEBUG_MESSAGE_SET_BREAKPOINT,		// set a breakpoint
149 	B_DEBUG_MESSAGE_CLEAR_BREAKPOINT,	// clear a breakpoint
150 	B_DEBUG_MESSAGE_SET_WATCHPOINT,		// set a watchpoint
151 	B_DEBUG_MESSAGE_CLEAR_WATCHPOINT,	// clear a watchpoint
152 	B_DEBUG_MESSAGE_SET_SIGNAL_MASKS,	// set/get a thread's masks of signals
153 	B_DEBUG_MESSAGE_GET_SIGNAL_MASKS,	//  the debugger is interested in
154 	B_DEBUG_MESSAGE_SET_SIGNAL_HANDLER,	// set/get the team's signal handler for
155 	B_DEBUG_MESSAGE_GET_SIGNAL_HANDLER,	//  a signal
156 
157 	B_DEBUG_MESSAGE_PREPARE_HANDOVER,	// prepares the debugged team for being
158 										// handed over to another debugger;
159 										// the new debugger can just invoke
160 										// install_team_debugger()
161 
162 	B_DEBUG_START_PROFILER,				// start/stop sampling
163 	B_DEBUG_STOP_PROFILER				//
164 } debug_nub_message;
165 
166 // messages sent to the debugger
167 typedef enum {
168 	B_DEBUGGER_MESSAGE_THREAD_DEBUGGED = 0,	// debugger message in reaction to
169 											// an invocation of debug_thread()
170 	B_DEBUGGER_MESSAGE_DEBUGGER_CALL,		// thread called debugger()
171 	B_DEBUGGER_MESSAGE_BREAKPOINT_HIT,		// thread hit a breakpoint
172 	B_DEBUGGER_MESSAGE_WATCHPOINT_HIT,		// thread hit a watchpoint
173 	B_DEBUGGER_MESSAGE_SINGLE_STEP,			// thread was single-stepped
174 	B_DEBUGGER_MESSAGE_PRE_SYSCALL,			// begin of a syscall
175 	B_DEBUGGER_MESSAGE_POST_SYSCALL,		// end of a syscall
176 	B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED,		// thread received a signal
177 	B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED,	// an exception occurred
178 	B_DEBUGGER_MESSAGE_TEAM_CREATED,		// the debugged team created a new
179 											// one
180 	B_DEBUGGER_MESSAGE_TEAM_DELETED,		// the debugged team is gone
181 	B_DEBUGGER_MESSAGE_TEAM_EXEC,			// the debugged team executes exec()
182 	B_DEBUGGER_MESSAGE_THREAD_CREATED,		// a thread has been created
183 	B_DEBUGGER_MESSAGE_THREAD_DELETED,		// a thread has been deleted
184 	B_DEBUGGER_MESSAGE_IMAGE_CREATED,		// an image has been created
185 	B_DEBUGGER_MESSAGE_IMAGE_DELETED,		// an image has been deleted
186 
187 	B_DEBUGGER_MESSAGE_PROFILER_UPDATE,		// flush the profiling buffer for a
188 											// thread
189 
190 	B_DEBUGGER_MESSAGE_HANDED_OVER,			// the debugged team has been
191 											// handed over to another debugger,
192 											// sent to both debuggers
193 } debug_debugger_message;
194 
195 
196 // profile events -- when the buffer is in variable stack depth format, a sample
197 // count entry >= B_DEBUG_PROFILE_EVENT_BASE indicates a profile event
198 enum {
199 	B_DEBUG_PROFILE_EVENT_BASE				= 0x80000000,
200 	B_DEBUG_PROFILE_EVENT_PARAMETER_MASK	= 0x0000ffff,
201 		// & with to get the event's parameter count
202 
203 	B_DEBUG_PROFILE_IMAGE_EVENT				= 0x80010001
204 		// single parameter: the respective image event counter
205 };
206 
207 
208 // #pragma mark -
209 // #pragma mark ----- messages to the debug nub thread -----
210 
211 // B_DEBUG_MESSAGE_READ_MEMORY
212 
213 typedef struct {
214 	port_id		reply_port;		// port to send the reply to
215 	void		*address;		// address from which to read
216 	int32		size;			// number of bytes to read
217 } debug_nub_read_memory;
218 
219 typedef struct {
220 	status_t	error;			// B_OK, if reading went fine
221 	int32		size;			// the number of bytes actually read
222 								// > 0, iff error == B_OK
223 	char		data[B_MAX_READ_WRITE_MEMORY_SIZE];
224 								// the read data
225 } debug_nub_read_memory_reply;
226 
227 // B_DEBUG_MESSAGE_WRITE_MEMORY
228 
229 typedef struct {
230 	port_id		reply_port;		// port to send the reply to
231 	void		*address;		// address to which to write
232 	int32		size;			// number of bytes to write
233 	char		data[B_MAX_READ_WRITE_MEMORY_SIZE];
234 								// data to write
235 } debug_nub_write_memory;
236 
237 typedef struct {
238 	status_t	error;			// B_OK, if writing went fine
239 	int32		size;			// the number of bytes actually written
240 } debug_nub_write_memory_reply;
241 
242 // B_DEBUG_MESSAGE_SET_TEAM_FLAGS
243 
244 typedef struct {
245 	int32		flags;			// the new team debugging flags
246 } debug_nub_set_team_flags;
247 
248 // B_DEBUG_MESSAGE_SET_THREAD_FLAGS
249 
250 typedef struct {
251 	thread_id	thread;			// the thread
252 	int32		flags;			// the new thread debugging flags
253 } debug_nub_set_thread_flags;
254 
255 // B_DEBUG_MESSAGE_CONTINUE_THREAD
256 
257 typedef struct {
258 	thread_id	thread;			// the thread
259 	uint32		handle_event;	// how to handle the occurred event
260 	bool		single_step;	// true == single step, false == run full speed
261 } debug_nub_continue_thread;
262 
263 // B_DEBUG_MESSAGE_SET_CPU_STATE
264 
265 typedef struct {
266 	thread_id			thread;				// the thread
267 	debug_cpu_state		cpu_state;			// the new CPU state
268 } debug_nub_set_cpu_state;
269 
270 // B_DEBUG_MESSAGE_GET_CPU_STATE
271 
272 typedef struct {
273 	port_id					reply_port;		// port to send the reply to
274 	thread_id				thread;			// the thread
275 } debug_nub_get_cpu_state;
276 
277 typedef struct {
278 	status_t				error;		// != B_OK, if something went wrong
279 										// (bad thread ID, thread not stopped)
280 	debug_debugger_message	message;	// the reason why the thread stopped
281 	debug_cpu_state			cpu_state;	// the thread's CPU state
282 } debug_nub_get_cpu_state_reply;
283 
284 // B_DEBUG_MESSAGE_SET_BREAKPOINT
285 
286 typedef struct {
287 	port_id		reply_port;		// port to send the reply to
288 	void		*address;		// breakpoint address
289 } debug_nub_set_breakpoint;
290 
291 typedef struct {
292 	status_t	error;			// B_OK, if the breakpoint has been set
293 								// successfully
294 } debug_nub_set_breakpoint_reply;
295 
296 // B_DEBUG_MESSAGE_CLEAR_BREAKPOINT
297 
298 typedef struct {
299 	void		*address;		// breakpoint address
300 } debug_nub_clear_breakpoint;
301 
302 // B_DEBUG_MESSAGE_SET_WATCHPOINT
303 
304 typedef struct {
305 	port_id		reply_port;		// port to send the reply to
306 	void		*address;		// watchpoint address
307 	uint32		type;			// watchpoint type (see type constants above)
308 	int32		length;			// number of bytes to watch (typically 1, 2,
309 								// 4); architecture specific alignment
310 								// restrictions apply.
311 } debug_nub_set_watchpoint;
312 
313 typedef struct {
314 	status_t	error;			// B_OK, if the watchpoint has been set
315 								// successfully
316 } debug_nub_set_watchpoint_reply;
317 
318 // B_DEBUG_MESSAGE_CLEAR_WATCHPOINT
319 
320 typedef struct {
321 	void		*address;		// watchpoint address
322 } debug_nub_clear_watchpoint;
323 
324 // B_DEBUG_MESSAGE_SET_SIGNAL_MASKS
325 
326 typedef struct {
327 	thread_id				thread;				// the thread
328 	uint64					ignore_mask;		// the mask for signals the
329 												// debugger wishes not to be
330 												// notified of
331 	uint64					ignore_once_mask;	// the mask for signals the
332 												// debugger wishes not to be
333 												// notified of when they next
334 												// occur
335 	debug_signal_mask_op	ignore_op;			// what to do with ignore_mask
336 	debug_signal_mask_op	ignore_once_op;		// what to do with
337 												// ignore_once_mask
338 } debug_nub_set_signal_masks;
339 
340 // B_DEBUG_MESSAGE_GET_SIGNAL_MASKS
341 
342 typedef struct {
343 	port_id		reply_port;			// port to send the reply to
344 	thread_id	thread;				// the thread
345 } debug_nub_get_signal_masks;
346 
347 typedef struct {
348 	status_t	error;				// B_OK, if the thread exists
349 	uint64		ignore_mask;		// the mask for signals the debugger wishes
350 									// not to be notified of
351 	uint64		ignore_once_mask;	// the mask for signals the debugger wishes
352 									// not to be notified of when they next
353 									// occur
354 } debug_nub_get_signal_masks_reply;
355 
356 // B_DEBUG_MESSAGE_SET_SIGNAL_HANDLER
357 
358 typedef struct {
359 	int					signal;		// the signal
360 	struct sigaction	handler;	// the new signal handler
361 } debug_nub_set_signal_handler;
362 
363 // B_DEBUG_MESSAGE_GET_SIGNAL_HANDLER
364 
365 typedef struct {
366 	port_id				reply_port;	// port to send the reply to
367 	int					signal;		// the signal
368 } debug_nub_get_signal_handler;
369 
370 typedef struct {
371 	status_t			error;		// B_OK, if the thread exists
372 	struct sigaction	handler;	// the signal handler
373 } debug_nub_get_signal_handler_reply;
374 
375 // B_DEBUG_MESSAGE_PREPARE_HANDOVER
376 
377 // no parameters, no reply
378 
379 // B_DEBUG_START_PROFILER
380 
381 struct debug_profile_function {
382 	addr_t			base;	// function base address
383 	size_t			size;	// function size
384 };
385 
386 typedef struct {
387 	port_id				reply_port;		// port to send the reply to
388 	thread_id			thread;			// thread to profile
389 	bigtime_t			interval;		// sample interval
390 	area_id				sample_area;	// area into which the sample will be
391 										// written
392 	int32				stack_depth;	// number of return address per hit
393 	bool				variable_stack_depth;
394 										// variable number of samples per hit;
395 										// cf. debug_profiler_update
396 } debug_nub_start_profiler;
397 
398 typedef struct {
399 	status_t			error;
400 	int32				image_event;	// number of the last image event
401 	bigtime_t			interval;		// actual sample interval (might
402 										// differ from the requested one)
403 } debug_nub_start_profiler_reply;
404 
405 // B_DEBUG_STOP_PROFILER
406 
407 typedef struct {
408 	port_id				reply_port;		// port to send the reply to
409 	thread_id			thread;			// thread to profile
410 } debug_nub_stop_profiler;
411 
412 // reply is debug_profiler_update
413 
414 // union of all messages structures sent to the debug nub thread
415 typedef union {
416 	debug_nub_read_memory			read_memory;
417 	debug_nub_write_memory			write_memory;
418 	debug_nub_set_team_flags		set_team_flags;
419 	debug_nub_set_thread_flags		set_thread_flags;
420 	debug_nub_continue_thread		continue_thread;
421 	debug_nub_set_cpu_state			set_cpu_state;
422 	debug_nub_get_cpu_state			get_cpu_state;
423 	debug_nub_set_breakpoint		set_breakpoint;
424 	debug_nub_clear_breakpoint		clear_breakpoint;
425 	debug_nub_set_watchpoint		set_watchpoint;
426 	debug_nub_clear_watchpoint		clear_watchpoint;
427 	debug_nub_set_signal_masks		set_signal_masks;
428 	debug_nub_get_signal_masks		get_signal_masks;
429 	debug_nub_set_signal_handler	set_signal_handler;
430 	debug_nub_get_signal_handler	get_signal_handler;
431 	debug_nub_start_profiler		start_profiler;
432 	debug_nub_stop_profiler			stop_profiler;
433 } debug_nub_message_data;
434 
435 
436 // #pragma mark -
437 // #pragma mark ----- messages to the debugger -----
438 
439 // first member of all debugger messages -- not a message by itself
440 typedef struct {
441 	thread_id	thread;			// the thread being the event origin
442 	team_id		team;			// the thread's team
443 	port_id		nub_port;		// port to debug nub for this team (only set
444 								// for synchronous messages)
445 } debug_origin;
446 
447 // B_DEBUGGER_MESSAGE_THREAD_DEBUGGED
448 
449 typedef struct {
450 	debug_origin		origin;
451 } debug_thread_debugged;
452 
453 // B_DEBUGGER_MESSAGE_DEBUGGER_CALL
454 
455 typedef struct {
456 	debug_origin		origin;
457 	void				*message;	// address of the message passed to
458 									// debugger()
459 } debug_debugger_call;
460 
461 // B_DEBUGGER_MESSAGE_BREAKPOINT_HIT
462 
463 typedef struct {
464 	debug_origin		origin;
465 	debug_cpu_state		cpu_state;	// cpu state
466 } debug_breakpoint_hit;
467 
468 // B_DEBUGGER_MESSAGE_WATCHPOINT_HIT
469 
470 typedef struct {
471 	debug_origin		origin;
472 	debug_cpu_state		cpu_state;	// cpu state
473 } debug_watchpoint_hit;
474 
475 // B_DEBUGGER_MESSAGE_SINGLE_STEP
476 
477 typedef struct {
478 	debug_origin		origin;
479 	debug_cpu_state		cpu_state;	// cpu state
480 } debug_single_step;
481 
482 // B_DEBUGGER_MESSAGE_PRE_SYSCALL
483 
484 typedef struct {
485 	debug_origin	origin;
486 	uint32			syscall;		// the syscall number
487 	uint32			args[16];		// syscall arguments
488 } debug_pre_syscall;
489 
490 // B_DEBUGGER_MESSAGE_POST_SYSCALL
491 
492 typedef struct {
493 	debug_origin	origin;
494 	bigtime_t		start_time;		// time of syscall start
495 	bigtime_t		end_time;		// time of syscall completion
496 	uint64			return_value;	// the syscall's return value
497 	uint32			syscall;		// the syscall number
498 	uint32			args[16];		// syscall arguments
499 } debug_post_syscall;
500 
501 // B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED
502 
503 typedef struct {
504 	debug_origin		origin;
505 	int					signal;		// the signal
506 	struct sigaction	handler;	// the signal handler
507 	bool				deadly;		// true, if handling the signal will kill
508 									// the team
509 } debug_signal_received;
510 
511 // B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED
512 
513 typedef struct {
514 	debug_origin			origin;
515 	debug_exception_type	exception;		// the exception
516 	int						signal;			// the signal that will be sent,
517 											// when the thread continues
518 											// normally
519 } debug_exception_occurred;
520 
521 // B_DEBUGGER_MESSAGE_TEAM_CREATED
522 
523 typedef struct {
524 	debug_origin	origin;
525 	team_id			new_team;		// the newly created team
526 } debug_team_created;
527 
528 // B_DEBUGGER_MESSAGE_TEAM_DELETED
529 
530 typedef struct {
531 	debug_origin	origin;			// thread is < 0, team is the deleted team
532 									// (asynchronous message)
533 } debug_team_deleted;
534 
535 // B_DEBUGGER_MESSAGE_TEAM_EXEC
536 
537 typedef struct {
538 	debug_origin	origin;
539 	int32			image_event;	// number of the image event
540 } debug_team_exec;
541 
542 // B_DEBUGGER_MESSAGE_THREAD_CREATED
543 
544 typedef struct {
545 	debug_origin	origin;			// the thread that created the new thread
546 	team_id			new_thread;		// the newly created thread
547 } debug_thread_created;
548 
549 // B_DEBUGGER_MESSAGE_THREAD_DELETED
550 
551 typedef struct {
552 	debug_origin	origin;			// the deleted thread (asynchronous message)
553 } debug_thread_deleted;
554 
555 // B_DEBUGGER_MESSAGE_IMAGE_CREATED
556 
557 typedef struct {
558 	debug_origin	origin;
559 	image_info		info;			// info for the image
560 	int32			image_event;	// number of the image event
561 } debug_image_created;
562 
563 // B_DEBUGGER_MESSAGE_IMAGE_DELETED
564 
565 typedef struct {
566 	debug_origin	origin;
567 	image_info		info;			// info for the image
568 	int32			image_event;	// number of the image event
569 } debug_image_deleted;
570 
571 // B_DEBUGGER_MESSAGE_PROFILER_UPDATE
572 
573 typedef struct {
574 	debug_origin		origin;
575 	int32				image_event;	// number of the last image event; all
576 										// samples were recorded after this
577 										// event and before the next one
578 	int32				stack_depth;	// number of return addresses per tick
579 	int32				sample_count;	// number of samples in the buffer
580 	int32				dropped_ticks;	// number of ticks that had been
581 										// dropped, since the buffer was full
582 	bool				variable_stack_depth;
583 										// the number of samples per hit is
584 										// variable, i.e. the format for the
585 										// samples of a hit in the buffer is
586 										//   <n> <sample 1> ... <sample n>
587 										// instead of
588 										//   <sample 1> ... <sample stack_depth>
589 	bool				stopped;		// if true, the thread is no longer
590 										// being profiled
591 } debug_profiler_update;
592 
593 // B_DEBUGGER_MESSAGE_HANDED_OVER
594 
595 typedef struct {
596 	debug_origin	origin;			// thread is < 0, team is the deleted team
597 									// (asynchronous message)
598 	team_id			debugger;		// the new debugger
599 	port_id			debugger_port;	// the port the new debugger uses
600 	thread_id		causing_thread;	// the thread that caused entering the
601 									// debugger in the first place, -1 if the
602 									// debugger wasn't attached automatically
603 } debug_handed_over;
604 
605 // union of all messages structures sent to the debugger
606 typedef union {
607 	debug_thread_debugged			thread_debugged;
608 	debug_debugger_call				debugger_call;
609 	debug_breakpoint_hit			breakpoint_hit;
610 	debug_watchpoint_hit			watchpoint_hit;
611 	debug_single_step				single_step;
612 	debug_pre_syscall				pre_syscall;
613 	debug_post_syscall				post_syscall;
614 	debug_signal_received			signal_received;
615 	debug_exception_occurred		exception_occurred;
616 	debug_team_created				team_created;
617 	debug_team_deleted				team_deleted;
618 	debug_team_exec					team_exec;
619 	debug_thread_created			thread_created;
620 	debug_thread_deleted			thread_deleted;
621 	debug_image_created				image_created;
622 	debug_image_deleted				image_deleted;
623 	debug_profiler_update			profiler_update;
624 	debug_handed_over				handed_over;
625 
626 	debug_origin					origin;	// for convenience (no real message)
627 } debug_debugger_message_data;
628 
629 
630 extern void get_debug_message_string(debug_debugger_message message,
631 		char *buffer, int32 bufferSize);
632 extern void get_debug_exception_string(debug_exception_type exception,
633 		char *buffer, int32 bufferSize);
634 
635 
636 #ifdef __cplusplus
637 }	// extern "C"
638 #endif
639 
640 #endif	// _DEBUGGER_H
641