winedbg: Support for debugging child processes.
Added internal flag (AlsoDebugProcChild) to let winedbg debug both parent and child (in the same WineDbg session).
This commit is contained in:
parent
6cf2734574
commit
b795f8735d
|
@ -95,7 +95,7 @@ STRING \"[^\n"]+\"
|
||||||
%x NOPROCESS
|
%x NOPROCESS
|
||||||
%%
|
%%
|
||||||
/* set to special state when no process is loaded. */
|
/* 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; }
|
<<EOF>> { return tEOF; }
|
||||||
<*>\n { BEGIN(INITIAL); syntax_error = 0; return tEOL; }
|
<*>\n { BEGIN(INITIAL); syntax_error = 0; return tEOL; }
|
||||||
|
|
|
@ -421,6 +421,7 @@ extern int dbg_printf(const char* format, ...);
|
||||||
#endif
|
#endif
|
||||||
extern const struct dbg_internal_var* dbg_get_internal_var(const char*);
|
extern const struct dbg_internal_var* dbg_get_internal_var(const char*);
|
||||||
extern BOOL dbg_interrupt_debuggee(void);
|
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 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 void dbg_set_process_name(struct dbg_process* p, const char* name);
|
||||||
extern struct dbg_process* dbg_get_process(DWORD pid);
|
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 */
|
/* symbol manipulation */
|
||||||
INTERNAL_VAR(AlwaysShowThunks, FALSE, NULL, dbg_itype_unsigned_int)
|
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;
|
DEBUG_EVENT de;
|
||||||
|
|
||||||
while (dbg_curr_process && WaitForDebugEvent(&de, INFINITE))
|
while (dbg_num_processes() && WaitForDebugEvent(&de, INFINITE))
|
||||||
{
|
{
|
||||||
if (dbg_handle_debug_event(&de)) break;
|
if (dbg_handle_debug_event(&de)) break;
|
||||||
}
|
}
|
||||||
|
@ -704,6 +704,7 @@ static unsigned dbg_start_debuggee(LPSTR cmdLine)
|
||||||
{
|
{
|
||||||
PROCESS_INFORMATION info;
|
PROCESS_INFORMATION info;
|
||||||
STARTUPINFOA startup;
|
STARTUPINFOA startup;
|
||||||
|
DWORD flags;
|
||||||
|
|
||||||
memset(&startup, 0, sizeof(startup));
|
memset(&startup, 0, sizeof(startup));
|
||||||
startup.cb = 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
|
/* FIXME: shouldn't need the CREATE_NEW_CONSOLE, but as usual CUI:s need it
|
||||||
* while GUI:s don't
|
* while GUI:s don't
|
||||||
*/
|
*/
|
||||||
if (!CreateProcess(NULL, cmdLine, NULL, NULL,
|
flags = DEBUG_PROCESS | CREATE_NEW_CONSOLE;
|
||||||
FALSE,
|
if (!DBG_IVAR(AlsoDebugProcChild)) flags |= DEBUG_ONLY_THIS_PROCESS;
|
||||||
DEBUG_PROCESS|DEBUG_ONLY_THIS_PROCESS|CREATE_NEW_CONSOLE,
|
|
||||||
|
if (!CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, flags,
|
||||||
NULL, NULL, &startup, &info))
|
NULL, NULL, &startup, &info))
|
||||||
{
|
{
|
||||||
dbg_printf("Couldn't start process '%s'\n", cmdLine);
|
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;
|
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* dbg_get_process(DWORD pid)
|
||||||
{
|
{
|
||||||
struct dbg_process* p;
|
struct dbg_process* p;
|
||||||
|
|
Loading…
Reference in New Issue