amstream: Increase parent IAMMediaStream refcount in IDirectDrawMediaStream::CreateSa...
[wine.git] / server / debugger.c
blob401ce36a47a7c9d150b70f9a2ab8cb6c0b3ee9f2
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_lookup_name, /* lookup_name */
83 no_link_name, /* link_name */
84 NULL, /* unlink_name */
85 no_open_file, /* open_file */
86 no_kernel_obj_list, /* get_kernel_obj_list */
87 no_close_handle, /* close_handle */
88 debug_event_destroy /* destroy */
91 static void debug_ctx_dump( struct object *obj, int verbose );
92 static int debug_ctx_signaled( struct object *obj, struct wait_queue_entry *entry );
93 static void debug_ctx_destroy( struct object *obj );
95 static const struct object_ops debug_ctx_ops =
97 sizeof(struct debug_ctx), /* size */
98 debug_ctx_dump, /* dump */
99 no_get_type, /* get_type */
100 add_queue, /* add_queue */
101 remove_queue, /* remove_queue */
102 debug_ctx_signaled, /* signaled */
103 no_satisfied, /* satisfied */
104 no_signal, /* signal */
105 no_get_fd, /* get_fd */
106 no_map_access, /* map_access */
107 default_get_sd, /* get_sd */
108 default_set_sd, /* set_sd */
109 no_lookup_name, /* lookup_name */
110 no_link_name, /* link_name */
111 NULL, /* unlink_name */
112 no_open_file, /* open_file */
113 no_kernel_obj_list, /* get_kernel_obj_list */
114 no_close_handle, /* close_handle */
115 debug_ctx_destroy /* destroy */
119 /* routines to build an event according to its type */
121 static int fill_exception_event( struct debug_event *event, const void *arg )
123 const debug_event_t *data = arg;
124 event->data.exception = data->exception;
125 event->data.exception.nb_params = min( event->data.exception.nb_params, EXCEPTION_MAXIMUM_PARAMETERS );
126 return 1;
129 static int fill_create_thread_event( struct debug_event *event, const void *arg )
131 struct process *debugger = event->debugger->process;
132 struct thread *thread = event->sender;
133 const client_ptr_t *entry = arg;
134 obj_handle_t handle;
136 /* documented: THREAD_GET_CONTEXT | THREAD_SET_CONTEXT | THREAD_SUSPEND_RESUME */
137 if (!(handle = alloc_handle( debugger, thread, THREAD_ALL_ACCESS, 0 ))) return 0;
138 event->data.create_thread.handle = handle;
139 event->data.create_thread.teb = thread->teb;
140 if (entry) event->data.create_thread.start = *entry;
141 return 1;
144 static int fill_create_process_event( struct debug_event *event, const void *arg )
146 struct process *debugger = event->debugger->process;
147 struct thread *thread = event->sender;
148 struct process *process = thread->process;
149 struct process_dll *exe_module = get_process_exe_module( process );
150 const client_ptr_t *entry = arg;
151 struct file *file;
152 obj_handle_t handle;
154 /* documented: PROCESS_VM_READ | PROCESS_VM_WRITE */
155 if (!(handle = alloc_handle( debugger, process, PROCESS_ALL_ACCESS, 0 ))) return 0;
156 event->data.create_process.process = handle;
158 /* documented: THREAD_GET_CONTEXT | THREAD_SET_CONTEXT | THREAD_SUSPEND_RESUME */
159 if (!(handle = alloc_handle( debugger, thread, THREAD_ALL_ACCESS, 0 )))
161 close_handle( debugger, event->data.create_process.process );
162 return 0;
164 event->data.create_process.thread = handle;
165 event->data.create_process.file = 0;
166 event->data.create_process.teb = thread->teb;
167 event->data.create_process.base = exe_module->base;
168 event->data.create_process.start = *entry;
169 event->data.create_process.dbg_offset = exe_module->dbg_offset;
170 event->data.create_process.dbg_size = exe_module->dbg_size;
171 event->data.create_process.name = exe_module->name;
172 event->data.create_process.unicode = 1;
174 /* the doc says write access too, but this doesn't seem a good idea */
175 if ((file = get_mapping_file( process, exe_module->base, GENERIC_READ,
176 FILE_SHARE_READ | FILE_SHARE_WRITE )))
178 event->data.create_process.file = alloc_handle( debugger, file, GENERIC_READ, 0 );
179 release_object( file );
181 return 1;
184 static int fill_exit_thread_event( struct debug_event *event, const void *arg )
186 const struct thread *thread = arg;
187 event->data.exit.exit_code = thread->exit_code;
188 return 1;
191 static int fill_exit_process_event( struct debug_event *event, const void *arg )
193 const struct process *process = arg;
194 event->data.exit.exit_code = process->exit_code;
195 return 1;
198 static int fill_load_dll_event( struct debug_event *event, const void *arg )
200 struct process *process = event->sender->process;
201 struct process *debugger = event->debugger->process;
202 const struct process_dll *dll = arg;
203 struct file *file;
205 event->data.load_dll.handle = 0;
206 event->data.load_dll.base = dll->base;
207 event->data.load_dll.dbg_offset = dll->dbg_offset;
208 event->data.load_dll.dbg_size = dll->dbg_size;
209 event->data.load_dll.name = dll->name;
210 event->data.load_dll.unicode = 1;
211 if ((file = get_mapping_file( process, dll->base, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE )))
213 event->data.load_dll.handle = alloc_handle( debugger, file, GENERIC_READ, 0 );
214 release_object( file );
216 return 1;
219 static int fill_unload_dll_event( struct debug_event *event, const void *arg )
221 const mod_handle_t *base = arg;
222 event->data.unload_dll.base = *base;
223 return 1;
226 typedef int (*fill_event_func)( struct debug_event *event, const void *arg );
228 #define NB_DEBUG_EVENTS UNLOAD_DLL_DEBUG_EVENT
230 static const fill_event_func fill_debug_event[NB_DEBUG_EVENTS] =
232 fill_exception_event, /* EXCEPTION_DEBUG_EVENT */
233 fill_create_thread_event, /* CREATE_THREAD_DEBUG_EVENT */
234 fill_create_process_event, /* CREATE_PROCESS_DEBUG_EVENT */
235 fill_exit_thread_event, /* EXIT_THREAD_DEBUG_EVENT */
236 fill_exit_process_event, /* EXIT_PROCESS_DEBUG_EVENT */
237 fill_load_dll_event, /* LOAD_DLL_DEBUG_EVENT */
238 fill_unload_dll_event /* UNLOAD_DLL_DEBUG_EVENT */
242 /* unlink the first event from the queue */
243 static void unlink_event( struct debug_ctx *debug_ctx, struct debug_event *event )
245 list_remove( &event->entry );
246 if (event->sender->process->debug_event == event) event->sender->process->debug_event = NULL;
247 release_object( event );
250 /* link an event at the end of the queue */
251 static void link_event( struct debug_event *event )
253 struct debug_ctx *debug_ctx = event->debugger->debug_ctx;
255 assert( debug_ctx );
256 grab_object( event );
257 list_add_tail( &debug_ctx->event_queue, &event->entry );
258 if (!event->sender->process->debug_event)
260 /* grab reference since debugger could be killed while trying to wake up */
261 grab_object( debug_ctx );
262 wake_up( &debug_ctx->obj, 0 );
263 release_object( debug_ctx );
267 /* resume a delayed debug event already in the queue */
268 static void resume_event( struct debug_event *event )
270 struct debug_ctx *debug_ctx = event->debugger->debug_ctx;
272 assert( debug_ctx );
273 event->state = EVENT_QUEUED;
274 if (!event->sender->process->debug_event)
276 grab_object( debug_ctx );
277 wake_up( &debug_ctx->obj, 0 );
278 release_object( debug_ctx );
282 /* delay a debug event already in the queue to be replayed when thread wakes up */
283 static void delay_event( struct debug_event *event )
285 struct debug_ctx *debug_ctx = event->debugger->debug_ctx;
287 assert( debug_ctx );
288 event->state = EVENT_DELAYED;
289 if (event->sender->process->debug_event == event) event->sender->process->debug_event = NULL;
292 /* find the next event that we can send to the debugger */
293 static struct debug_event *find_event_to_send( struct debug_ctx *debug_ctx )
295 struct debug_event *event;
297 LIST_FOR_EACH_ENTRY( event, &debug_ctx->event_queue, struct debug_event, entry )
299 if (event->state == EVENT_SENT) continue; /* already sent */
300 if (event->state == EVENT_DELAYED) continue; /* delayed until thread resumes */
301 if (event->sender->process->debug_event) continue; /* process busy with another one */
302 return event;
304 return NULL;
307 static void debug_event_dump( struct object *obj, int verbose )
309 struct debug_event *debug_event = (struct debug_event *)obj;
310 assert( obj->ops == &debug_event_ops );
311 fprintf( stderr, "Debug event sender=%p code=%d state=%d\n",
312 debug_event->sender, debug_event->data.code, debug_event->state );
315 static int debug_event_signaled( struct object *obj, struct wait_queue_entry *entry )
317 struct debug_event *debug_event = (struct debug_event *)obj;
318 assert( obj->ops == &debug_event_ops );
319 return debug_event->state == EVENT_CONTINUED;
322 static void debug_event_destroy( struct object *obj )
324 struct debug_event *event = (struct debug_event *)obj;
325 assert( obj->ops == &debug_event_ops );
327 /* If the event has been sent already, the handles are now under the */
328 /* responsibility of the debugger process, so we don't touch them */
329 if (event->state == EVENT_QUEUED)
331 struct process *debugger = event->debugger->process;
332 switch(event->data.code)
334 case CREATE_THREAD_DEBUG_EVENT:
335 close_handle( debugger, event->data.create_thread.handle );
336 break;
337 case CREATE_PROCESS_DEBUG_EVENT:
338 if (event->data.create_process.file)
339 close_handle( debugger, event->data.create_process.file );
340 close_handle( debugger, event->data.create_process.thread );
341 close_handle( debugger, event->data.create_process.process );
342 break;
343 case LOAD_DLL_DEBUG_EVENT:
344 if (event->data.load_dll.handle)
345 close_handle( debugger, event->data.load_dll.handle );
346 break;
349 release_object( event->sender );
350 release_object( event->debugger );
353 static void debug_ctx_dump( struct object *obj, int verbose )
355 struct debug_ctx *debug_ctx = (struct debug_ctx *)obj;
356 assert( obj->ops == &debug_ctx_ops );
357 fprintf( stderr, "Debug context head=%p tail=%p\n",
358 debug_ctx->event_queue.next, debug_ctx->event_queue.prev );
361 static int debug_ctx_signaled( struct object *obj, struct wait_queue_entry *entry )
363 struct debug_ctx *debug_ctx = (struct debug_ctx *)obj;
364 assert( obj->ops == &debug_ctx_ops );
365 return find_event_to_send( debug_ctx ) != NULL;
368 static void debug_ctx_destroy( struct object *obj )
370 struct list *ptr;
371 struct debug_ctx *debug_ctx = (struct debug_ctx *)obj;
372 assert( obj->ops == &debug_ctx_ops );
374 /* free all pending events */
375 while ((ptr = list_head( &debug_ctx->event_queue )))
376 unlink_event( debug_ctx, LIST_ENTRY( ptr, struct debug_event, entry ));
379 /* continue a debug event */
380 static int continue_debug_event( struct process *process, struct thread *thread, int status )
382 struct debug_ctx *debug_ctx = current->debug_ctx;
384 if (debug_ctx && process->debugger == current && thread->process == process)
386 struct debug_event *event;
388 if (status == DBG_REPLY_LATER)
390 /* if thread is suspended, delay all its events and resume process
391 * if not, reset the event for immediate replay */
392 LIST_FOR_EACH_ENTRY( event, &debug_ctx->event_queue, struct debug_event, entry )
394 if (event->sender != thread) continue;
395 if (thread->suspend)
397 delay_event( event );
398 resume_process( process );
400 else if (event->state == EVENT_SENT)
402 assert( event->sender->process->debug_event == event );
403 event->sender->process->debug_event = NULL;
404 resume_event( event );
405 return 1;
408 return 1;
411 /* find the event in the queue */
412 LIST_FOR_EACH_ENTRY( event, &debug_ctx->event_queue, struct debug_event, entry )
414 if (event->state != EVENT_SENT) continue;
415 if (event->sender == thread)
417 assert( event->sender->process->debug_event == event );
418 event->status = status;
419 event->state = EVENT_CONTINUED;
420 wake_up( &event->obj, 0 );
421 unlink_event( debug_ctx, event );
422 resume_process( process );
423 return 1;
427 /* not debugging this process, or no such event */
428 set_error( STATUS_ACCESS_DENIED ); /* FIXME */
429 return 0;
432 /* alloc a debug event for a debugger */
433 static struct debug_event *alloc_debug_event( struct thread *thread, int code, const void *arg )
435 struct thread *debugger = thread->process->debugger;
436 struct debug_event *event;
438 assert( code > 0 && code <= NB_DEBUG_EVENTS );
439 /* cannot queue a debug event for myself */
440 assert( debugger->process != thread->process );
442 /* build the event */
443 if (!(event = alloc_object( &debug_event_ops ))) return NULL;
444 event->state = EVENT_QUEUED;
445 event->sender = (struct thread *)grab_object( thread );
446 event->debugger = (struct thread *)grab_object( debugger );
447 memset( &event->data, 0, sizeof(event->data) );
449 if (!fill_debug_event[code-1]( event, arg ))
451 event->data.code = -1; /* make sure we don't attempt to close handles */
452 release_object( event );
453 return NULL;
455 event->data.code = code;
456 return event;
459 /* generate a debug event from inside the server and queue it */
460 void generate_debug_event( struct thread *thread, int code, const void *arg )
462 if (thread->process->debugger)
464 struct debug_event *event = alloc_debug_event( thread, code, arg );
465 if (event)
467 link_event( event );
468 suspend_process( thread->process );
469 release_object( event );
471 clear_error(); /* ignore errors */
475 void resume_delayed_debug_events( struct thread *thread )
477 struct thread *debugger = thread->process->debugger;
478 struct debug_event *event;
480 if (debugger)
482 assert( debugger->debug_ctx );
483 LIST_FOR_EACH_ENTRY( event, &debugger->debug_ctx->event_queue, struct debug_event, entry )
485 if (event->sender != thread) continue;
486 if (event->state != EVENT_DELAYED) continue;
487 resume_event( event );
488 suspend_process( thread->process );
493 /* attach a process to a debugger thread and suspend it */
494 static int debugger_attach( struct process *process, struct thread *debugger )
496 if (process->debugger) goto error; /* already being debugged */
497 if (debugger->process == process) goto error;
498 if (!is_process_init_done( process )) goto error; /* still starting up */
499 if (list_empty( &process->thread_list )) goto error; /* no thread running in the process */
501 /* don't let a debugger debug its console... won't work */
502 if (debugger->process->console)
504 struct thread *renderer = console_get_renderer(debugger->process->console);
505 if (renderer && renderer->process == process)
506 goto error;
509 suspend_process( process );
510 if (!set_process_debugger( process, debugger ))
512 resume_process( process );
513 return 0;
515 if (!set_process_debug_flag( process, 1 ))
517 process->debugger = NULL;
518 resume_process( process );
519 return 0;
521 process->debug_children = 0;
522 return 1;
524 error:
525 set_error( STATUS_ACCESS_DENIED );
526 return 0;
530 /* detach a process from a debugger thread (and resume it ?) */
531 int debugger_detach( struct process *process, struct thread *debugger )
533 struct debug_event *event, *next;
534 struct debug_ctx *debug_ctx;
536 if (!process->debugger || process->debugger != debugger)
537 goto error; /* not currently debugged, or debugged by another debugger */
538 if (!debugger->debug_ctx ) goto error; /* should be a debugger */
539 /* init should be done, otherwise wouldn't be attached */
540 assert(is_process_init_done(process));
542 suspend_process( process );
543 /* send continue indication for all events */
544 debug_ctx = debugger->debug_ctx;
546 /* free all events from this process */
547 LIST_FOR_EACH_ENTRY_SAFE( event, next, &debug_ctx->event_queue, struct debug_event, entry )
549 if (event->sender->process != process) continue;
551 assert( event->state != EVENT_CONTINUED );
552 event->status = DBG_CONTINUE;
553 event->state = EVENT_CONTINUED;
554 wake_up( &event->obj, 0 );
555 unlink_event( debug_ctx, event );
556 /* from queued debug event */
557 resume_process( process );
560 /* remove relationships between process and its debugger */
561 process->debugger = NULL;
562 if (!set_process_debug_flag( process, 0 )) clear_error(); /* ignore error */
564 /* from this function */
565 resume_process( process );
566 return 0;
568 error:
569 set_error( STATUS_ACCESS_DENIED );
570 return 0;
573 /* generate all startup events of a given process */
574 void generate_startup_debug_events( struct process *process, client_ptr_t entry )
576 struct list *ptr;
577 struct thread *thread, *first_thread = get_process_first_thread( process );
579 generate_debug_event( first_thread, CREATE_PROCESS_DEBUG_EVENT, &entry );
580 ptr = list_head( &process->dlls ); /* skip main module reported in create process event */
582 /* generate ntdll.dll load event */
583 if (ptr && (ptr = list_next( &process->dlls, ptr )))
585 struct process_dll *dll = LIST_ENTRY( ptr, struct process_dll, entry );
586 generate_debug_event( first_thread, LOAD_DLL_DEBUG_EVENT, dll );
589 /* generate creation events */
590 LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
592 if (thread != first_thread)
593 generate_debug_event( thread, CREATE_THREAD_DEBUG_EVENT, NULL );
596 /* generate dll events (in loading order) */
597 while (ptr && (ptr = list_next( &process->dlls, ptr )))
599 struct process_dll *dll = LIST_ENTRY( ptr, struct process_dll, entry );
600 generate_debug_event( first_thread, LOAD_DLL_DEBUG_EVENT, dll );
604 /* set the debugger of a given process */
605 int set_process_debugger( struct process *process, struct thread *debugger )
607 struct debug_ctx *debug_ctx;
609 assert( !process->debugger );
611 if (!debugger->debug_ctx) /* need to allocate a context */
613 if (!(debug_ctx = alloc_object( &debug_ctx_ops ))) return 0;
614 debug_ctx->kill_on_exit = 1;
615 list_init( &debug_ctx->event_queue );
616 debugger->debug_ctx = debug_ctx;
618 process->debugger = debugger;
619 return 1;
622 /* a thread is exiting */
623 void debug_exit_thread( struct thread *thread )
625 if (thread->debug_ctx) /* this thread is a debugger */
627 if (thread->debug_ctx->kill_on_exit)
629 /* kill all debugged processes */
630 kill_debugged_processes( thread, STATUS_DEBUGGER_INACTIVE );
632 else
634 detach_debugged_processes( thread );
636 release_object( thread->debug_ctx );
637 thread->debug_ctx = NULL;
641 /* Wait for a debug event */
642 DECL_HANDLER(wait_debug_event)
644 struct debug_ctx *debug_ctx = current->debug_ctx;
645 struct debug_event *event;
647 if (!debug_ctx) /* current thread is not a debugger */
649 set_error( STATUS_INVALID_HANDLE );
650 return;
652 reply->wait = 0;
653 if ((event = find_event_to_send( debug_ctx )))
655 data_size_t size = get_reply_max_size();
656 event->state = EVENT_SENT;
657 event->sender->process->debug_event = event;
658 reply->pid = get_process_id( event->sender->process );
659 reply->tid = get_thread_id( event->sender );
660 if (size > sizeof(debug_event_t)) size = sizeof(debug_event_t);
661 set_reply_data( &event->data, size );
663 else /* no event ready */
665 reply->pid = 0;
666 reply->tid = 0;
667 if (req->get_handle)
668 reply->wait = alloc_handle( current->process, debug_ctx, SYNCHRONIZE, 0 );
672 /* Continue a debug event */
673 DECL_HANDLER(continue_debug_event)
675 struct process *process;
677 if (req->status != DBG_EXCEPTION_NOT_HANDLED &&
678 req->status != DBG_CONTINUE &&
679 req->status != DBG_REPLY_LATER)
681 set_error( STATUS_INVALID_PARAMETER );
682 return;
685 if ((process = get_process_from_id( req->pid )))
687 struct thread *thread = get_thread_from_id( req->tid );
688 if (thread)
690 continue_debug_event( process, thread, req->status );
691 release_object( thread );
693 release_object( process );
697 /* Start debugging an existing process */
698 DECL_HANDLER(debug_process)
700 struct process *process = get_process_from_id( req->pid );
701 if (!process) return;
703 if (!req->attach)
705 debugger_detach( process, current );
707 else if (debugger_attach( process, current ))
709 generate_startup_debug_events( process, 0 );
710 resume_process( process );
712 release_object( process );
715 /* queue an exception event */
716 DECL_HANDLER(queue_exception_event)
718 reply->handle = 0;
719 if (current->process->debugger)
721 debug_event_t data;
722 struct debug_event *event;
723 struct thread *thread = current;
725 if ((req->len % sizeof(client_ptr_t)) != 0 ||
726 req->len > get_req_data_size() ||
727 req->len > EXCEPTION_MAXIMUM_PARAMETERS * sizeof(client_ptr_t))
729 set_error( STATUS_INVALID_PARAMETER );
730 return;
732 memset( &data, 0, sizeof(data) );
733 data.exception.first = req->first;
734 data.exception.exc_code = req->code;
735 data.exception.flags = req->flags;
736 data.exception.record = req->record;
737 data.exception.address = req->address;
738 data.exception.nb_params = req->len / sizeof(client_ptr_t);
739 memcpy( data.exception.params, get_req_data(), req->len );
741 if ((event = alloc_debug_event( thread, EXCEPTION_DEBUG_EVENT, &data )))
743 if ((reply->handle = alloc_handle( thread->process, event, SYNCHRONIZE, 0 )))
745 link_event( event );
746 suspend_process( thread->process );
748 release_object( event );
753 /* retrieve the status of an exception event */
754 DECL_HANDLER(get_exception_status)
756 struct debug_event *event;
758 if ((event = (struct debug_event *)get_handle_obj( current->process, req->handle,
759 0, &debug_event_ops )))
761 close_handle( current->process, req->handle );
762 set_error( event->state == EVENT_CONTINUED ? event->status : STATUS_PENDING );
763 release_object( event );
767 /* set debugger kill on exit flag */
768 DECL_HANDLER(set_debugger_kill_on_exit)
770 if (!current->debug_ctx)
772 set_error( STATUS_ACCESS_DENIED );
773 return;
775 current->debug_ctx->kill_on_exit = req->kill_on_exit;