| 1 | /* $Id: kHll.h,v 1.5 2000-03-31 15:47: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 | class kHllSrcEntry
|
|---|
| 68 | {
|
|---|
| 69 | private:
|
|---|
| 70 |
|
|---|
| 71 | public:
|
|---|
| 72 |
|
|---|
| 73 | };
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 | /**
|
|---|
| 78 | * HLL Module entry.
|
|---|
| 79 | * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 80 | */
|
|---|
| 81 | class kHllModuleEntry : public kListEntry
|
|---|
| 82 | {
|
|---|
| 83 | private:
|
|---|
| 84 | /** @cat
|
|---|
| 85 | * Internal data.
|
|---|
| 86 | * HLL Module data.
|
|---|
| 87 | * Lists of HLL elements
|
|---|
| 88 | * Offsets and sizes - set by write(..).
|
|---|
| 89 | */
|
|---|
| 90 | PHLLMODULE pModule;
|
|---|
| 91 |
|
|---|
| 92 | kList<kHllPubSymEntry> PublicSymbols;
|
|---|
| 93 | /*
|
|---|
| 94 | kList<kHllTypeEntry> Types;
|
|---|
| 95 | kList<kHllSymEntry> Symbols;
|
|---|
| 96 | kList<kHllSrcEntry> Source;
|
|---|
| 97 | */
|
|---|
| 98 |
|
|---|
| 99 | BOOL fValidOffsetsAndSizes;
|
|---|
| 100 | unsigned long offModule;
|
|---|
| 101 | unsigned long cbModule;
|
|---|
| 102 | unsigned long offPublicSymbols;
|
|---|
| 103 | unsigned long cbPublicSymbols;
|
|---|
| 104 | unsigned long offTypes;
|
|---|
| 105 | unsigned long cbTypes;
|
|---|
| 106 | unsigned long offSymbols;
|
|---|
| 107 | unsigned long cbSymbols;
|
|---|
| 108 | unsigned long offSource;
|
|---|
| 109 | unsigned long cbSource;
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 | /** @cat
|
|---|
| 113 | * Internal methods.
|
|---|
| 114 | */
|
|---|
| 115 | int writeList(FILE *phFile, kList<kHllBaseEntry> &List);
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 | public:
|
|---|
| 119 | /** @cat
|
|---|
| 120 | * Constructor and destructor.
|
|---|
| 121 | */
|
|---|
| 122 | kHllModuleEntry(
|
|---|
| 123 | const char * pszName,
|
|---|
| 124 | unsigned short iLib,
|
|---|
| 125 | unsigned char cSegInfo = 0,
|
|---|
| 126 | PHLLSEGINFO paSegInfo = NULL
|
|---|
| 127 | );
|
|---|
| 128 | ~kHllModuleEntry();
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 | /** @cat
|
|---|
| 132 | * Add menthods
|
|---|
| 133 | */
|
|---|
| 134 | BOOL addSegInfo(
|
|---|
| 135 | unsigned short int iObject,
|
|---|
| 136 | unsigned long off,
|
|---|
| 137 | unsigned long cb
|
|---|
| 138 | );
|
|---|
| 139 |
|
|---|
| 140 | const void * addPublicSymbol(
|
|---|
| 141 | const char * pszName,
|
|---|
| 142 | unsigned long int off,
|
|---|
| 143 | unsigned short int iObject,
|
|---|
| 144 | const void * pvType
|
|---|
| 145 | );
|
|---|
| 146 | const void * addPublicSymbol(
|
|---|
| 147 | const char * pachName,
|
|---|
| 148 | int cchName,
|
|---|
| 149 | unsigned long int off,
|
|---|
| 150 | unsigned short int iObject,
|
|---|
| 151 | const void * pvType
|
|---|
| 152 | );
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 | /** @cat
|
|---|
| 156 | * Output.
|
|---|
| 157 | */
|
|---|
| 158 | int write(FILE *phFile, unsigned long off);
|
|---|
| 159 | int writeDirEntries(FILE *phFile, unsigned short iMod);
|
|---|
| 160 | };
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 | /**
|
|---|
| 165 | * HLL Debug Info generator.
|
|---|
| 166 | * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 167 | */
|
|---|
| 168 | class kHll
|
|---|
| 169 | {
|
|---|
| 170 |
|
|---|
| 171 | private:
|
|---|
| 172 | /** @cat
|
|---|
| 173 | * Internal data.
|
|---|
| 174 | */
|
|---|
| 175 | kList<kHllModuleEntry> Modules;
|
|---|
| 176 | /*
|
|---|
| 177 | kList<kHllLibraryEntry> Libraries;
|
|---|
| 178 | */
|
|---|
| 179 |
|
|---|
| 180 | /** @cat
|
|---|
| 181 | * Internal methods.
|
|---|
| 182 | */
|
|---|
| 183 | int write(FILE *phFile);
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 | public:
|
|---|
| 187 | /** @cat
|
|---|
| 188 | * Constructors and Destructors.
|
|---|
| 189 | */
|
|---|
| 190 | kHll();
|
|---|
| 191 | ~kHll();
|
|---|
| 192 |
|
|---|
| 193 | /** @cat
|
|---|
| 194 | * Add menthods
|
|---|
| 195 | */
|
|---|
| 196 | kHllModuleEntry * addModule(
|
|---|
| 197 | const char * pszName,
|
|---|
| 198 | const void * pvLib,
|
|---|
| 199 | unsigned cSegInfo = 0,
|
|---|
| 200 | PHLLSEGINFO paSegInfo = NULL
|
|---|
| 201 | );
|
|---|
| 202 | kHllModuleEntry * addModule(
|
|---|
| 203 | const char * pachName,
|
|---|
| 204 | unsigned cchName,
|
|---|
| 205 | const void * pvLib,
|
|---|
| 206 | unsigned cSegInfo = 0,
|
|---|
| 207 | PHLLSEGINFO paSegInfo = NULL
|
|---|
| 208 | );
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 | /** @cat
|
|---|
| 212 | * Output.
|
|---|
| 213 | */
|
|---|
| 214 | BOOL write(
|
|---|
| 215 | const char *pszFilename
|
|---|
| 216 | );
|
|---|
| 217 | APIRET writeToLX(
|
|---|
| 218 | const char *pszFilename
|
|---|
| 219 | );
|
|---|
| 220 |
|
|---|
| 221 |
|
|---|
| 222 | };
|
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 | #endif
|
|---|
| 227 |
|
|---|