winegstreamer: Use gst_audio_info_to_caps for media type translation.
[wine.git] / server / debugger.c
blobe4a6c1e43a8a2c725fdffa088304650b0255343b
1 /*
2 * Server-side debugger functions
4 * Copyright (C) 1999 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include <assert.h>
25 #include <signal.h>
26 #include <string.h>
27 #include <stdarg.h>
28 #include <stdio.h>
30 #include "ntstatus.h"
31 #define WIN32_NO_STATUS
32 #include "windef.h"
33 #include "winternl.h"
35 #include "handle.h"
36 #include "file.h"
37 #include "process.h"
38 #include "thread.h"
39 #include "request.h"
41 enum debug_event_state { EVENT_QUEUED, EVENT_SENT, EVENT_DELAYED, EVENT_CONTINUED };
43 /* debug event */
44 struct debug_event
46 struct object obj; /* object header */
47 struct list entry; /* entry in event queue */
48 struct thread *sender; /* thread which sent this event */
49 struct thread *debugger; /* debugger thread receiving the event */
50 enum debug_event_state state; /* event state */
51 int status; /* continuation status */
52 debug_event_t data; /* event data */
55 /* debug context */
56 struct debug_ctx
58 struct object obj; /* object header */
59 struct list event_queue; /* pending events queue */
60 int kill_on_exit;/* kill debuggees on debugger exit ? */
64 static void debug_event_dump( struct object *obj, int verbose );
65 static int debug_event_signaled( struct object *obj, struct wait_queue_entry *entry );
66 static void debug_event_destroy( struct object *obj );
68 static const struct object_ops debug_event_ops =
70 sizeof(struct debug_event), /* size */
71 debug_event_dump, /* dump */
72 no_get_type, /* get_type */
73 add_queue, /* add_queue */
74 remove_queue, /* remove_queue */
75 debug_event_signaled, /* signaled */
76 no_satisfied, /* satisfied */
77 no_signal, /* signal */
78 no_get_fd, /* get_fd */
79 no_map_access, /* map_access */
80 default_get_sd, /* get_sd */
81 default_set_sd, /* set_sd */
82 no_get_full_name, /* get_full_name */
83 no_lookup_name, /* lookup_name */
84 no_link_name, /* link_name */
85 NULL, /* unlink_name */
86 no_open_file, /* open_file */
87 no_kernel_obj_list, /* get_kernel_obj_list */
88 no_close_handle, /* close_handle */
89 debug_event_destroy /* destroy */
92 static void debug_ctx_dump( struct object *obj, int verbose );
93 static int debug_ctx_signaled( struct object *obj, struct wait_queue_entry *entry );
94 static void debug_ctx_destroy( struct object *obj );
96 static const struct object_ops debug_ctx_ops =
98 sizeof(struct debug_ctx), /* size */
99 debug_ctx_dump, /* dump */
100 no_get_type, /* get_type */
101 add_queue, /* add_queue */
102 remove_queue, /* remove_queue */
103 debug_ctx_signaled, /* signaled */
104 no_satisfied, /* satisfied */
105 no_signal, /* signal */
106 no_get_fd, /* get_fd */
107 no_map_access, /* map_access */
108 default_get_sd, /* get_sd */
109 default_set_sd, /* set_sd */
110 no_get_full_name, /* get_full_name */
111 no_lookup_name, /* lookup_name */
112 no_link_name, /* link_name */
113 NULL, /* unlink_name */
114 no_open_file, /* open_file */
115 no_kernel_obj_list, /* get_kernel_obj_list */
116 no_close_handle, /* close_handle */
117 debug_ctx_destroy /* destroy */
121 /* routines to build an event according to its type */
123 static int fill_exception_event( struct debug_event *event, const void *arg )
125 const debug_event_t *data = arg;
126 event->data.exception = data->exception;
127 event->data.exception.nb_params = min( event->data.exception.nb_params, EXCEPTION_MAXIMUM_PARAMETERS );
128 return 1;
131 static int fill_create_thread_event( struct debug_event *event, const void *arg )
133 struct process *debugger = event->debugger->process;
134 struct thread *thread = event->sender;
135 const client_ptr_t *entry = arg;
136 obj_handle_t handle;
138 /* documented: THREAD_GET_CONTEXT | THREAD_SET_CONTEXT | THREAD_SUSPEND_RESUME */
139 if (!(handle = alloc_handle( debugger, thread, THREAD_ALL_ACCESS, 0 ))) return 0;
140 event->data.create_thread.handle = handle;
141 event->data.create_thread.teb = thread->teb;
142 if (entry) event->data.create_thread.start = *entry;
143 return 1;
146 static int fill_create_process_event( struct debug_event *event, const void *arg )
148 struct process *debugger = event->debugger->process;
149 struct thread *thread = event->sender;
150 struct process *process = thread->process;
151 struct process_dll *exe_module = get_process_exe_module( process );
152 const client_ptr_t *entry = arg;
153 struct file *file;
154 obj_handle_t handle;
156 /* documented: PROCESS_VM_READ | PROCESS_VM_WRITE */
157 if (!(handle = alloc_handle( debugger, process, PROCESS_ALL_ACCESS, 0 ))) return 0;
158 event->data.create_process.process = handle;
160 /* documented: THREAD_GET_CONTEXT | THREAD_SET_CONTEXT | THREAD_SUSPEND_RESUME */
161 if (!(handle = alloc_handle( debugger, thread, THREAD_ALL_ACCESS, 0 )))
163 close_handle( debugger, event->data.create_process.process );
164 return 0;
166 event->data.create_process.thread = handle;
167 event->data.create_process.file = 0;
168 event->data.create_process.teb = thread->teb;
169 event->data.create_process.base = exe_module->base;
170 event->data.create_process.start = *entry;
171 event->data.create_process.dbg_offset = exe_module->dbg_offset;
172 event->data.create_process.dbg_size = exe_module->dbg_size;
173 event->data.create_process.name = exe_module->name;
174 event->data.create_process.unicode = 1;
176 /* the doc says write access too, but this doesn't seem a good idea */
177 if ((file = get_mapping_file( process, exe_module->base, GENERIC_READ,
178 FILE_SHARE_READ | FILE_SHARE_WRITE )))
180 event->data.create_process.file = alloc_handle( debugger, file, GENERIC_READ, 0 );
181 release_object( file );
183 return 1;
186 static int fill_exit_thread_event( struct debug_event *event, const void *arg )
188 const struct thread *thread = arg;
189 event->data.exit.exit_code = thread->exit_code;
190 return 1;
193 static int fill_exit_process_event( struct debug_event *event, const void *arg )
195 const struct process *process = arg;
196 event->data.exit.exit_code = process->exit_code;
197 return 1;
200 static int fill_load_dll_event( struct debug_event *event, const void *arg )
202 struct process *process = event->sender->process;
203 struct process *debugger = event->debugger->process;
204 const struct process_dll *dll = arg;
205 struct file *file;
207 event->data.load_dll.handle = 0;
208 event->data.load_dll.base = dll->base;
209 event->data.load_dll.dbg_offset = dll->dbg_offset;
210 event->data.load_dll.dbg_size = dll->dbg_size;
211 event->data.load_dll.name = dll->name;
212 event->data.load_dll.unicode = 1;
213 if ((file = get_mapping_file( process, dll->base, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE )))
215 event->data.load_dll.handle = alloc_handle( debugger, file, GENERIC_READ, 0 );
216 release_object( file );
218 return 1;
221 static int fill_unload_dll_event( struct debug_event *event, const void *arg )
223 const mod_handle_t *base = arg;
224 event->data.unload_dll.base = *base;
225 return 1;
228 typedef int (*fill_event_func)( struct debug_event *event, const void *arg );
230 #define NB_DEBUG_EVENTS UNLOAD_DLL_DEBUG_EVENT
232 static const fill_event_func fill_debug_event[NB_DEBUG_EVENTS] =
234 fill_exception_event, /* EXCEPTION_DEBUG_EVENT */
235 fill_create_thread_event, /* CREATE_THREAD_DEBUG_EVENT */
236 fill_create_process_event, /* CREATE_PROCESS_DEBUG_EVENT */
237 fill_exit_thread_event, /* EXIT_THREAD_DEBUG_EVENT */
238 fill_exit_process_event, /* EXIT_PROCESS_DEBUG_EVENT */
239 fill_load_dll_event, /* LOAD_DLL_DEBUG_EVENT */
240 fill_unload_dll_event /* UNLOAD_DLL_DEBUG_EVENT */
244 /* unlink the first event from the queue */
245 static void unlink_event( struct debug_ctx *debug_ctx, struct debug_event *event )
247 list_remove( &event->entry );
248 if (event->sender->process->debug_event == event) event->sender->process->debug_event = NULL;
249 release_object( event );
252 /* link an event at the end of the queue */
253 static void link_event( struct debug_event *event )
255 struct debug_ctx *debug_ctx = event->debugger->debug_ctx;
257 assert( debug_ctx );
258 grab_object( event );
259 list_add_tail( &debug_ctx->event_queue, &event->entry );
260 if (!event->sender->process->debug_event)
262 /* grab reference since debugger could be killed while trying to wake up */
263 grab_object( debug_ctx );
264 wake_up( &debug_ctx->obj, 0 );
265 release_object( debug_ctx );
269 /* resume a delayed debug event already in the queue */
270 static void resume_event( struct debug_event *event )
272 struct debug_ctx *debug_ctx = event->debugger->debug_ctx;
274 assert( debug_ctx );
275 event->state = EVENT_QUEUED;
276 if (!event->sender->process->debug_event)
278 grab_object( debug_ctx );
279 wake_up( &debug_ctx->obj, 0 );
280 release_object( debug_ctx );
284 /* delay a debug event already in the queue to be replayed when thread wakes up */
285 static void delay_event( struct debug_event *event )
287 struct debug_ctx *debug_ctx = event->debugger->debug_ctx;
289 assert( debug_ctx );
290 event->state = EVENT_DELAYED;
291 if (event->sender->process->debug_event == event) event->sender->process->debug_event = NULL;
294 /* find the next event that we can send to the debugger */
295 static struct debug_event *find_event_to_send( struct debug_ctx *debug_ctx )
297 struct debug_event *event;
299 LIST_FOR_EACH_ENTRY( event, &debug_ctx->event_queue, struct debug_event, entry )
301 if (event->state == EVENT_SENT) continue; /* already sent */
302 if (event->state == EVENT_DELAYED) continue; /* delayed until thread resumes */
303 if (event->sender->process->debug_event) continue; /* process busy with another one */
304 return event;
306 return NULL;
309 static void debug_event_dump( struct object *obj, int verbose )
311 struct debug_event *debug_event = (struct debug_event *)obj;
312 assert( obj->ops == &debug_event_ops );
313 fprintf( stderr, "Debug event sender=%p code=%d state=%d\n",
314 debug_event->sender, debug_event->data.code, debug_event->state );
317 static int debug_event_signaled( struct object *obj, struct wait_queue_entry *entry )
319 struct debug_event *debug_event = (struct debug_event *)obj;
320 assert( obj->ops == &debug_event_ops );
321 return debug_event->state == EVENT_CONTINUED;
324 static void debug_event_destroy( struct object *obj )
326 struct debug_event *event = (struct debug_event *)obj;
327 assert( obj->ops == &debug_event_ops );
329 /* If the event has been sent already, the handles are now under the */
330 /* responsibility of the debugger process, so we don't touch them */
331 if (event->state == EVENT_QUEUED)
333 struct process *debugger = event->debugger->process;
334 switch(event->data.code)
336 case CREATE_THREAD_DEBUG_EVENT:
337 close_handle( debugger, event->data.create_thread.handle );
338 break;
339 case CREATE_PROCESS_DEBUG_EVENT:
340 if (event->data.create_process.file)
341 close_handle( debugger, event->data.create_process.file );
342 close_handle( debugger, event->data.create_process.thread );
343 close_handle( debugger, event->data.create_process.process );
344 break;
345 case LOAD_DLL_DEBUG_EVENT:
346 if (event->data.load_dll.handle)
347 close_handle( debugger, event->data.load_dll.handle );
348 break;
351 release_object( event->sender );
352 release_object( event->debugger );
355 static void debug_ctx_dump( struct object *obj, int verbose )
357 struct debug_ctx *debug_ctx = (struct debug_ctx *)obj;
358 assert( obj->ops == &debug_ctx_ops );
359 fprintf( stderr, "Debug context head=%p tail=%p\n",
360 debug_ctx->event_queue.next, debug_ctx->event_queue.prev );
363 static int debug_ctx_signaled( struct object *obj, struct wait_queue_entry *entry )
365 struct debug_ctx *debug_ctx = (struct debug_ctx *)obj;
366 assert( obj->ops == &debug_ctx_ops );
367 return find_event_to_send( debug_ctx ) != NULL;
370 static void debug_ctx_destroy( struct object *obj )
372 struct list *ptr;
373 struct debug_ctx *debug_ctx = (struct debug_ctx *)obj;
374 assert( obj->ops == &debug_ctx_ops );
376 /* free all pending events */
377 while ((ptr = list_head( &debug_ctx->event_queue )))
378 unlink_event( debug_ctx, LIST_ENTRY( ptr, struct debug_event, entry ));
381 /* continue a debug event */
382 static int continue_debug_event( struct process *process, struct thread *thread, int status )
384 struct debug_ctx *debug_ctx = current->debug_ctx;
386 if (debug_ctx && process->debugger == current && thread->process == process)
388 struct debug_event *event;
390 if (status == DBG_REPLY_LATER)
392 /* if thread is suspended, delay all its events and resume process
393 * if not, reset the event for immediate replay */
394 LIST_FOR_EACH_ENTRY( event, &debug_ctx->event_queue, struct debug_event, entry )
396 if (event->sender != thread) continue;
397 if (thread->suspend)
399 delay_event( event );
400 resume_process( process );
402 else if (event->state == EVENT_SENT)
404 assert( event->sender->process->debug_event == event );
405 event->sender->process->debug_event = NULL;
406 resume_event( event );
407 return 1;
410 return 1;
413 /* find the event in the queue */
414 LIST_FOR_EACH_ENTRY( event, &debug_ctx->event_queue, struct debug_event, entry )
416 if (event->state != EVENT_SENT) continue;
417 if (event->sender == thread)
419 assert( event->sender->process->debug_event == event );
420 event->status = status;
421 event->state = EVENT_CONTINUED;
422 wake_up( &event->obj, 0 );
423 unlink_event( debug_ctx, event );
424 resume_process( process );
425 return 1;
429 /* not debugging this process, or no such event */
430 set_error( STATUS_ACCESS_DENIED ); /* FIXME */
431 return 0;
434 /* alloc a debug event for a debugger */
435 static struct debug_event *alloc_debug_event( struct thread *thread, int code, const void *arg )
437 struct thread *debugger = thread->process->debugger;
438 struct debug_event *event;
440 assert( code > 0 && code <= NB_DEBUG_EVENTS );
441 /* cannot queue a debug event for myself */
442 assert( debugger->process != thread->process );
444 /* build the event */
445 if (!(event = alloc_object( &debug_event_ops ))) return NULL;
446 event->state = EVENT_QUEUED;
447 event->sender = (struct thread *)grab_object( thread );
448 event->debugger = (struct thread *)grab_object( debugger );
449 memset( &event->data, 0, sizeof(event->data) );
451 if (!fill_debug_event[code-1]( event, arg ))
453 event->data.code = -1; /* make sure we don't attempt to close handles */
454 release_object( event );
455 return NULL;
457 event->data.code = code;
458 return event;
461 /* generate a debug event from inside the server and queue it */
462 void generate_debug_event( struct thread *thread, int code, const void *arg )
464 if (thread->process->debugger)
466 struct debug_event *event = alloc_debug_event( thread, code, arg );
467 if (event)
469 link_event( event );
470 suspend_process( thread->process );
471 release_object( event );
473 clear_error(); /* ignore errors */
477 void resume_delayed_debug_events( struct thread *thread )
479 struct thread *debugger = thread->process->debugger;
480 struct debug_event *event;
482 if (debugger)
484 assert( debugger->debug_ctx );
485 LIST_FOR_EACH_ENTRY( event, &debugger->debug_ctx->event_queue, struct debug_event, entry )
487 if (event->sender != thread) continue;
488 if (event->state != EVENT_DELAYED) continue;
489 resume_event( event );
490 suspend_process( thread->process );
495 /* attach a process to a debugger thread and suspend it */
496 static int debugger_attach( struct process *process, struct thread *debugger )
498 if (process->debugger) goto error; /* already being debugged */
499 if (debugger->process == process) goto error;
500 if (!is_process_init_done( process )) goto error; /* still starting up */
501 if (list_empty( &process->thread_list )) goto error; /* no thread running in the process */
503 /* don't let a debugger debug its console... won't work */
504 if (debugger->process->console)
506 struct thread *renderer = console_get_renderer(debugger->process->console);
507 if (renderer && renderer->process == process)
508 goto error;
511 suspend_process( process );
512 if (!set_process_debugger( process, debugger ))
514 resume_process( process );
515 return 0;
517 if (!set_process_debug_flag( process, 1 ))
519 process->debugger = NULL;
520 resume_process( process );
521 return 0;
523 process->debug_children = 0;
524 return 1;
526 error:
527 set_error( STATUS_ACCESS_DENIED );
528 return 0;
532 /* detach a process from a debugger thread (and resume it ?) */
533 int debugger_detach( struct process *process, struct thread *debugger )
535 struct debug_event *event, *next;
536 struct debug_ctx *debug_ctx;
538 if (!process->debugger || process->debugger != debugger)
539 goto error; /* not currently debugged, or debugged by another debugger */
540 if (!debugger->debug_ctx ) goto error; /* should be a debugger */
541 /* init should be done, otherwise wouldn't be attached */
542 assert(is_process_init_done(process));
544 suspend_process( process );
545 /* send continue indication for all events */
546 debug_ctx = debugger->debug_ctx;
548 /* free all events from this process */
549 LIST_FOR_EACH_ENTRY_SAFE( event, next, &debug_ctx->event_queue, struct debug_event, entry )
551 if (event->sender->process != process) continue;
553 assert( event->state != EVENT_CONTINUED );
554 event->status = DBG_CONTINUE;
555 event->state = EVENT_CONTINUED;
556 wake_up( &event->obj, 0 );
557 unlink_event( debug_ctx, event );
558 /* from queued debug event */
559 resume_process( process );
562 /* remove relationships between process and its debugger */
563 process->debugger = NULL;
564 if (!set_process_debug_flag( process, 0 )) clear_error(); /* ignore error */
566 /* from this function */
567 resume_process( process );
568 return 0;
570 error:
571 set_error( STATUS_ACCESS_DENIED );
572 return 0;
575 /* generate all startup events of a given process */
576 void generate_startup_debug_events( struct process *process, client_ptr_t entry )
578 struct list *ptr;
579 struct thread *thread, *first_thread = get_process_first_thread( process );
581 generate_debug_event( first_thread, CREATE_PROCESS_DEBUG_EVENT, &entry );
582 ptr = list_head( &process->dlls ); /* skip main module reported in create process event */
584 /* generate ntdll.dll load event */
585 if (ptr && (ptr = list_next( &process->dlls, ptr )))
587 struct process_dll *dll = LIST_ENTRY( ptr, struct process_dll, entry );
588 generate_debug_event( first_thread, LOAD_DLL_DEBUG_EVENT, dll );
591 /* generate creation events */
592 LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
594 if (thread != first_thread)
595 generate_debug_event( thread, CREATE_THREAD_DEBUG_EVENT, NULL );
598 /* generate dll events (in loading order) */
599 while (ptr && (ptr = list_next( &process->dlls, ptr )))
601 struct process_dll *dll = LIST_ENTRY( ptr, struct process_dll, entry );
602 generate_debug_event( first_thread, LOAD_DLL_DEBUG_EVENT, dll );
606 /* set the debugger of a given process */
607 int set_process_debugger( struct process *process, struct thread *debugger )
609 struct debug_ctx *debug_ctx;
611 assert( !process->debugger );
613 if (!debugger->debug_ctx) /* need to allocate a context */
615 if (!(debug_ctx = alloc_object( &debug_ctx_ops ))) return 0;
616 debug_ctx->kill_on_exit = 1;
617 list_init( &debug_ctx->event_queue );
618 debugger->debug_ctx = debug_ctx;
620 process->debugger = debugger;
621 return 1;
624 /* a thread is exiting */
625 void debug_exit_thread( struct thread *thread )
627 if (thread->debug_ctx) /* this thread is a debugger */
629 if (thread->debug_ctx->kill_on_exit)
631 /* kill all debugged processes */
632 kill_debugged_processes( thread, STATUS_DEBUGGER_INACTIVE );
634 else
636 detach_debugged_processes( thread );
638 release_object( thread->debug_ctx );
639 thread->debug_ctx = NULL;
643 /* Wait for a debug event */
644 DECL_HANDLER(wait_debug_event)
646 struct debug_ctx *debug_ctx = current->debug_ctx;
647 struct debug_event *event;
649 if (!debug_ctx) /* current thread is not a debugger */
651 set_error( STATUS_INVALID_HANDLE );
652 return;
654 reply->wait = 0;
655 if ((event = find_event_to_send( debug_ctx )))
657 data_size_t size = get_reply_max_size();
658 event->state = EVENT_SENT;
659 event->sender->process->debug_event = event;
660 reply->pid = get_process_id( event->sender->process );
661 reply->tid = get_thread_id( event->sender );
662 if (size > sizeof(debug_event_t)) size = sizeof(debug_event_t);
663 set_reply_data( &event->data, size );
665 else /* no event ready */
667 reply->pid = 0;
668 reply->tid = 0;
669 if (req->get_handle)
670 reply->wait = alloc_handle( current->process, debug_ctx, SYNCHRONIZE, 0 );
674 /* Continue a debug event */
675 DECL_HANDLER(continue_debug_event)
677 struct process *process;
679 if (req->status != DBG_EXCEPTION_NOT_HANDLED &&
680 req->status != DBG_CONTINUE &&
681 req->status != DBG_REPLY_LATER)
683 set_error( STATUS_INVALID_PARAMETER );
684 return;
687 if ((process = get_process_from_id( req->pid )))
689 struct thread *thread = get_thread_from_id( req->tid );
690 if (thread)
692 continue_debug_event( process, thread, req->status );
693 release_object( thread );
695 release_object( process );
699 /* Start debugging an existing process */
700 DECL_HANDLER(debug_process)
702 struct process *process = get_process_from_id( req->pid );
703 if (!process) return;
705 if (!req->attach)
707 debugger_detach( process, current );
709 else if (debugger_attach( process, current ))
711 generate_startup_debug_events( process, 0 );
712 resume_process( process );
714 release_object( process );
717 /* queue an exception event */
718 DECL_HANDLER(queue_exception_event)
720 reply->handle = 0;
721 if (current->process->debugger)
723 debug_event_t data;
724 struct debug_event *event;
725 struct thread *thread = current;
727 if ((req->len % sizeof(client_ptr_t)) != 0 ||
728 req->len > get_req_data_size() ||
729 req->len > EXCEPTION_MAXIMUM_PARAMETERS * sizeof(client_ptr_t))
731 set_error( STATUS_INVALID_PARAMETER );
732 return;
734 memset( &data, 0, sizeof(data) );
735 data.exception.first = req->first;
736 data.exception.exc_code = req->code;
737 data.exception.flags = req->flags;
738 data.exception.record = req->record;
739 data.exception.address = req->address;
740 data.exception.nb_params = req->len / sizeof(client_ptr_t);
741 memcpy( data.exception.params, get_req_data(), req->len );
743 if ((event = alloc_debug_event( thread, EXCEPTION_DEBUG_EVENT, &data )))
745 if ((reply->handle = alloc_handle( thread->process, event, SYNCHRONIZE, 0 )))
747 link_event( event );
748 suspend_process( thread->process );
750 release_object( event );
755 /* retrieve the status of an exception event */
756 DECL_HANDLER(get_exception_status)
758 struct debug_event *event;
760 if ((event = (struct debug_event *)get_handle_obj( current->process, req->handle,
761 0, &debug_event_ops )))
763 close_handle( current->process, req->handle );
764 set_error( event->state == EVENT_CONTINUED ? event->status : STATUS_PENDING );
765 release_object( event );
769 /* set debugger kill on exit flag */
770 DECL_HANDLER(set_debugger_kill_on_exit)
772 if (!current->debug_ctx)
774 set_error( STATUS_ACCESS_DENIED );
775 return;
777 current->debug_ctx->kill_on_exit = req->kill_on_exit;