Changeset 3286 for trunk/tools


Ignore:
Timestamp:
Mar 31, 2000, 5:35:10 PM (25 years ago)
Author:
bird
Message:

IBMSRC record somewhat dumpable.

Location:
trunk/tools/dbginfo
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/dbginfo/dbgLXDumper.c

    r3248 r3286  
    1 /* $Id: dbgLXDumper.c,v 1.5 2000-03-27 12:36:16 bird Exp $
     1/* $Id: dbgLXDumper.c,v 1.6 2000-03-31 15:35:08 bird Exp $
    22 *
    33 * dbgLXDumper - reads and interprets the debuginfo found in an LX executable.
     
    1616#define DWORD               ULONG       /* Used by exe386.h / newexe.h */
    1717#define WORD                USHORT      /* Used by exe386.h / newexe.h */
     18
     19#define HLLVERSION100       0x0100
     20#define HLLVERSION300       0x0300
     21#define HLLVERSION400       0x0400
     22#define HLLVERSION500       0x0500
    1823
    1924
     
    179184int dumpHLL(FILE *phOut, PBYTE pb, int cb)
    180185{
    181     PHLLDIR     pDir;
    182     int         i;
    183     PHLLHDR     pHdr = (PHLLHDR)pb;
     186    int             i, j, k;            /* loop variables! */
     187    unsigned long   ulHLLVersion = 0;   /* HLL version of the last module. */
     188    PHLLDIR         pDir;
     189    PHLLHDR         pHdr = (PHLLHDR)pb;
    184190
    185191    /*
     
    292298                PHLLMODULE  pModule = (PHLLMODULE)(pDir->aEntries[i].off + pb);
    293299                PHLLSEGINFO paSegInfo;
    294                 int         j, c;
     300                int         c;
    295301
    296302                /*
     
    321327                        );
    322328
     329                ulHLLVersion = pModule->chVerMajor*0x100 + pModule->chVerMinor;
     330
    323331
    324332                /*
     
    389397                break;
    390398
    391             case HLL_DE_IBMSRC:         /* Line numbers - (IBM HLL) */
    392                 break;
     399            /*
     400             * Line numbers - (IBM HLL)
     401             *
     402             * HLL 04 have a FirstEntry before each table.
     403             * HLL 03 don't seem to have... This is not implemented yet.
     404             */
     405            case HLL_DE_IBMSRC:
     406            {
     407                PHLLFIRSTENTRY      pFirstEntry = (PHLLFIRSTENTRY)(pb + pDir->aEntries[i].off);
     408                int                 cbFirstEntry;
     409                int                 cb;
     410
     411
     412                /*
     413                 * Set the size of an first entry struct based on the HLL version.
     414                 */
     415                if (ulHLLVersion == HLLVERSION100)
     416                    cbFirstEntry = sizeof(pFirstEntry->hll01);
     417                else
     418                    cbFirstEntry = sizeof(pFirstEntry->hll04);
     419
     420
     421                /*
     422                 * Loop thru all the arrays in this data directory.
     423                 * Each array starts with an HLLFIRSTENTRY structure.
     424                 */
     425                cb = pDir->aEntries[i].cb;
     426                while (cb >= cbFirstEntry)
     427                {
     428                    int     cbEntries;
     429
     430                    /*
     431                     * Dump the special first entry.
     432                     */
     433                    fprintf(phOut,
     434                            "    First entry:\n"
     435                            "      uchType          0x%02x\n"
     436                            "      uchReserved      0x%02x\n"
     437                            "      cEntries         0x%04x\n"
     438                            "      iSeg             0x%04x\n"
     439                            "      offBase/cb       0x%08x\n",
     440                            pFirstEntry->hll04.uchType,
     441                            pFirstEntry->hll04.uchReserved,
     442                            pFirstEntry->hll04.cEntries,
     443                            pFirstEntry->hll04.iSeg,
     444                            pFirstEntry->hll04.u1.offBase
     445                            );
     446
     447                    switch (pFirstEntry->hll03.uchType)
     448                    {
     449                        /*
     450                         * Source File information and offset only.
     451                         */
     452                        case 0:
     453                        {
     454                            int                 cbLine;
     455                            PHLLLINENUMBERENTRY pLines =
     456                                (PHLLLINENUMBERENTRY)((char*)pFirstEntry + cbFirstEntry);
     457
     458                            /*
     459                             * Determin size of a line entry.
     460                             */
     461                            if (ulHLLVersion == HLLVERSION100)
     462                                cbLine = sizeof(pLines->hll01);
     463                            else
     464                                cbLine = sizeof(pLines->hll03);
     465
     466                            /*
     467                             * Loop thru all the line info and dump it.
     468                             */
     469                            fprintf(phOut, "      Lineinfo:\n");
     470                            for (k = 0; k < pFirstEntry->hll01.cEntries; k++) /* cEntries is similar for all formats. */
     471                            {
     472                                fprintf(phOut,
     473                                        "          usLine=%4d (0x%02x)  iusSourceFile=0x%04x  off=0x%08x\n",
     474                                        pLines->hll04.usLine,
     475                                        pLines->hll04.usLine,
     476                                        pLines->hll04.iusSourceFile,
     477                                        pLines->hll04.off
     478                                        );
     479                                /* next */
     480                                pLines = (PHLLLINENUMBERENTRY)((char*)pLines + cbLine);
     481                            }
     482
     483                            cbEntries = cbLine * pFirstEntry->hll01.cEntries; /* cEntries is similar for all formats. */
     484                            break;
     485                        }
     486
     487
     488                        /*
     489                         * Filenames.
     490                         */
     491                        case 3:
     492                        {
     493                            PCHAR               pch;
     494                            PHLLFILENAMEENTRY   pFilenameEntry =
     495                                (PHLLFILENAMEENTRY)((char*)pFirstEntry + cbFirstEntry);
     496
     497                            fprintf(phOut,
     498                                    "    FilenameEntry:\n"
     499                                    "      offSource        0x%08x\n"
     500                                    "      cSourceRecords   0x%08x\n"
     501                                    "      cSourceFiles     0x%08x\n"
     502                                    "      cchName          0x%02x\n",
     503                                    pFilenameEntry->offSource,
     504                                    pFilenameEntry->cSourceRecords,
     505                                    pFilenameEntry->cSourceFiles,
     506                                    pFilenameEntry->cchName
     507                                    );
     508
     509                            fprintf(phOut,
     510                                    "      Filenames:\n");
     511                            pch = &pFilenameEntry->cchName;
     512                            for (k = 0; k < pFilenameEntry->cSourceFiles; k++)
     513                            {
     514                                fprintf(phOut,
     515                                        "        %.*s\n", *pch, pch+1);
     516                                /* next */
     517                                cbEntries += 1 + *pch;
     518                                pch += 1 + *pch;
     519                            }
     520
     521                            if (ulHLLVersion == HLLVERSION100)
     522                                cbEntries = pFirstEntry->hll01.u1.cbFileNameTable;
     523                            else
     524                                cbEntries = pFirstEntry->hll03.u1.cbFileNameTable;
     525                            break;
     526                        }
     527
     528
     529                        default:
     530                            fprintf(phOut, "warning: unsupported entry type, %d\n", pFirstEntry->hll03.uchType);
     531                            cbEntries = cb = 0;
     532                    }
     533
     534
     535                    /*
     536                     * Next
     537                     */
     538                    cb -= cbEntries + sizeof(HLLFIRSTENTRY);
     539                    pFirstEntry = (PHLLFIRSTENTRY)((char*)pFirstEntry + cbEntries + sizeof(HLLFIRSTENTRY));
     540                }
     541
     542                dumpHex(phOut,
     543                        pDir->aEntries[i].off + pb,
     544                        pDir->aEntries[i].cb);
     545                break;
     546            }
    393547
    394548            default:
     
    401555    /* - temporary - */
    402556    printf("\ndumps debug data\n");
    403     dumpHex(stdout, pb, cb);
     557    dumpHex(phOut, pb, cb);
    404558
    405559    return NO_ERROR;
  • trunk/tools/dbginfo/hll.h

    r3248 r3286  
    1 /* $Id: hll.h,v 1.4 2000-03-27 12:36:17 bird Exp $
     1/* $Id: hll.h,v 1.5 2000-03-31 15:35:09 bird Exp $
    22 *
    33 * HLL definitions.
     
    130130
    131131
    132 
     132/*
     133 * HLL First entry of the IBMSRC data.
     134 */
     135typedef union _HLLFirstEntry
     136{
     137    struct
     138    {
     139        unsigned short  usLine;
     140        unsigned char   uchType;
     141        unsigned char   uchReserved;
     142        unsigned short  cEntries;
     143        union
     144        {
     145            unsigned short  cbFileNameTable;
     146            unsigned short  cPathTableEntries;
     147            unsigned short  offBase;
     148        } u1;
     149    } hll01;
     150    struct
     151    {
     152        unsigned short  usLine;
     153        unsigned char   uchType;
     154        unsigned char   uchReserved;
     155        unsigned short  cEntries;
     156        unsigned short  iSeg;
     157        union
     158        {
     159            unsigned long   cbFileNameTable;
     160            unsigned long   cPathTableEntries;
     161            unsigned long   offBase;
     162        } u1;
     163    } hll03, hll04;
     164} HLLFIRSTENTRY, *PHLLFIRSTENTRY;
     165
     166
     167/*
     168 * HLL Source filename entry.
     169 */
     170typedef struct _HLLFilenameEntry
     171{
     172    unsigned long   offSource;
     173    unsigned long   cSourceRecords;
     174    unsigned long   cSourceFiles;
     175    unsigned char   cchName;
     176    unsigned char   achName[1];
     177} HLLFILENAMEENTRY, *PHLLFILENAMEENTRY;
     178
     179
     180/*
     181 * HLL Linenumber entry.
     182 */
     183typedef union _HLLLinenumberEntry
     184{
     185    struct
     186    {
     187        unsigned short  usLine;
     188        unsigned char   ichSourceFile;
     189        unsigned char   chFlags;
     190        unsigned long   off;
     191    } hll01;
     192    struct
     193    {
     194        unsigned short  usLine;
     195        unsigned short  iusSourceFile;
     196        unsigned long   off;
     197    } hll03, hll04;
     198} HLLLINENUMBERENTRY, *PHLLLINENUMBERENTRY;
     199
     200
     201/*
     202 * HLL Path entry (HLL 01)
     203 */
     204typedef struct _HLLPathEntry_HL01
     205{
     206    unsigned long   off;
     207    unsigned short  usPathcode;
     208} HLLPATHENTRY_HL01, *PHLLPATHENTRY_HL01;
    133209
    134210
  • trunk/tools/dbginfo/kHll.cpp

    r3249 r3286  
    1 /* $Id: kHll.cpp,v 1.8 2000-03-27 12:52:13 bird Exp $
     1/* $Id: kHll.cpp,v 1.9 2000-03-31 15:35:09 bird Exp $
    22 *
    33 * kHll - Implementation of the class kHll.
     
    659659     * Hacking:
    660660     * Writing an extra HLL header pointing to an non-existing directory
    661      * staring at the last byte of this header.
     661     * staring at the last byte of this header. This is present when linking
     662     * with ilink...
    662663     */
    663664    if (fseek(phFile, lPosStart + cchWritten, SEEK_SET) != 0)
  • trunk/tools/dbginfo/makefile

    r3247 r3286  
    1 # $Id: makefile,v 1.1 2000-03-27 10:20:42 bird Exp $
     1# $Id: makefile,v 1.2 2000-03-31 15:35:10 bird Exp $
    22
    33
     
    88
    99
    10 dbgLXDumper.exe:
    11     icc /Ti+ dbgLXDumper.c
     10dbgLXDumper.obj: dbgLXDumper.c hll.h
     11    icc -c /Ti+ dbgLXDumper.c
     12
     13dummy.c:
     14    echo creating <<$@
     15/* dummy.c */
     16int idummy;
     17<<keep
     18
     19dummy.obj: dummy.c
     20    icc -c  $**
     21
     22dbgLXDumper.exe: dbgLXDumper.obj dummy.obj
     23    icc /Ti+ dbgLXDumper.obj dummy.obj
    1224
    1325
Note: See TracChangeset for help on using the changeset viewer.