Changeset 41374 in vbox for trunk/src/VBox/GuestHost/OpenGL/util
- Timestamp:
- May 21, 2012 6:04:03 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/util/error.c
r40388 r41374 27 27 #include <VBox/log.h> 28 28 #endif 29 30 #if defined(WINDOWS) 31 # define CR_DEBUG_TO_CONSOLE_ENABLE 32 #endif 33 34 #if defined(WINDOWS) && defined(IN_GUEST) 35 # ifndef CR_DEBUG_TO_BACKDOOR_ENABLE 36 # error "CR_DEBUG_TO_BACKDOOR_ENABLE is expected!" 37 # endif 38 #else 39 # ifdef CR_DEBUG_TO_BACKDOOR_ENABLE 40 # error "CR_DEBUG_TO_BACKDOOR_ENABLE is NOT expected!" 41 # endif 42 #endif 43 44 45 #ifdef CR_DEBUG_TO_BACKDOOR_ENABLE 46 # include <VBoxDispMpLogger.h> 47 # include <iprt/err.h> 48 #endif 49 29 50 30 51 static char my_hostname[256]; … … 291 312 static int first_time = 1; 292 313 static int silent = 0; 314 #ifdef CR_DEBUG_TO_BACKDOOR_ENABLE 315 static int logBackdoor = 0; 316 #endif 293 317 294 318 if (first_time) 295 319 { 296 320 const char *fname = crGetenv( "CR_DEBUG_FILE" ); 297 char str[1024]; 298 299 #if defined(Linux) && defined(IN_GUEST) && defined(DEBUG_leo) 300 if (!fname) 321 const char *fnamePrefix = crGetenv( "CR_DEBUG_FILE_PREFIX" ); 322 char str[2048]; 323 #ifdef CR_DEBUG_TO_CONSOLE_ENABLE 324 int logToConsole = 0; 325 #endif 326 #ifdef CR_DEBUG_TO_BACKDOOR_ENABLE 327 if (crGetenv( "CR_DEBUG_TO_BACKDOOR" )) 328 { 329 int rc = VBoxDispMpLoggerInit(); 330 if (RT_SUCCESS(rc)) 331 logBackdoor = 1; 332 } 333 #endif 334 335 if (!fname && fnamePrefix) 301 336 { 302 337 char pname[1024]; 303 crGetProcName(pname, 1024); 304 sprintf(str, "/home/leo/crlog_%s.txt", pname); 305 fname = &str[0]; 306 } 307 #endif 338 if (strlen(fnamePrefix) < sizeof (str) - sizeof (pname) - 20) 339 { 340 crGetProcName(pname, 1024); 341 sprintf(str, "%s_%s_%d.txt", fnamePrefix, pname, 342 #ifdef RT_OS_WINDOWS 343 GetCurrentProcessId() 344 #else 345 crGetPID() 346 #endif 347 ); 348 fname = &str[0]; 349 } 350 } 308 351 309 352 first_time = 0; 310 353 if (fname) 311 354 { 312 char debugFile[ 1000], *p;355 char debugFile[2048], *p; 313 356 crStrcpy(debugFile, fname); 314 357 p = crStrstr(debugFile, "%p"); … … 327 370 else 328 371 { 329 #if defined(WINDOWS) && defined(IN_GUEST) && (defined(DEBUG_leo) || defined(DEBUG_ll158262) || defined(DEBUG_misha)) 330 crRedirectIOToConsole(); 372 #ifdef CR_DEBUG_TO_CONSOLE_ENABLE 373 if (crGetenv( "CR_DEBUG_TO_CONSOLE" )) 374 { 375 crRedirectIOToConsole(); 376 logToConsole = 1; 377 } 331 378 #endif 332 379 output = stderr; 333 380 } 381 334 382 #if !defined(DEBUG)/* || defined(DEBUG_misha)*/ 335 383 /* Release mode: only emit crDebug messages if CR_DEBUG 336 384 * or CR_DEBUG_FILE is set. 337 385 */ 338 if (!fname && !crGetenv("CR_DEBUG")) 386 if (!fname && !crGetenv("CR_DEBUG") 387 #ifdef CR_DEBUG_TO_CONSOLE_ENABLE 388 && !logToConsole 389 #endif 390 #ifdef CR_DEBUG_TO_BACKDOOR_ENABLE 391 && !logBackdoor 392 #endif 393 ) 339 394 silent = 1; 340 395 #endif … … 380 435 else 381 436 { 382 offset = sprintf( txt, "[0x%x ] OpenGL Debug: ", crThreadID());383 } 384 #else 385 offset = sprintf( txt, "[0x%lx ] OpenGL Debug: ", crThreadID());437 offset = sprintf( txt, "[0x%x.0x%x] OpenGL Debug: ", GetCurrentProcessId(), crThreadID()); 438 } 439 #else 440 offset = sprintf( txt, "[0x%lx.0x%lx] OpenGL Debug: ", crGetPID(), crThreadID()); 386 441 #endif 387 442 va_start( args, format ); 388 443 vsprintf( txt + offset, format, args ); 444 #ifdef CR_DEBUG_TO_BACKDOOR_ENABLE 445 if (logBackdoor) 446 { 447 VBoxDispMpLoggerLog(txt); 448 } 449 #endif 389 450 #if defined(IN_GUEST) 390 451 outputChromiumMessage( output, txt ); 391 452 #else 392 # if defined(DEBUG) && (defined(DEBUG_leo) || defined(DEBUG_ll158262)) 393 outputChromiumMessage( output, txt ); 453 if (!output 454 # ifndef DEBUG_misha 455 || output==stderr 394 456 # endif 395 #ifndef DEBUG_misha 396 if (output==stderr) 397 #endif 457 ) 398 458 { 399 459 LogRel(("%s\n", txt)); 400 460 } 401 #ifndef DEBUG_misha402 461 else 403 #endif 404 { 462 { 463 # ifndef DEBUG_misha 464 LogRel(("%s\n", txt)); 465 # endif 405 466 outputChromiumMessage(output, txt); 406 467 }
Note:
See TracChangeset
for help on using the changeset viewer.