Hack: Debug a specific critical section WINE_DEBUG_SPINLOCK

Maarten Lankhorst m.b.lankhorst at gmail.com
Fri Apr 18 16:37:28 CDT 2008


Hi all,

I created a hack to debug a specific critical section with
WINE_DEBUG_SPINLOCK environment. It was useful for me because it found
a very weird deadlock, a thread would terminate before releasing its
critical section. It will also change the timeout to 1 second so you
will get a faster response on potential latency issues.

How to use it?

First you need the exact spinlock name.

for example in parser.c:

    pParser->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ":
ParserImpl.csFilter");

Of course you still need to know what __FILE__ is, this is usually
parser.c but I'm not 100% sure that is the same for out of tree
builds.

So just to be sure:
$ strings parser.o |grep csFilter
parser.c: ParserImpl.csFilter

export WINE_DEBUG_SPINLOCK="parser.c: ParserImpl.csFilter"

It will then print a ++ for every time a lock is entered, and -- for
every time lock is left., I would recommend mixing this with
WINEDEBUG=+tid so you can also see the threads they are in.

Comments?

Cheers,
Maarten.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0013-ntdll-Add-reading-WINE_DEBUG_SPINLOCK-variable.txt
Url: http://www.winehq.org/pipermail/wine-devel/attachments/20080418/56e157b8/attachment.txt 


More information about the wine-devel mailing list