Changeset 3630 for trunk/tools


Ignore:
Timestamp:
May 29, 2000, 9:46:29 PM (25 years ago)
Author:
bird
Message:

Work in progress...

Location:
trunk/tools/dbginfo
Files:
2 edited

Legend:

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

    r3614 r3630  
    1 /* $Id: kHll.cpp,v 1.13 2000-05-27 02:15:41 bird Exp $
     1/* $Id: kHll.cpp,v 1.14 2000-05-29 19:46:28 bird Exp $
    22 *
    33 * kHll - Implementation of the class kHll.
     
    9595
    9696/**
    97  * Loops thru the given list and call the dump function for each
     97 * Loops thru the given list and call the dump method for each
    9898 * node with the passed in parameters.
    9999 * @param       ph          Dump file handle.
     
    114114
    115115
     116/**
     117 * Loops thru the given list and call the ida method for each
     118 * node with the passed in parameters.
     119 * !!!NOTE!!! THIS IS ONLY TO BE USED FOR YOUR OWN PROGRAMS!!!
     120 * @param       pFile   Output file.
     121 * @param       pEntry      Indent.
     122 */
     123void kHllBaseEntry::idaList(kFile *pFile, kHllBaseEntry *pEntry)
     124{
     125    /*
     126     * Loop thru the list staring at pEntry and call ida for each entry.
     127     */
     128    while (pEntry != NULL)
     129    {
     130        pEntry->ida(pFile);
     131        pEntry = (kHllBaseEntry*)pEntry->getNext();
     132    }
     133}
    116134
    117135
     
    200218     * Dump public symbol entry
    201219     */
    202     fprintf(ph, "%*.s0x%04x:0x%08x  type:%04d(0x%04)  name: %.*s\n",
     220    fprintf(ph, "%*.s0x%04x:0x%08x  type:%5d(0x%04x)  name: %.*s\n",
    203221            cchIndent, "",
    204222            pPubSym->iObject,
     
    206224            pPubSym->iType,
    207225            pPubSym->iType,
    208             pPubSym->cchName, pPubSym->achName
     226            pPubSym->cchName, &pPubSym->achName[0]
    209227            );
    210228}
     229
     230
     231/**
     232 * Create IDC (IDA Pro) calls which adds info contained in the entry
     233 * to the ida pro database.
     234 * !!!NOTE!!! THIS IS ONLY TO BE USED FOR YOUR OWN PROGRAMS!!!
     235 * @param       pFile   Output file.
     236 */
     237void            kHllPubSymEntry::ida(kFile *pFile) throw(int)
     238{
     239    #if 0
     240    pFile->printf("    /* PubSym %.*s */\n",
     241                  pPubSym->cchName, &pPubSym->achName[0]);
     242    #endif
     243    pFile->printf("    ea = SegByBase(%d) + 0x%08x; MakeName(ea, \"\"); MakeName(ea, \"%.*s\");\n",
     244                  pPubSym->iObject,
     245                  pPubSym->off,
     246                  pPubSym->cchName, &pPubSym->achName[0]
     247                  );
     248}
     249
     250
     251
     252
    211253
    212254
     
    383425
    384426
     427/**
     428 * Create IDC (IDA Pro) calls which adds info contained in the entry
     429 * to the ida pro database.
     430 * !!!NOTE!!! THIS IS ONLY TO BE USED FOR YOUR OWN PROGRAMS!!!
     431 * @param       pFile   Output file.
     432 */
     433void            kHllLineNumberChunk::ida(kFile *pFile) throw(int)
     434{
     435    pFile->printf("    /* Line number chunk */\n");
     436}
     437
     438
     439
     440
    385441
    386442
     
    624680}
    625681
     682
     683/**
     684 * Create IDC (IDA Pro) calls which adds info contained in the entry
     685 * to the ida pro database.
     686 * !!!NOTE!!! THIS IS ONLY TO BE USED FOR YOUR OWN PROGRAMS!!!
     687 * @param       pFile   Output file.
     688 */
     689void            kHllSrcEntry::ida(kFile *pFile) throw(int)
     690{
     691    pFile->printf("    /* Source entry */\n");
     692}
    626693
    627694
     
    10591126
    10601127
     1128/**
     1129 * Create IDC (IDA Pro) calls which adds info contained in the entry
     1130 * to the ida pro database.
     1131 * !!!NOTE!!! THIS IS ONLY TO BE USED FOR YOUR OWN PROGRAMS!!!
     1132 * @param       pFile   Output file.
     1133 */
     1134void            kHllModuleEntry::ida(kFile *pFile) throw(int)
     1135{
     1136    pFile->printf("    /* kHllModuleEntry */\n");
     1137
     1138    /*
     1139     * Write the sub-entries.
     1140     */
     1141    kHllBaseEntry::idaList(pFile, PublicSymbols.getFirst());
     1142    /*
     1143    kHllBaseEntry::dumpList(ph, 8, Types.getFirst());
     1144    kHllBaseEntry::dumpList(ph, 8, Symbols.getFirst());
     1145    kHllBaseEntry::dumpList(ph, 8, Source.getFirst());
     1146    */
     1147    Source.ida(pFile);
     1148}
    10611149
    10621150
     
    12891377                if (paSegInfo != NULL)
    12901378                    free(paSegInfo);
    1291                 fprintf(stderr, "Module directory entry: %s\n", szName);
    12921379                break;
    12931380            }
    12941381
    1295             case HLL_DE_PUBLICS:        /* Public symbols */
    1296                 fprintf(stderr, "Publics directory entry\n");
    1297                 break;
     1382
     1383            /*
     1384             * Public symbols
     1385             */
     1386            case HLL_DE_PUBLICS:
     1387            {
     1388                HLLPUBLICSYM  pubSym;
     1389
     1390                if (pCurMod == NULL || iCurMod != pDirEntry->iMod)
     1391                {
     1392                    fprintf(stderr, "hmm. iMod in public entry not equal to current module\n");
     1393                    break;
     1394                }
     1395
     1396                fprintf(stderr, "HLL_DE_PUBLICS\n");
     1397                pFile->set(pDirEntry->off + offHllHdr);
     1398                while (pFile->getPos() - pDirEntry->off - offHllHdr < pDirEntry->cb)
     1399                {
     1400                    pFile->read(&pubSym, sizeof(pubSym) - 1);
     1401                    pFile->read(szName, pubSym.cchName);
     1402                    szName[pubSym.cchName] = '\0';
     1403
     1404                    fprintf(stderr, "HLL_DE_PUBLICS\n");
     1405                    pCurMod->addPublicSymbol(szName,
     1406                                             pubSym.cchName,
     1407                                             pubSym.off,
     1408                                             pubSym.iObject,
     1409                                             (void*)pubSym.iType);
     1410                }
     1411            }
    12981412
    12991413            case HLL_DE_TYPES:          /* Types */
     
    14291543            this, Modules.getCount());
    14301544}
     1545
     1546
     1547/**
     1548 * Create IDC (IDA Pro) scripts which adds debuginfo to the ida pro database.
     1549 * !!!NOTE!!! THIS IS ONLY TO BE USED FOR YOUR OWN PROGRAMS!!!
     1550 * @param       pFile   Output file.
     1551 */
     1552void            kHll::ida(kFile *pFile) throw(int)
     1553{
     1554    pFile->printf("/* !!!NOTE!!! THIS IS ONLY TO BE USED FOR YOUR OWN PROGRAMS!!!*/\n"
     1555                  "#include <idc.idc>\n"
     1556                  "static main() {\n"
     1557                  "    auto ea;\n"
     1558                  );
     1559
     1560    kHllModuleEntry *   pMod =  Modules.getFirst();
     1561    while (pMod != NULL)
     1562    {
     1563        /* Dump it */
     1564        pMod->ida(pFile);
     1565
     1566        /* Next module */
     1567        pMod = (kHllModuleEntry*)pMod->getNext();
     1568    }
     1569
     1570    pFile->printf("}\n\n");
     1571}
     1572
    14311573
    14321574
     
    16701812    kHll *pHll;
    16711813
    1672     /* read my self */
    1673     pHll = kHll::readLX(argv[0]);
     1814    /* read last argument */
     1815    pHll = kHll::readLX(argv[argc-1]);
    16741816    if (pHll)
    16751817    {
    16761818        printf("Successfully read %s\n", argv[0]);
    16771819        pHll->dump();
     1820        kFile kidc("dbg.idc", FALSE);
     1821        pHll->ida(&kidc);
    16781822    }
    16791823    argc = argc;
  • trunk/tools/dbginfo/kHll.h

    r3614 r3630  
    1 /* $Id: kHll.h,v 1.8 2000-05-27 02:15:42 bird Exp $
     1/* $Id: kHll.h,v 1.9 2000-05-29 19:46:29 bird Exp $
    22 *
    33 * kHll - Declarations of the class kHll.
     
    4646    virtual void    dump(FILE *ph, int cchIndent) = 0;
    4747    static  void    dumpList(FILE *ph, int cchIndent, kHllBaseEntry *pEntry);
     48
     49    /**
     50     * Create IDC (IDA Pro) calls which adds info contained in the entry
     51     * to the ida pro database.
     52     * !!!NOTE!!! THIS IS ONLY TO BE USED FOR YOUR OWN PROGRAMS!!!
     53     * @param       pFile   Output file.
     54     */
     55    virtual void    ida(kFile *pFile) throw(int) = 0;
     56    static void     idaList(kFile *pFile, kHllBaseEntry *pEntry) throw(int);
    4857};
    4958
     
    7180    int             write(FILE *phFile);
    7281    void            dump(FILE *ph, int cchIndent);
     82    void            ida(kFile *pFile) throw(int);
    7383};
    7484
     
    100110    int             write(FILE *phFile);
    101111    void            dump(FILE *ph, int cchIndent);
     112    void            ida(kFile *pFile) throw(int);
    102113
    103114    int             getSeg()    { return FirstEntry.hll04.iSeg; }
     
    138149    int             write(FILE *phFile);
    139150    void            dump(FILE *ph, int cchIndent);
     151    void            ida(kFile *pFile) throw(int);
    140152};
    141153
     
    232244     */
    233245    void            dump(FILE *ph);
     246    void            ida(kFile *pFile) throw(int);
    234247};
    235248
     
    305318     */
    306319    void                dump();
     320    void                ida(kFile *pFile) throw(int);
    307321};
    308322
Note: See TracChangeset for help on using the changeset viewer.