Changeset 21302 for trunk/src/kernel32/exceptstackdump.cpp
- Timestamp:
- Jun 18, 2009, 11:53:26 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/exceptstackdump.cpp
r8401 r21302 25 25 #include "windllbase.h" 26 26 27 #include <_ras.h> 28 27 29 #define DBG_LOCALLOG DBG_exceptstackdump 28 30 #include "dbglocal.h" … … 30 32 int SYSTEM EXPORT WriteLogNoEOL(char *tekst, ...); 31 33 34 #define FIX64KLIMIT 35 32 36 #undef dprintf 33 #define dprintf(a) if(DbgEnabledKERNEL32[DBG_LOCALLOG] == 1) WriteLogNoEOL a 37 #ifdef RAS 38 # ifdef DEBUG 39 # define dprintf(a) RasLogNoEOL a; if(DbgEnabledKERNEL32[DBG_LOCALLOG] == 1) WriteLogNoEOL a 40 # else 41 # define dprintf(a) RasLogNoEOL a; 42 # endif 43 #else 44 # ifdef DEBUG 45 # define dprintf(a) if(DbgEnabledKERNEL32[DBG_LOCALLOG] == 1) WriteLogNoEOL a 46 # else 47 # define dprintf(a) 48 # endif 49 #endif 34 50 35 51 /* ****************************************************************** … … 55 71 */ 56 72 57 BOOL dbg PrintSYMInfo(CHAR * SymFileName, ULONG Object, ULONG TrapOffset)73 BOOL dbgGetSYMInfo(CHAR * SymFileName, ULONG Object, ULONG TrapOffset, CHAR *Info, ULONG cbInfo) 58 74 { 59 75 static FILE *SymFile; … … 88 104 if (fseek(SymFile, SegOffset, SEEK_SET)) 89 105 { 90 dprintf(("Seek error."));106 // dprintf(("Seek error.")); 91 107 goto endofprintsym; 92 108 } … … 100 116 LastVal = 0; 101 117 118 #ifdef FIX64KLIMIT 119 // Custom build dll's SYM file is much greater than 64K. 120 // SYM file structures use 16 bit offsets in the file and 121 // therefore these offsets can't be directly used as they 122 // are overflowed. 123 // Some offsets like segment definition offsets are 124 // paragraph (*16) ones and will overflow for an 1 meg file. 125 // In particular this affects SYMbol searching algorithm 126 // used here. 127 // With the #ifdef it will be changed to so we will 128 // extract symbol by symbol from the file instead of using 129 // symbol table that is far further 64K fence. 130 131 // Offset of first symbol 132 SymOffset = sizeof (SEGDEF) - 1 + SegDef.cbSegName; 133 #endif 134 102 135 // go thru all symbols in this object 103 136 for (SymNum = 0; SymNum < SegDef.cSymbols; SymNum++) 104 137 { 138 #ifndef FIX64KLIMIT 105 139 // read in symbol offset USHORT 106 140 SymPtrOffset = SYMDEFOFFSET(SegOffset, SegDef, SymNum); 107 141 fseek(SymFile, SymPtrOffset, SEEK_SET); 108 142 fread(&SymOffset, sizeof(unsigned short int), 1, SymFile); 143 #endif 109 144 110 145 // go to symbol definition … … 121 156 fread(&Buffer[1], 1, SymDef32.cbSymName, SymFile); 122 157 Buffer[SymDef32.cbSymName] = 0x00; 123 dprintf(("%s\n", Buffer)); 158 // dprintf(("%s\n", Buffer)); 159 strcpy (Info, Buffer); 124 160 rc = TRUE; 125 161 break; … … 134 170 { 135 171 // symbol found 136 dprintf(("between %s + 0x%X", Buffer, TrapOffset - LastVal)); 172 #ifdef RAS 173 snprintf(Info, cbInfo, "between %s + 0x%X", Buffer, TrapOffset - LastVal); 174 #else 175 sprintf(Info, "between %s + 0x%X", Buffer, TrapOffset - LastVal); 176 #endif 137 177 } 138 178 LastVal = SymDef32.wSymVal; … … 144 184 { 145 185 // symbol found, as above 146 dprintf((" and %s - 0x%X\n", Buffer, LastVal - TrapOffset)); 186 #ifdef RAS 187 snprintf(&Info[strlen(Info)], cbInfo - strlen(Info), " and %s - 0x%X\n", Buffer, LastVal - TrapOffset); 188 #else 189 sprintf(&Info[strlen(Info)], " and %s - 0x%X\n", Buffer, LastVal - TrapOffset); 190 #endif 147 191 rc = TRUE; 148 192 break; 149 193 } 150 194 /*printf("32 Bit Symbol <%s> Address %p",Buffer,SymDef32.wSymVal); */ 195 #ifdef FIX64KLIMIT 196 SymOffset += sizeof (SYMDEF32) + SymDef32.cbSymName - 1; 197 #endif 151 198 } 152 199 else … … 163 210 if (SymDef16.wSymVal > TrapOffset) 164 211 { 165 dprintf(("between %s + %X", Buffer, TrapOffset - LastVal)); 212 #ifdef RAS 213 snprintf(Info, cbInfo, "between %s + 0x%X", Buffer, TrapOffset - LastVal); 214 #else 215 sprintf(Info, "between %s + 0x%X", Buffer, TrapOffset - LastVal); 216 #endif 166 217 } 167 218 LastVal = SymDef16.wSymVal; … … 171 222 if (SymDef16.wSymVal > TrapOffset) 172 223 { 173 dprintf((" and %s - %X\n", Buffer, LastVal - TrapOffset)); 224 #ifdef RAS 225 snprintf(&Info[strlen(Info)], cbInfo - strlen(Info), " and %s - 0x%X\n", Buffer, LastVal - TrapOffset); 226 #else 227 sprintf(&Info[strlen(Info)], " and %s - 0x%X\n", Buffer, LastVal - TrapOffset); 228 #endif 174 229 rc = TRUE; 175 230 break; 176 231 } 177 232 /*printf("16 Bit Symbol <%s> Address %p",Buffer,SymDef16.wSymVal); */ 233 #ifdef FIX64KLIMIT 234 SymOffset += sizeof (SYMDEF16) + SymDef16.cbSymName - 1; 235 #endif 178 236 } // endif 179 237 } 238 #ifdef FIX64KLIMIT 239 if (SymNum < SegDef.cSymbols) 240 { 241 #endif 180 242 break; 243 #ifdef FIX64KLIMIT 244 } 245 #endif 181 246 } // endif 182 247 SegOffset = NEXTSEGDEFOFFSET(SegDef); … … 184 249 endofprintsym: 185 250 if(SymFile) fclose(SymFile); 186 if(rc == FALSE) dprintf(("\n")); 251 // if(rc == FALSE) dprintf(("\n")); 252 if(rc == FALSE) strcpy (Info, "\n"); 253 return rc; 254 } 255 BOOL dbgPrintSYMInfo(CHAR * SymFileName, ULONG Object, ULONG TrapOffset) 256 { 257 static char szInfo[256]; 258 BOOL rc = dbgGetSYMInfo (SymFileName, Object, TrapOffset, szInfo, sizeof (szInfo)); 259 dprintf(("%s", szInfo)); 187 260 return rc; 188 261 }
Note:
See TracChangeset
for help on using the changeset viewer.