diff options
author | Pedro Alves <palves@redhat.com> | 2009-07-04 18:13:28 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2009-07-04 18:13:28 +0000 |
commit | 912cf4ba32021ba75d11c496e9ffd17bbb15bc64 (patch) | |
tree | ed2725b4c7d136096eeca96b791ab0dcb2a79f7d /gdb/gdbserver/win32-i386-low.c | |
parent | dd8f35ac84e9ae2bcd5bc75004b7e5312805843a (diff) | |
download | gdb-912cf4ba32021ba75d11c496e9ffd17bbb15bc64.zip gdb-912cf4ba32021ba75d11c496e9ffd17bbb15bc64.tar.gz gdb-912cf4ba32021ba75d11c496e9ffd17bbb15bc64.tar.bz2 |
* win32-i386-low.c (i386_get_thread_context): Handle systems that
don't support CONTEXT_EXTENDED_REGISTERS.
(i386_win32_breakpoint, i386_win32_breakpoint_len): New.
(the_low_target): Install them.
* win32-low.c (get_child_debug_event): Handle WaitForDebugEvent
failing with ERROR_PIPE_NOT_CONNECTED.
Diffstat (limited to 'gdb/gdbserver/win32-i386-low.c')
-rw-r--r-- | gdb/gdbserver/win32-i386-low.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/gdb/gdbserver/win32-i386-low.c b/gdb/gdbserver/win32-i386-low.c index 7e058a5..b610631 100644 --- a/gdb/gdbserver/win32-i386-low.c +++ b/gdb/gdbserver/win32-i386-low.c @@ -129,13 +129,28 @@ i386_initial_stuff (void) static void i386_get_thread_context (win32_thread_info *th, DEBUG_EVENT* current_event) { - th->context.ContextFlags = \ - CONTEXT_FULL | \ - CONTEXT_FLOATING_POINT | \ - CONTEXT_EXTENDED_REGISTERS | \ - CONTEXT_DEBUG_REGISTERS; + /* Requesting the CONTEXT_EXTENDED_REGISTERS register set fails if + the system doesn't support extended registers. */ + static DWORD extended_registers = CONTEXT_EXTENDED_REGISTERS; - GetThreadContext (th->h, &th->context); + again: + th->context.ContextFlags = (CONTEXT_FULL + | CONTEXT_FLOATING_POINT + | CONTEXT_DEBUG_REGISTERS + | extended_registers); + + if (!GetThreadContext (th->h, &th->context)) + { + DWORD e = GetLastError (); + + if (extended_registers && e == ERROR_INVALID_PARAMETER) + { + extended_registers = 0; + goto again; + } + + error ("GetThreadContext failure %ld\n", (long) e); + } debug_registers_changed = 0; @@ -283,6 +298,9 @@ i386_store_inferior_register (win32_thread_info *th, int r) collect_register (r, context_offset); } +static const unsigned char i386_win32_breakpoint = 0xcc; +#define i386_win32_breakpoint_len 1 + struct win32_target_ops the_low_target = { init_registers_i386, sizeof (mappings) / sizeof (mappings[0]), @@ -293,8 +311,8 @@ struct win32_target_ops the_low_target = { i386_fetch_inferior_register, i386_store_inferior_register, i386_single_step, - NULL, /* breakpoint */ - 0, /* breakpoint_len */ + &i386_win32_breakpoint, + i386_win32_breakpoint_len, i386_insert_point, i386_remove_point, i386_stopped_by_watchpoint, |