Changeset 21916 for trunk/src/kernel32/dbglog.cpp
- Timestamp:
- Dec 18, 2011, 10:28:22 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 bin 2 Makefile.inc 1 env.cmd 2 LocalConfig.kmk
-
-
Property svn:mergeinfo
set to
/branches/gcc-kmk merged eligible
- Property svn:ignore
-
trunk/src/kernel32/dbglog.cpp
r21343 r21916 26 26 #include <string.h> 27 27 #include <stdarg.h> 28 #include <process.h> 28 29 #include <win32type.h> 29 30 #include <win32api.h> … … 93 94 /* arguments. */ 94 95 /* ----------------------------------------------------------------- */ 95 int SYSTEM WriteLog(c har *f, ...)96 int SYSTEM WriteLog(const char *f, ...) 96 97 { 97 98 TIB *ptib; /* process/thread id structures */ … … 257 258 static BOOL fLogging = TRUE; 258 259 static int dwEnableLogging = 1; 260 #ifdef __IBMC__ 259 261 static int oldcrtmsghandle = 0; 262 #endif 260 263 261 264 static BOOL fDisableThread[5] = {0}; 262 265 static BOOL fFlushLines = TRUE; 263 266 264 static c har *pszLastLogEntry = NULL;267 static const char *pszLastLogEntry = NULL; 265 268 266 269 //#define CHECK_ODINHEAP … … 305 308 } 306 309 307 int SYSTEM WriteLog(c har *tekst, ...)310 int SYSTEM WriteLog(const char *tekst, ...) 308 311 { 309 312 USHORT sel = RestoreOS2FS(); … … 330 333 #ifdef WIN32_IP_LOGGING 331 334 char *logserver = getenv("WIN32LOG_IPSERVER"); 332 if(logserver && loadNr == 0) {335 if(logserver) { 333 336 sock_init(); 334 337 … … 346 349 pszLogBase = "odin32_"; 347 350 348 sprintf(szLogFile, "%s%d.log", pszLogBase, loadNr);351 sprintf(szLogFile, "%s%d.log", pszLogBase, getpid()); 349 352 flog = fopen(szLogFile, "w"); 350 if(flog == NULL) 353 if(flog == NULL) 351 354 {//probably running exe on readonly device 352 sprintf(szLogFile, "%sodin32_%d.log", kernel32Path, loadNr);355 sprintf(szLogFile, "%sodin32_%d.log", kernel32Path, getpid()); 353 356 flog = fopen(szLogFile, "w"); 354 357 } 358 #ifdef __IBMC__ 355 359 oldcrtmsghandle = _set_crt_msg_handle(fileno(flog)); 360 #endif 356 361 } 357 362 else … … 385 390 if(logSocket == -1) { 386 391 #endif 387 if(teb) 392 if(teb) 388 393 { 389 394 ULONG ulCallDepth; … … 393 398 ulCallDepth = 0; 394 399 #endif 395 400 396 401 teb->o.odin.logfile = (DWORD)flog; 397 402 398 403 #ifdef LOG_TIME 399 404 if(sel == 0x150b && fSwitchTIBSel) 400 fprintf(flog, 405 fprintf(flog, 401 406 "t%02d (%3d): (%x) (FS=150B) ", 402 407 LOWORD(teb->o.odin.threadId), 403 408 ulCallDepth, 404 409 GetTickCount()); 405 else 406 fprintf(flog, 410 else 411 fprintf(flog, 407 412 "t%02d (%3d): (%x) ", 408 413 LOWORD(teb->o.odin.threadId), … … 410 415 GetTickCount()); 411 416 #else 412 if(sel == 0x150b && fSwitchTIBSel) 413 fprintf(flog, 417 if(sel == 0x150b && fSwitchTIBSel) 418 fprintf(flog, 414 419 #ifdef SHOW_FPU_CONTROLREG 415 420 "t%02d (%3d)(%3x): ", … … 422 427 ulCallDepth); 423 428 #endif 424 else 425 fprintf(flog, 429 else 430 fprintf(flog, 426 431 #ifdef SHOW_FPU_CONTROLREG 427 432 "t%02d (%3d)(%3x): ", … … 450 455 int prefixlen = 0; 451 456 452 if(teb) 457 if(teb) 453 458 { 454 459 ULONG ulCallDepth; … … 459 464 #endif 460 465 #ifdef LOG_TIME 461 if(sel == 0x150b && fSwitchTIBSel) 466 if(sel == 0x150b && fSwitchTIBSel) 462 467 sprintf(logbuffer, "t%02d (%3d): %x (FS=150B) ", 463 468 LOWORD(teb->o.odin.threadId), ulCallDepth, GetTickCount()); 464 else 469 else 465 470 sprintf(logbuffer, "t%02d (%3d): %x ", 466 471 LOWORD(teb->o.odin.threadId), ulCallDepth, GetTickCount()); 467 472 #else 468 if(sel == 0x150b && fSwitchTIBSel) 473 if(sel == 0x150b && fSwitchTIBSel) 469 474 sprintf(logbuffer, "t%02d (%3d): (FS=150B) ", 470 475 LOWORD(teb->o.odin.threadId), ulCallDepth); 471 else 476 else 472 477 sprintf(logbuffer, "t%02d (%3d): ", 473 478 LOWORD(teb->o.odin.threadId), ulCallDepth); … … 497 502 if(tekst[strlen(tekst)-1] != '\n') 498 503 fprintf(flog, "\n"); 499 #if 0 504 #if 0 500 505 if (teb && LOWORD(teb->o.odin.threadId) > 1) 501 506 { … … 514 519 break; 515 520 } 516 521 517 522 if ((ULONG)pframe < getESP()) 518 523 { … … 554 559 //****************************************************************************** 555 560 //****************************************************************************** 556 int SYSTEM WriteLogNoEOL(c har *tekst, ...)561 int SYSTEM WriteLogNoEOL(const char *tekst, ...) 557 562 { 558 563 USHORT sel = RestoreOS2FS(); … … 572 577 char logname[CCHMAXPATH]; 573 578 574 sprintf(logname, "odin32_%d.log", loadNr);579 sprintf(logname, "odin32_%d.log", getpid()); 575 580 flog = fopen(logname, "w"); 576 581 if(flog == NULL) {//probably running exe on readonly device 577 sprintf(logname, "%sodin32_%d.log", kernel32Path, loadNr);582 sprintf(logname, "%sodin32_%d.log", kernel32Path, getpid()); 578 583 flog = fopen(logname, "w"); 579 584 } … … 612 617 //****************************************************************************** 613 618 //****************************************************************************** 614 int SYSTEM WritePrivateLog(void *logfile, c har *tekst, ...)619 int SYSTEM WritePrivateLog(void *logfile, const char *tekst, ...) 615 620 { 616 621 USHORT sel = RestoreOS2FS(); … … 717 722 void CloseLogFile() 718 723 { 724 #ifdef __IBMC__ 719 725 if(oldcrtmsghandle) 720 726 _set_crt_msg_handle(oldcrtmsghandle); 727 #endif 721 728 722 729 #ifdef WIN32_IP_LOGGING … … 789 796 "int 3" 790 797 #endif 798 extern "C" 791 799 void WIN32API DebugBreak() 792 800 {
Note:
See TracChangeset
for help on using the changeset viewer.