aboutsummaryrefslogtreecommitdiff
path: root/gdb/win32-nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/win32-nat.c')
-rw-r--r--gdb/win32-nat.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index 03b2f52..cd4d533 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -1550,6 +1550,12 @@ do_initial_win32_stuff (DWORD pid, int attaching)
inf = add_inferior (pid);
inf->attach_flag = attaching;
+ /* Make the new process the current inferior, so terminal handling
+ can rely on it. When attaching, we don't know about any thread
+ id here, but that's OK --- nothing should be referencing the
+ current thread until we report an event out of win32_wait. */
+ inferior_ptid = pid_to_ptid (pid);
+
terminal_init_inferior_with_pgrp (pid);
target_terminal_inferior ();