Changeset 2078


Ignore:
Timestamp:
Jun 26, 2005, 5:47:36 AM (20 years ago)
Author:
bird
Message:

More details on failure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/process/fmutex.c

    • Property cvs2svn:cvs-rev changed from 1.11 to 1.12
    r2077 r2078  
    308308}
    309309
     310static void __fmutex_deadlock_hex(unsigned u, unsigned cDigits)
     311{
     312    static const char szHex[17] = "0123456789abcdef";
     313    ULONG cb;
     314    char sz[32];
     315    if (u <= 0xf && cDigits <= 1)
     316    {
     317        sz[0] = szHex[u & 0xf];
     318        sz[1] = '\0';
     319        cb = 1;
     320    }
     321    if (u <= 0xff && cDigits <= 2)
     322    {
     323        sz[0] = szHex[u >> 4];
     324        sz[1] = szHex[u & 0xf];
     325        sz[2] = '\0';
     326        cb = 2;
     327    }
     328    else if (u <= 0xffff && cDigits <= 4)
     329    {
     330        sz[0] = szHex[u >> 12];
     331        sz[1] = szHex[(u >> 8) & 0xf];
     332        sz[2] = szHex[(u >> 4) & 0xf];
     333        sz[3] = szHex[u & 0xf];
     334        sz[4] = '\0';
     335        cb = 4;
     336    }
     337    else
     338    {
     339        sz[0] = szHex[u >> 28];
     340        sz[1] = szHex[(u >> 24) & 0xf];
     341        sz[2] = szHex[(u >> 20) & 0xf];
     342        sz[3] = szHex[(u >> 16) & 0xf];
     343        sz[4] = szHex[(u >> 12) & 0xf];
     344        sz[5] = szHex[(u >>  8) & 0xf];
     345        sz[6] = szHex[(u >>  4) & 0xf];
     346        sz[7] = szHex[u & 0xf];
     347        sz[8] = '\0';
     348        cb = 8;
     349    }
     350    DosWrite(2, sz, cb, &cb);
     351}
    310352
    311353static void __fmutex_deadlock(_fmutex *pSem, const char *pszMsg)
    312354{
    313355    ULONG ul;
    314     static const char szMsg[] = "\r\n!!!deadlock!!! ";
    315     DosWrite(2, szMsg, sizeof(szMsg), &ul);
     356    static const char szMsg[] = "\r\n!!!deadlock!!! fmutex ";
     357    DosWrite(2, szMsg, sizeof(szMsg) - 1, &ul);
    316358    if (pSem->pszDesc)
    317     {
    318359        DosWrite(2, pSem->pszDesc, strlen(pSem->pszDesc), &ul);
    319         DosWrite(2, " ", 1, &ul);
    320     }
    321360    if (pszMsg)
     361    {
     362        DosWrite(2, ": ", 2, &ul);
    322363        DosWrite(2, pszMsg, strlen(pszMsg), &ul);
    323     static const char szNewLine[] = "\r\n";
    324     DosWrite(2, szNewLine, sizeof(szNewLine), &ul);
     364    }
     365    static const char szMsg2[] = "\r\nOwner=0x";
     366    DosWrite(2, szMsg2, sizeof(szMsg2) - 1, &ul);
     367    __fmutex_deadlock_hex(pSem->Owner, 8);
     368    static const char szMsg3[] = " Self=0x";
     369    DosWrite(2, szMsg3, sizeof(szMsg3) - 1, &ul);
     370    __fmutex_deadlock_hex(fibGetTidPid(), 8);
     371    static const char szMsg4[] = " fs=0x";
     372    DosWrite(2, szMsg4, sizeof(szMsg4) - 1, &ul);
     373    __fmutex_deadlock_hex(pSem->fs, 2);
     374    static const char szMsg5[] = "\r\n";
     375    DosWrite(2, szMsg5, sizeof(szMsg5) - 1, &ul);
     376
    325377    __asm__ __volatile__("movl $0xdead10cc, %%eax; movl $0xdead10cc, %%edx; movl %0, %%ecx; int $3" : : "m" (pSem) : "%eax", "%edx", "%ecx");
    326378}
Note: See TracChangeset for help on using the changeset viewer.