VirtualBox

Ignore:
Timestamp:
May 23, 2012 2:44:06 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
78140
Message:

wine & crOpenGL: backdoor logging for wine and enhancements for crOpenGL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/util/error.c

    r41376 r41418  
    2929
    3030#if defined(WINDOWS)
    31 # define CR_DEBUG_TO_CONSOLE_ENABLE
     31# define CR_DEBUG_CONSOLE_ENABLE
    3232#endif
    3333
    3434#if defined(WINDOWS) && defined(IN_GUEST)
    35 # ifndef CR_DEBUG_TO_BACKDOOR_ENABLE
    36 #  error "CR_DEBUG_TO_BACKDOOR_ENABLE is expected!"
     35# ifndef CR_DEBUG_BACKDOOR_ENABLE
     36#  error "CR_DEBUG_BACKDOOR_ENABLE is expected!"
    3737# endif
    3838#else
    39 # ifdef CR_DEBUG_TO_BACKDOOR_ENABLE
    40 #  error "CR_DEBUG_TO_BACKDOOR_ENABLE is NOT expected!"
     39# ifdef CR_DEBUG_BACKDOOR_ENABLE
     40#  error "CR_DEBUG_BACKDOOR_ENABLE is NOT expected!"
    4141# endif
    4242#endif
    4343
    4444
    45 #ifdef CR_DEBUG_TO_BACKDOOR_ENABLE
     45#ifdef CR_DEBUG_BACKDOOR_ENABLE
    4646# include <VBoxDispMpLogger.h>
    4747# include <iprt/err.h>
     
    301301}
    302302
     303static DECLCALLBACK(void) crDebugBackdoorRt(char* pcszStr)
     304{
     305    RTLogBackdoorPrintf("%s", pcszStr);
     306}
     307
     308static DECLCALLBACK(void) crDebugBackdoorDispMp(char* pcszStr)
     309{
     310    VBoxDispMpLoggerLog(pcszStr);
     311}
     312
    303313DECLEXPORT(void) crDebug(const char *format, ... )
    304314{
     
    312322    static int first_time = 1;
    313323    static int silent = 0;
    314 #ifdef CR_DEBUG_TO_BACKDOOR_ENABLE
    315     static int logBackdoor = 0;
     324#ifdef CR_DEBUG_BACKDOOR_ENABLE
     325    typedef DECLCALLBACK(void) FNCRGEDUGBACKDOOR(char* pcszStr);
     326    typedef FNCRGEDUGBACKDOOR *PFNCRGEDUGBACKDOOR;
     327    static PFNCRGEDUGBACKDOOR pfnLogBackdoor = NULL;
    316328#endif
    317329
     
    321333        const char *fnamePrefix = crGetenv( "CR_DEBUG_FILE_PREFIX" );
    322334        char str[2048];
    323 #ifdef CR_DEBUG_TO_CONSOLE_ENABLE
     335#ifdef CR_DEBUG_CONSOLE_ENABLE
    324336        int logToConsole = 0;
    325337#endif
    326 #ifdef CR_DEBUG_TO_BACKDOOR_ENABLE
    327         if (crGetenv( "CR_DEBUG_TO_BACKDOOR" ))
     338#ifdef CR_DEBUG_BACKDOOR_ENABLE
     339        if (crGetenv( "CR_DEBUG_BACKDOOR" ))
    328340        {
    329341            int rc = VBoxDispMpLoggerInit();
    330342            if (RT_SUCCESS(rc))
    331                 logBackdoor = 1;
     343                pfnLogBackdoor = crDebugBackdoorDispMp;
     344            else
     345                pfnLogBackdoor = crDebugBackdoorRt;
    332346        }
    333347#endif
     
    370384        else
    371385        {
    372 #ifdef CR_DEBUG_TO_CONSOLE_ENABLE
    373             if (crGetenv( "CR_DEBUG_TO_CONSOLE" ))
     386#ifdef CR_DEBUG_CONSOLE_ENABLE
     387            if (crGetenv( "CR_DEBUG_CONSOLE" ))
    374388            {
    375389                crRedirectIOToConsole();
     
    385399         */
    386400        if (!fname && !crGetenv("CR_DEBUG")
    387 #ifdef CR_DEBUG_TO_CONSOLE_ENABLE
     401#ifdef CR_DEBUG_CONSOLE_ENABLE
    388402                    && !logToConsole
    389403#endif
    390 #ifdef CR_DEBUG_TO_BACKDOOR_ENABLE
    391                     && !logBackdoor
     404#ifdef CR_DEBUG_BACKDOOR_ENABLE
     405                    && !pfnLogBackdoor
    392406#endif
    393407                )
     
    442456    va_start( args, format );
    443457    vsprintf( txt + offset, format, args );
    444 #ifdef CR_DEBUG_TO_BACKDOOR_ENABLE
    445     if (logBackdoor)
    446     {
    447         VBoxDispMpLoggerLog(txt);
     458#ifdef CR_DEBUG_BACKDOOR_ENABLE
     459    if (pfnLogBackdoor)
     460    {
     461        pfnLogBackdoor(txt);
    448462    }
    449463#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette