Ignore:
Timestamp:
Mar 27, 2000, 12:20:42 PM (25 years ago)
Author:
bird
Message:

Things are beginning to work. ICSDEBUG don't like use the debug info generated
by Sym2Hll yet, don't know why.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/dbginfo/Sym2Hll.cpp

    r3244 r3247  
    1 /* $Id: Sym2Hll.cpp,v 1.2 2000-03-26 21:56:36 bird Exp $
     1/* $Id: Sym2Hll.cpp,v 1.3 2000-03-27 10:20:41 bird Exp $
    22 *
    33 * Sym2Hll - Symbol file to HLL debuginfo converter.
     
    88 *
    99 */
     10/*******************************************************************************
     11*   Defined Constants And Macros                                               *
     12*******************************************************************************/
     13#define INCL_DOSERRORS
     14#define WORD    USHORT
     15#define DWORD   ULONG
    1016
    1117/*******************************************************************************
     
    1319*******************************************************************************/
    1420#include <os2.h>
     21#include <exe386.h>
    1522
    1623#include <stdio.h>
     
    2532#include "kHll.h"
    2633#include "sym.h"
     34#include "kFileFormatBase.h"
     35#include "kFileLX.h"
    2736
    2837/*******************************************************************************
     
    3342
    3443
     44/*******************************************************************************
     45*   External Functions                                                         *
     46*******************************************************************************/
     47APIRET APIENTRY DosReplaceModule (PSZ pszOldModule, PSZ pszNewModule, PSZ pszBackupModule);
     48
    3549
    3650
    3751int main(int argc, char **argv)
    3852{
    39     kHll *pHll;
     53    kHll *      pHll;
     54    kFileLX *   pFileLX;
    4055
    4156    /*
     
    5166    pHll = new kHll();
    5267    assert(pHll != NULL);
     68
     69    try {
     70        pFileLX = new kFileLX(argv[2]);
     71    } catch (int errcd)
     72    {
     73        fprintf(stderr, "failed to open/read LX file (%s). errcd=%d\n", argv[2], errcd);
     74        return -3;
     75    }
     76
    5377
    5478
     
    117141            while (pSegDef != NULL)
    118142            {
     143                struct o32_obj *pLXObject;
    119144                PSYMDEF32       pSymDef32;  /* Symbol definition 32-bit */
    120145                PSYMDEF16       pSymDef16;  /* Symbol definition 16-bit */
     
    160185                 * Add segment to the module - FIXME - need info from the LX Object table...
    161186                 */
    162 
     187                pLXObject = pFileLX->getObject(iSegment-1);
     188                if (pLXObject)
     189                {
     190                    if (!pModule->addSegInfo(iSegment, 0, pLXObject->o32_size))
     191                        fprintf(stderr, "warning: addseginfo failed!\n");
     192                }
     193                else
     194                    fprintf(stderr, "warning: pFileLX->getObject failed for iSegment=%d\n",
     195                            iSegment);
    163196
    164197                /*
     
    233266         */
    234267        pHll->write("debug.hll");
    235         pHll->writeToLX(argv[2]);
     268        rc = pHll->writeToLX(argv[2]);
     269        if (rc == ERROR_ACCESS_DENIED)
     270        {
     271
     272            rc = DosReplaceModule(argv[2], NULL, NULL);
     273            if (rc == NO_ERROR)
     274            {
     275                rc = pHll->writeToLX(argv[2]);
     276            }
     277        }
    236278    }
    237279    else
     
    290332
    291333
    292 /**
    293  * Find the size of a file.
    294  * @returns   Size of file. -1 on error.
    295  * @param     phFile  File handle.
    296  */
    297 signed long fsize(FILE *phFile)
    298 {
    299     int ipos;
    300     signed long cb;
    301 
    302     if ((ipos = ftell(phFile)) < 0
    303         ||
    304         fseek(phFile, 0, SEEK_END) != 0
    305         ||
    306         (cb = ftell(phFile)) < 0
    307         ||
    308         fseek(phFile, ipos, SEEK_SET) != 0
    309         )
    310         cb = -1;
    311     return cb;
    312 }
    313 
    314334
    315335
Note: See TracChangeset for help on using the changeset viewer.