Rein Klazes wrote:
hi,

I am trying to add some support for the floating point unit to winedbg.
I have one question to the experts. The debugger code gets/sets the CPU
registers through a {G|S}etThreadContext() from the server, adding the
flag CONTEXT_FLOATING_POINT should make sure to include the FP
registers. This doesn't work because the server code clears the
CONTEXT_FLOATING_POINT flag at some point (see attached patch). My patch
is simply preventing this, but it may well be that the FP registers
should be available at this point.

So is this the correct fix?
this won't work in all cases: when (g|s)etting the registers for a thread, two cases exist:
1/ either the thread is currently caught in an exception
2/ or the thread is not

the get/set is done, in case 1/, but just copying the CONTEXT that the exception handler sent to the server
in case 2, we use the existing unix API (ptrace or equivalent) to get the CONTEXT

what's not working with your patch is that in the case 1/ only a partial context is copied and it doesn't contain the floating point regs

and most of the operations in the debugger (when displaying the context of thread) are of type 1/, not 2/

one of the fix would be to store the FPU registers for each exception, but that may be time consuming (and restoring as well)
(see dlls/ntdll/signal_i386.c)
note than on i386, the floating regs in exception are only present for floating point ops

A+
--
Eric Pouech




Reply via email to