From e7ec00d22cfcaedbccad499f503c50efc8125117 Mon Sep 17 00:00:00 2001 From: Bernhard Loos Date: Sun, 9 Oct 2011 23:26:03 +0200 Subject: [PATCH] server: If a debugger is attached to a process, child processes shouldn't get debugged. --- server/debugger.c | 1 + server/process.c | 6 +++--- server/process.h | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/debugger.c b/server/debugger.c index 35cb3e3f0f3..5c0e2c87a7a 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -485,6 +485,7 @@ int debugger_detach( struct process *process, struct thread *debugger ) /* remove relationships between process and its debugger */ process->debugger = NULL; + process->debug_children = 0; if (!set_process_debug_flag( process, 0 )) clear_error(); /* ignore error */ /* from this function */ diff --git a/server/process.c b/server/process.c index c88c89bdf2c..de3b594d7c7 100644 --- a/server/process.c +++ b/server/process.c @@ -322,7 +322,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit process->priority = PROCESS_PRIOCLASS_NORMAL; process->suspend = 0; process->is_system = 0; - process->create_flags = 0; + process->debug_children = 0; process->console = NULL; process->startup_state = STARTUP_IN_PROGRESS; process->startup_info = NULL; @@ -937,7 +937,7 @@ DECL_HANDLER(new_process) if (!(thread = create_process( socket_fd, current, req->inherit_all ))) goto done; process = thread->process; - process->create_flags = req->create_flags; + process->debug_children = !(req->create_flags & DEBUG_ONLY_THIS_PROCESS); process->startup_info = (struct startup_info *)grab_object( info ); /* connect to the window station */ @@ -972,7 +972,7 @@ DECL_HANDLER(new_process) /* attach to the debugger if requested */ if (req->create_flags & (DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS)) set_process_debugger( process, current ); - else if (parent->debugger && !(parent->create_flags & DEBUG_ONLY_THIS_PROCESS)) + else if (parent->debugger && parent->debug_children) set_process_debugger( process, parent->debugger ); if (!(req->create_flags & CREATE_NEW_PROCESS_GROUP)) diff --git a/server/process.h b/server/process.h index da51a0ee4b4..93ec6c7d5a0 100644 --- a/server/process.h +++ b/server/process.h @@ -66,8 +66,8 @@ struct process affinity_t affinity; /* process affinity mask */ int priority; /* priority class */ int suspend; /* global process suspend count */ - int is_system; /* is it a system process? */ - unsigned int create_flags; /* process creation flags */ + unsigned int is_system:1; /* is it a system process? */ + unsigned int debug_children:1;/* also debug all child processes */ struct list locks; /* list of file locks owned by the process */ struct list classes; /* window classes owned by the process */ struct console_input*console; /* console input */