2 * Console output in Windows seems to be protected via semaphores. SuspendThread() at the moment
3 * of writing something to console leaves it in locked state. Attempt to write something to it from
4 * timer interrupt thread leads to a deadlock. So we have to do this.
7 /* Be careful again - with this i was able to debug scheduler, but often this causes lockups. Looks like console
8 doesn't like concurrent output from several threads in some conditions (too fast maybe?)
15 static inline void bug(char *format, ...)
20 va_start(args, format);
21 vsnprintf(buf, sizeof(buf), format, args);
22 OutputDebugString(buf);
27 static inline void PrintCPUContext(CONTEXT
*ctx
)
29 bug("ContextFlags=0x%08lX\n", ctx
->ContextFlags
);
30 bug("ESP=%08lx EFP=%08lx EIP =%08lx\n", ctx
->Esp
, ctx
->Ebp
, ctx
->Eip
);
31 bug("EAX=%08lx EBX=%08lx ECX =%08lx EDX=%08lx\n", ctx
->Eax
, ctx
->Ebx
, ctx
->Ecx
, ctx
->Edx
);
32 bug("EDI=%08lx ESI=%08lx EFLAGS=%08lx\n", ctx
->Edi
, ctx
->Esi
, ctx
->EFlags
);