From 16d905e2bea111256aa322e7e76fa647d05dfd1f Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 27 Jan 2010 19:57:54 +0000 Subject: [PATCH] * windows-nat.c (windows_initialization_done): New variable. (get_windows_debug_event): Issue error when process dies before completely initializing. (do_initial_windows_stuff): Set flag to indicate when we are done with the initial steps of attaching to the child. --- gdb/ChangeLog | 8 ++++++++ gdb/windows-nat.c | 22 +++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cbfe494881..0c6d99f54e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2010-01-27 Christopher Faylor + + * windows-nat.c (windows_initialization_done): New variable. + (get_windows_debug_event): Issue error when process dies before + completely initializing. + (do_initial_windows_stuff): Set flag to indicate when we are done with + the initial steps of attaching to the child. + 2010-01-27 Jan Kratochvil * symtab.h (struct symbol ): New comment on NULL values. diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index f91ca32270..2740366a8b 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -123,6 +123,8 @@ enum static uintptr_t dr[8]; static int debug_registers_changed; static int debug_registers_used; + +static int windows_initialization_done; #define DR6_CLEAR_VALUE 0xffff0ff0 /* The string sent by cygwin when it processes a signal. @@ -1399,11 +1401,19 @@ get_windows_debug_event (struct target_ops *ops, (unsigned) current_event.dwProcessId, (unsigned) current_event.dwThreadId, "EXIT_PROCESS_DEBUG_EVENT")); - if (saw_create != 1) - break; - ourstatus->kind = TARGET_WAITKIND_EXITED; - ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode; - retval = main_thread_id; + if (!windows_initialization_done) + { + target_terminal_ours (); + target_mourn_inferior (); + error (_("During startup program exited with code 0x%x."), + (unsigned int) current_event.u.ExitProcess.dwExitCode); + } + else if (saw_create == 1) + { + ourstatus->kind = TARGET_WAITKIND_EXITED; + ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode; + retval = main_thread_id; + } break; case LOAD_DLL_DEBUG_EVENT: @@ -1598,6 +1608,7 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching) terminal_init_inferior_with_pgrp (pid); target_terminal_inferior (); + windows_initialization_done = 0; inf->stop_soon = STOP_QUIETLY; while (1) { @@ -1610,6 +1621,7 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching) break; } + windows_initialization_done = 1; inf->stop_soon = NO_STOP_QUIETLY; stop_after_trap = 0; return; -- 2.34.1