Changeset 53374 in vbox
- Timestamp:
- Nov 21, 2014 4:42:52 PM (10 years ago)
- Location:
- trunk/src/VBox/GuestHost/OpenGL/util
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/util/error.c
r52437 r53374 1 /* $Id$ */ 2 /** @file 3 * VBox crOpenGL error logging 4 */ 5 6 /* 7 * Copyright (C) 2014 Oracle Corporation 8 * 9 * This file is part of VirtualBox Open Source Edition (OSE), as 10 * available from http://www.virtualbox.org. This file is free software; 11 * you can redistribute it and/or modify it under the terms of the GNU 12 * General Public License (GPL) as published by the Free Software 13 * Foundation, in version 2 as it comes in the "COPYING" file of the 14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 */ 17 #if 1 18 19 #include <iprt/string.h> 20 #include <iprt/stream.h> 21 #include <VBox/log.h> 22 23 #ifdef RT_OS_WINDOWS 24 # include <windows.h> 25 #endif 26 27 #include <signal.h> 28 #include <stdlib.h> 29 30 static void logMessageV(const char *pszPrefix, const char *pszFormat, va_list va) 31 { 32 char *pszMessage; 33 34 RTStrAPrintfV(&pszMessage, pszFormat, va); 35 if (pszMessage != NULL) 36 { 37 LogRel(("%s%s\n", pszPrefix, pszMessage)); 38 #ifdef IN_GUEST 39 RTStrmPrintf(g_pStdErr, "%s%s\n", pszPrefix, pszMessage); 40 #endif 41 RTStrFree(pszMessage); 42 } 43 } 44 45 static void logMessage(const char *pszPrefix, const char *pszFormat, ...) 46 { 47 va_list va; 48 49 va_start(va, pszFormat); 50 logMessageV(pszPrefix, pszFormat, va); 51 va_end(va); 52 } 53 54 static void logDebugV(const char *pszPrefix, const char *pszFormat, va_list va) 55 { 56 char *pszMessage; 57 58 RTStrAPrintfV(&pszMessage, pszFormat, va); 59 if (pszMessage != NULL) 60 { 61 Log(("%s%s\n", pszPrefix, pszMessage)); 62 RTStrFree(pszMessage); 63 } 64 } 65 66 DECLEXPORT(void) crError(const char *pszFormat, ... ) 67 { 68 va_list va; 69 #ifdef WINDOWS 70 DWORD err; 71 #endif 72 73 #ifdef WINDOWS 74 if ((err = GetLastError()) != 0 && crGetenv("CR_WINDOWS_ERRORS") != NULL ) 75 { 76 char *pszWindowsMessage; 77 78 SetLastError(0); 79 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | 80 FORMAT_MESSAGE_FROM_SYSTEM | 81 FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, err, 82 MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), 83 (LPTSTR) &pszWindowsMessage, 0, NULL ); 84 if (pszWindowsMessage) 85 { 86 logMessage("OpenGL, Windows error: \n", "%s", pszWindowsMessage); 87 LocalFree(pszWindowsMessage); 88 } 89 else 90 logMessage("OpenGL, Windows error: \n", "%ld", (long) err); 91 } 92 #endif 93 va_start(va, pszFormat); 94 logMessageV("OpenGL Error: ", pszFormat, va); 95 va_end(va); 96 AssertFailed(); 97 #ifdef IN_GUEST 98 /* Give things a chance to close down. */ 99 raise(SIGTERM); 100 exit(1); 101 #endif 102 } 103 104 DECLEXPORT(void) crWarning(const char *pszFormat, ... ) 105 { 106 va_list va; 107 108 va_start(va, pszFormat); 109 logMessageV("OpenGL Warning: ", pszFormat, va); 110 va_end(va); 111 } 112 113 DECLEXPORT(void) crInfo(const char *pszFormat, ... ) 114 { 115 va_list va; 116 117 va_start(va, pszFormat); 118 logMessageV("OpenGL Info: ", pszFormat, va); 119 va_end(va); 120 } 121 122 DECLEXPORT(void) crDebug(const char *pszFormat, ... ) 123 { 124 va_list va; 125 126 va_start(va, pszFormat); 127 logDebugV("OpenGL Debug: ", pszFormat, va); 128 va_end(va); 129 } 130 131 #else 1 132 /* Copyright (c) 2001, Stanford University 2 133 * All rights reserved … … 607 738 } 608 739 #endif 740 #endif -
trunk/src/VBox/GuestHost/OpenGL/util/net.c
r53371 r53374 424 424 425 425 426 extern void __getHostInfo();427 426 /** 428 427 * Start the ball rolling. give functions to handle incoming traffic … … 450 449 if (err != 0) 451 450 crError("Couldn't initialize sockets on WINDOWS"); 452 //reinit hostname for debug messages as it's incorrect before WSAStartup gets called453 __getHostInfo();454 451 #endif 455 452 -
trunk/src/VBox/GuestHost/OpenGL/util/util.def
r44887 r53374 9 9 crDLLClose 10 10 crError 11 crEnableWarnings12 11 crWarning 13 12 crDebug
Note:
See TracChangeset
for help on using the changeset viewer.