| 1 | /* $Id: kHll.h,v 1.7 2000-04-07 02:47:01 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 | * Linenumber chunk.
|
|---|
| 70 | * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 71 | */
|
|---|
| 72 | class kHllLineNumberChunk : public kHllBaseEntry
|
|---|
| 73 | {
|
|---|
| 74 | private:
|
|---|
| 75 | PHLLLINENUMBERENTRY paLines;
|
|---|
| 76 | HLLFIRSTENTRY FirstEntry;
|
|---|
| 77 |
|
|---|
| 78 | public:
|
|---|
| 79 | kHllLineNumberChunk(
|
|---|
| 80 | unsigned short int iSeg,
|
|---|
| 81 | unsigned long int offBase = 0
|
|---|
| 82 | );
|
|---|
| 83 | ~kHllLineNumberChunk();
|
|---|
| 84 |
|
|---|
| 85 | BOOL addLineInfo(
|
|---|
| 86 | unsigned short int iusFile,
|
|---|
| 87 | unsigned short int usLine,
|
|---|
| 88 | unsigned long int off
|
|---|
| 89 | );
|
|---|
| 90 |
|
|---|
| 91 | int write(FILE *phFile);
|
|---|
| 92 | int getSeg() { return FirstEntry.hll04.iSeg; }
|
|---|
| 93 | };
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 | /**
|
|---|
| 97 | * HLL Source entry.
|
|---|
| 98 | * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 99 | */
|
|---|
| 100 | class kHllSrcEntry
|
|---|
| 101 | {
|
|---|
| 102 | private:
|
|---|
| 103 | unsigned long int cFilenames;
|
|---|
| 104 | char * pachFilenames;
|
|---|
| 105 | unsigned long int cbFilenames;
|
|---|
| 106 | unsigned long int cbFilenamesAllocated;
|
|---|
| 107 |
|
|---|
| 108 | kList<kHllLineNumberChunk>
|
|---|
| 109 | Lines;
|
|---|
| 110 |
|
|---|
| 111 | public:
|
|---|
| 112 | kHllSrcEntry();
|
|---|
| 113 | ~kHllSrcEntry();
|
|---|
| 114 |
|
|---|
| 115 | kHllLineNumberChunk *
|
|---|
| 116 | addLineNumberChunk(
|
|---|
| 117 | unsigned short int iSeg,
|
|---|
| 118 | unsigned long int offBase = 0
|
|---|
| 119 | );
|
|---|
| 120 | unsigned short addFile(
|
|---|
| 121 | const char * pszFilename
|
|---|
| 122 | );
|
|---|
| 123 | unsigned short addFile(
|
|---|
| 124 | const char * pachFilename,
|
|---|
| 125 | int cchFilename
|
|---|
| 126 | );
|
|---|
| 127 | int write(FILE *phFile);
|
|---|
| 128 | };
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 | /**
|
|---|
| 133 | * HLL Module entry.
|
|---|
| 134 | * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 135 | */
|
|---|
| 136 | class kHllModuleEntry : public kListEntry
|
|---|
| 137 | {
|
|---|
| 138 | private:
|
|---|
| 139 | /** @cat
|
|---|
| 140 | * Internal data.
|
|---|
| 141 | * HLL Module data.
|
|---|
| 142 | * Lists of HLL elements
|
|---|
| 143 | * Offsets and sizes - set by write(..).
|
|---|
| 144 | */
|
|---|
| 145 | PHLLMODULE pModule;
|
|---|
| 146 |
|
|---|
| 147 | kList<kHllPubSymEntry> PublicSymbols;
|
|---|
| 148 | /*
|
|---|
| 149 | kList<kHllTypeEntry> Types;
|
|---|
| 150 | kList<kHllSymEntry> Symbols;
|
|---|
| 151 | */
|
|---|
| 152 | kHllSrcEntry Source;
|
|---|
| 153 |
|
|---|
| 154 | BOOL fValidOffsetsAndSizes;
|
|---|
| 155 | unsigned long offModule;
|
|---|
| 156 | unsigned long cbModule;
|
|---|
| 157 | unsigned long offPublicSymbols;
|
|---|
| 158 | unsigned long cbPublicSymbols;
|
|---|
| 159 | unsigned long offTypes;
|
|---|
| 160 | unsigned long cbTypes;
|
|---|
| 161 | unsigned long offSymbols;
|
|---|
| 162 | unsigned long cbSymbols;
|
|---|
| 163 | unsigned long offSource;
|
|---|
| 164 | unsigned long cbSource;
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 | /** @cat
|
|---|
| 168 | * Internal methods.
|
|---|
| 169 | */
|
|---|
| 170 | int writeList(FILE *phFile, kList<kHllBaseEntry> &List);
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 | public:
|
|---|
| 174 | /** @cat
|
|---|
| 175 | * Constructor and destructor.
|
|---|
| 176 | */
|
|---|
| 177 | kHllModuleEntry(
|
|---|
| 178 | const char * pszName,
|
|---|
| 179 | unsigned short iLib,
|
|---|
| 180 | unsigned char cSegInfo = 0,
|
|---|
| 181 | PHLLSEGINFO paSegInfo = NULL
|
|---|
| 182 | );
|
|---|
| 183 | ~kHllModuleEntry();
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 | /** @cat
|
|---|
| 187 | * Add menthods
|
|---|
| 188 | */
|
|---|
| 189 | BOOL addSegInfo(
|
|---|
| 190 | unsigned short int iObject,
|
|---|
| 191 | unsigned long off,
|
|---|
| 192 | unsigned long cb
|
|---|
| 193 | );
|
|---|
| 194 |
|
|---|
| 195 | const void * addPublicSymbol(
|
|---|
| 196 | const char * pszName,
|
|---|
| 197 | unsigned long int off,
|
|---|
| 198 | unsigned short int iObject,
|
|---|
| 199 | const void * pvType
|
|---|
| 200 | );
|
|---|
| 201 | const void * addPublicSymbol(
|
|---|
| 202 | const char * pachName,
|
|---|
| 203 | int cchName,
|
|---|
| 204 | unsigned long int off,
|
|---|
| 205 | unsigned short int iObject,
|
|---|
| 206 | const void * pvType
|
|---|
| 207 | );
|
|---|
| 208 | kHllSrcEntry * getSourceEntry() { return &Source; }
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 | /** @cat
|
|---|
| 212 | * Output.
|
|---|
| 213 | */
|
|---|
| 214 | int write(FILE *phFile, unsigned long off);
|
|---|
| 215 | int writeDirEntries(FILE *phFile, unsigned short iMod);
|
|---|
| 216 | };
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 | /**
|
|---|
| 221 | * HLL Debug Info generator.
|
|---|
| 222 | * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 223 | */
|
|---|
| 224 | class kHll
|
|---|
| 225 | {
|
|---|
| 226 |
|
|---|
| 227 | private:
|
|---|
| 228 | /** @cat
|
|---|
| 229 | * Internal data.
|
|---|
| 230 | */
|
|---|
| 231 | kList<kHllModuleEntry> Modules;
|
|---|
| 232 | /*
|
|---|
| 233 | kList<kHllLibraryEntry> Libraries;
|
|---|
| 234 | */
|
|---|
| 235 |
|
|---|
| 236 | /** @cat
|
|---|
| 237 | * Internal methods.
|
|---|
| 238 | */
|
|---|
| 239 | int write(FILE *phFile);
|
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 | public:
|
|---|
| 243 | /** @cat
|
|---|
| 244 | * Constructors and Destructors.
|
|---|
| 245 | */
|
|---|
| 246 | kHll();
|
|---|
| 247 | ~kHll();
|
|---|
| 248 |
|
|---|
| 249 | /** @cat
|
|---|
| 250 | * Add menthods
|
|---|
| 251 | */
|
|---|
| 252 | kHllModuleEntry * addModule(
|
|---|
| 253 | const char * pszName,
|
|---|
| 254 | const void * pvLib,
|
|---|
| 255 | unsigned cSegInfo = 0,
|
|---|
| 256 | PHLLSEGINFO paSegInfo = NULL
|
|---|
| 257 | );
|
|---|
| 258 | kHllModuleEntry * addModule(
|
|---|
| 259 | const char * pachName,
|
|---|
| 260 | unsigned cchName,
|
|---|
| 261 | const void * pvLib,
|
|---|
| 262 | unsigned cSegInfo = 0,
|
|---|
| 263 | PHLLSEGINFO paSegInfo = NULL
|
|---|
| 264 | );
|
|---|
| 265 |
|
|---|
| 266 |
|
|---|
| 267 | /** @cat
|
|---|
| 268 | * Output.
|
|---|
| 269 | */
|
|---|
| 270 | BOOL write(
|
|---|
| 271 | const char *pszFilename
|
|---|
| 272 | );
|
|---|
| 273 | APIRET writeToLX(
|
|---|
| 274 | const char *pszFilename
|
|---|
| 275 | );
|
|---|
| 276 |
|
|---|
| 277 |
|
|---|
| 278 | };
|
|---|
| 279 |
|
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 | #endif
|
|---|
| 283 |
|
|---|