Windbg itself hangs waiting for semaphore
(too old to reply)
David Sanders
2010-01-04 17:50:01 UTC
Raw Message
I'm using the IFEO\Debugger registry key to debug the startup of a process.
That process produces an access violation, which causes windbg to stop and
report the AV. However, the windbg UI hangs indefinitely. I attach another
windbg process to the first to debug the hung windbg. There are three threads
in the hung windbg:

0:002> ~*kb

0 Id: 99c.608 Suspend: 1 Teb: 7ffdf000 Unfrozen
ChildEBP RetAddr Args to Child
0006df30 7e419418 010549c5 00000001 0078c6d0 ntdll!KiFastSystemCallRet
0006ff7c 010581c6 00000004 00784ed8 00786fd8 USER32!NtUserWaitMessage+0xc
0006ffc0 7c817077 000dd320 00acf0cc 7ffd6000 windbg!_initterm_e+0x163
0006fff0 00000000 010582f7 00000000 78746341 kernel32!BaseProcessStart+0x23

1 Id: 99c.b1c Suspend: 1 Teb: 7ffde000 Unfrozen
ChildEBP RetAddr Args to Child
0090ff14 7c90df5a 7c8025db 00000084 00000001 ntdll!KiFastSystemCallRet
0090ff18 7c8025db 00000084 00000001 00000000 ntdll!ZwWaitForSingleObject+0xc
0090ff7c 020f4a9a 00000084 ffffffff 00000001
0090ff9c 0102b3fd 00788cdc ffffffff 806e6ef2
0090ffb4 7c80b729 00000000 0106e798 00ffffff windbg!EngineLoop+0x30d
0090ffec 00000000 0102b0f0 00000000 00000000 kernel32!BaseThreadStart+0x37

# 2 Id: 99c.b08 Suspend: 1 Teb: 7ffdd000 Unfrozen
ChildEBP RetAddr Args to Child
00e4ffc8 7c951e40 00000005 00000004 00000001 ntdll!DbgBreakPoint
00e4fff4 00000000 00000000 00000000 00000000 ntdll!DbgUiRemoteBreakin+0x2d

Note that thread 1 with ID of b1c is waiting on handle 84:

0:002> !handle 84 f
Handle 84
Type Semaphore
Attributes 0
GrantedAccess 0x1f0003:
HandleCount 2
PointerCount 4
Name <none>
Object Specific Information
Semaphore Count 0
Semaphore Limit 2147483647

I have a minidump of the hung windbg process if that helps. Is my analysis
correct that windbg is waiting on that handle? Does anyone know what this
sempaphore corresponds to? I am able to work around the problem if I start
windbg from windbg and use that debugger to debug the process I'm really
interested in. It seems like a race condition in windbg.

I'm using WinDbg 6.11.0001.404 X86 on Windows XP SP3.

2013-06-07 06:16:36 UTC
Raw Message
look at http://www.codeproject.com/Articles/7919/Debug-Tutorial-Part-7-Locks-and-Synchronization-Ob

you might find some more help