Commit e2c081a8 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntdll: Trace the name of critical sections which are released while not acquired.

parent c2bff6b6
...@@ -155,6 +155,13 @@ static BOOL crit_section_has_debuginfo( const RTL_CRITICAL_SECTION *crit ) ...@@ -155,6 +155,13 @@ static BOOL crit_section_has_debuginfo( const RTL_CRITICAL_SECTION *crit )
return crit->DebugInfo != NULL && crit->DebugInfo != no_debug_info_marker; return crit->DebugInfo != NULL && crit->DebugInfo != no_debug_info_marker;
} }
static const char *crit_section_get_name( const RTL_CRITICAL_SECTION *crit )
{
if (crit_section_has_debuginfo( crit ))
return (char *)crit->DebugInfo->Spare[0];
return "?";
}
static inline HANDLE get_semaphore( RTL_CRITICAL_SECTION *crit ) static inline HANDLE get_semaphore( RTL_CRITICAL_SECTION *crit )
{ {
HANDLE ret = crit->LockSemaphore; HANDLE ret = crit->LockSemaphore;
...@@ -311,9 +318,8 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit ) ...@@ -311,9 +318,8 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
if ( status == STATUS_TIMEOUT ) if ( status == STATUS_TIMEOUT )
{ {
const char *name = NULL; const char *name = crit_section_get_name( crit );
if (crit_section_has_debuginfo( crit )) name = (char *)crit->DebugInfo->Spare[0];
if (!name) name = "?";
ERR( "section %p %s wait timed out in thread %04lx, blocked by %04lx, retrying (60 sec)\n", ERR( "section %p %s wait timed out in thread %04lx, blocked by %04lx, retrying (60 sec)\n",
crit, debugstr_a(name), GetCurrentThreadId(), HandleToULong(crit->OwningThread) ); crit, debugstr_a(name), GetCurrentThreadId(), HandleToULong(crit->OwningThread) );
status = wait_semaphore( crit, 60 ); status = wait_semaphore( crit, 60 );
...@@ -461,7 +467,7 @@ NTSTATUS WINAPI RtlLeaveCriticalSection( RTL_CRITICAL_SECTION *crit ) ...@@ -461,7 +467,7 @@ NTSTATUS WINAPI RtlLeaveCriticalSection( RTL_CRITICAL_SECTION *crit )
if (--crit->RecursionCount) if (--crit->RecursionCount)
{ {
if (crit->RecursionCount > 0) InterlockedDecrement( &crit->LockCount ); if (crit->RecursionCount > 0) InterlockedDecrement( &crit->LockCount );
else ERR( "section %p is not acquired\n", crit ); else ERR( "section %p %s is not acquired\n", crit, debugstr_a( crit_section_get_name( crit )));
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment