[gdbserver/wince] (7/11) Make the new interrupt method actually always work in WinCE

Pedro Alves pedro_alves@portugalmail.pt
Mon Dec 3 03:54:00 GMT 2007

Daniel Jacobowitz wrote:
> On Mon, Nov 12, 2007 at 02:08:03AM +0000, Pedro Alves wrote:
>> So, what this patch does, is implement the same workaround MSFT's
>> debugger uses.  Don't set the context back to the inferior, unless
>> it has been explicitly changed by gdb or gdbserver.  Actually, it
>> is a little bit better, as it won't crash if the user sets some
>> register's contents back to what it was when the inferior stopped.
> This is all really nasty.  Does this mean the register values we
> report to GDB may actually change before the process stops?

Yes, unfortunatelly, but only on threads that are performing a
syscall.  I still haven't found a way around it, and the fact
that MSFT's debugger has the same behaviour makes me
believe there isn't one.
The values we pass to gdb aren't that random.  The
registers seem to hold the values needed for a syscall, and
are quite similar to what I see when I pause a process
with MSFT's debugger.
A syscall in WinCE ( < 6 at least ) is implemented by
having the kernel sets things up for the thread to
continue execution on a server process, outside kernel
mode.  I suspect that a SuspendThread will only have
effect when the thread is running on the original process.
If it is running on the server process, it will not stop
until the kernel switches it back into the original process.

>> 2007-11-12  Pedro Alves  <pedro_alves@portugalmail.pt>
>> 	* win32-low.c (win32_get_thread_context)
>> 	(win32_set_thread_context): New.
>> 	(thread_rec): Use win32_get_thread_context.
>> 	(continue_one_thread, win32_resume): Use win32_set_thread_context.
>> 	* win32-low.h (win32_thread_info) [_WIN32_WCE]: Add `base_context'
>> 	field.
> OK, I suppose.

Thanks, checked in.

Pedro Alves

More information about the Gdb-patches mailing list