#include "objfiles.h"
#include "gdb_obstack.h"
#include "gdb_string.h"
-#include "gdb_stdint.h"
#include "gdbthread.h"
#include "gdbcmd.h"
#include <sys/param.h>
do_win32_fetch_inferior_registers (struct regcache *regcache, int r)
{
char *context_offset = ((char *) ¤t_thread->context) + mappings[r];
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
long l;
if (!current_thread)
current_thread->reload_context = 0;
}
-#define I387_ST0_REGNUM I386_ST0_REGNUM
-
- if (r == I387_FISEG_REGNUM)
+ if (r == I387_FISEG_REGNUM (tdep))
{
l = *((long *) context_offset) & 0xffff;
regcache_raw_supply (regcache, r, (char *) &l);
}
- else if (r == I387_FOP_REGNUM)
+ else if (r == I387_FOP_REGNUM (tdep))
{
l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1);
regcache_raw_supply (regcache, r, (char *) &l);
regcache_raw_supply (regcache, r, context_offset);
else
{
- for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++)
+ for (r = 0; r < gdbarch_num_regs (gdbarch); r++)
do_win32_fetch_inferior_registers (regcache, r);
}
-
-#undef I387_ST0_REGNUM
}
static void
safe_symbol_file_add_stub (void *argv)
{
#define p ((struct safe_symbol_file_add_args *) argv)
- struct so_list *so = &solib_start;
-
p->ret = symbol_file_add (p->name, p->from_tty, p->addrs, p->mainline, p->flags);
return !!p->ret;
#undef p
solib_end->next = win32_make_so (dll_name, (DWORD) event->lpBaseOfDll);
solib_end = solib_end->next;
+ DEBUG_EVENTS (("gdb: Loading dll \"%s\" at 0x%lx.\n", solib_end->so_name,
+ (DWORD) solib_end->lm_info->load_addr));
+
return 1;
}
so->next = sodel->next;
if (!so->next)
solib_end = so;
+ DEBUG_EVENTS (("gdb: Unloading dll \"%s\".\n", sodel->so_name));
+
win32_free_so (sodel);
solib_add (NULL, 0, NULL, auto_solib_add);
return 1;
while (1)
{
- int retval = get_win32_debug_event (pid, ourstatus);
+ int retval;
+
+ /* Ignore CTRL+C signals while waiting for a debug event.
+ FIXME: brobecker/2008-05-20: When the user presses CTRL+C while
+ the inferior is running, both the inferior and GDB receive the
+ associated signal. If the inferior receives the signal first
+ and the delay until GDB receives that signal is sufficiently long,
+ GDB can sometimes receive the SIGINT after we have unblocked
+ the CTRL+C handler. This would lead to the debugger to stop
+ prematurely while handling the new-thread event that comes
+ with the handling of the SIGINT inside the inferior, and then
+ stop again immediately when the user tries to resume the execution
+ in the inferior. This is a classic race, and it would be nice
+ to find a better solution to that problem. But in the meantime,
+ the current approach already greatly mitigate this issue. */
+ SetConsoleCtrlHandler (NULL, TRUE);
+ retval = get_win32_debug_event (pid, ourstatus);
+ SetConsoleCtrlHandler (NULL, FALSE);
+
if (retval)
return pid_to_ptid (retval);
else
terminal_init_inferior_with_pgrp (pid);
target_terminal_inferior ();
+ stop_soon = STOP_QUIETLY;
while (1)
{
stop_after_trap = 1;
- wait_for_inferior ();
+ wait_for_inferior (0);
if (stop_signal != TARGET_SIGNAL_TRAP)
resume (0, stop_signal);
else
break;
}
+
+ stop_soon = NO_STOP_QUIETLY;
stop_after_trap = 0;
return;
}
if ((DWORD) pid == current_event.dwProcessId)
sprintf (buf, "process %d", pid);
else
- sprintf (buf, "thread %ld.0x%x", current_event.dwProcessId, pid);
+ sprintf (buf, "Thread %ld.0x%x", current_event.dwProcessId, pid);
return buf;
}
case TARGET_OBJECT_MEMORY:
if (readbuf)
return (*ops->deprecated_xfer_memory) (offset, readbuf,
- len, 0/*write*/, NULL, ops);
+ len, 0/*read*/, NULL, ops);
if (writebuf)
return (*ops->deprecated_xfer_memory) (offset, (gdb_byte *) writebuf,
len, 1/*write*/, NULL, ops);
win32_ops.to_open = win32_open;
win32_ops.to_close = win32_close;
win32_ops.to_attach = win32_attach;
+ win32_ops.to_attach_no_wait = 1;
win32_ops.to_detach = win32_detach;
win32_ops.to_resume = win32_resume;
win32_ops.to_wait = win32_wait;