{G|S}etThreadContext question

Rein Klazes rklazes at xs4all.nl
Tue Feb 4 13:09:21 CST 2003


On Mon, 03 Feb 2003 21:45:29 +0100, you wrote:

> 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

Aha, and trying to do this ptrace call in case 1 (like in my patch) does
not return the correct 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)

OK, I will have a look there. 

> note than on i386, the floating regs in exception are only present for 
> floating point ops

I hope that doesn't prevent me form single stepping through FP code,
while displaying some of the registers.

Thanks for the explanation!

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl



More information about the wine-devel mailing list