Changeset 2204


Ignore:
Timestamp:
Jul 4, 2005, 3:17:39 AM (20 years ago)
Author:
bird
Message:

panic enh.

Location:
trunk/src/emx
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/ChangeLog.LIBC

    • Property cvs2svn:cvs-rev changed from 1.96 to 1.97
    r2203 r2204  
    11/* $Id$ */
     2
     32005-07-03: knut st. osmundsen <bird-gccos2-spam@anduin.net>
     4    - libc:
     5        o Collected the different panic routines into one single routine
     6          in the backend, __libc_Back_panic[V](). The routine supports
     7          very simple printf like message formatting. By default it wil
     8          dump any available registers and attempt dumping the process
     9          before killing it. This behaviour can be configured with the
     10          env var.: LIBC_PANIC=[nodump][terse][quiet][breakpoint]
    211
    3122005-07-02: knut st. osmundsen <bird-gccos2-spam@anduin.net>
  • trunk/src/emx/include/InnoTekLIBC/backend.h

    • Property cvs2svn:cvs-rev changed from 1.25 to 1.26
    r2203 r2204  
    3838#include <signal.h>
    3939#include <emx/io.h>
     40#include <stdarg.h>
    4041
    4142
     
    10401041/** @} */
    10411042
     1043
     1044/** @defgroup grp_Back_panic    LIBC Backend - Panic Routines
     1045 * @{ */
     1046
     1047/** The panic was caused by a signal. Drop the LIBC PANIC line. */
     1048#define __LIBC_PANIC_SIGNAL         1
     1049/** Don't set the SPM termination code / status. When set the caller is
     1050 * responsible for doing this. */
     1051#define __LIBC_PANIC_NO_SPM_TERM    2
     1052
     1053/**
     1054 * Print a panic message and dump/kill the process.
     1055 *
     1056 * @param   fFlags      A combination of the __LIBC_PANIC_* defines.
     1057 * @param   pvCtx       Pointer to a context record if available. This is a PCONTEXTRECORD.
     1058 * @param   pszFormat   User message which may contain %s and %x.
     1059 * @param   ...         String pointers and unsigned intergers as specified by the %s and %x in pszFormat.
     1060 */
     1061void __libc_Back_panic(unsigned fFlags, void *pvCtx, const char *pszFormat, ...) __attribute__((__noreturn__));
     1062
     1063/**
     1064 * Print a panic message and dump/kill the process.
     1065 *
     1066 * @param   fFlags      A combination of the __LIBC_PANIC_* defines.
     1067 * @param   pvCtx       Pointer to a context record if available. This is a PCONTEXTRECORD.
     1068 * @param   pszFormat   User message which may contain %s and %x.
     1069 * @param   args        String pointers and unsigned intergers as specified by the %s and %x in pszFormat.
     1070 */
     1071void __libc_Back_panicV(unsigned fFlags, void *pvCtx, const char *pszFormat, va_list args) __attribute__((__noreturn__));
     1072
     1073/* @} */
     1074
    10421075__END_DECLS
    10431076
  • trunk/src/emx/include/emx/umalloc.h

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r2203 r2204  
    807807
    808808
    809 static __inline__ void _um_abort (const char *pszmsg)
    810 {
    811   /* Use the 'syscall' write for safest possible path. */
    812   extern int __write (int handle, const void *buf, size_t nbytes);
    813   __write (2, "\r\n!_um_abort!", 13);
    814   if (pszmsg)
    815     {
    816       const char *psz = pszmsg;
    817       while (*psz)
    818         psz++;
    819       __write (2, " ", 1);
    820       __write (2, pszmsg, psz - pszmsg);
    821     }
    822   __write (2, "\r\n", 2);
    823   __asm__ __volatile__ ("int $3");
    824 }
    825 
     809void _um_abort (const char *, ...)  __attribute__((__noreturn__));
    826810
    827811#if defined (__cplusplus)
  • trunk/src/emx/src/lib/libc.def

    • Property cvs2svn:cvs-rev changed from 1.130 to 1.131
    r2203 r2204  
    19171917    "__ufc_output_conversion_r" @1916
    19181918    "__ufc_setup_salt_r" @1917
     1919    "___libc_Back_panic" @1918
     1920    "___libc_Back_panicV" @1919
     1921    "__um_abort" @1920
  • trunk/src/emx/src/lib/malloc/_hinitheap.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r2203 r2204  
    9090    if (!pvInitial)
    9191    {
    92         abort();
     92        _um_abort("_hinitheap: __libc_HimemDefaultAlloc failed!\n");
    9393        return NULL;
    9494    }
     
    103103    if (Heap == NULL)
    104104    {
    105         abort();
     105        _um_abort("_hinitheap: _ucreate2 failed!\n");
    106106        return NULL;
    107107    }
    108108    if (_uopen(Heap) != 0)
    109109    {
    110         abort();
     110        _um_abort("_hinitheap: _uopen(%p) failed!\n", Heap);
    111111        return NULL;
    112112    }
  • trunk/src/emx/src/lib/malloc/_linitheap.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r2203 r2204  
    7575    if (pvInitial == (void *)-1)
    7676    {
    77         abort();
     77        _um_abort("_linitheap: sbrk failed!\n");
    7878        return NULL;
    7979    }
     
    8888    if (Heap == NULL)
    8989    {
    90         abort();
     90        _um_abort("_linitheap: _ucreate2 failed!\n");
    9191        return NULL;
    9292    }
    9393    if (_uopen(Heap) != 0)
    9494    {
    95         abort();
     95        _um_abort("_linitheap: _uopen(%p) failed!\n", Heap);
    9696        return NULL;
    9797    }
  • trunk/src/emx/src/lib/malloc/ifree.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r2203 r2204  
    4040  if (*patch == NULL)
    4141    {
    42       _um_abort ("Corrupt heap? (Patch not found.)");
     42      _um_abort ("_um_crate_free: patch not found! patch=%p crate=%p crateset=%p\n",
     43                 patch, crate, crateset);
    4344      return;
    4445    }
     
    126127  if (_UM_HDR_STATUS (hdr) == _UMS_FREE)
    127128    {
    128       _um_abort ("Tried to free block twice! (free)");
     129      _um_abort ("_um_free_maybe_lock: Tried to free block twice - block=%p lock=%d\n",
     130                 block, lock);
    129131      return;
    130132    }
     
    141143      break;
    142144    default:
    143       _um_abort ("Corrupt heap or passing wrong pointer to free! (bad parent magic)");
     145      _um_abort ("_um_free_maybe_lock: bad parent magic %x, parent=%p block=%p lock=%d\n",
     146                 *parent, parent, block, lock);
    144147      return;
    145148
  • trunk/src/emx/src/lib/malloc/imisc.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r2203 r2204  
    99#include <sys/fmutex.h>
    1010#include <emx/umalloc.h>
     11#include <InnoTekLIBC/backend.h>
    1112
    1213/* Leave FLS undefined if __fls() is not available.  __fls() is
     
    3334    if (_UM_BUCKET_SIZE (bucket) <= rsize)
    3435      return bucket;
    35   abort ();                    /* RSIZE is probably not rounded! */
     36  _um_abort ("_um_find_bucked: rsize=%x\n", rsize); /* RSIZE is probably not rounded! */
    3637#endif
    3738}
     
    162163  _um_lump_link_heap (h, lump);
    163164}
     165
     166
     167void _um_abort (const char *pszMsg, ...)
     168{
     169  va_list args;
     170  va_start(args, pszMsg);
     171  __libc_Back_panicV(0, NULL, pszMsg, args);
     172  va_end(args);
     173}
     174
  • trunk/src/emx/src/lib/malloc/irealloc.c

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r2203 r2204  
    316316  if (_UM_HDR_STATUS (hdr) == _UMS_FREE)
    317317    {
    318       _um_abort ("Tried to free block twice! (realloc)");
     318      _um_abort ("_um_free_maybe_lock: Tried to reallocate freed block - block=%p new_size=%x align=%x flags=%x\n",
     319                 block, new_size, align, flags);
    319320      errno = EINVAL;
    320321      return NULL;
     
    337338    default:
    338339      {
    339         _um_abort ("Corrupt heap or passing wrong pointer to realloc! (bad parent magic)");
     340        _um_abort ("_um_realloc: bad parent magic %x, parent=%p block=%p new_size=%x align=%x flags=%x\n",
     341                   *parent, parent, block, new_size, align, flags);
    340342        errno = EINVAL;
    341343        return NULL;
  • trunk/src/emx/src/lib/malloc/uheapmin.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r2203 r2204  
    6464                }
    6565              else
    66                 abort ();
     66                 _um_abort ("_uheapmin: shrink_size=%x seg->size=%x\n", shrink_size, seg->size);
    6767            }
    6868          else
  • trunk/src/emx/src/lib/process/fmutex.c

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r2203 r2204  
    1717#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MUTEX
    1818#include <InnoTekLIBC/logstrict.h>
     19#include <InnoTekLIBC/backend.h>
    1920
    2021/*******************************************************************************
     
    308309}
    309310
    310 static 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 }
    352 
    353311static void __fmutex_deadlock(_fmutex *pSem, const char *pszMsg)
    354312{
    355     ULONG ul;
    356     static const char szMsg[] = "\r\n!!!deadlock!!! fmutex ";
    357     DosWrite(2, szMsg, sizeof(szMsg) - 1, &ul);
    358     if (pSem->pszDesc)
    359         DosWrite(2, pSem->pszDesc, strlen(pSem->pszDesc), &ul);
    360     if (pszMsg)
    361     {
    362         DosWrite(2, ": ", 2, &ul);
    363         DosWrite(2, pszMsg, strlen(pszMsg), &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 
    377     __asm__ __volatile__("movl $0xdead10cc, %%eax; movl $0xdead10cc, %%edx; movl %0, %%ecx; int $3" : : "m" (pSem) : "%eax", "%edx", "%ecx");
     313    __libc_Back_panic(0, NULL,
     314                      "fmutex deadlock: %s\n"
     315                      "%x: Owner=%x Self=%x fs=%x flags=%x hev=%x\n"
     316                      "            Desc=\"%s\"\n",
     317                      pszMsg,
     318                      pSem, pSem->Owner, fibGetTidPid(), pSem->fs, pSem->flags, pSem->hev,
     319                      pSem->pszDesc);
    378320}
    379321
  • trunk/src/emx/src/lib/sys/libcfork.c

    • Property cvs2svn:cvs-rev changed from 1.13 to 1.14
    r2203 r2204  
    155155static int                  forkBthCallbacksCall(__LIBC_PFORKCALLBACK *papCallbacks, __LIBC_PFORKHANDLE pForkHandle, __LIBC_FORKOP enmOperation);
    156156static void                 forkBthDumpMemFlags(void *pv);
    157 static void                 forkChlFatalError(__LIBC_PFORKHANDLE pForkHandle, int rc) __attribute__((__noreturn__));
     157static void                 forkChlFatalError(__LIBC_PFORKHANDLE pForkHandle, int rc, void *pvCtx) __attribute__((__noreturn__));
    158158static ULONG _System        forkChlExceptionHandler(PEXCEPTIONREPORTRECORD       pXcptRepRec,
    159159                                                    PEXCEPTIONREGISTRATIONRECORD pXcptRegRec,
     
    10611061                           PAG_READ | PAG_WRITE | PAG_COMMIT);
    10621062        if (rc)
    1063             forkChlFatalError(pForkHandle, -__libc_native2errno(rc));
     1063            forkChlFatalError(pForkHandle, -__libc_native2errno(rc), NULL);
    10641064    }
    10651065    else
     
    11181118    rc = forkBthBufferGiveWaitNext(pForkHandle, __LIBC_FORK_CTX_CHILD);
    11191119    if (rc < 0)
    1120         forkChlFatalError(pForkHandle, rc);
     1120        forkChlFatalError(pForkHandle, rc, NULL);
    11211121
    11221122    /*
     
    11301130    LIBC_ASSERTM(pModules, "No fork modules in child process!!!!\n");
    11311131    if (!pModules)
    1132         forkChlFatalError(pForkHandle, -EDOOFUS);
     1132        forkChlFatalError(pForkHandle, -EDOOFUS, NULL);
    11331133
    11341134    /*
     
    11371137    rc = forkChlRunForkChild(pForkHandle, pModules);
    11381138    if (rc < 0)
    1139         forkChlFatalError(pForkHandle, rc);
     1139        forkChlFatalError(pForkHandle, rc, NULL);
    11401140
    11411141
     
    20192019                rc = pHdr->u.Abort.err;
    20202020                if (enmCtx == __LIBC_FORK_CTX_CHILD)
    2021                     forkChlFatalError(pForkHandle, rc);
     2021                    forkChlFatalError(pForkHandle, rc, NULL);
    20222022                break;
    20232023
     
    25102510 * @param   pForkHandle     Pointer to fork handle.
    25112511 * @param   rc              The return code (negative) which caused the failure.
    2512  */
    2513 void                 forkChlFatalError(__LIBC_PFORKHANDLE pForkHandle, int rc)
    2514 {
    2515     LIBCLOG_ENTER("pForkHandle=%p rc=%d\n", (void *)pForkHandle, rc);
    2516     static const char   szMsg[] = "LIBC Error: Child aborting fork()!\r\n";
    2517     ULONG               cbWritten;
     2512 * @param   pvCtx           Context if available.
     2513 */
     2514void                 forkChlFatalError(__LIBC_PFORKHANDLE pForkHandle, int rc, void *pvCtx)
     2515{
     2516    LIBCLOG_ENTER("pForkHandle=%p rc=%d pvCtx=%p\n", (void *)pForkHandle, rc, pvCtx);
    25182517    PID                 pid;
    25192518    TID                 tid;
     
    25692568     * Exit process.
    25702569     */
    2571     DosWrite(2, szMsg, sizeof(szMsg) - 1, &cbWritten);
    2572     for (;;)
    2573     {
    2574         LIBCLOG_MSG("Calling DosExit(EXIT_PROCESS, 0xffff)...\n");
    2575         DosExit(EXIT_PROCESS, /*fixme*/0xffff);
    2576     }
     2570    __libc_Back_panic(__LIBC_PANIC_NO_SPM_TERM, pvCtx, "LIBC fork: Child aborting fork()! rc=%x\n", rc);
    25772571}
    25782572
     
    27552749            {
    27562750                DosPostEventSem(pForkHandle->hevParent);
    2757                 forkChlFatalError(pForkHandle, -EINTR);
     2751                forkChlFatalError(pForkHandle, -EINTR, pCtx);
    27582752            }
    27592753            break;
  • trunk/src/emx/src/lib/sys/sharedpm.c

    • Property cvs2svn:cvs-rev changed from 1.30 to 1.31
    r2203 r2204  
    38053805    {
    38063806        /*
    3807          * This isn't wrong just unlikely and must be ignored!
     3807         * This isn't wrong, just unlikely and must be ignored!
    38083808         */
    38093809        case XCPT_ASYNC_PROCESS_TERMINATE:
     
    38913891    spmCheck(1, 1);
    38923892#endif
     3893    __libc_Back_panic(__LIBC_PANIC_NO_SPM_TERM, pCtx,
     3894                      "SPM Exception %x (%x,%x,%x,%x)%s\n",
     3895                      pRepRec->ExceptionNum,
     3896                      pRepRec->ExceptionInfo[0],
     3897                      pRepRec->ExceptionInfo[1],
     3898                      pRepRec->ExceptionInfo[2],
     3899                      pRepRec->ExceptionInfo[3],
     3900                      !rc && pPib->pib_ulpid == pid && pTib->tib_ptib2->tib2_ultid == tid ? " - Owner of the mutex" : "");
    38933901    return XCPT_CONTINUE_SEARCH;
    38943902}
  • trunk/src/emx/src/lib/sys/signals.c

    • Property cvs2svn:cvs-rev changed from 1.28 to 1.29
    r2203 r2204  
    18931893
    18941894                /*
    1895                  * Kill process / dump core (no cores for LIBC!).
     1895                 * Kill process / dump core.
    18961896                 */
    18971897                case SPA_NEXT_KILL:
     
    20782078
    20792079/**
    2080  * Calculates the length of a string.
    2081  * @returns String length in bytes.
    2082  * @param   psz     Pointer to the string.
    2083  */
    2084 static size_t signalTerminateStrLen(const char *psz)
    2085 {
    2086     const char *pszEnd = psz;
    2087     while (*pszEnd)
    2088         pszEnd++;
    2089     return pszEnd - psz;
    2090 }
    2091 
    2092 
    2093 /**
    2094  * Termination time hex formatter.
    2095  *
    2096  * @returns number of bytes formatted.
    2097  * @param   pszBuf  Where to store the formatted number.
    2098  * @param   u       Number to format.
    2099  * @param   cDigits Minimum number of digits in the output. Use 0 for whatever fits.
    2100  */
    2101 static int signalTerminateHex(char *pszBuf, unsigned u, unsigned cDigits)
    2102 {
    2103     static const char szHex[17] = "0123456789abcdef";
    2104     if (u <= 0xf && cDigits <= 1)
    2105     {
    2106         pszBuf[0] = szHex[u & 0xf];
    2107         pszBuf[1] = '\0';
    2108         return 1;
    2109     }
    2110     if (u <= 0xff && cDigits <= 2)
    2111     {
    2112         pszBuf[0] = szHex[u >> 4];
    2113         pszBuf[1] = szHex[u & 0xf];
    2114         pszBuf[2] = '\0';
    2115         return 2;
    2116     }
    2117     else if (u <= 0xffff && cDigits <= 4)
    2118     {
    2119         pszBuf[0] = szHex[u >> 12];
    2120         pszBuf[1] = szHex[(u >> 8) & 0xf];
    2121         pszBuf[2] = szHex[(u >> 4) & 0xf];
    2122         pszBuf[3] = szHex[u & 0xf];
    2123         pszBuf[4] = '\0';
    2124         return 4;
    2125     }
    2126     else
    2127     {
    2128         pszBuf[0] = szHex[u >> 28];
    2129         pszBuf[1] = szHex[(u >> 24) & 0xf];
    2130         pszBuf[2] = szHex[(u >> 20) & 0xf];
    2131         pszBuf[3] = szHex[(u >> 16) & 0xf];
    2132         pszBuf[4] = szHex[(u >> 12) & 0xf];
    2133         pszBuf[5] = szHex[(u >>  8) & 0xf];
    2134         pszBuf[6] = szHex[(u >>  4) & 0xf];
    2135         pszBuf[7] = szHex[u & 0xf];
    2136         pszBuf[8] = '\0';
    2137         return 8;
    2138     }
    2139 }
    2140 
    2141 
    2142 /**
    21432080 * Cause immediate process termination because of the given signal.
    21442081 *
     
    21502087{
    21512088    LIBCLOG_ENTER("iSignalNo=%d\n", iSignalNo);
     2089
    21522090    /*
    21532091     * Set the exit reason in SPM.
     
    21562094
    21572095    /*
    2158      * Before we go crazy here, let's release the semaphore.
    2159      *
    2160      * If possible we'll stay in the must complete section to
    2161      * be sure we get to the exit. If not we'll have to mess with
    2162      * exception handlers and such now.
    2163      */
    2164     //if (__libc_back_signalSemIsOwner())
    2165     //    DosReleaseMutexSem(ghmtxSignals);
    2166 
    2167     /*
    2168      * Terminate the exception handler chain to avoid recursive trouble.
    2169      */
    2170     FS_VAR();
    2171     FS_SAVE_LOAD();
    2172     PTIB pTib;
    2173     PPIB pPib;
    2174     DosGetInfoBlocks(&pTib, &pPib);
    2175     pTib->tib_pexchain = END_OF_CHAIN;
    2176 
    2177     /*
    2178      * Write message to stderr.
    2179      */
    2180     ULONG   cb;
    2181     char szHexNum[12];
    2182 #define SIG_PRINT_C(msg)  DosWrite(HFILE_STDERR, msg, sizeof(msg) - 1, &cb)
    2183 #define SIG_PRINT_P(msg)  DosWrite(HFILE_STDERR, msg, signalTerminateStrLen(msg), &cb)
    2184 #define SIG_PRINT_H(hex)  DosWrite(HFILE_STDERR, szHexNum, signalTerminateHex(szHexNum, hex, 0), &cb)
    2185 #define SIG_PRINT_H16(hex)  DosWrite(HFILE_STDERR, szHexNum, signalTerminateHex(szHexNum, hex, 4), &cb)
    2186 #define SIG_PRINT_H32(hex)  DosWrite(HFILE_STDERR, szHexNum, signalTerminateHex(szHexNum, hex, 8), &cb)
    2187     if (iSignalNo == SIGABRT)
    2188         SIG_PRINT_C("\n\rAbnormal program termination");
     2096     * Panic
     2097     */
     2098    PCONTEXTRECORD pCtx = pvXcptParams ? pCtx = ((PEXCPTPARAMS)pvXcptParams)->pCtx : NULL;
     2099    if (iSignalNo < sizeof(gaszSignalNames) / sizeof(gaszSignalNames[0]))
     2100        __libc_Back_panic(__LIBC_PANIC_SIGNAL | __LIBC_PANIC_NO_SPM_TERM, pCtx, "Killed by %s\n", gaszSignalNames[iSignalNo]);
    21892101    else
    2190     {
    2191         SIG_PRINT_C("\n\rProcess terminated by ");
    2192 
    2193         if (iSignalNo < sizeof(gaszSignalNames) / sizeof(gaszSignalNames[0]))
    2194             SIG_PRINT_P(gaszSignalNames[iSignalNo]);
    2195         else
    2196         {
    2197             SIG_PRINT_C("unknown signal ");
    2198             SIG_PRINT_H(iSignalNo);
    2199         }
    2200     }
    2201 
    2202     /* pid */
    2203     SIG_PRINT_C(" - pid=0x"); SIG_PRINT_H16(pPib->pib_ulpid);
    2204 
    2205     /* tid */
    2206     SIG_PRINT_C(" - tid=0x"); SIG_PRINT_H16(pTib->tib_ptib2->tib2_ultid);
    2207 
    2208     /* executable name. */
    2209     static char szExeName[CCHMAXPATH];
    2210     if (!DosQueryModuleName(pPib->pib_hmte, sizeof(szExeName), &szExeName[0]))
    2211     {
    2212         static const char szHypen[] = " - ";
    2213         DosWrite(HFILE_STDERR, szHypen, sizeof(szHypen) - 1, &cb);
    2214 
    2215         for (cb = 0; szExeName[cb];)
    2216             cb++;
    2217         DosWrite(HFILE_STDERR, szExeName, cb, &cb);
    2218     }
    2219 
    2220     /* eip */
    2221     PCONTEXTRECORD pCtx;
    2222     if (    pvXcptParams
    2223         &&  (pCtx = ((PEXCPTPARAMS)pvXcptParams)->pCtx))
    2224     {
    2225         SIG_PRINT_C("\r\ncs:eip=");
    2226         SIG_PRINT_H16(pCtx->ctx_SegCs);
    2227         SIG_PRINT_C(":");
    2228         SIG_PRINT_H32(pCtx->ctx_RegEip);
    2229         if (pCtx->ctx_RegEip >= 0x10000)
    2230         {
    2231             HMODULE hmod;
    2232             ULONG iObj = 0;
    2233             ULONG offObj = 0;
    2234             if (!DosQueryModFromEIP(&hmod, &iObj, sizeof(szExeName), szExeName, &offObj, pCtx->ctx_RegEip))
    2235             {
    2236                 SIG_PRINT_C(" - ");
    2237                 SIG_PRINT_H(iObj);
    2238                 SIG_PRINT_C(":");
    2239                 SIG_PRINT_H32(offObj);
    2240                 SIG_PRINT_C(" ");
    2241                 SIG_PRINT_P(szExeName);
    2242             }
    2243         }
    2244     }
    2245 
    2246     /* final newline */
    2247     SIG_PRINT_C("\r\n");
    2248 
    2249     /*
    2250      * Terminate the process.
    2251      */
    2252     LIBCLOG_MSG("Calling DosKillProcess()\n");
    2253     for (;;)
    2254     {
    2255         DosKillProcess(DKP_PROCESS, fibGetPid());
    2256         DosExit(EXIT_PROCESS, 127);
    2257     }
     2102        __libc_Back_panic(__LIBC_PANIC_SIGNAL | __LIBC_PANIC_NO_SPM_TERM, pCtx, "Killed by unknown signal %d\n", iSignalNo);
     2103    LIBCLOG_MSG("panic failed\n"); /* shuts up gcc */
     2104    asm("int3");
    22582105}
    22592106
Note: See TracChangeset for help on using the changeset viewer.