Changeset 3247 for trunk/tools/dbginfo/Sym2Hll.cpp
- Timestamp:
- Mar 27, 2000, 12:20:42 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/dbginfo/Sym2Hll.cpp
r3244 r3247 1 /* $Id: Sym2Hll.cpp,v 1. 2 2000-03-26 21:56:36bird Exp $1 /* $Id: Sym2Hll.cpp,v 1.3 2000-03-27 10:20:41 bird Exp $ 2 2 * 3 3 * Sym2Hll - Symbol file to HLL debuginfo converter. … … 8 8 * 9 9 */ 10 /******************************************************************************* 11 * Defined Constants And Macros * 12 *******************************************************************************/ 13 #define INCL_DOSERRORS 14 #define WORD USHORT 15 #define DWORD ULONG 10 16 11 17 /******************************************************************************* … … 13 19 *******************************************************************************/ 14 20 #include <os2.h> 21 #include <exe386.h> 15 22 16 23 #include <stdio.h> … … 25 32 #include "kHll.h" 26 33 #include "sym.h" 34 #include "kFileFormatBase.h" 35 #include "kFileLX.h" 27 36 28 37 /******************************************************************************* … … 33 42 34 43 44 /******************************************************************************* 45 * External Functions * 46 *******************************************************************************/ 47 APIRET APIENTRY DosReplaceModule (PSZ pszOldModule, PSZ pszNewModule, PSZ pszBackupModule); 48 35 49 36 50 37 51 int main(int argc, char **argv) 38 52 { 39 kHll *pHll; 53 kHll * pHll; 54 kFileLX * pFileLX; 40 55 41 56 /* … … 51 66 pHll = new kHll(); 52 67 assert(pHll != NULL); 68 69 try { 70 pFileLX = new kFileLX(argv[2]); 71 } catch (int errcd) 72 { 73 fprintf(stderr, "failed to open/read LX file (%s). errcd=%d\n", argv[2], errcd); 74 return -3; 75 } 76 53 77 54 78 … … 117 141 while (pSegDef != NULL) 118 142 { 143 struct o32_obj *pLXObject; 119 144 PSYMDEF32 pSymDef32; /* Symbol definition 32-bit */ 120 145 PSYMDEF16 pSymDef16; /* Symbol definition 16-bit */ … … 160 185 * Add segment to the module - FIXME - need info from the LX Object table... 161 186 */ 162 187 pLXObject = pFileLX->getObject(iSegment-1); 188 if (pLXObject) 189 { 190 if (!pModule->addSegInfo(iSegment, 0, pLXObject->o32_size)) 191 fprintf(stderr, "warning: addseginfo failed!\n"); 192 } 193 else 194 fprintf(stderr, "warning: pFileLX->getObject failed for iSegment=%d\n", 195 iSegment); 163 196 164 197 /* … … 233 266 */ 234 267 pHll->write("debug.hll"); 235 pHll->writeToLX(argv[2]); 268 rc = pHll->writeToLX(argv[2]); 269 if (rc == ERROR_ACCESS_DENIED) 270 { 271 272 rc = DosReplaceModule(argv[2], NULL, NULL); 273 if (rc == NO_ERROR) 274 { 275 rc = pHll->writeToLX(argv[2]); 276 } 277 } 236 278 } 237 279 else … … 290 332 291 333 292 /**293 * Find the size of a file.294 * @returns Size of file. -1 on error.295 * @param phFile File handle.296 */297 signed long fsize(FILE *phFile)298 {299 int ipos;300 signed long cb;301 302 if ((ipos = ftell(phFile)) < 0303 ||304 fseek(phFile, 0, SEEK_END) != 0305 ||306 (cb = ftell(phFile)) < 0307 ||308 fseek(phFile, ipos, SEEK_SET) != 0309 )310 cb = -1;311 return cb;312 }313 314 334 315 335
Note:
See TracChangeset
for help on using the changeset viewer.