Changeset 3244 for trunk/tools


Ignore:
Timestamp:
Mar 26, 2000, 11:56:38 PM (25 years ago)
Author:
bird
Message:

Temporary checkin.

Location:
trunk/tools/dbginfo
Files:
5 edited

Legend:

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

    r3240 r3244  
    1 /* $Id: Sym2Hll.cpp,v 1.1 2000-03-26 14:23:21 bird Exp $
     1/* $Id: Sym2Hll.cpp,v 1.2 2000-03-26 21:56:36 bird Exp $
    22 *
    33 * Sym2Hll - Symbol file to HLL debuginfo converter.
     
    1515
    1616#include <stdio.h>
     17#include <malloc.h>
     18#include <stdlib.h>
     19#include <stddef.h>
    1720#include <string.h>
    1821#include <assert.h>
     
    2124#include "kList.h"
    2225#include "kHll.h"
     26#include "sym.h"
     27
     28/*******************************************************************************
     29*   Internal Functions                                                         *
     30*******************************************************************************/
     31void *          readfile(const char *pszFilename);
     32signed long     fsize(FILE *phFile);
    2333
    2434
     
    2737int main(int argc, char **argv)
    2838{
     39    kHll *pHll;
     40
     41    /*
     42     * Quite simple input currently:
     43     *      <filename.sym> <filename.exe>
     44     */
     45    if (argc != 3)
     46    {
     47        fprintf(stderr, "syntax error\n");
     48        return -87;
     49    }
     50
     51    pHll = new kHll();
     52    assert(pHll != NULL);
     53
     54
     55    /*
     56     * Start conversion.
     57     */
     58    PBYTE pbSym = (PBYTE)readfile(argv[1]);
     59    if (pbSym != NULL)
     60    {
     61        int             rc;
     62        kHllModuleEntry*pModule;
     63        PMAPDEF         pMapDef;             /* Mapfile header */
     64
     65        pMapDef = (PMAPDEF)pbSym;
     66        while (pMapDef != NULL)
     67        {
     68            int         iSegment;
     69            PSEGDEF     pSegDef;             /* Segment header */
     70
     71            /*
     72             * Map definition.
     73             */
     74            printf("- Map definition -\n"
     75                   "    ppNextMap    0x%04x  paragraph pointer to next map\n"
     76                   "    bFlags       0x%02x    symbol types\n"
     77                   "    bReserved1   0x%02x    reserved\n"
     78                   "    pSegEntry    0x%04x  segment entry point value\n"
     79                   "    cConsts      0x%04x  count of constants in map\n"
     80                   "    pConstDef    0x%04x  pointer to constant chain\n"
     81                   "    cSegs        0x%04x  count of segments in map\n"
     82                   "    ppSegDef     0x%04x  paragraph pointer to first segment\n"
     83                   "    cbMaxSym     0x%02x    maximum symbol-name length\n"
     84                   "    cbModName    0x%02x    length of module name\n"
     85                   "    achModName   %.*s\n"
     86                   "\n",
     87                   pMapDef->ppNextMap,
     88                   pMapDef->bFlags,
     89                   pMapDef->bReserved1,
     90                   pMapDef->pSegEntry,
     91                   pMapDef->cConsts,
     92                   pMapDef->pConstDef,
     93                   pMapDef->cSegs,
     94                   pMapDef->ppSegDef,
     95                   pMapDef->cbMaxSym,
     96                   pMapDef->cbModName,
     97                   pMapDef->cbModName,
     98                   pMapDef->achModName
     99                   );
     100
     101            /*
     102             * Add Modulename.
     103             */
     104            pModule = pHll->addModule(pMapDef->achModName, pMapDef->cbModName, NULL);
     105            if (pModule == NULL)
     106            {
     107                fprintf(stderr, "addModule failed\n");
     108                return -3;
     109            }
     110
     111
     112            /*
     113             * Read and convert segments with info.
     114             */
     115            pSegDef = SEGDEFPTR(pbSym, *pMapDef);
     116            iSegment = 1;
     117            while (pSegDef != NULL)
     118            {
     119                PSYMDEF32       pSymDef32;  /* Symbol definition 32-bit */
     120                PSYMDEF16       pSymDef16;  /* Symbol definition 16-bit */
     121                int             iSym;
     122
     123
     124                /*
     125                 * Dump Segment definition.
     126                 */
     127                printf("    - Segment Definition -\n"
     128                       "      ppNextSeg   0x%04x  paragraph pointer to next segment\n"
     129                       "      cSymbols    0x%04x  count of symbols in list\n"
     130                       "      pSymDef     0x%04x  offset of symbol chain\n"
     131                       "      wReserved1  0x%04x  reserved\n"
     132                       "      wReserved2  0x%04x  reserved\n"
     133                       "      wReserved3  0x%04x  reserved\n"
     134                       "      wReserved4  0x%04x  reserved\n"
     135                       "      bFlags      0x%04x  symbol types\n"
     136                       "      bReserved1  0x%04x  reserved\n"
     137                       "      ppLineDef   0x%04x  offset of line number record\n"
     138                       "      bReserved2  0x%04x  reserved\n"
     139                       "      bReserved3  0x%04x  reserved\n"
     140                       "      cbSegName   0x%04x  length of segment name\n"
     141                       "      achSegName  %.*s\n",
     142                       pSegDef->ppNextSeg,
     143                       pSegDef->cSymbols,
     144                       pSegDef->pSymDef,
     145                       pSegDef->wReserved1,
     146                       pSegDef->wReserved2,
     147                       pSegDef->wReserved3,
     148                       pSegDef->wReserved4,
     149                       pSegDef->bFlags,
     150                       pSegDef->bReserved1,
     151                       pSegDef->ppLineDef ,
     152                       pSegDef->bReserved2,
     153                       pSegDef->bReserved3,
     154                       pSegDef->cbSegName,
     155                       pSegDef->cbSegName,
     156                       pSegDef->achSegName
     157                       );
     158
     159                /*
     160                 * Add segment to the module - FIXME - need info from the LX Object table...
     161                 */
     162
     163
     164                /*
     165                 * Read and convert symbols
     166                 */
     167                for (iSym = 0; iSym < pSegDef->cSymbols; iSym++)
     168                {
     169                    unsigned long   offset;
     170                    int             cchName;
     171                    const char *    pachName;
     172                    pSymDef32 = SYMDEFPTR32(pbSym, pSegDef, iSym);
     173                    pSymDef16 = (PSYMDEF16)pSymDef32;
     174
     175                    if (SEG32BitSegment(*pSegDef))
     176                    {   /* pSymDef32 */
     177                        offset = pSymDef32->wSymVal;
     178                        cchName = pSymDef32->cbSymName;
     179                        pachName = pSymDef32->achSymName;
     180                    }
     181                    else
     182                    {   /* pSymDef16 */
     183                        offset = pSymDef16->wSymVal;
     184                        cchName = pSymDef16->cbSymName;
     185                        pachName = pSymDef16->achSymName;
     186                    }
     187
     188                    printf("      0x%08x  %.*s\n",
     189                           offset,
     190                           cchName,
     191                           pachName);
     192
     193                    /*
     194                     * Add symbol - currently we define it as public - it's a symbol local to this module really.
     195                     */
     196                    pModule->addPublicSymbol(pachName, cchName, offset, iSegment, 0);
     197                }
     198
     199
     200                /*
     201                 * Next segment
     202                 */
     203                printf("\n");
     204                pSegDef = NEXTSEGDEFPTR(pbSym, *pSegDef);
     205                iSegment++;
     206            }
     207
     208
     209            /*
     210             * Next map
     211             */
     212            pMapDef = NEXTMAPDEFPTR(pbSym, *pMapDef);
     213            if (pMapDef != NULL)
     214            {
     215                if (pMapDef->ppNextMap == 0)
     216                {   /* last map */
     217                    PLAST_MAPDEF pLastMapDef = (PLAST_MAPDEF)pMapDef;
     218                    printf("- Last Map definition -\n"
     219                           "    ppNextMap    0x%04x  always zero\n"
     220                           "    version      0x%02x    release number (minor version number)\n"
     221                           "    release      0x%02x    major version number\n",
     222                           pLastMapDef->ppNextMap,
     223                           pLastMapDef->release,
     224                           pLastMapDef->version
     225                           );
     226                    break;
     227                }
     228            }
     229        } /* Map loop */
     230
     231        /*
     232         * debug
     233         */
     234        pHll->write("debug.hll");
     235        pHll->writeToLX(argv[2]);
     236    }
     237    else
     238    {
     239        fprintf(stderr, "failed to open/read .sym file.\n");
     240        return -2;
     241    }
     242
     243
     244
     245
     246
    29247
    30248    return -1;
    31249}
     250
     251
     252
     253
     254
     255/**
     256 * Creates a memory buffer for a binary file.
     257 * @returns   Pointer to file memoryblock. NULL on error.
     258 * @param     pszFilename  Pointer to filename string.
     259 * @remark    This function is the one using most of the execution
     260 *            time (DosRead + DosOpen) - about 70% of the execution time!
     261 */
     262void *readfile(const char *pszFilename)
     263{
     264    void *pvFile = NULL;
     265    FILE *phFile;
     266
     267    phFile = fopen(pszFilename, "rb");
     268    if (phFile != NULL)
     269    {
     270        signed long cbFile = fsize(phFile);
     271        if (cbFile > 0)
     272        {
     273            pvFile = malloc(cbFile + 1);
     274            if (pvFile != NULL)
     275            {
     276                memset(pvFile, 0, cbFile + 1);
     277                if (fread(pvFile, 1, cbFile, phFile) == 0)
     278                {   /* failed! */
     279                    free(pvFile);
     280                    pvFile = NULL;
     281                }
     282            }
     283            else
     284                fprintf(stderr, "warning/error: failed to open file %s\n", pszFilename);
     285        }
     286        fclose(phFile);
     287    }
     288    return pvFile;
     289}
     290
     291
     292/**
     293 * Find the size of a file.
     294 * @returns   Size of file. -1 on error.
     295 * @param     phFile  File handle.
     296 */
     297signed 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
    32314
    33315
  • trunk/tools/dbginfo/dbgLXDumper.c

    r3236 r3244  
    1 /* $Id: dbgLXDumper.c,v 1.2 2000-03-25 21:09:58 bird Exp $
     1/* $Id: dbgLXDumper.c,v 1.3 2000-03-26 21:56:37 bird Exp $
    22 *
    33 * dbgLXDumper - reads and interprets the debuginfo found in an LX executable.
     
    202202     * Get and Dump directory
    203203     */
    204     if (pHdr->offDirectory + sizeof(HLLDIR) >= cb)
    205     {
    206         fprintf(phOut, "error: offcEntries is incorrect!\n");
     204    if (pHdr->offDirectory + sizeof(HLLDIR) > cb)
     205    {
     206        fprintf(phOut, "error: offDirectory is incorrect! (cb=%d, off=%d)\n",
     207                cb, pHdr->offDirectory);
    207208        return ERROR_INVALID_DATA;
    208209    }
     
    221222     * Directory sanity check - check that it's not too big
    222223     */
    223     if ((PBYTE)&pDir->aEntries[pDir->cEntries] - pb >= cb)
     224    if ((PBYTE)&pDir->aEntries[pDir->cEntries] - pb > cb)
    224225    {
    225226        fprintf(phOut, "Error: Directory is to big!\n");
     
    290291            {
    291292                PHLLMODULE  pModule = (PHLLMODULE)(pDir->aEntries[i].off + pb);
    292                 PHLLOBJECT  paObjects;
     293                PHLLSEGINFO paSegInfo;
    293294                int         j, c;
    294295
     
    320321
    321322                /*
    322                  * Dump object data
     323                 * Dump Segment info
    323324                 */
    324325                fprintf(phOut,
    325                         "    Object %d\n"
    326                         "      iObj %#x\n"
    327                         "      off  %#x\n"
    328                         "      cb   %#x\n",
     326                        "    SegmentInfo %d\n"
     327                        "      iObject  %#x\n"
     328                        "      off       %#x\n"
     329                        "      cb        %#x\n",
    329330                        0,
    330                         pModule->Object.iObj,
    331                         pModule->Object.off,
    332                         pModule->Object.cb);
    333 
    334                 c = pModule->cObjects > 0 ? pModule->cObjects : 0;
    335                 paObjects = (PHLLOBJECT)((void*)&pModule->achName[pModule->cchName]);
     331                        pModule->SegInfo0.iObject,
     332                        pModule->SegInfo0.off,
     333                        pModule->SegInfo0.cb);
     334
     335                c = pModule->cSegInfo > 0 ? pModule->cSegInfo : 0;
     336                paSegInfo = (PHLLSEGINFO)((void*)&pModule->achName[pModule->cchName]);
    336337                for (j = 0; j < c; j++)
    337338                {
    338339                    fprintf(phOut,
    339                         "    Object %d\n"
    340                         "      iObj %#x\n"
    341                         "      off  %#x\n"
    342                         "      cb   %#x\n",
     340                        "    SegmentInfo %d\n"
     341                        "      iObject  %#x\n"
     342                        "      off       %#x\n"
     343                        "      cb        %#x\n",
    343344                        j + 1,
    344                         paObjects[j].iObj,
    345                         paObjects[j].off,
    346                         paObjects[j].cb);
     345                        paSegInfo[j].iObject,
     346                        paSegInfo[j].off,
     347                        paSegInfo[j].cb);
    347348                }
    348349                break;
     
    358359                    fprintf(phOut,
    359360                            "    %#03x:%#08x iType=%#2x  name=%.*s\n",
    360                             pPubSym->iObj,
     361                            pPubSym->iObject,
    361362                            pPubSym->off,
    362363                            pPubSym->iType,
  • trunk/tools/dbginfo/hll.h

    r3236 r3244  
    1 /* $Id: hll.h,v 1.2 2000-03-25 21:09:59 bird Exp $
     1/* $Id: hll.h,v 1.3 2000-03-26 21:56:37 bird Exp $
    22 *
    33 * HLL definitions.
     
    8787
    8888/*
    89  * HLL Object (LX Object = NE/OMF Segment)
     89 * HLL Segment
    9090 */
    91 typedef struct _HLLObject /*segment*/
     91typedef struct _HLLSegInfo
    9292{
    93     unsigned short  iObj;               /* LX Object number. */
     93    unsigned short  iObject;            /* LX Object number. */
    9494    unsigned long   off;                /* Offset into the load image. */
    9595    unsigned long   cb;                 /* Object length. */
    96 } HLLOBJECT, *PHLLOBJECT;
     96} HLLSEGINFO, *PHLLSEGINFO;
    9797
    9898
     
    102102typedef struct _HLLModule
    103103{
    104     HLLOBJECT       Object;             /* Description of an object. */
     104    HLLSEGINFO      SegInfo0;           /* Segment info entry 0. */
    105105    unsigned short  overlay;            /* unused. */
    106106    unsigned short  iLib;               /* Library number it came from. */
    107     unsigned char   cObjects;           /* Number of objects.*/
     107    unsigned char   cSegInfo;           /* Number of segment info entries. */
    108108    unsigned char   pad;                /* 1 byte padding. */
    109109    unsigned short  usDebugStyle;       /* Debug style -'HL' */
     
    112112    unsigned char   cchName;            /* Filename length. */
    113113    unsigned char   achName[1];         /* Filename. (*) */
    114     /* HLLOBJECT     aObjects[] */      /* Array of object descriptions. (Starts at achName[cchName+1]) */
     114    /* HLLSEGINFO      aSegInfo[] */    /* Array of segment info, starting with entry 1. (Starts at achName[cchName]) */
    115115} HLLMODULE, *PHLLMODULE;
    116116
     
    122122{
    123123    unsigned long   off;                /* 32-bit offset (into the LX object) of the symbol location. */
    124     unsigned short  iObj;               /* LX Object number. */
     124    unsigned short  iObject;            /* LX Object number. */
    125125    unsigned short  iType;              /* Symbol type index (into the type info data). */
    126126    unsigned char   cchName;            /* Size of name. */
  • trunk/tools/dbginfo/kHll.cpp

    r3239 r3244  
    1 /* $Id: kHll.cpp,v 1.3 2000-03-26 14:16:18 bird Exp $
     1/* $Id: kHll.cpp,v 1.4 2000-03-26 21:56:37 bird Exp $
    22 *
    33 * kHll - Implementation of the class kHll.
     
    101101/**
    102102 * Creates an HLL public symbol entry.
    103  * @param     pszName   Symbol name.
     103 * @param     pachName  Symbol name.
     104 * @param     cchName   Length of symbol name.
    104105 * @param     off       Offset into the object.
    105  * @param     iObj      LX Object index.
     106 * @param     iObject   LX Object index.
    106107 * @param     iType     Type index. (index into type table)
    107108 */
    108109kHllPubSymEntry::kHllPubSymEntry(
    109         const char *        pszName,
     110        const char *        pachName,
     111        int                 cchName,
    110112        unsigned long       off,
    111         unsigned short      iObj,
     113        unsigned short      iObject,
    112114        unsigned short      iType
    113115        )
    114116{
    115     pPubSym = (PHLLPUBLICSYM)malloc(strlen(pszName) + sizeof(HLLPUBLICSYM));
     117    pPubSym = (PHLLPUBLICSYM)malloc(cchName + sizeof(HLLPUBLICSYM));
    116118    assert(pPubSym != NULL);
    117119
    118     pPubSym->cchName = strlen(pszName);
    119     strcpy((char*)&pPubSym->achName[0], pszName);
     120    pPubSym->cchName = cchName;
     121    pPubSym->achName[0] = '\0';
     122    strncat((char*)&pPubSym->achName[0], pachName, cchName);
    120123    pPubSym->off = off;
    121     pPubSym->iObj = iObj;
     124    pPubSym->iObject = iObject;
    122125    pPubSym->iType = iType;
    123126}
     
    173176 * @param     pszName       Module name. (NULL is not allowed!)
    174177 * @param     iLib          Library index.
    175  * @param     cObjects      Number of objects in the array.
    176  * @param     paObjects     Pointer to an array of objects.
     178 * @param     cSegInfo      Number of objects in the array.
     179 * @param     paSegInfo     Pointer to an array of objects.
    177180 */
    178181kHllModuleEntry::kHllModuleEntry(
    179182        const char *        pszName,
    180183        unsigned short      iLib,
    181         unsigned char       cObjects/*= 0 */,
    182         PMODOBJECT          paObjects/*= NULL */
     184        unsigned char       cSegInfo/*= 0 */,
     185        PHLLSEGINFO         paSegInfo/*= NULL */
    183186        )
    184187: fValidOffsetsAndSizes(FALSE)
     
    186189    int         i;
    187190    int         cchName;
    188     PHLLOBJECT  pObj;
     191    PHLLSEGINFO pSegInfo;
    189192
    190193    /*
     
    192195     */
    193196    assert(pszName != NULL);
    194     assert(cObjects == 0 || paObjects != NULL);
     197    assert(cSegInfo == 0 || paSegInfo != NULL);
    195198
    196199    /*
     
    199202    cchName = strlen(pszName);
    200203    pModule = (PHLLMODULE)malloc(sizeof(HLLMODULE) + cchName +
    201                                  sizeof(HLLOBJECT) * min((cObjects - 1), 3));
     204                                 sizeof(HLLSEGINFO) * min((cSegInfo - 1), 3));
    202205    assert(pModule != NULL);
    203206    memset(pModule, 0, sizeof(*pModule));
     
    206209    pModule->chVerMajor = 4;
    207210    pModule->chVerMinor = 0;
    208     pModule->cObjects = cObjects;
     211    pModule->cSegInfo = cSegInfo;
    209212    pModule->iLib = iLib;
    210213    pModule->usDebugStyle = HLL_MOD_STYLE;
     
    213216
    214217    /* objects */
    215     if (cObjects > 0)
    216     {
    217         pModule->Object.cb   = paObjects->cb;
    218         pModule->Object.iObj = paObjects->iObject;
    219         pModule->Object.off  = paObjects->offset;
    220 
    221         for (i = 1, pObj = (PHLLOBJECT)&pModule->achName[cchName]; i < cObjects; i++, pObj++)
     218    if (cSegInfo > 0)
     219    {
     220        pModule->SegInfo0.iObject = paSegInfo->iObject;
     221        pModule->SegInfo0.cb      = paSegInfo->cb;
     222        pModule->SegInfo0.off     = paSegInfo->off;
     223
     224        for (i = 1, pSegInfo = (PHLLSEGINFO)&pModule->achName[cchName]; i < cSegInfo; i++, pSegInfo++)
    222225        {
    223             pObj->cb   = paObjects[i].cb;
    224             pObj->iObj = paObjects[i].iObject;
    225             pObj->off  = paObjects[i].offset;
     226            pSegInfo->iObject   = paSegInfo[i].iObject;
     227            pSegInfo->cb        = paSegInfo[i].cb;
     228            pSegInfo->off       = paSegInfo[i].off;
    226229        }
    227230    }
     
    248251 * @param     cb        Size of module data (in the object).
    249252 */
    250 BOOL            kHllModuleEntry::addObject(
     253BOOL            kHllModuleEntry::addSegInfo(
    251254                    unsigned short int  iObject,
    252255                    unsigned long       off,
     
    259262     * Reallocate? (Note that we'll initially allocated space for 3 objects.)
    260263     */
    261     if (pModule->cObjects >= 3)
     264    if (pModule->cSegInfo >= 3)
    262265    {
    263266        void *pv = realloc(pModule, sizeof(HLLMODULE) + pModule->cchName
    264                            + (pModule->cObjects + 1) * sizeof(HLLOBJECT));
     267                           + (pModule->cSegInfo + 1) * sizeof(HLLSEGINFO));
    265268        assert(pv != NULL);
    266269        if (pv == NULL)
     
    273276     * Add module.
    274277     */
    275     if (pModule->cObjects == 0)
    276     {
    277         pModule->Object.cb = cb;
    278         pModule->Object.off = off;
    279         pModule->Object.iObj = iObject;
     278    if (pModule->cSegInfo == 0)
     279    {
     280        pModule->SegInfo0.cb = cb;
     281        pModule->SegInfo0.off = off;
     282        pModule->SegInfo0.iObject = iObject;
    280283    }
    281284    else
    282285    {
    283         PHLLOBJECT pObject =  (PHLLOBJECT)(pModule->cObjects * sizeof(HLLOBJECT)
    284                                            + pModule->achName[pModule->cchName]);
    285         pObject->cb = cb;
    286         pObject->off = off;
    287         pObject->iObj = iObject;
    288     }
    289     pModule->cObjects++;
     286        PHLLSEGINFO pSegInfo =  (PHLLSEGINFO)(pModule->cSegInfo * sizeof(HLLSEGINFO)
     287                                              + pModule->achName[pModule->cchName]);
     288        pSegInfo->cb = cb;
     289        pSegInfo->off = off;
     290        pSegInfo->iObject = iObject;
     291    }
     292    pModule->cSegInfo++;
    290293
    291294    return TRUE;
     
    309312                    )
    310313{
     314    assert(pszName != NULL);
     315    return addPublicSymbol(pszName, strlen(pszName), off, iObject, pvType);
     316}
     317
     318
     319
     320/**
     321 * Adds a public symbol.
     322 * @returns   Handle to the symbol. NULL on error.
     323 * @param     pachName   Symbol name.
     324 * @param     cchName    Name length.
     325 * @param     off        Offset into the LX Object of the symbol.
     326 * @param     iObject    LX Object index.
     327 * @param     pvType     Type handle. NULL if not type.
     328 */
     329const void *    kHllModuleEntry::addPublicSymbol(
     330                    const char *        pachName,
     331                    int                 cchName,
     332                    unsigned long int   off,
     333                    unsigned short int  iObject,
     334                    const void *        pvType
     335                    )
     336{
    311337    kHllPubSymEntry *   pEntry;
    312338
    313339    /* parameter assertion */
    314     assert(pszName != NULL);
     340    assert(pachName != NULL);
    315341
    316342    /*
     
    320346     */
    321347    pEntry = new kHllPubSymEntry(
    322         pszName,
     348        pachName,
     349        cchName,
    323350        off,
    324351        iObject,
     
    332359    return pEntry;
    333360}
     361
    334362
    335363
     
    616644     */
    617645    hllHdr.offDirectory = lPosDir - lPosStart;
     646    if (fseek(phFile, lPosStart, SEEK_SET) != 0)
     647        return -2;
    618648    cch = fwrite(&hllHdr, 1, sizeof(hllHdr), phFile);
    619649    if (cch != sizeof(hllHdr))
    620650        return -1;
    621 
    622651
    623652    return cch;
     
    649678 * @param    pszName    Module name
    650679 * @param    pvLib      Library module handle.
    651  * @param    cObjects   Number of objects in the array.
    652  * @param    paObjects  Pointer to an array of objects.
     680 * @param    cSegInfo   Number of objects in the array.
     681 * @param    paSegInfo  Pointer to an array of objects.
    653682 */
    654683kHllModuleEntry *   kHll::addModule(
    655684                        const char *        pszName,
    656685                        const void *        pvLib,
    657                         unsigned            cObjects,
    658                         PMODOBJECT          paObjects)
     686                        unsigned            cSegInfo,
     687                        PHLLSEGINFO         paSegInfo)
    659688{
    660689    kHllModuleEntry *   pEntry;
     
    664693        pszName,
    665694        pvLib == NULL ? 0 : -1, //FIXME/TODO: Libs->getIndex(pvLib); check if 0 or -1;
    666         cObjects,
    667         paObjects);
     695        cSegInfo,
     696        paSegInfo);
     697
     698    Modules.insert(pEntry);
     699    return pEntry;
     700}
     701
     702
     703
     704/**
     705 * Adds a module.
     706 * @returns  Pointer to the module object added. NULL on error.
     707 * @param    pachName   Module name
     708 * @param    cchName    Length of modulename
     709 * @param    pvLib      Library module handle.
     710 * @param    cSegInfo   Number of objects in the array.
     711 * @param    paSegInfo  Pointer to an array of objects.
     712 */
     713kHllModuleEntry *   kHll::addModule(
     714                        const char *        pachName,
     715                        unsigned            cchName,
     716                        const void *        pvLib,
     717                        unsigned            cSegInfo,
     718                        PHLLSEGINFO         paSegInfo)
     719{
     720    char szModName[256];
     721    kHllModuleEntry *   pEntry;
     722    assert(pachName != NULL && cchName > 0);
     723
     724    szModName[0] = '\0';
     725    strncat(szModName, pachName, min(cchName, 255));
     726    pEntry = new kHllModuleEntry(
     727        szModName,
     728        pvLib == NULL ? 0 : -1, //FIXME/TODO: Libs->getIndex(pvLib); check if 0 or -1;
     729        cSegInfo,
     730        paSegInfo);
    668731
    669732    Modules.insert(pEntry);
     
    733796        if (cch == sizeof(ehdr))
    734797        {
    735             if (ehdr.e_magic == NEMAGIC)
     798            if (ehdr.e_magic == EMAGIC)
    736799                lPosLXHdr = ehdr.e_lfanew;
    737800            else
     
    748811                         * Check if there is any debug info.
    749812                         */
    750                         if (e32.e32_debuginfo > 0 && e32.e32_debuginfo > 0)
     813                        if (e32.e32_debuginfo == 0 && e32.e32_debuginfo == 0)
    751814                        {
    752815                            long lPosDebug;
  • trunk/tools/dbginfo/kHll.h

    r3239 r3244  
    1 /* $Id: kHll.h,v 1.3 2000-03-26 14:16:19 bird Exp $
     1/* $Id: kHll.h,v 1.4 2000-03-26 21:56:38 bird Exp $
    22 *
    33 * kHll - Declarations of the class kHll.
     
    1818*   Structures and Typedefs                                                    *
    1919*******************************************************************************/
    20 /**
    21  * Module object(=segment) description.
    22  */
    23 typedef struct
    24 {
    25     unsigned short  iObject;            /* LX Object index. */
    26     unsigned long   cb;                 /* Size of object part. */
    27     unsigned long   offset;             /* Offset into the LX Object. */
    28 } MODOBJECT, *PMODOBJECT;
    29 
    30 
    3120
    3221/**
     
    6453public:
    6554    kHllPubSymEntry(
    66         const char *        pszName,
     55        const char *        pachName,
     56        int                 cchName,
    6757        unsigned long       off,
    68         unsigned short      iObj,
     58        unsigned short      iObject,
    6959        unsigned short      iType
    7060        );
     
    124114        const char *        pszName,
    125115        unsigned short      iLib,
    126         unsigned char       cObjects = 0,
    127         PMODOBJECT          paObjects = NULL
     116        unsigned char       cSegInfo = 0,
     117        PHLLSEGINFO         paSegInfo = NULL
    128118        );
    129119    ~kHllModuleEntry();
     
    133123     * Add menthods
    134124     */
    135     BOOL            addObject(
     125    BOOL            addSegInfo(
    136126                        unsigned short int  iObject,
    137127                        unsigned long       off,
     
    145135                        const void *        pvType
    146136                        );
     137    const void *    addPublicSymbol(
     138                        const char *        pachName,
     139                        int                 cchName,
     140                        unsigned long int   off,
     141                        unsigned short int  iObject,
     142                        const void *        pvType
     143                        );
    147144
    148145
     
    191188                            const char *        pszName,
    192189                            const void *        pvLib,
    193                             unsigned            cObjects,
    194                             PMODOBJECT          paObjects
     190                            unsigned            cSegInfo = 0,
     191                            PHLLSEGINFO         paSegInfo = NULL
     192                            );
     193    kHllModuleEntry *   addModule(
     194                            const char *        pachName,
     195                            unsigned            cchName,
     196                            const void *        pvLib,
     197                            unsigned            cSegInfo = 0,
     198                            PHLLSEGINFO         paSegInfo = NULL
    195199                            );
    196200
Note: See TracChangeset for help on using the changeset viewer.