Ignore:
Timestamp:
Nov 22, 2001, 2:35:42 PM (24 years ago)
Author:
phaller
Message:

.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/odinprof/symfile.cpp

    r7423 r7427  
    1 /* $Id: symfile.cpp,v 1.2 2001-11-22 11:34:43 phaller Exp $ */
     1/* $Id: symfile.cpp,v 1.3 2001-11-22 13:35:42 phaller Exp $ */
    22/*
    33 * Project Odin Software License can be found in LICENSE.TXT
     
    395395  if (NULL == pSym)
    396396  {
    397     CHAR szFilename[260];
     397    DosEnterCritSec();
    398398   
    399     // 1 - locate the file
    400     APIRET rc = searchModule(pszModule, szFilename, sizeof(szFilename));
     399    // try again since someone else could have loaded the map already
     400    pSym = (LXSymbolFile*)pHashModules->getElement(pszModule);
     401    if (NULL == pSym)
     402    {
     403      CHAR szFilename[260];
     404     
     405      // 1 - locate the file
     406      APIRET rc = searchModule(pszModule, szFilename, sizeof(szFilename));
     407     
     408      // create new entry
     409      pSym = new LXSymbolFile(pszModule, szFilename);
     410     
     411      // parse the file
     412      if (rc == NO_ERROR)
     413        pSym->parseFile();
     414      else
     415        pSym->setErrorMessage("file not found");
     416     
     417      // add to the hashtable
     418      PSZ pszCopyOfModuleName = strdup(pszModule);
     419      pHashModules->addElement(pszCopyOfModuleName, pSym);
     420    }
    401421   
    402     // create new entry
    403     pSym = new LXSymbolFile(pszModule, szFilename);
    404    
    405     // parse the file
    406     if (rc == NO_ERROR)
    407       pSym->parseFile();
    408     else
    409       pSym->setErrorMessage("file not found");
    410    
    411     // add to the hashtable
    412     pHashModules->addElement(pszModule, pSym);
     422    DosExitCritSec();
    413423  }
    414424 
     
    457467}
    458468
     469
     470static int _Optlink sortHashtableSYMs(const void *arg1,const void *arg2)
     471{
     472  PHASHTABLEENTRY pHTE1 = (PHASHTABLEENTRY)arg1;
     473  PHASHTABLEENTRY pHTE2 = (PHASHTABLEENTRY)arg2;
     474 
     475  LXSymbolFile* p1 = (LXSymbolFile*)pHTE1->pObject;
     476  LXSymbolFile* p2 = (LXSymbolFile*)pHTE2->pObject;
     477 
     478  return stricmp(p1->getName(), p2->getName());
     479}
     480
     481
     482void SymbolFilePool::printSYMs(FILE *file)
     483{
     484  int iEntries = pHashModules->getNumberOfElements();
     485 
     486  // get a list of all entries of the hashtable
     487  PHASHTABLEENTRY arrEntries = (PHASHTABLEENTRY)malloc( iEntries * sizeof(HASHTABLEENTRY) );
     488  iEntries = pHashModules->getElementMap(arrEntries);
     489 
     490  fprintf(file,
     491          "\nSymbolic debug information maps (%d maps)\n",
     492          iEntries);
     493 
     494  // sort the list by name
     495  qsort(arrEntries,
     496        iEntries,
     497        sizeof( HASHTABLEENTRY ),
     498        sortHashtableSYMs);
     499 
     500  // write to file
     501  fprintf(file,
     502          "Module ---- Status --------------------------------------------------------\n");
     503  for(int i = 0;
     504      i < iEntries;
     505      i++)
     506  {
     507    LXSymbolFile* p = (LXSymbolFile*)arrEntries[i].pObject;
     508    fprintf(file,
     509            "%-10s %s (%s)\n",
     510            p->getName(),
     511            p->getFileName(),
     512            (p->getErrorMessage() != NULL) ? p->getErrorMessage() : "");
     513  }
     514}
Note: See TracChangeset for help on using the changeset viewer.