/* Target-vector operations for controlling win32 child processes, for GDB.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006
- Free Software Foundation, Inc.
+ 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Cygnus Solutions, A Red Hat Company.
}
static void
-do_win32_fetch_inferior_registers (int r)
+do_win32_fetch_inferior_registers (struct regcache *regcache, int r)
{
char *context_offset = ((char *) ¤t_thread->context) + mappings[r];
long l;
if (r == I387_FISEG_REGNUM)
{
l = *((long *) context_offset) & 0xffff;
- regcache_raw_supply (current_regcache, r, (char *) &l);
+ regcache_raw_supply (regcache, r, (char *) &l);
}
else if (r == I387_FOP_REGNUM)
{
l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1);
- regcache_raw_supply (current_regcache, r, (char *) &l);
+ regcache_raw_supply (regcache, r, (char *) &l);
}
else if (r >= 0)
- regcache_raw_supply (current_regcache, r, context_offset);
+ regcache_raw_supply (regcache, r, context_offset);
else
{
- for (r = 0; r < NUM_REGS; r++)
- do_win32_fetch_inferior_registers (r);
+ for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++)
+ do_win32_fetch_inferior_registers (regcache, r);
}
#undef I387_ST0_REGNUM
}
static void
-win32_fetch_inferior_registers (int r)
+win32_fetch_inferior_registers (struct regcache *regcache, int r)
{
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent
thread id in its events */
if (current_thread)
- do_win32_fetch_inferior_registers (r);
+ do_win32_fetch_inferior_registers (regcache, r);
}
static void
-do_win32_store_inferior_registers (int r)
+do_win32_store_inferior_registers (const struct regcache *regcache, int r)
{
if (!current_thread)
/* Windows sometimes uses a non-existent thread id in its events */;
else if (r >= 0)
- regcache_raw_collect (current_regcache, r,
+ regcache_raw_collect (regcache, r,
((char *) ¤t_thread->context) + mappings[r]);
else
{
- for (r = 0; r < NUM_REGS; r++)
- do_win32_store_inferior_registers (r);
+ for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++)
+ do_win32_store_inferior_registers (regcache, r);
}
}
/* Store a new register value into the current thread context */
static void
-win32_store_inferior_registers (int r)
+win32_store_inferior_registers (struct regcache *regcache, int r)
{
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent
thread id in its events */
if (current_thread)
- do_win32_store_inferior_registers (r);
+ do_win32_store_inferior_registers (regcache, r);
}
static int psapi_loaded = 0;
if (step)
{
/* Single step by setting t bit */
- win32_fetch_inferior_registers (PS_REGNUM);
+ win32_fetch_inferior_registers (current_regcache, PS_REGNUM);
th->context.EFlags |= FLAG_TRACE_BIT;
}
{
int pid = PIDGET (ptid);
+ target_terminal_ours ();
+
/* We loop when we get a non-standard exception rather than return
with a SPURIOUS because resume can try and step or modify things,
which needs a current_thread->h. But some of these exceptions mark
clear_proceed_status ();
init_wait_for_inferior ();
- target_terminal_init ();
+ terminal_init_inferior_with_pgrp (pid);
target_terminal_inferior ();
while (1)
if (has_detach_ability ())
{
- delete_command (NULL, 0);
- win32_continue (DBG_CONTINUE, -1);
+ ptid_t ptid = {-1};
+ win32_resume (ptid, 0, TARGET_SIGNAL_0);
+
if (!DebugActiveProcessStop (current_event.dwProcessId))
{
error (_("Can't detach process %lu (error %lu)"),
}
static void
-win32_prepare_to_store (void)
+win32_prepare_to_store (struct regcache *regcache)
{
/* Do nothing, since we can store individual regs */
}
}
static void
-fetch_elf_core_registers (char *core_reg_sect,
+fetch_elf_core_registers (struct regcache *regcache,
+ char *core_reg_sect,
unsigned core_reg_size,
int which,
CORE_ADDR reg_addr)
error (_("Core file register section too small (%u bytes)."), core_reg_size);
return;
}
- for (r = 0; r < NUM_REGS; r++)
- regcache_raw_supply (current_regcache, r, core_reg_sect + mappings[r]);
+ for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++)
+ regcache_raw_supply (regcache, r, core_reg_sect + mappings[r]);
}
static int