Changeset 114 for trunk/openjdk


Ignore:
Timestamp:
Aug 26, 2010, 2:24:46 AM (15 years ago)
Author:
dmik
Message:

hotspot: Fixed a crash in os::print_dll_info().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk/hotspot/src/os/os2/vm/os_os2.cpp

    r113 r114  
    7878}
    7979
     80static void find_and_print_module_info(os2_QSPTRREC *pPtrRec, USHORT hmte,
     81                                       outputStream *st) {
     82    os2_QSLREC *pLibRec = pPtrRec->pLibRec;
     83    while (pLibRec) {
     84        if (pLibRec->hmte == hmte) {
     85            // mark as already walked
     86            pLibRec->hmte = os2_NULLHANDLE;
     87            st->print("  %s\n", pLibRec->pName);
     88            // It happens that for some modules ctObj is > 0 but
     89            // pbjInfo is NULL. I have no idea why.
     90            if (pLibRec->pObjInfo && pLibRec->fFlat) {
     91                for (ULONG i = 0; i < pLibRec->ctObj; ++i) {
     92                    if (pLibRec->pObjInfo[i].oaddr)
     93                        st->print("    " PTR_FORMAT " - " PTR_FORMAT "\n",
     94                                  pLibRec->pObjInfo[i].oaddr,
     95                                  pLibRec->pObjInfo[i].oaddr +
     96                                  pLibRec->pObjInfo[i].osize);
     97                }
     98            }
     99            // Print imported modules of this module
     100            USHORT *pImpMods = (USHORT *)(((ULONG) pLibRec) + sizeof(*pLibRec));
     101            for (ULONG i = 0; i < pLibRec->ctImpMod; ++i) {
     102                find_and_print_module_info(pPtrRec, pImpMods[i], st);
     103            }
     104        }
     105        pLibRec = (os2_QSLREC *)pLibRec->pNextRec;
     106    }
     107}
     108
    80109void os::print_dll_info(outputStream *st) {
    81110    int pid = os::current_process_id();
    82111    char *buf = (char *)malloc(64 * 1024);
    83     os2_APIRET arc = DosQuerySysState(os2_QS_PROCESS | os2_QS_MTE, 0, pid, 0,
    84                                       buf, 64 * 1024);
     112    os2_APIRET arc = DosQuerySysState(os2_QS_PROCESS | os2_QS_MTE, os2_QS_MTE,
     113                                      pid, 0, buf, 64 * 1024);
    85114    if (arc != NO_ERROR) {
    86115        assert(false, "DosQuerySysState() failed.");
     
    88117    }
    89118
     119    st->print_cr("Dynamic libraries:");
     120
    90121    os2_QSPTRREC *pPtrRec = (os2_QSPTRREC *)buf;
    91     os2_QSLREC *pLibRec = pPtrRec->pLibRec;
    92     st->print_cr("Dynamic libraries:");
    93     while (pLibRec) {
    94         for (ULONG i = 0; i < pLibRec->ctObj; ++i) {
    95             if (!i)
    96                 st->print(PTR_FORMAT " - " PTR_FORMAT " \t%s\n",
    97                           pLibRec->pObjInfo[i].oaddr,
    98                           pLibRec->pObjInfo[i].oaddr + pLibRec->pObjInfo[i].osize,
    99                           pLibRec->pName);
    100             else
    101                 st->print(PTR_FORMAT " - " PTR_FORMAT,
    102                           pLibRec->pObjInfo[i].oaddr,
    103                           pLibRec->pObjInfo[i].oaddr + pLibRec->pObjInfo[i].osize);
     122    os2_QSPREC *pProcRec = pPtrRec->pProcRec;
     123    find_and_print_module_info(pPtrRec, pProcRec->hMte, st);
     124    if (pProcRec->pLibRec) {
     125        for (USHORT i = 0; i < pProcRec->cLib; ++i) {
     126            USHORT hmte = pProcRec->pLibRec[i];
     127            find_and_print_module_info(pPtrRec, hmte, st);
    104128        }
    105         pLibRec = (os2_QSLREC *)pLibRec->pNextRec;
    106129    }
     130
    107131    free(buf);
    108132}
Note: See TracChangeset for help on using the changeset viewer.