Commit b795f873 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Support for debugging child processes.

Added internal flag (AlsoDebugProcChild) to let winedbg debug both parent and child (in the same WineDbg session).
parent 6cf27345
......@@ -95,7 +95,7 @@ STRING \"[^\n"]+\"
%x NOPROCESS
%%
/* set to special state when no process is loaded. */
if (!dbg_curr_process && YYSTATE == INITIAL) {BEGIN(NOPROCESS);}
if (!dbg_num_processes() && YYSTATE == INITIAL) {BEGIN(NOPROCESS);}
<<EOF>> { return tEOF; }
<*>\n { BEGIN(INITIAL); syntax_error = 0; return tEOL; }
......
......@@ -421,6 +421,7 @@ extern int dbg_printf(const char* format, ...);
#endif
extern const struct dbg_internal_var* dbg_get_internal_var(const char*);
extern BOOL dbg_interrupt_debuggee(void);
extern unsigned dbg_num_processes(void);
extern struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid, HANDLE h);
extern void dbg_set_process_name(struct dbg_process* p, const char* name);
extern struct dbg_process* dbg_get_process(DWORD pid);
......
......@@ -33,3 +33,6 @@ INTERNAL_VAR(ProcessId, FALSE, &dbg_curr_pid, dbg_itype_unsigned_int)
/* symbol manipulation */
INTERNAL_VAR(AlwaysShowThunks, FALSE, NULL, dbg_itype_unsigned_int)
/* process manipulation */
INTERNAL_VAR(AlsoDebugProcChild, FALSE, NULL, dbg_itype_unsigned_int)
......@@ -664,7 +664,7 @@ static void wait_exception(void)
{
DEBUG_EVENT de;
while (dbg_curr_process && WaitForDebugEvent(&de, INFINITE))
while (dbg_num_processes() && WaitForDebugEvent(&de, INFINITE))
{
if (dbg_handle_debug_event(&de)) break;
}
......@@ -704,6 +704,7 @@ static unsigned dbg_start_debuggee(LPSTR cmdLine)
{
PROCESS_INFORMATION info;
STARTUPINFOA startup;
DWORD flags;
memset(&startup, 0, sizeof(startup));
startup.cb = sizeof(startup);
......@@ -713,9 +714,10 @@ static unsigned dbg_start_debuggee(LPSTR cmdLine)
/* FIXME: shouldn't need the CREATE_NEW_CONSOLE, but as usual CUI:s need it
* while GUI:s don't
*/
if (!CreateProcess(NULL, cmdLine, NULL, NULL,
FALSE,
DEBUG_PROCESS|DEBUG_ONLY_THIS_PROCESS|CREATE_NEW_CONSOLE,
flags = DEBUG_PROCESS | CREATE_NEW_CONSOLE;
if (!DBG_IVAR(AlsoDebugProcChild)) flags |= DEBUG_ONLY_THIS_PROCESS;
if (!CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, flags,
NULL, NULL, &startup, &info))
{
dbg_printf("Couldn't start process '%s'\n", cmdLine);
......
......@@ -242,6 +242,16 @@ const struct dbg_internal_var* dbg_get_internal_var(const char* name)
return NULL;
}
unsigned dbg_num_processes(void)
{
struct dbg_process* p;
unsigned num = 0;
for (p = dbg_process_list; p; p = p->next)
num++;
return num;
}
struct dbg_process* dbg_get_process(DWORD pid)
{
struct dbg_process* p;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment