| 1 | /* $Id: kHll.h,v 1.4 2000-03-26 21:56:38 bird Exp $
|
|---|
| 2 | *
|
|---|
| 3 | * kHll - Declarations of the class kHll.
|
|---|
| 4 | * That class is used to create HLL debuginfo.
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 7 | *
|
|---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 9 | *
|
|---|
| 10 | */
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 | #ifndef _kHll_h_
|
|---|
| 14 | #define _kHll_h_
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | /*******************************************************************************
|
|---|
| 18 | * Structures and Typedefs *
|
|---|
| 19 | *******************************************************************************/
|
|---|
| 20 |
|
|---|
| 21 | /**
|
|---|
| 22 | * HLL General entry.
|
|---|
| 23 | * Provided as a base class for kList entries.
|
|---|
| 24 | * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 25 | */
|
|---|
| 26 | class kHllBaseEntry : public kListEntry
|
|---|
| 27 | {
|
|---|
| 28 | public:
|
|---|
| 29 | /**
|
|---|
| 30 | * Write this HLL entry to file.
|
|---|
| 31 | * @returns Count of bytes written (on success).
|
|---|
| 32 | * -3 Invalid offsets.
|
|---|
| 33 | * -2 Seek error.
|
|---|
| 34 | * -1 Write error.
|
|---|
| 35 | * 0 No data written. Concidered as an error!
|
|---|
| 36 | * @param phFile Filehandle.
|
|---|
| 37 | */
|
|---|
| 38 | virtual int write(FILE *phFile) = 0;
|
|---|
| 39 | static int writeList(FILE *phFile, kHllBaseEntry *pEntry);
|
|---|
| 40 | };
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | /**
|
|---|
| 45 | * HLL Public symbol entry.
|
|---|
| 46 | * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 47 | */
|
|---|
| 48 | class kHllPubSymEntry : public kHllBaseEntry
|
|---|
| 49 | {
|
|---|
| 50 | private:
|
|---|
| 51 | PHLLPUBLICSYM pPubSym;
|
|---|
| 52 |
|
|---|
| 53 | public:
|
|---|
| 54 | kHllPubSymEntry(
|
|---|
| 55 | const char * pachName,
|
|---|
| 56 | int cchName,
|
|---|
| 57 | unsigned long off,
|
|---|
| 58 | unsigned short iObject,
|
|---|
| 59 | unsigned short iType
|
|---|
| 60 | );
|
|---|
| 61 | ~kHllPubSymEntry();
|
|---|
| 62 |
|
|---|
| 63 | int write(FILE *phFile);
|
|---|
| 64 | };
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | /**
|
|---|
| 69 | * HLL Module entry.
|
|---|
| 70 | * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 71 | */
|
|---|
| 72 | class kHllModuleEntry : public kListEntry
|
|---|
| 73 | {
|
|---|
| 74 | private:
|
|---|
| 75 | /** @cat
|
|---|
| 76 | * Internal data.
|
|---|
| 77 | * HLL Module data.
|
|---|
| 78 | * Lists of HLL elements
|
|---|
| 79 | * Offsets and sizes - set by write(..).
|
|---|
| 80 | */
|
|---|
| 81 | PHLLMODULE pModule;
|
|---|
| 82 |
|
|---|
| 83 | kList<kHllPubSymEntry> PublicSymbols;
|
|---|
| 84 | /*
|
|---|
| 85 | kList<kHllTypeEntry> Types;
|
|---|
| 86 | kList<kHllSymEntry> Symbols;
|
|---|
| 87 | kList<kHllSrcEntry> Source;
|
|---|
| 88 | */
|
|---|
| 89 |
|
|---|
| 90 | BOOL fValidOffsetsAndSizes;
|
|---|
| 91 | unsigned long offModule;
|
|---|
| 92 | unsigned long cbModule;
|
|---|
| 93 | unsigned long offPublicSymbols;
|
|---|
| 94 | unsigned long cbPublicSymbols;
|
|---|
| 95 | unsigned long offTypes;
|
|---|
| 96 | unsigned long cbTypes;
|
|---|
| 97 | unsigned long offSymbols;
|
|---|
| 98 | unsigned long cbSymbols;
|
|---|
| 99 | unsigned long offSource;
|
|---|
| 100 | unsigned long cbSource;
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 | /** @cat
|
|---|
| 104 | * Internal methods.
|
|---|
| 105 | */
|
|---|
| 106 | int writeList(FILE *phFile, kList<kHllBaseEntry> &List);
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 | public:
|
|---|
| 110 | /** @cat
|
|---|
| 111 | * Constructor and destructor.
|
|---|
| 112 | */
|
|---|
| 113 | kHllModuleEntry(
|
|---|
| 114 | const char * pszName,
|
|---|
| 115 | unsigned short iLib,
|
|---|
| 116 | unsigned char cSegInfo = 0,
|
|---|
| 117 | PHLLSEGINFO paSegInfo = NULL
|
|---|
| 118 | );
|
|---|
| 119 | ~kHllModuleEntry();
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 | /** @cat
|
|---|
| 123 | * Add menthods
|
|---|
| 124 | */
|
|---|
| 125 | BOOL addSegInfo(
|
|---|
| 126 | unsigned short int iObject,
|
|---|
| 127 | unsigned long off,
|
|---|
| 128 | unsigned long cb
|
|---|
| 129 | );
|
|---|
| 130 |
|
|---|
| 131 | const void * addPublicSymbol(
|
|---|
| 132 | const char * pszName,
|
|---|
| 133 | unsigned long int off,
|
|---|
| 134 | unsigned short int iObject,
|
|---|
| 135 | const void * pvType
|
|---|
| 136 | );
|
|---|
| 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 | );
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 | /** @cat
|
|---|
| 147 | * Output.
|
|---|
| 148 | */
|
|---|
| 149 | int write(FILE *phFile, unsigned long off);
|
|---|
| 150 | int writeDirEntries(FILE *phFile, unsigned short iMod);
|
|---|
| 151 | };
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 | /**
|
|---|
| 156 | * HLL Debug Info generator.
|
|---|
| 157 | * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 158 | */
|
|---|
| 159 | class kHll
|
|---|
| 160 | {
|
|---|
| 161 |
|
|---|
| 162 | private:
|
|---|
| 163 | /** @cat
|
|---|
| 164 | * Internal data.
|
|---|
| 165 | */
|
|---|
| 166 | kList<kHllModuleEntry> Modules;
|
|---|
| 167 | /*
|
|---|
| 168 | kList<kHllLibraryEntry> Libraries;
|
|---|
| 169 | */
|
|---|
| 170 |
|
|---|
| 171 | /** @cat
|
|---|
| 172 | * Internal methods.
|
|---|
| 173 | */
|
|---|
| 174 | int write(FILE *phFile);
|
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 | public:
|
|---|
| 178 | /** @cat
|
|---|
| 179 | * Constructors and Destructors.
|
|---|
| 180 | */
|
|---|
| 181 | kHll();
|
|---|
| 182 | ~kHll();
|
|---|
| 183 |
|
|---|
| 184 | /** @cat
|
|---|
| 185 | * Add menthods
|
|---|
| 186 | */
|
|---|
| 187 | kHllModuleEntry * addModule(
|
|---|
| 188 | const char * pszName,
|
|---|
| 189 | const void * pvLib,
|
|---|
| 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
|
|---|
| 199 | );
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 | /** @cat
|
|---|
| 203 | * Output.
|
|---|
| 204 | */
|
|---|
| 205 | BOOL write(
|
|---|
| 206 | const char *pszFilename
|
|---|
| 207 | );
|
|---|
| 208 | APIRET writeToLX(
|
|---|
| 209 | const char *pszFilename
|
|---|
| 210 | );
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 | };
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 | #endif
|
|---|
| 218 |
|
|---|