Changeset 71606 in vbox
- Timestamp:
- Apr 1, 2018 11:29:06 PM (6 years ago)
- Location:
- trunk/include/VBox
- Files:
-
- 1 edited
- 1 copied
-
AssertGuest.h (copied) (copied from trunk/include/iprt/assert.h ) (37 diffs)
-
cdefs.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/AssertGuest.h
r71601 r71606 1 1 /** @file 2 * IPRT - Assertions.2 * VirtualBox - Guest input assertions. 3 3 */ 4 4 5 5 /* 6 * Copyright (C) 2006-201 7Oracle Corporation6 * Copyright (C) 2006-2018 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 */ 25 25 26 #ifndef ___iprt_assert_h 27 #define ___iprt_assert_h 28 29 #include <iprt/cdefs.h> 30 #include <iprt/types.h> 31 #include <iprt/stdarg.h> 32 #include <iprt/assertcompile.h> 33 34 /** @defgroup grp_rt_assert Assert - Assertions 35 * @ingroup grp_rt 36 * 37 * Assertions are generally used to check preconditions and other 38 * assumptions. Sometimes it is also used to catch odd errors or errors 39 * that one would like to inspect in the debugger. They should not be 40 * used for errors that happen frequently. 41 * 42 * IPRT provides a host of assertion macros, so many that it can be a bit 43 * overwhelming at first. Don't despair, there is a system (surprise). 44 * 45 * First there are four families of assertions: 46 * - Assert - The normal strict build only assertions. 47 * - AssertLogRel - Calls LogRel() in non-strict builds, otherwise like Assert. 48 * - AssertRelease - Triggers in all builds. 49 * - AssertFatal - Triggers in all builds and cannot be continued. 50 * 51 * Then there are variations wrt to argument list and behavior on failure: 52 * - Msg - Custom RTStrPrintf-like message with the assertion message. 53 * - Return - Return the specific rc on failure. 54 * - ReturnVoid - Return (void) on failure. 55 * - Break - Break (out of switch/loop) on failure. 56 * - Stmt - Execute the specified statement(s) on failure. 57 * - RC - Assert RT_SUCCESS. 58 * - RCSuccess - Assert VINF_SUCCESS. 59 * 60 * @remarks As you might have noticed, the macros don't follow the 61 * coding guidelines wrt to macros supposedly being all uppercase 62 * and underscored. For various reasons they don't, and nobody 63 * has complained yet. Wonder why... :-) 64 * 65 * @remarks Each project has its own specific guidelines on how to use 66 * assertions, so the above is just trying to give you the general idea 67 * from the IPRT point of view. 68 * 26 #ifndef ___VBox_AssertGuest_h 27 #define ___VBox_AssertGuest_h 28 29 #include <VBox/cdefs.h> 30 #include <iprt/assert.h> 31 32 33 /** @defgroup grp_vbox_assert_guest VBox Guest Input Assertion Macros 69 34 * @{ 70 35 */ 71 36 72 RT_C_DECLS_BEGIN 73 74 /** 75 * The 1st part of an assert message. 76 * 77 * @param pszExpr Expression. Can be NULL. 78 * @param uLine Location line number. 79 * @param pszFile Location file name. 80 * @param pszFunction Location function name. 81 */ 82 RTDECL(void) RTAssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction); 83 /** 84 * Weak version of RTAssertMsg1 that can be overridden locally in a module to 85 * modify, redirect or otherwise mess with the assertion output. 86 * 87 * @copydoc RTAssertMsg1 88 */ 89 RTDECL(void) RTAssertMsg1Weak(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction); 90 91 /** 92 * The 2nd (optional) part of an assert message. 93 * 94 * @param pszFormat Printf like format string. 95 * @param ... Arguments to that string. 96 */ 97 RTDECL(void) RTAssertMsg2(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 98 /** 99 * Weak version of RTAssertMsg2 that forwards to RTAssertMsg2WeakV. 100 * 101 * There is not need to override this, check out RTAssertMsg2WeakV instead! 102 * 103 * @copydoc RTAssertMsg2 104 */ 105 RTDECL(void) RTAssertMsg2Weak(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 106 107 /** 108 * The 2nd (optional) part of an assert message. 109 * 110 * @param pszFormat Printf like format string. 111 * @param va Arguments to that string. 112 */ 113 RTDECL(void) RTAssertMsg2V(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0); 114 /** 115 * Weak version of RTAssertMsg2V that can be overridden locally in a module to 116 * modify, redirect or otherwise mess with the assertion output. 117 * 118 * @copydoc RTAssertMsg2V 119 */ 120 RTDECL(void) RTAssertMsg2WeakV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0); 121 122 /** 123 * Additional information which should be appended to the 2nd part of an 124 * assertion message. 125 * 126 * @param pszFormat Printf like format string. 127 * @param ... Arguments to that string. 128 */ 129 RTDECL(void) RTAssertMsg2Add(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 130 /** 131 * Weak version of RTAssertMsg2Add that forwards to RTAssertMsg2AddWeakV. 132 * 133 * There is not need to override this, check out RTAssertMsg2AddWeakV instead! 134 * 135 * @copydoc RTAssertMsg2Add 136 */ 137 RTDECL(void) RTAssertMsg2AddWeak(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 138 139 /** 140 * Additional information which should be appended to the 2nd part of an 141 * assertion message. 142 * 143 * @param pszFormat Printf like format string. 144 * @param va Arguments to that string. 145 */ 146 RTDECL(void) RTAssertMsg2AddV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0); 147 /** 148 * Weak version of RTAssertMsg2AddV that can be overridden locally in a module 149 * to modify, redirect or otherwise mess with the assertion output. 150 * 151 * @copydoc RTAssertMsg2AddV 152 */ 153 RTDECL(void) RTAssertMsg2AddWeakV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0); 154 155 #ifdef IN_RING0 156 /** 157 * Panics the system as the result of a fail assertion. 158 */ 159 RTR0DECL(void) RTR0AssertPanicSystem(void); 160 #endif /* IN_RING0 */ 161 162 /** 163 * Overridable function that decides whether assertions executes the panic 164 * (breakpoint) or not. 165 * 166 * The generic implementation will return true. 167 * 168 * @returns true if the breakpoint should be hit, false if it should be ignored. 169 * 170 * @remark The RTDECL() makes this a bit difficult to override on Windows. So, 171 * you'll have to use RTASSERT_HAVE_SHOULD_PANIC or 172 * RTASSERT_HAVE_SHOULD_PANIC_PRIVATE there to control the kind of 173 * prototype. 174 */ 175 #if !defined(RTASSERT_HAVE_SHOULD_PANIC) && !defined(RTASSERT_HAVE_SHOULD_PANIC_PRIVATE) 176 RTDECL(bool) RTAssertShouldPanic(void); 177 #elif defined(RTASSERT_HAVE_SHOULD_PANIC_PRIVATE) 178 bool RTAssertShouldPanic(void); 179 #else 180 DECLEXPORT(bool) RTCALL RTAssertShouldPanic(void); 181 #endif 182 183 /** 184 * Controls whether the assertions should be quiet or noisy (default). 185 * 186 * @returns The old setting. 187 * @param fQuiet The new setting. 188 */ 189 RTDECL(bool) RTAssertSetQuiet(bool fQuiet); 190 191 /** 192 * Are assertions quiet or noisy? 193 * 194 * @returns True if they are quiet, false if noisy. 195 */ 196 RTDECL(bool) RTAssertAreQuiet(void); 197 198 /** 199 * Makes the assertions panic (default) or not. 200 * 201 * @returns The old setting. 202 * @param fPanic The new setting. 203 */ 204 RTDECL(bool) RTAssertSetMayPanic(bool fPanic); 205 206 /** 207 * Can assertion panic. 208 * 209 * @returns True if they can, false if not. 210 */ 211 RTDECL(bool) RTAssertMayPanic(void); 212 213 214 /** @name Globals for crash analysis 215 * @remarks This is the full potential set, it 37 38 /** @name Guest input assertions 39 * 40 * These assertions will only trigger when VBOX_STRICT_GUEST is defined. When 41 * it is undefined they will all be no-ops and generate no code, unless they 42 * have other side effected (i.e. the _RETURN, _STMT, _BREAK variations). 43 * 44 * The assertions build on top of the functions in iprt/assert.h. 45 * 216 46 * @{ 217 47 */ 218 /** The last assert message, 1st part. */ 219 extern RTDATADECL(char) g_szRTAssertMsg1[1024]; 220 /** The last assert message, 2nd part. */ 221 extern RTDATADECL(char) g_szRTAssertMsg2[4096]; 222 /** The last assert message, expression. */ 223 extern RTDATADECL(const char * volatile) g_pszRTAssertExpr; 224 /** The last assert message, file name. */ 225 extern RTDATADECL(const char * volatile) g_pszRTAssertFile; 226 /** The last assert message, line number. */ 227 extern RTDATADECL(uint32_t volatile) g_u32RTAssertLine; 228 /** The last assert message, function name. */ 229 extern RTDATADECL(const char * volatile) g_pszRTAssertFunction; 230 /** @} */ 231 232 RT_C_DECLS_END 233 234 /** @def RTAssertDebugBreak() 235 * Debugger breakpoint instruction. 236 * 237 * @remarks This macro does not depend on RT_STRICT. 238 */ 239 #define RTAssertDebugBreak() do { RT_BREAKPOINT(); } while (0) 240 241 242 243 /** @name Assertions 244 * 245 * These assertions will only trigger when RT_STRICT is defined. When it is 246 * undefined they will all be no-ops and generate no code. 247 * 248 * @{ 249 */ 250 251 252 /** @def RTASSERT_QUIET 253 * This can be defined to shut up the messages for a file where this would be 254 * problematic because the message printing code path passes thru it. 255 * @internal */ 256 #ifdef DOXYGEN_RUNNING 257 # define RTASSERT_QUIET 258 #endif 259 #if defined(RTASSERT_QUIET) && !defined(DOXYGEN_RUNNING) 260 # define RTAssertMsg1Weak(pszExpr, uLine, pszfile, pszFunction) \ 261 do { } while (0) 262 # define RTAssertMsg2Weak if (1) {} else RTAssertMsg2Weak 263 #endif 264 265 /** @def RTAssertDoPanic 266 * Raises an assertion panic appropriate to the current context. 267 * @remarks This macro does not depend on RT_STRICT. 268 */ 269 #if defined(IN_RING0) \ 270 && (defined(RT_OS_DARWIN) || defined(RT_OS_HAIKU) || defined(RT_OS_SOLARIS)) 271 # define RTAssertDoPanic() RTR0AssertPanicSystem() 272 #else 273 # define RTAssertDoPanic() RTAssertDebugBreak() 274 #endif 275 276 /** @def AssertBreakpoint() 277 * Assertion Breakpoint. 278 * @deprecated Use RTAssertPanic or RTAssertDebugBreak instead. 279 */ 280 #ifdef RT_STRICT 281 # define AssertBreakpoint() RTAssertDebugBreak() 282 #else 283 # define AssertBreakpoint() do { } while (0) 284 #endif 285 286 /** @def RTAssertPanic() 287 * If RT_STRICT is defined this macro will invoke RTAssertDoPanic if 288 * RTAssertShouldPanic returns true. If RT_STRICT isn't defined it won't do any 289 * thing. 290 */ 291 #if defined(RT_STRICT) && !defined(RTASSERT_DONT_PANIC) 292 # define RTAssertPanic() do { if (RTAssertShouldPanic()) RTAssertDoPanic(); } while (0) 293 #else 294 # define RTAssertPanic() do { } while (0) 295 #endif 296 297 /** @def Assert 48 49 50 /** @def ASSERT_GUEST_PANIC() 51 * If VBOX_STRICT_GUEST is defined this macro will invoke RTAssertDoPanic if 52 * RTAssertShouldPanic returns true. If VBOX_STRICT_GUEST isn't defined it won't 53 * do any thing. 54 */ 55 #if defined(VBOX_STRICT_GUEST) && !defined(VBOX_STRICT_GUEST_DONT_PANIC) 56 # define ASSERT_GUEST_PANIC() do { if (RTAssertShouldPanic()) RTAssertDoPanic(); } while (0) 57 #else 58 # define ASSERT_GUEST_PANIC() do { } while (0) 59 #endif 60 61 /** Wrapper around RTAssertMsg1Weak that prefixes the expression. */ 62 #define ASSERT_GUEST_MSG1(szExpr, iLine, pszFile, pszFunction) \ 63 RTAssertMsg1Weak("guest-input: " szExpr, iLine, pszFile, pszFunction) 64 65 66 /** @def ASSERT_GUEST 298 67 * Assert that an expression is true. If false, hit breakpoint. 299 * @param exprExpression which should be true.300 */ 301 #ifdef RT_STRICT302 # define A ssert(expr) \303 do { \ 304 if (RT_LIKELY(!!( expr))) \305 { /* likely */ } \ 306 else \ 307 { \ 308 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \309 RTAssertPanic(); \310 } \ 311 } while (0) 312 #else 313 # define A ssert(expr)do { } while (0)314 #endif 315 316 317 /** @def A ssertStmt68 * @param a_Expr Expression which should be true. 69 */ 70 #ifdef VBOX_STRICT_GUEST 71 # define ASSERT_GUEST(a_Expr) \ 72 do { \ 73 if (RT_LIKELY(!!(a_Expr))) \ 74 { /* likely */ } \ 75 else \ 76 { \ 77 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 78 ASSERT_GUEST_PANIC(); \ 79 } \ 80 } while (0) 81 #else 82 # define ASSERT_GUEST(a_Expr) do { } while (0) 83 #endif 84 85 86 /** @def ASSERT_GUEST_STMT 318 87 * Assert that an expression is true. If false, hit breakpoint and execute the 319 88 * statement. 320 * @param exprExpression which should be true.321 * @param stmtStatement to execute on failure.322 */ 323 #ifdef RT_STRICT324 # define A ssertStmt(expr, stmt) \325 do { \ 326 if (RT_LIKELY(!!( expr))) \327 { /* likely */ } \ 328 else \ 329 { \ 330 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \331 RTAssertPanic(); \332 stmt; \333 } \ 334 } while (0) 335 #else 336 # define A ssertStmt(expr, stmt) \337 do { \ 338 if (RT_LIKELY(!!( expr))) \339 { /* likely */ } \ 340 else \ 341 { \ 342 stmt; \343 } \ 344 } while (0) 345 #endif 346 347 348 /** @def A ssertReturn89 * @param a_Expr Expression which should be true. 90 * @param a_Stmt Statement to execute on failure. 91 */ 92 #ifdef VBOX_STRICT_GUEST 93 # define ASSERT_GUEST_STMT(a_Expr, a_Stmt) \ 94 do { \ 95 if (RT_LIKELY(!!(a_Expr))) \ 96 { /* likely */ } \ 97 else \ 98 { \ 99 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 100 ASSERT_GUEST_PANIC(); \ 101 a_Stmt; \ 102 } \ 103 } while (0) 104 #else 105 # define ASSERT_GUEST_STMT(a_Expr, a_Stmt) \ 106 do { \ 107 if (RT_LIKELY(!!(a_Expr))) \ 108 { /* likely */ } \ 109 else \ 110 { \ 111 a_Stmt; \ 112 } \ 113 } while (0) 114 #endif 115 116 117 /** @def ASSERT_GUEST_RETURN 349 118 * Assert that an expression is true and returns if it isn't. 350 * In RT_STRICT mode it will hit a breakpoint before returning.351 * 352 * @param exprExpression which should be true.353 * @param rcWhat is to be presented to return.354 */ 355 #ifdef RT_STRICT356 # define A ssertReturn(expr,rc) \357 do { \ 358 if (RT_LIKELY(!!( expr))) \359 { /* likely */ } \ 360 else \ 361 { \ 362 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \363 RTAssertPanic(); \364 return ( rc); \365 } \ 366 } while (0) 367 #else 368 # define A ssertReturn(expr,rc) \369 do { \ 370 if (RT_LIKELY(!!( expr))) \371 { /* likely */ } \ 372 else \ 373 return ( rc); \374 } while (0) 375 #endif 376 377 /** @def A ssertReturnStmt119 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning. 120 * 121 * @param a_Expr Expression which should be true. 122 * @param a_rc What is to be presented to return. 123 */ 124 #ifdef VBOX_STRICT_GUEST 125 # define ASSERT_GUEST_RETURN(a_Expr, a_rc) \ 126 do { \ 127 if (RT_LIKELY(!!(a_Expr))) \ 128 { /* likely */ } \ 129 else \ 130 { \ 131 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 132 ASSERT_GUEST_PANIC(); \ 133 return (a_rc); \ 134 } \ 135 } while (0) 136 #else 137 # define ASSERT_GUEST_RETURN(a_Expr, a_rc) \ 138 do { \ 139 if (RT_LIKELY(!!(a_Expr))) \ 140 { /* likely */ } \ 141 else \ 142 return (a_rc); \ 143 } while (0) 144 #endif 145 146 /** @def ASSERT_GUEST_STMT_RETURN 378 147 * Assert that an expression is true, if it isn't execute the given statement 379 148 * and return rc. 380 149 * 381 * In RT_STRICT mode it will hit a breakpoint before executing the statement and150 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before executing the statement and 382 151 * returning. 383 152 * 384 * @param exprExpression which should be true.385 * @param stmtStatement to execute before returning on failure.386 * @param rcWhat is to be presented to return.387 */ 388 #ifdef RT_STRICT389 # define A ssertReturnStmt(expr, stmt,rc) \390 do { \ 391 if (RT_LIKELY(!!( expr))) \392 { /* likely */ } \ 393 else \ 394 { \ 395 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \396 RTAssertPanic(); \397 stmt; \398 return ( rc); \399 } \ 400 } while (0) 401 #else 402 # define A ssertReturnStmt(expr, stmt,rc) \403 do { \ 404 if (RT_LIKELY(!!( expr))) \405 { /* likely */ } \ 406 else \ 407 { \ 408 stmt; \409 return ( rc); \410 } \ 411 } while (0) 412 #endif 413 414 /** @def A ssertReturnVoid153 * @param a_Expr Expression which should be true. 154 * @param a_Stmt Statement to execute before returning on failure. 155 * @param a_rc What is to be presented to return. 156 */ 157 #ifdef VBOX_STRICT_GUEST 158 # define ASSERT_GUEST_STMT_RETURN(a_Expr, a_Stmt, a_rc) \ 159 do { \ 160 if (RT_LIKELY(!!(a_Expr))) \ 161 { /* likely */ } \ 162 else \ 163 { \ 164 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 165 ASSERT_GUEST_PANIC(); \ 166 a_Stmt; \ 167 return (a_rc); \ 168 } \ 169 } while (0) 170 #else 171 # define ASSERT_GUEST_STMT_RETURN(a_Expr, a_Stmt, a_rc) \ 172 do { \ 173 if (RT_LIKELY(!!(a_Expr))) \ 174 { /* likely */ } \ 175 else \ 176 { \ 177 a_Stmt; \ 178 return (a_rc); \ 179 } \ 180 } while (0) 181 #endif 182 183 /** @def ASSERT_GUEST_RETURN_VOID 415 184 * Assert that an expression is true and returns if it isn't. 416 * In RT_STRICT mode it will hit a breakpoint before returning.417 * 418 * @param exprExpression which should be true.419 */ 420 #ifdef RT_STRICT421 # define A ssertReturnVoid(expr) \422 do { \ 423 if (RT_LIKELY(!!( expr))) \424 { /* likely */ } \ 425 else \ 426 { \ 427 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \428 RTAssertPanic(); \185 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning. 186 * 187 * @param a_Expr Expression which should be true. 188 */ 189 #ifdef VBOX_STRICT_GUEST 190 # define ASSERT_GUEST_RETURN_VOID(a_Expr) \ 191 do { \ 192 if (RT_LIKELY(!!(a_Expr))) \ 193 { /* likely */ } \ 194 else \ 195 { \ 196 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 197 ASSERT_GUEST_PANIC(); \ 429 198 return; \ 430 199 } \ 431 200 } while (0) 432 201 #else 433 # define A ssertReturnVoid(expr) \434 do { \ 435 if (RT_LIKELY(!!( expr))) \202 # define ASSERT_GUEST_RETURN_VOID(a_Expr) \ 203 do { \ 204 if (RT_LIKELY(!!(a_Expr))) \ 436 205 { /* likely */ } \ 437 206 else \ … … 440 209 #endif 441 210 442 /** @def A ssertReturnVoidStmt211 /** @def ASSERT_GUEST_STMT_RETURN_VOID 443 212 * Assert that an expression is true, if it isn't execute the given statement 444 213 * and return. 445 214 * 446 * In RT_STRICT mode it will hit a breakpoint before returning.447 * 448 * @param exprExpression which should be true.449 * @param stmtStatement to execute before returning on failure.450 */ 451 #ifdef RT_STRICT452 # define A ssertReturnVoidStmt(expr, stmt) \453 do { \ 454 if (RT_LIKELY(!!( expr))) \455 { /* likely */ } \ 456 else \ 457 { \ 458 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \459 RTAssertPanic(); \460 stmt; \215 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning. 216 * 217 * @param a_Expr Expression which should be true. 218 * @param a_Stmt Statement to execute before returning on failure. 219 */ 220 #ifdef VBOX_STRICT_GUEST 221 # define ASSERT_GUEST_STMT_RETURN_VOID(a_Expr, a_Stmt) \ 222 do { \ 223 if (RT_LIKELY(!!(a_Expr))) \ 224 { /* likely */ } \ 225 else \ 226 { \ 227 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 228 ASSERT_GUEST_PANIC(); \ 229 a_Stmt; \ 461 230 return; \ 462 231 } \ 463 232 } while (0) 464 233 #else 465 # define A ssertReturnVoidStmt(expr, stmt) \466 do { \ 467 if (RT_LIKELY(!!( expr))) \468 { /* likely */ } \ 469 else \ 470 { \ 471 stmt; \234 # define ASSERT_GUEST_STMT_RETURN_VOID(a_Expr, a_Stmt) \ 235 do { \ 236 if (RT_LIKELY(!!(a_Expr))) \ 237 { /* likely */ } \ 238 else \ 239 { \ 240 a_Stmt; \ 472 241 return; \ 473 242 } \ … … 476 245 477 246 478 /** @def A ssertBreak247 /** @def ASSERT_GUEST_BREAK 479 248 * Assert that an expression is true and breaks if it isn't. 480 * In RT_STRICT mode it will hit a breakpoint before breaking.481 * 482 * @param exprExpression which should be true.483 */ 484 #ifdef RT_STRICT485 # define A ssertBreak(expr) \486 if (RT_LIKELY(!!( expr))) \249 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before breaking. 250 * 251 * @param a_Expr Expression which should be true. 252 */ 253 #ifdef VBOX_STRICT_GUEST 254 # define ASSERT_GUEST_BREAK(a_Expr) \ 255 if (RT_LIKELY(!!(a_Expr))) \ 487 256 { /* likely */ } \ 488 257 else if (1) \ 489 258 { \ 490 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \491 RTAssertPanic(); \259 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 260 ASSERT_GUEST_PANIC(); \ 492 261 break; \ 493 262 } else \ 494 263 break 495 264 #else 496 # define A ssertBreak(expr) \497 if (RT_LIKELY(!!( expr))) \265 # define ASSERT_GUEST_BREAK(a_Expr) \ 266 if (RT_LIKELY(!!(a_Expr))) \ 498 267 { /* likely */ } \ 499 268 else \ … … 501 270 #endif 502 271 503 /** @def A ssertContinue272 /** @def ASSERT_GUEST_CONTINUE 504 273 * Assert that an expression is true and continue if it isn't. 505 * In RT_STRICT mode it will hit a breakpoint before continuing.506 * 507 * @param exprExpression which should be true.508 */ 509 #ifdef RT_STRICT510 # define A ssertContinue(expr) \511 if (RT_LIKELY(!!( expr))) \274 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before continuing. 275 * 276 * @param a_Expr Expression which should be true. 277 */ 278 #ifdef VBOX_STRICT_GUEST 279 # define ASSERT_GUEST_CONTINUE(a_Expr) \ 280 if (RT_LIKELY(!!(a_Expr))) \ 512 281 { /* likely */ } \ 513 282 else if (1) \ 514 283 { \ 515 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \516 RTAssertPanic(); \284 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 285 ASSERT_GUEST_PANIC(); \ 517 286 continue; \ 518 287 } else do {} while (0) 519 288 #else 520 # define A ssertContinue(expr) \521 if (RT_LIKELY(!!( expr))) \289 # define ASSERT_GUEST_CONTINUE(a_Expr) \ 290 if (RT_LIKELY(!!(a_Expr))) \ 522 291 { /* likely */ } \ 523 292 else \ … … 525 294 #endif 526 295 527 /** @def A ssertBreakStmt296 /** @def ASSERT_GUEST_STMT_BREAK 528 297 * Assert that an expression is true and breaks if it isn't. 529 * In RT_STRICT mode it will hit a breakpoint before doing break.530 * 531 * @param exprExpression which should be true.532 * @param stmtStatement to execute before break in case of a failed assertion.533 */ 534 #ifdef RT_STRICT535 # define A ssertBreakStmt(expr, stmt) \536 if (RT_LIKELY(!!( expr))) \298 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before doing break. 299 * 300 * @param a_Expr Expression which should be true. 301 * @param a_Stmt Statement to execute before break in case of a failed assertion. 302 */ 303 #ifdef VBOX_STRICT_GUEST 304 # define ASSERT_GUEST_STMT_BREAK(a_Expr, a_Stmt) \ 305 if (RT_LIKELY(!!(a_Expr))) \ 537 306 { /* likely */ } \ 538 307 else if (1) \ 539 308 { \ 540 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \541 RTAssertPanic(); \542 stmt; \309 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 310 ASSERT_GUEST_PANIC(); \ 311 a_Stmt; \ 543 312 break; \ 544 313 } else do {} while (0) 545 314 #else 546 # define A ssertBreakStmt(expr, stmt) \547 if (RT_LIKELY(!!( expr))) \315 # define ASSERT_GUEST_STMT_BREAK(a_Expr, a_Stmt) \ 316 if (RT_LIKELY(!!(a_Expr))) \ 548 317 { /* likely */ } \ 549 318 else if (1) \ 550 319 { \ 551 stmt; \320 a_Stmt; \ 552 321 break; \ 553 322 } else do {} while (0) … … 555 324 556 325 557 /** @def A ssertMsg326 /** @def ASSERT_GUEST_MSG 558 327 * Assert that an expression is true. If it's not print message and hit breakpoint. 559 * @param exprExpression which should be true.560 * @param a printf argument list (in parenthesis). 561 */ 562 #ifdef RT_STRICT563 # define A ssertMsg(expr, a) \564 do { \ 565 if (RT_LIKELY(!!( expr))) \566 { /* likely */ } \ 567 else \ 568 { \ 569 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \328 * @param a_Expr Expression which should be true. 329 * @param a printf argument list (in parenthesis). 330 */ 331 #ifdef VBOX_STRICT_GUEST 332 # define ASSERT_GUEST_MSG(a_Expr, a) \ 333 do { \ 334 if (RT_LIKELY(!!(a_Expr))) \ 335 { /* likely */ } \ 336 else \ 337 { \ 338 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 570 339 RTAssertMsg2Weak a; \ 571 RTAssertPanic(); \572 } \ 573 } while (0) 574 #else 575 # define A ssertMsg(expr, a) do { } while (0)576 #endif 577 578 /** @def A ssertMsgStmt340 ASSERT_GUEST_PANIC(); \ 341 } \ 342 } while (0) 343 #else 344 # define ASSERT_GUEST_MSG(a_Expr, a) do { } while (0) 345 #endif 346 347 /** @def ASSERT_GUEST_MSG_STMT 579 348 * Assert that an expression is true. If it's not print message and hit 580 349 * breakpoint and execute the statement. 581 350 * 582 * @param exprExpression which should be true.583 * @param a printf argument list (in parenthesis). 584 * @param stmtStatement to execute in case of a failed assertion.351 * @param a_Expr Expression which should be true. 352 * @param a printf argument list (in parenthesis). 353 * @param a_Stmt Statement to execute in case of a failed assertion. 585 354 * 586 355 * @remarks The expression and statement will be evaluated in all build types. 587 356 */ 588 #ifdef RT_STRICT589 # define A ssertMsgStmt(expr, a, stmt) \590 do { \ 591 if (RT_LIKELY(!!( expr))) \592 { /* likely */ } \ 593 else \ 594 { \ 595 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \357 #ifdef VBOX_STRICT_GUEST 358 # define ASSERT_GUEST_MSG_STMT(a_Expr, a, a_Stmt) \ 359 do { \ 360 if (RT_LIKELY(!!(a_Expr))) \ 361 { /* likely */ } \ 362 else \ 363 { \ 364 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 596 365 RTAssertMsg2Weak a; \ 597 RTAssertPanic(); \598 stmt; \599 } \ 600 } while (0) 601 #else 602 # define A ssertMsgStmt(expr, a, stmt) \603 do { \ 604 if (RT_LIKELY(!!( expr))) \605 { /* likely */ } \ 606 else \ 607 { \ 608 stmt; \609 } \ 610 } while (0) 611 #endif 612 613 /** @def A ssertMsgReturn366 ASSERT_GUEST_PANIC(); \ 367 a_Stmt; \ 368 } \ 369 } while (0) 370 #else 371 # define ASSERT_GUEST_MSG_STMT(a_Expr, a, a_Stmt) \ 372 do { \ 373 if (RT_LIKELY(!!(a_Expr))) \ 374 { /* likely */ } \ 375 else \ 376 { \ 377 a_Stmt; \ 378 } \ 379 } while (0) 380 #endif 381 382 /** @def ASSERT_GUEST_MSG_RETURN 614 383 * Assert that an expression is true and returns if it isn't. 615 * In RT_STRICT mode it will hit a breakpoint before returning.616 * 617 * @param exprExpression which should be true.618 * @param a printf argument list (in parenthesis). 619 * @param rcWhat is to be presented to return.620 */ 621 #ifdef RT_STRICT622 # define A ssertMsgReturn(expr, a,rc) \623 do { \ 624 if (RT_LIKELY(!!( expr))) \625 { /* likely */ } \ 626 else \ 627 { \ 628 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \384 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning. 385 * 386 * @param a_Expr Expression which should be true. 387 * @param a printf argument list (in parenthesis). 388 * @param a_rc What is to be presented to return. 389 */ 390 #ifdef VBOX_STRICT_GUEST 391 # define ASSERT_GUEST_MSG_RETURN(a_Expr, a, a_rc) \ 392 do { \ 393 if (RT_LIKELY(!!(a_Expr))) \ 394 { /* likely */ } \ 395 else \ 396 { \ 397 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 629 398 RTAssertMsg2Weak a; \ 630 RTAssertPanic(); \631 return ( rc); \632 } \ 633 } while (0) 634 #else 635 # define A ssertMsgReturn(expr, a,rc) \636 do { \ 637 if (RT_LIKELY(!!( expr))) \638 { /* likely */ } \ 639 else \ 640 return ( rc); \641 } while (0) 642 #endif 643 644 /** @def A ssertMsgReturnStmt399 ASSERT_GUEST_PANIC(); \ 400 return (a_rc); \ 401 } \ 402 } while (0) 403 #else 404 # define ASSERT_GUEST_MSG_RETURN(a_Expr, a, a_rc) \ 405 do { \ 406 if (RT_LIKELY(!!(a_Expr))) \ 407 { /* likely */ } \ 408 else \ 409 return (a_rc); \ 410 } while (0) 411 #endif 412 413 /** @def ASSERT_GUEST_MSG_STMT_RETURN 645 414 * Assert that an expression is true, if it isn't execute the statement and 646 415 * return. 647 416 * 648 * In RT_STRICT mode it will hit a breakpoint before returning.649 * 650 * @param exprExpression which should be true.651 * @param a printf argument list (in parenthesis). 652 * @param stmtStatement to execute before returning in case of a failed417 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning. 418 * 419 * @param a_Expr Expression which should be true. 420 * @param a printf argument list (in parenthesis). 421 * @param a_Stmt Statement to execute before returning in case of a failed 653 422 * assertion. 654 * @param rcWhat is to be presented to return.655 */ 656 #ifdef RT_STRICT657 # define A ssertMsgReturnStmt(expr, a, stmt,rc) \658 do { \ 659 if (RT_LIKELY(!!( expr))) \660 { /* likely */ } \ 661 else \ 662 { \ 663 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \423 * @param a_rc What is to be presented to return. 424 */ 425 #ifdef VBOX_STRICT_GUEST 426 # define ASSERT_GUEST_MSG_STMT_RETURN(a_Expr, a, a_Stmt, a_rc) \ 427 do { \ 428 if (RT_LIKELY(!!(a_Expr))) \ 429 { /* likely */ } \ 430 else \ 431 { \ 432 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 664 433 RTAssertMsg2Weak a; \ 665 RTAssertPanic(); \666 stmt; \667 return ( rc); \668 } \ 669 } while (0) 670 #else 671 # define A ssertMsgReturnStmt(expr, a, stmt,rc) \672 do { \ 673 if (RT_LIKELY(!!( expr))) \674 { /* likely */ } \ 675 else \ 676 { \ 677 stmt; \678 return ( rc); \679 } \ 680 } while (0) 681 #endif 682 683 /** @def A ssertMsgReturnVoid434 ASSERT_GUEST_PANIC(); \ 435 a_Stmt; \ 436 return (a_rc); \ 437 } \ 438 } while (0) 439 #else 440 # define ASSERT_GUEST_MSG_STMT_RETURN(a_Expr, a, a_Stmt, a_rc) \ 441 do { \ 442 if (RT_LIKELY(!!(a_Expr))) \ 443 { /* likely */ } \ 444 else \ 445 { \ 446 a_Stmt; \ 447 return (a_rc); \ 448 } \ 449 } while (0) 450 #endif 451 452 /** @def ASSERT_GUEST_MSG_RETURN_VOID 684 453 * Assert that an expression is true and returns if it isn't. 685 * In RT_STRICT mode it will hit a breakpoint before returning.686 * 687 * @param exprExpression which should be true.688 * @param a printf argument list (in parenthesis). 689 */ 690 #ifdef RT_STRICT691 # define A ssertMsgReturnVoid(expr, a) \692 do { \ 693 if (RT_LIKELY(!!( expr))) \694 { /* likely */ } \ 695 else \ 696 { \ 697 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \454 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning. 455 * 456 * @param a_Expr Expression which should be true. 457 * @param a printf argument list (in parenthesis). 458 */ 459 #ifdef VBOX_STRICT_GUEST 460 # define ASSERT_GUEST_MSG_RETURN_VOID(a_Expr, a) \ 461 do { \ 462 if (RT_LIKELY(!!(a_Expr))) \ 463 { /* likely */ } \ 464 else \ 465 { \ 466 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 698 467 RTAssertMsg2Weak a; \ 699 RTAssertPanic(); \468 ASSERT_GUEST_PANIC(); \ 700 469 return; \ 701 470 } \ 702 471 } while (0) 703 472 #else 704 # define A ssertMsgReturnVoid(expr, a) \705 do { \ 706 if (RT_LIKELY(!!( expr))) \473 # define ASSERT_GUEST_MSG_RETURN_VOID(a_Expr, a) \ 474 do { \ 475 if (RT_LIKELY(!!(a_Expr))) \ 707 476 { /* likely */ } \ 708 477 else \ … … 711 480 #endif 712 481 713 /** @def A ssertMsgReturnVoidStmt482 /** @def ASSERT_GUEST_MSG_STMT_RETURN_VOID 714 483 * Assert that an expression is true, if it isn't execute the statement and 715 484 * return. 716 485 * 717 * In RT_STRICT mode it will hit a breakpoint before returning.718 * 719 * @param exprExpression which should be true.720 * @param a printf argument list (in parenthesis). 721 * @param stmtStatement to execute before return in case of a failed assertion.722 */ 723 #ifdef RT_STRICT724 # define A ssertMsgReturnVoidStmt(expr, a, stmt) \725 do { \ 726 if (RT_LIKELY(!!( expr))) \727 { /* likely */ } \ 728 else \ 729 { \ 730 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \486 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning. 487 * 488 * @param a_Expr Expression which should be true. 489 * @param a printf argument list (in parenthesis). 490 * @param a_Stmt Statement to execute before return in case of a failed assertion. 491 */ 492 #ifdef VBOX_STRICT_GUEST 493 # define ASSERT_GUEST_MSG_STMT_RETURN_VOID(a_Expr, a, a_Stmt) \ 494 do { \ 495 if (RT_LIKELY(!!(a_Expr))) \ 496 { /* likely */ } \ 497 else \ 498 { \ 499 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 731 500 RTAssertMsg2Weak a; \ 732 RTAssertPanic(); \733 stmt; \501 ASSERT_GUEST_PANIC(); \ 502 a_Stmt; \ 734 503 return; \ 735 504 } \ 736 505 } while (0) 737 506 #else 738 # define A ssertMsgReturnVoidStmt(expr, a, stmt) \739 do { \ 740 if (RT_LIKELY(!!( expr))) \741 { /* likely */ } \ 742 else \ 743 { \ 744 stmt; \507 # define ASSERT_GUEST_MSG_STMT_RETURN_VOID(a_Expr, a, a_Stmt) \ 508 do { \ 509 if (RT_LIKELY(!!(a_Expr))) \ 510 { /* likely */ } \ 511 else \ 512 { \ 513 a_Stmt; \ 745 514 return; \ 746 515 } \ … … 749 518 750 519 751 /** @def A ssertMsgBreak520 /** @def ASSERT_GUEST_MSG_BREAK 752 521 * Assert that an expression is true and breaks if it isn't. 753 * In RT_STRICT mode it will hit a breakpoint before returning.754 * 755 * @param exprExpression which should be true.756 * @param a printf argument list (in parenthesis). 757 */ 758 #ifdef RT_STRICT759 # define A ssertMsgBreak(expr, a) \760 if (RT_LIKELY(!!( expr))) \522 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning. 523 * 524 * @param a_Expr Expression which should be true. 525 * @param a printf argument list (in parenthesis). 526 */ 527 #ifdef VBOX_STRICT_GUEST 528 # define ASSERT_GUEST_MSG_BREAK(a_Expr, a) \ 529 if (RT_LIKELY(!!(a_Expr))) \ 761 530 { /* likely */ } \ 762 531 else if (1) \ 763 532 { \ 764 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \533 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 765 534 RTAssertMsg2Weak a; \ 766 RTAssertPanic(); \535 ASSERT_GUEST_PANIC(); \ 767 536 break; \ 768 537 } else \ 769 538 break 770 539 #else 771 # define A ssertMsgBreak(expr, a) \772 if (RT_LIKELY(!!( expr))) \540 # define ASSERT_GUEST_MSG_BREAK(a_Expr, a) \ 541 if (RT_LIKELY(!!(a_Expr))) \ 773 542 { /* likely */ } \ 774 543 else \ … … 776 545 #endif 777 546 778 /** @def A ssertMsgBreakStmt547 /** @def ASSERT_GUEST_MSG_STMT_BREAK 779 548 * Assert that an expression is true and breaks if it isn't. 780 * In RT_STRICT mode it will hit a breakpoint before doing break.781 * 782 * @param exprExpression which should be true.783 * @param a printf argument list (in parenthesis). 784 * @param stmtStatement to execute before break in case of a failed assertion.785 */ 786 #ifdef RT_STRICT787 # define A ssertMsgBreakStmt(expr, a, stmt) \788 if (RT_LIKELY(!!( expr))) \549 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before doing break. 550 * 551 * @param a_Expr Expression which should be true. 552 * @param a printf argument list (in parenthesis). 553 * @param a_Stmt Statement to execute before break in case of a failed assertion. 554 */ 555 #ifdef VBOX_STRICT_GUEST 556 # define ASSERT_GUEST_MSG_STMT_BREAK(a_Expr, a, a_Stmt) \ 557 if (RT_LIKELY(!!(a_Expr))) \ 789 558 { /* likely */ } \ 790 559 else if (1) \ 791 560 { \ 792 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \561 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 793 562 RTAssertMsg2Weak a; \ 794 RTAssertPanic(); \795 stmt; \563 ASSERT_GUEST_PANIC(); \ 564 a_Stmt; \ 796 565 break; \ 797 566 } else \ 798 567 break 799 568 #else 800 # define A ssertMsgBreakStmt(expr, a, stmt) \801 if (RT_LIKELY(!!( expr))) \569 # define ASSERT_GUEST_MSG_STMT_BREAK(a_Expr, a, a_Stmt) \ 570 if (RT_LIKELY(!!(a_Expr))) \ 802 571 { /* likely */ } \ 803 572 else if (1) \ 804 573 { \ 805 stmt; \574 a_Stmt; \ 806 575 break; \ 807 576 } else \ … … 809 578 #endif 810 579 811 /** @def A ssertFailed580 /** @def ASSERT_GUEST_FAILED 812 581 * An assertion failed, hit breakpoint. 813 582 */ 814 #ifdef RT_STRICT815 # define A ssertFailed() \816 do { \ 817 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \818 RTAssertPanic(); \819 } while (0) 820 #else 821 # define A ssertFailed() do { } while (0)822 #endif 823 824 /** @def A ssertFailedStmt583 #ifdef VBOX_STRICT_GUEST 584 # define ASSERT_GUEST_FAILED() \ 585 do { \ 586 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 587 ASSERT_GUEST_PANIC(); \ 588 } while (0) 589 #else 590 # define ASSERT_GUEST_FAILED() do { } while (0) 591 #endif 592 593 /** @def ASSERT_GUEST_FAILEDStmt 825 594 * An assertion failed, hit breakpoint and execute statement. 826 595 */ 827 #ifdef RT_STRICT828 # define A ssertFailedStmt(stmt) \829 do { \ 830 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \831 RTAssertPanic(); \832 stmt; \833 } while (0) 834 #else 835 # define A ssertFailedStmt(stmt) do { stmt; } while (0)836 #endif 837 838 /** @def A ssertFailedReturn839 * An assertion failed, hit breakpoint ( RT_STRICT mode only) and return.840 * 841 * @param rc Therc to return.842 */ 843 #ifdef RT_STRICT844 # define A ssertFailedReturn(rc) \845 do { \ 846 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \847 RTAssertPanic(); \848 return ( rc); \849 } while (0) 850 #else 851 # define A ssertFailedReturn(rc) \852 do { \ 853 return ( rc); \854 } while (0) 855 #endif 856 857 /** @def A ssertFailedReturnStmt858 * An assertion failed, hit breakpoint ( RT_STRICT mode only), execute a596 #ifdef VBOX_STRICT_GUEST 597 # define ASSERT_GUEST_FAILED_STMT(a_Stmt) \ 598 do { \ 599 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 600 ASSERT_GUEST_PANIC(); \ 601 a_Stmt; \ 602 } while (0) 603 #else 604 # define ASSERT_GUEST_FAILED_STMT(a_Stmt) do { a_Stmt; } while (0) 605 #endif 606 607 /** @def ASSERT_GUEST_FAILED_RETURN 608 * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only) and return. 609 * 610 * @param a_rc The a_rc to return. 611 */ 612 #ifdef VBOX_STRICT_GUEST 613 # define ASSERT_GUEST_FAILED_RETURN(a_rc) \ 614 do { \ 615 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 616 ASSERT_GUEST_PANIC(); \ 617 return (a_rc); \ 618 } while (0) 619 #else 620 # define ASSERT_GUEST_FAILED_RETURN(a_rc) \ 621 do { \ 622 return (a_rc); \ 623 } while (0) 624 #endif 625 626 /** @def ASSERT_GUEST_FAILED_STMT_RETURN 627 * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute a 859 628 * statement and return a value. 860 629 * 861 * @param stmtThe statement to execute before returning.862 * @param rcThe value to return.863 */ 864 #ifdef RT_STRICT865 # define A ssertFailedReturnStmt(stmt,rc) \866 do { \ 867 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \868 RTAssertPanic(); \869 stmt; \870 return ( rc); \871 } while (0) 872 #else 873 # define A ssertFailedReturnStmt(stmt,rc) \874 do { \ 875 stmt; \876 return ( rc); \877 } while (0) 878 #endif 879 880 /** @def A ssertFailedReturnVoid881 * An assertion failed, hit breakpoint ( RT_STRICT mode only) and return.882 */ 883 #ifdef RT_STRICT884 # define A ssertFailedReturnVoid() \885 do { \ 886 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \887 RTAssertPanic(); \630 * @param a_Stmt The statement to execute before returning. 631 * @param a_rc The value to return. 632 */ 633 #ifdef VBOX_STRICT_GUEST 634 # define ASSERT_GUEST_FAILED_STMT_RETURN(a_Stmt, a_rc) \ 635 do { \ 636 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 637 ASSERT_GUEST_PANIC(); \ 638 a_Stmt; \ 639 return (a_rc); \ 640 } while (0) 641 #else 642 # define ASSERT_GUEST_FAILED_STMT_RETURN(a_Stmt, a_rc) \ 643 do { \ 644 a_Stmt; \ 645 return (a_rc); \ 646 } while (0) 647 #endif 648 649 /** @def ASSERT_GUEST_FAILED_RETURN_VOID 650 * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only) and return. 651 */ 652 #ifdef VBOX_STRICT_GUEST 653 # define ASSERT_GUEST_FAILED_RETURN_VOID() \ 654 do { \ 655 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 656 ASSERT_GUEST_PANIC(); \ 888 657 return; \ 889 658 } while (0) 890 659 #else 891 # define A ssertFailedReturnVoid() \660 # define ASSERT_GUEST_FAILED_RETURN_VOID() \ 892 661 do { \ 893 662 return; \ … … 895 664 #endif 896 665 897 /** @def A ssertFailedReturnVoidStmt898 * An assertion failed, hit breakpoint ( RT_STRICT mode only), execute a666 /** @def ASSERT_GUEST_FAILED_STMT_RETURN_VOID 667 * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute a 899 668 * statement and return. 900 669 * 901 * @param stmt The statement to execute before returning.902 */ 903 #ifdef RT_STRICT904 # define A ssertFailedReturnVoidStmt(stmt) \905 do { \ 906 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \907 RTAssertPanic(); \908 stmt; \670 * @param a_Stmt The statement to execute before returning. 671 */ 672 #ifdef VBOX_STRICT_GUEST 673 # define ASSERT_GUEST_FAILED_STMT_RETURN_VOID(a_Stmt) \ 674 do { \ 675 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 676 ASSERT_GUEST_PANIC(); \ 677 a_Stmt; \ 909 678 return; \ 910 679 } while (0) 911 680 #else 912 # define A ssertFailedReturnVoidStmt(stmt) \913 do { \ 914 stmt; \681 # define ASSERT_GUEST_FAILED_STMT_RETURN_VOID(a_Stmt) \ 682 do { \ 683 a_Stmt; \ 915 684 return; \ 916 685 } while (0) … … 918 687 919 688 920 /** @def A ssertFailedBreak921 * An assertion failed, hit breakpoint ( RT_STRICT mode only) and break.922 */ 923 #ifdef RT_STRICT924 # define A ssertFailedBreak() \689 /** @def ASSERT_GUEST_FAILED_BREAK 690 * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only) and break. 691 */ 692 #ifdef VBOX_STRICT_GUEST 693 # define ASSERT_GUEST_FAILED_BREAK() \ 925 694 if (1) { \ 926 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \927 RTAssertPanic(); \695 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 696 ASSERT_GUEST_PANIC(); \ 928 697 break; \ 929 698 } else \ 930 699 break 931 700 #else 932 # define A ssertFailedBreak() \701 # define ASSERT_GUEST_FAILED_BREAK() \ 933 702 if (1) \ 934 703 break; \ … … 937 706 #endif 938 707 939 /** @def A ssertFailedBreakStmt940 * An assertion failed, hit breakpoint ( RT_STRICT mode only), execute708 /** @def ASSERT_GUEST_FAILED_STMT_BREAK 709 * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute 941 710 * the given statement and break. 942 711 * 943 * @param stmtStatement to execute before break.944 */ 945 #ifdef RT_STRICT946 # define A ssertFailedBreakStmt(stmt) \712 * @param a_Stmt Statement to execute before break. 713 */ 714 #ifdef VBOX_STRICT_GUEST 715 # define ASSERT_GUEST_FAILED_STMT_BREAK(a_Stmt) \ 947 716 if (1) { \ 948 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \949 RTAssertPanic(); \950 stmt; \717 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 718 ASSERT_GUEST_PANIC(); \ 719 a_Stmt; \ 951 720 break; \ 952 721 } else \ 953 722 break 954 723 #else 955 # define A ssertFailedBreakStmt(stmt) \724 # define ASSERT_GUEST_FAILED_STMT_BREAK(a_Stmt) \ 956 725 if (1) { \ 957 stmt; \726 a_Stmt; \ 958 727 break; \ 959 728 } else \ … … 962 731 963 732 964 /** @def A ssertMsgFailed733 /** @def ASSERT_GUEST_MSG_FAILED 965 734 * An assertion failed print a message and a hit breakpoint. 966 735 * 967 736 * @param a printf argument list (in parenthesis). 968 737 */ 969 #ifdef RT_STRICT970 # define A ssertMsgFailed(a) \971 do { \ 972 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \738 #ifdef VBOX_STRICT_GUEST 739 # define ASSERT_GUEST_MSG_FAILED(a) \ 740 do { \ 741 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 973 742 RTAssertMsg2Weak a; \ 974 RTAssertPanic(); \975 } while (0) 976 #else 977 # define A ssertMsgFailed(a) do { } while (0)978 #endif 979 980 /** @def A ssertMsgFailedReturn981 * An assertion failed, hit breakpoint with message ( RT_STRICT mode only) and return.982 * 983 * @param a printf argument list (in parenthesis). 984 * @param rcWhat is to be presented to return.985 */ 986 #ifdef RT_STRICT987 # define A ssertMsgFailedReturn(a,rc) \988 do { \ 989 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \743 ASSERT_GUEST_PANIC(); \ 744 } while (0) 745 #else 746 # define ASSERT_GUEST_MSG_FAILED(a) do { } while (0) 747 #endif 748 749 /** @def ASSERT_GUEST_MSG_FAILEDReturn 750 * An assertion failed, hit breakpoint with message (VBOX_STRICT_GUEST mode only) and return. 751 * 752 * @param a printf argument list (in parenthesis). 753 * @param a_rc What is to be presented to return. 754 */ 755 #ifdef VBOX_STRICT_GUEST 756 # define ASSERT_GUEST_MSG_FAILED_RETURN(a, a_rc) \ 757 do { \ 758 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 990 759 RTAssertMsg2Weak a; \ 991 RTAssertPanic(); \992 return ( rc); \993 } while (0) 994 #else 995 # define A ssertMsgFailedReturn(a,rc) \996 do { \ 997 return ( rc); \998 } while (0) 999 #endif 1000 1001 /** @def A ssertMsgFailedReturnVoid1002 * An assertion failed, hit breakpoint with message ( RT_STRICT mode only) and return.1003 * 1004 * @param a printf argument list (in parenthesis). 1005 */ 1006 #ifdef RT_STRICT1007 # define A ssertMsgFailedReturnVoid(a) \1008 do { \ 1009 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \760 ASSERT_GUEST_PANIC(); \ 761 return (a_rc); \ 762 } while (0) 763 #else 764 # define ASSERT_GUEST_MSG_FAILED_RETURN(a, a_rc) \ 765 do { \ 766 return (a_rc); \ 767 } while (0) 768 #endif 769 770 /** @def ASSERT_GUEST_MSG_FAILED_RETURN_VOID 771 * An assertion failed, hit breakpoint with message (VBOX_STRICT_GUEST mode only) and return. 772 * 773 * @param a printf argument list (in parenthesis). 774 */ 775 #ifdef VBOX_STRICT_GUEST 776 # define ASSERT_GUEST_MSG_FAILED_RETURN_VOID(a) \ 777 do { \ 778 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1010 779 RTAssertMsg2Weak a; \ 1011 RTAssertPanic(); \780 ASSERT_GUEST_PANIC(); \ 1012 781 return; \ 1013 782 } while (0) 1014 783 #else 1015 # define A ssertMsgFailedReturnVoid(a) \784 # define ASSERT_GUEST_MSG_FAILED_RETURN_VOID(a) \ 1016 785 do { \ 1017 786 return; \ … … 1020 789 1021 790 1022 /** @def A ssertMsgFailedBreak1023 * An assertion failed, hit breakpoint with message ( RT_STRICT mode only) and break.1024 * 1025 * @param a printf argument list (in parenthesis). 1026 */ 1027 #ifdef RT_STRICT1028 # define A ssertMsgFailedBreak(a) \791 /** @def ASSERT_GUEST_MSG_FAILED_BREAK 792 * An assertion failed, hit breakpoint with message (VBOX_STRICT_GUEST mode only) and break. 793 * 794 * @param a printf argument list (in parenthesis). 795 */ 796 #ifdef VBOX_STRICT_GUEST 797 # define ASSERT_GUEST_MSG_FAILED_BREAK(a) \ 1029 798 if (1) { \ 1030 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \799 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1031 800 RTAssertMsg2Weak a; \ 1032 RTAssertPanic(); \801 ASSERT_GUEST_PANIC(); \ 1033 802 break; \ 1034 803 } else \ 1035 804 break 1036 805 #else 1037 # define A ssertMsgFailedBreak(a) \806 # define ASSERT_GUEST_MSG_FAILED_BREAK(a) \ 1038 807 if (1) \ 1039 808 break; \ … … 1042 811 #endif 1043 812 1044 /** @def A ssertMsgFailedBreakStmt1045 * An assertion failed, hit breakpoint ( RT_STRICT mode only), execute813 /** @def ASSERT_GUEST_MSG_FAILED_STMT_BREAK 814 * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute 1046 815 * the given statement and break. 1047 816 * 1048 817 * @param a printf argument list (in parenthesis). 1049 * @param stmtStatement to execute before break.1050 */ 1051 #ifdef RT_STRICT1052 # define A ssertMsgFailedBreakStmt(a, stmt) \818 * @param a_Stmt Statement to execute before break. 819 */ 820 #ifdef VBOX_STRICT_GUEST 821 # define ASSERT_GUEST_MSG_FAILED_STMT_BREAK(a, a_Stmt) \ 1053 822 if (1) { \ 1054 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \823 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1055 824 RTAssertMsg2Weak a; \ 1056 RTAssertPanic(); \1057 stmt; \825 ASSERT_GUEST_PANIC(); \ 826 a_Stmt; \ 1058 827 break; \ 1059 828 } else \ 1060 829 break 1061 830 #else 1062 # define A ssertMsgFailedBreakStmt(a, stmt) \831 # define ASSERT_GUEST_MSG_FAILED_STMT_BREAK(a, a_Stmt) \ 1063 832 if (1) { \ 1064 stmt; \833 a_Stmt; \ 1065 834 break; \ 1066 835 } else \ … … 1072 841 1073 842 1074 /** @name Release Log Assertions1075 * 1076 * These assertions will work like normal strict assertion when RT_STRICT is1077 * defined and LogRel statements when RT_STRICT is undefined. Typically used for1078 * things which shouldn't go wrong, but when it does you'd like to know one way1079 * or the other.843 /** @name Guest input release log assertions 844 * 845 * These assertions will work like normal strict assertion when VBOX_STRICT_GUEST is 846 * defined and LogRel statements when VBOX_STRICT_GUEST is undefined. Typically 847 * used for important guest input that it would be helpful to find in VBox.log 848 * if the guest doesn't get it right. 1080 849 * 1081 850 * @{ 1082 851 */ 1083 852 1084 /** @def RTAssertLogRelMsg1 853 854 /** @def ASSERT_GUEST_LOGREL_MSG1 1085 855 * RTAssertMsg1Weak (strict builds) / LogRel wrapper (non-strict). 1086 856 */ 1087 #ifdef RT_STRICT 1088 # define RTAssertLogRelMsg1(pszExpr, iLine, pszFile, pszFunction) \ 1089 RTAssertMsg1Weak(pszExpr, iLine, pszFile, pszFunction) 1090 #else 1091 # define RTAssertLogRelMsg1(pszExpr, iLine, pszFile, pszFunction) \ 1092 LogRel(("AssertLogRel %s(%d) %s: %s\n",\ 1093 (pszFile), (iLine), (pszFunction), (pszExpr) )) 1094 #endif 1095 1096 /** @def RTAssertLogRelMsg2 857 #ifdef VBOX_STRICT_GUEST 858 # define ASSERT_GUEST_LOGREL_MSG1(szExpr, iLine, pszFile, pszFunction) \ 859 RTAssertMsg1Weak("guest-input: " szExpr, iLine, pszFile, pszFunction) 860 #else 861 # define ASSERT_GUEST_LOGREL_MSG1(szExpr, iLine, pszFile, pszFunction) \ 862 LogRel(("ASSERT_GUEST_LOGREL %s(%d) %s: %s\n", (pszFile), (iLine), (pszFunction), (szExpr) )) 863 #endif 864 865 /** @def ASSERT_GUEST_LOGREL_MSG2 1097 866 * RTAssertMsg2Weak (strict builds) / LogRel wrapper (non-strict). 1098 867 */ 1099 #ifdef RT_STRICT1100 # define RTAssertLogRelMsg2(a) RTAssertMsg2Weak a1101 #else 1102 # define RTAssertLogRelMsg2(a) LogRel(a)1103 #endif 1104 1105 /** @def A ssertLogRel868 #ifdef VBOX_STRICT_GUEST 869 # define ASSERT_GUEST_LOGREL_MSG2(a) RTAssertMsg2Weak a 870 #else 871 # define ASSERT_GUEST_LOGREL_MSG2(a) LogRel(a) 872 #endif 873 874 /** @def ASSERT_GUEST_LOGREL 1106 875 * Assert that an expression is true. 1107 876 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1108 877 * 1109 * @param exprExpression which should be true.1110 */ 1111 #define A ssertLogRel(expr) \1112 do { \ 1113 if (RT_LIKELY(!!( expr))) \1114 { /* likely */ } \ 1115 else \ 1116 { \ 1117 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \1118 RTAssertPanic(); \1119 } \ 1120 } while (0) 1121 1122 /** @def A ssertLogRelReturn1123 * Assert that an expression is true, return \a rc if it isn't.1124 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1125 * 1126 * @param exprExpression which should be true.1127 * @param rcWhat is to be presented to return.1128 */ 1129 #define A ssertLogRelReturn(expr,rc) \1130 do { \ 1131 if (RT_LIKELY(!!( expr))) \1132 { /* likely */ } \ 1133 else \ 1134 { \ 1135 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \1136 RTAssertPanic(); \1137 return ( rc); \1138 } \ 1139 } while (0) 1140 1141 /** @def A ssertLogRelReturnVoid878 * @param a_Expr Expression which should be true. 879 */ 880 #define ASSERT_GUEST_LOGREL(a_Expr) \ 881 do { \ 882 if (RT_LIKELY(!!(a_Expr))) \ 883 { /* likely */ } \ 884 else \ 885 { \ 886 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 887 ASSERT_GUEST_PANIC(); \ 888 } \ 889 } while (0) 890 891 /** @def ASSERT_GUEST_LOGRELReturn 892 * Assert that an expression is true, return \a a_rc if it isn't. 893 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 894 * 895 * @param a_Expr Expression which should be true. 896 * @param a_rc What is to be presented to return. 897 */ 898 #define ASSERT_GUEST_LOGREL_RETURN(a_Expr, a_rc) \ 899 do { \ 900 if (RT_LIKELY(!!(a_Expr))) \ 901 { /* likely */ } \ 902 else \ 903 { \ 904 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 905 ASSERT_GUEST_PANIC(); \ 906 return (a_rc); \ 907 } \ 908 } while (0) 909 910 /** @def ASSERT_GUEST_LOGREL_RETURN_VOID 1142 911 * Assert that an expression is true, return void if it isn't. 1143 912 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1144 913 * 1145 * @param exprExpression which should be true.1146 */ 1147 #define A ssertLogRelReturnVoid(expr) \1148 do { \ 1149 if (RT_LIKELY(!!( expr))) \1150 { /* likely */ } \ 1151 else \ 1152 { \ 1153 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \1154 RTAssertPanic(); \914 * @param a_Expr Expression which should be true. 915 */ 916 #define ASSERT_GUEST_LOGREL_RETURN_VOID(a_Expr) \ 917 do { \ 918 if (RT_LIKELY(!!(a_Expr))) \ 919 { /* likely */ } \ 920 else \ 921 { \ 922 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 923 ASSERT_GUEST_PANIC(); \ 1155 924 return; \ 1156 925 } \ 1157 926 } while (0) 1158 927 1159 /** @def A ssertLogRelBreak928 /** @def ASSERT_GUEST_LOGREL_BREAK 1160 929 * Assert that an expression is true, break if it isn't. 1161 930 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1162 931 * 1163 * @param exprExpression which should be true.1164 */ 1165 #define A ssertLogRelBreak(expr) \1166 if (RT_LIKELY(!!( expr))) \932 * @param a_Expr Expression which should be true. 933 */ 934 #define ASSERT_GUEST_LOGREL_BREAK(a_Expr) \ 935 if (RT_LIKELY(!!(a_Expr))) \ 1167 936 { /* likely */ } \ 1168 937 else if (1) \ 1169 938 { \ 1170 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \1171 RTAssertPanic(); \939 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 940 ASSERT_GUEST_PANIC(); \ 1172 941 break; \ 1173 942 } \ … … 1175 944 break 1176 945 1177 /** @def A ssertLogRelBreakStmt1178 * Assert that an expression is true, execute \a stmt and break if it isn't.1179 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1180 * 1181 * @param exprExpression which should be true.1182 * @param stmtStatement to execute before break in case of a failed assertion.1183 */ 1184 #define A ssertLogRelBreakStmt(expr, stmt) \1185 if (RT_LIKELY(!!( expr))) \946 /** @def ASSERT_GUEST_LOGREL_STMT_BREAK 947 * Assert that an expression is true, execute \a a_Stmt and break if it isn't. 948 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 949 * 950 * @param a_Expr Expression which should be true. 951 * @param a_Stmt Statement to execute before break in case of a failed assertion. 952 */ 953 #define ASSERT_GUEST_LOGREL_STMT_BREAK(a_Expr, a_Stmt) \ 954 if (RT_LIKELY(!!(a_Expr))) \ 1186 955 { /* likely */ } \ 1187 956 else if (1) \ 1188 957 { \ 1189 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \1190 RTAssertPanic(); \1191 stmt; \958 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 959 ASSERT_GUEST_PANIC(); \ 960 a_Stmt; \ 1192 961 break; \ 1193 962 } else \ 1194 963 break 1195 964 1196 /** @def A ssertLogRelMsg965 /** @def ASSERT_GUEST_LOGREL_MSG 1197 966 * Assert that an expression is true. 1198 967 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1199 968 * 1200 * @param exprExpression which should be true.1201 * @param a printf argument list (in parenthesis). 1202 */ 1203 #define A ssertLogRelMsg(expr, a) \1204 do { \ 1205 if (RT_LIKELY(!!( expr))) \969 * @param a_Expr Expression which should be true. 970 * @param a printf argument list (in parenthesis). 971 */ 972 #define ASSERT_GUEST_LOGREL_MSG(a_Expr, a) \ 973 do { \ 974 if (RT_LIKELY(!!(a_Expr))) \ 1206 975 { /* likely */ } \ 1207 976 else\ 1208 977 { \ 1209 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \1210 RTAssertLogRelMsg2(a); \1211 RTAssertPanic(); \1212 } \ 1213 } while (0) 1214 1215 /** @def A ssertLogRelMsgStmt1216 * Assert that an expression is true, execute \a stmt and break if it isn't1217 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1218 * 1219 * @param exprExpression which should be true.1220 * @param a printf argument list (in parenthesis). 1221 * @param stmtStatement to execute in case of a failed assertion.1222 */ 1223 #define A ssertLogRelMsgStmt(expr, a, stmt) \1224 do { \ 1225 if (RT_LIKELY(!!( expr))) \978 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 979 ASSERT_GUEST_LOGREL_MSG2(a); \ 980 ASSERT_GUEST_PANIC(); \ 981 } \ 982 } while (0) 983 984 /** @def ASSERT_GUEST_LOGREL_MSG_STMT 985 * Assert that an expression is true, execute \a a_Stmt and break if it isn't 986 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 987 * 988 * @param a_Expr Expression which should be true. 989 * @param a printf argument list (in parenthesis). 990 * @param a_Stmt Statement to execute in case of a failed assertion. 991 */ 992 #define ASSERT_GUEST_LOGREL_MSG_STMT(a_Expr, a, a_Stmt) \ 993 do { \ 994 if (RT_LIKELY(!!(a_Expr))) \ 1226 995 { /* likely */ } \ 1227 996 else\ 1228 997 { \ 1229 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \1230 RTAssertLogRelMsg2(a); \1231 RTAssertPanic(); \1232 stmt; \1233 } \ 1234 } while (0) 1235 1236 /** @def A ssertLogRelMsgReturn1237 * Assert that an expression is true, return \a rc if it isn't.1238 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1239 * 1240 * @param exprExpression which should be true.1241 * @param a printf argument list (in parenthesis). 1242 * @param rcWhat is to be presented to return.1243 */ 1244 #define A ssertLogRelMsgReturn(expr, a,rc) \1245 do { \ 1246 if (RT_LIKELY(!!( expr))) \998 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 999 ASSERT_GUEST_LOGREL_MSG2(a); \ 1000 ASSERT_GUEST_PANIC(); \ 1001 a_Stmt; \ 1002 } \ 1003 } while (0) 1004 1005 /** @def ASSERT_GUEST_LOGREL_MSG_RETURN 1006 * Assert that an expression is true, return \a a_rc if it isn't. 1007 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1008 * 1009 * @param a_Expr Expression which should be true. 1010 * @param a printf argument list (in parenthesis). 1011 * @param a_rc What is to be presented to return. 1012 */ 1013 #define ASSERT_GUEST_LOGREL_MSG_RETURN(a_Expr, a, a_rc) \ 1014 do { \ 1015 if (RT_LIKELY(!!(a_Expr))) \ 1247 1016 { /* likely */ } \ 1248 1017 else\ 1249 1018 { \ 1250 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \1251 RTAssertLogRelMsg2(a); \1252 RTAssertPanic(); \1253 return ( rc); \1254 } \ 1255 } while (0) 1256 1257 /** @def A ssertLogRelMsgReturnStmt1258 * Assert that an expression is true, execute @a stmt and return @a rcRet if it1019 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1020 ASSERT_GUEST_LOGREL_MSG2(a); \ 1021 ASSERT_GUEST_PANIC(); \ 1022 return (a_rc); \ 1023 } \ 1024 } while (0) 1025 1026 /** @def ASSERT_GUEST_LOGREL_MSG_STMT_RETURN 1027 * Assert that an expression is true, execute @a a_Stmt and return @a rcRet if it 1259 1028 * isn't. 1260 1029 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1261 1030 * 1262 * @param expr Expression which should be true. 1263 * @param a printf argument list (in parenthesis). 1031 * @param a_Expr Expression which should be true. 1032 * @param a printf argument list (in parenthesis). 1033 * @param a_Stmt Statement to execute before returning in case of a failed 1034 * assertion. 1035 * @param rcRet What is to be presented to return. 1036 */ 1037 #define ASSERT_GUEST_LOGREL_MSG_STMT_RETURN(a_Expr, a, a_Stmt, rcRet) \ 1038 do { \ 1039 if (RT_LIKELY(!!(a_Expr))) \ 1040 { /* likely */ } \ 1041 else\ 1042 { \ 1043 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1044 ASSERT_GUEST_LOGREL_MSG2(a); \ 1045 ASSERT_GUEST_PANIC(); \ 1046 a_Stmt; \ 1047 return (rcRet); \ 1048 } \ 1049 } while (0) 1050 1051 /** @def ASSERT_GUEST_LOGREL_MSG_RETURN_VOID 1052 * Assert that an expression is true, return (void) if it isn't. 1053 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1054 * 1055 * @param a_Expr Expression which should be true. 1056 * @param a printf argument list (in parenthesis). 1057 */ 1058 #define ASSERT_GUEST_LOGREL_MSG_RETURN_VOID(a_Expr, a) \ 1059 do { \ 1060 if (RT_LIKELY(!!(a_Expr))) \ 1061 { /* likely */ } \ 1062 else\ 1063 { \ 1064 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1065 ASSERT_GUEST_LOGREL_MSG2(a); \ 1066 ASSERT_GUEST_PANIC(); \ 1067 return; \ 1068 } \ 1069 } while (0) 1070 1071 /** @def ASSERT_GUEST_LOGREL_MSG_BREAK 1072 * Assert that an expression is true, break if it isn't. 1073 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1074 * 1075 * @param a_Expr Expression which should be true. 1076 * @param a printf argument list (in parenthesis). 1077 */ 1078 #define ASSERT_GUEST_LOGREL_MSG_BREAK(a_Expr, a) \ 1079 if (RT_LIKELY(!!(a_Expr))) \ 1080 { /* likely */ } \ 1081 else if (1) \ 1082 { \ 1083 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1084 ASSERT_GUEST_LOGREL_MSG2(a); \ 1085 ASSERT_GUEST_PANIC(); \ 1086 break; \ 1087 } \ 1088 else \ 1089 break 1090 1091 /** @def ASSERT_GUEST_LOGREL_MSG_STMT_BREAK 1092 * Assert that an expression is true, execute \a a_Stmt and break if it isn't. 1093 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1094 * 1095 * @param a_Expr Expression which should be true. 1096 * @param a printf argument list (in parenthesis). 1097 * @param a_Stmt Statement to execute before break in case of a failed assertion. 1098 */ 1099 #define ASSERT_GUEST_LOGREL_MSG_STMT_BREAK(a_Expr, a, a_Stmt) \ 1100 if (RT_LIKELY(!!(a_Expr))) \ 1101 { /* likely */ } \ 1102 else if (1) \ 1103 { \ 1104 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1105 ASSERT_GUEST_LOGREL_MSG2(a); \ 1106 ASSERT_GUEST_PANIC(); \ 1107 a_Stmt; \ 1108 break; \ 1109 } else \ 1110 break 1111 1112 /** @def ASSERT_GUEST_LOGREL_FAILED 1113 * An assertion failed. 1114 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1115 */ 1116 #define ASSERT_GUEST_LOGREL_FAILED() \ 1117 do { \ 1118 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1119 ASSERT_GUEST_PANIC(); \ 1120 } while (0) 1121 1122 /** @def ASSERT_GUEST_LOGREL_FAILED_RETURN 1123 * An assertion failed. 1124 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1125 * 1126 * @param a_rc What is to be presented to return. 1127 */ 1128 #define ASSERT_GUEST_LOGREL_FAILED_RETURN(a_rc) \ 1129 do { \ 1130 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1131 ASSERT_GUEST_PANIC(); \ 1132 return (a_rc); \ 1133 } while (0) 1134 1135 /** @def ASSERT_GUEST_LOGREL_FAILED_RETURN_VOID 1136 * An assertion failed, hit a breakpoint and return. 1137 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1138 */ 1139 #define ASSERT_GUEST_LOGREL_FAILED_RETURN_VOID() \ 1140 do { \ 1141 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1142 ASSERT_GUEST_PANIC(); \ 1143 return; \ 1144 } while (0) 1145 1146 /** @def ASSERT_GUEST_LOGREL_FAILED_BREAK 1147 * An assertion failed, break. 1148 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1149 */ 1150 #define ASSERT_GUEST_LOGREL_FAILED_BREAK() \ 1151 if (1) \ 1152 { \ 1153 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1154 ASSERT_GUEST_PANIC(); \ 1155 break; \ 1156 } else \ 1157 break 1158 1159 /** @def ASSERT_GUEST_LOGREL_FAILED_STMT_BREAK 1160 * An assertion failed, execute \a a_Stmt and break. 1161 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1162 * 1163 * @param a_Stmt Statement to execute before break. 1164 */ 1165 #define ASSERT_GUEST_LOGREL_FAILED_STMT_BREAK(a_Stmt) \ 1166 if (1) \ 1167 { \ 1168 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1169 ASSERT_GUEST_PANIC(); \ 1170 a_Stmt; \ 1171 break; \ 1172 } else \ 1173 break 1174 1175 /** @def ASSERT_GUEST_LOGREL_MSG_FAILED 1176 * An assertion failed. 1177 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1178 * 1179 * @param a printf argument list (in parenthesis). 1180 */ 1181 #define ASSERT_GUEST_LOGREL_MSG_FAILED(a) \ 1182 do { \ 1183 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1184 ASSERT_GUEST_LOGREL_MSG2(a); \ 1185 ASSERT_GUEST_PANIC(); \ 1186 } while (0) 1187 1188 /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_STMT 1189 * An assertion failed, execute @a a_Stmt. 1190 * 1191 * Strict builds will hit a breakpoint, non-strict will only do LogRel. The 1192 * statement will be executed in regardless of build type. 1193 * 1194 * @param a printf argument list (in parenthesis). 1195 * @param a_Stmt Statement to execute after raising/logging the assertion. 1196 */ 1197 #define ASSERT_GUEST_LOGREL_MSG_FAILED_STMT(a, a_Stmt) \ 1198 do { \ 1199 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1200 ASSERT_GUEST_LOGREL_MSG2(a); \ 1201 ASSERT_GUEST_PANIC(); \ 1202 a_Stmt; \ 1203 } while (0) 1204 1205 /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_RETURN 1206 * An assertion failed, return \a a_rc. 1207 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1208 * 1209 * @param a printf argument list (in parenthesis). 1210 * @param a_rc What is to be presented to return. 1211 */ 1212 #define ASSERT_GUEST_LOGREL_MSG_FAILED_RETURN(a, a_rc) \ 1213 do { \ 1214 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1215 ASSERT_GUEST_LOGREL_MSG2(a); \ 1216 ASSERT_GUEST_PANIC(); \ 1217 return (a_rc); \ 1218 } while (0) 1219 1220 /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_RETURN 1221 * An assertion failed, execute @a a_Stmt and return @a a_rc. 1222 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1223 * 1224 * @param a printf argument list (in parenthesis). 1225 * @param a_Stmt Statement to execute before returning in case of a failed 1226 * assertion. 1227 * @param a_rc What is to be presented to return. 1228 */ 1229 #define ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_RETURN(a, a_Stmt, a_rc) \ 1230 do { \ 1231 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1232 ASSERT_GUEST_LOGREL_MSG2(a); \ 1233 ASSERT_GUEST_PANIC(); \ 1234 a_Stmt; \ 1235 return (a_rc); \ 1236 } while (0) 1237 1238 /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_RETURN_VOID 1239 * An assertion failed, return void. 1240 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1241 * 1242 * @param a printf argument list (in parenthesis). 1243 */ 1244 #define ASSERT_GUEST_LOGREL_MSG_FAILED_RETURN_VOID(a) \ 1245 do { \ 1246 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1247 ASSERT_GUEST_LOGREL_MSG2(a); \ 1248 ASSERT_GUEST_PANIC(); \ 1249 return; \ 1250 } while (0) 1251 1252 /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_RETURN_VOID 1253 * An assertion failed, execute @a a_Stmt and return void. 1254 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1255 * 1256 * @param a printf argument list (in parenthesis). 1257 * @param a_Stmt Statement to execute before returning in case of a failed 1258 * assertion. 1259 */ 1260 #define ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_RETURN_VOID(a, a_Stmt) \ 1261 do { \ 1262 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1263 ASSERT_GUEST_LOGREL_MSG2(a); \ 1264 ASSERT_GUEST_PANIC(); \ 1265 a_Stmt; \ 1266 return; \ 1267 } while (0) 1268 1269 /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_BREAK 1270 * An assertion failed, break. 1271 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1272 * 1273 * @param a printf argument list (in parenthesis). 1274 */ 1275 #define ASSERT_GUEST_LOGREL_MSG_FAILED_BREAK(a) \ 1276 if (1)\ 1277 { \ 1278 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1279 ASSERT_GUEST_LOGREL_MSG2(a); \ 1280 ASSERT_GUEST_PANIC(); \ 1281 break; \ 1282 } else \ 1283 break 1284 1285 /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_BREAK 1286 * An assertion failed, execute \a a_Stmt and break. 1287 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1288 * 1289 * @param a printf argument list (in parenthesis). 1290 * @param a_Stmt Statement to execute before break. 1291 */ 1292 #define ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_BREAK(a, a_Stmt) \ 1293 if (1) \ 1294 { \ 1295 ASSERT_GUEST_LOGREL_MSG1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1296 ASSERT_GUEST_LOGREL_MSG2(a); \ 1297 ASSERT_GUEST_PANIC(); \ 1298 a_Stmt; \ 1299 break; \ 1300 } else \ 1301 break 1302 1303 /** @} */ 1304 1305 1306 /** @name Convenience Assertions Macros 1307 * @{ 1308 */ 1309 1310 /** @def ASSERT_GUEST_RC 1311 * Asserts a iprt status code successful. 1312 * 1313 * On failure it will print info about the rc and hit a breakpoint. 1314 * 1315 * @param rc iprt status code. 1316 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1317 */ 1318 #define ASSERT_GUEST_RC(rc) ASSERT_GUEST_MSG_RC(rc, ("%Rra\n", (rc))) 1319 1320 /** @def ASSERT_GUEST_RC_STMT 1321 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and execute 1322 * @a stmt if it isn't. 1323 * 1324 * @param rc iprt status code. 1325 * @param stmt Statement to execute before returning in case of a failed 1326 * assertion. 1327 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1328 */ 1329 #define ASSERT_GUEST_RC_STMT(rc, stmt) ASSERT_GUEST_MSG_RC_STMT(rc, ("%Rra\n", (rc)), stmt) 1330 1331 /** @def ASSERT_GUEST_RC_RETURN 1332 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't. 1333 * 1334 * @param rc iprt status code. 1335 * @param rcRet What is to be presented to return. 1336 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1337 */ 1338 #define ASSERT_GUEST_RC_RETURN(rc, rcRet) ASSERT_GUEST_MSG_RC_RETURN(rc, ("%Rra\n", (rc)), rcRet) 1339 1340 /** @def ASSERT_GUEST_RC_STMT_RETURN 1341 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute 1342 * @a stmt and returns @a rcRet if it isn't. 1343 * 1344 * @param rc iprt status code. 1264 1345 * @param stmt Statement to execute before returning in case of a failed 1265 1346 * assertion. 1266 1347 * @param rcRet What is to be presented to return. 1267 */ 1268 #define AssertLogRelMsgReturnStmt(expr, a, stmt, rcRet) \ 1269 do { \ 1270 if (RT_LIKELY(!!(expr))) \ 1271 { /* likely */ } \ 1272 else\ 1273 { \ 1274 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1275 RTAssertLogRelMsg2(a); \ 1276 RTAssertPanic(); \ 1277 stmt; \ 1278 return (rcRet); \ 1279 } \ 1280 } while (0) 1281 1282 /** @def AssertLogRelMsgReturnVoid 1283 * Assert that an expression is true, return (void) if it isn't. 1284 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1285 * 1286 * @param expr Expression which should be true. 1287 * @param a printf argument list (in parenthesis). 1288 */ 1289 #define AssertLogRelMsgReturnVoid(expr, a) \ 1290 do { \ 1291 if (RT_LIKELY(!!(expr))) \ 1292 { /* likely */ } \ 1293 else\ 1294 { \ 1295 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1296 RTAssertLogRelMsg2(a); \ 1297 RTAssertPanic(); \ 1298 return; \ 1299 } \ 1300 } while (0) 1301 1302 /** @def AssertLogRelMsgBreak 1303 * Assert that an expression is true, break if it isn't. 1304 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1305 * 1306 * @param expr Expression which should be true. 1307 * @param a printf argument list (in parenthesis). 1308 */ 1309 #define AssertLogRelMsgBreak(expr, a) \ 1310 if (RT_LIKELY(!!(expr))) \ 1311 { /* likely */ } \ 1312 else if (1) \ 1313 { \ 1314 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1315 RTAssertLogRelMsg2(a); \ 1316 RTAssertPanic(); \ 1317 break; \ 1318 } \ 1319 else \ 1320 break 1321 1322 /** @def AssertLogRelMsgBreakStmt 1323 * Assert that an expression is true, execute \a stmt and break if it isn't. 1324 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1325 * 1326 * @param expr Expression which should be true. 1327 * @param a printf argument list (in parenthesis). 1328 * @param stmt Statement to execute before break in case of a failed assertion. 1329 */ 1330 #define AssertLogRelMsgBreakStmt(expr, a, stmt) \ 1331 if (RT_LIKELY(!!(expr))) \ 1332 { /* likely */ } \ 1333 else if (1) \ 1334 { \ 1335 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1336 RTAssertLogRelMsg2(a); \ 1337 RTAssertPanic(); \ 1338 stmt; \ 1339 break; \ 1340 } else \ 1341 break 1342 1343 /** @def AssertLogRelFailed 1344 * An assertion failed. 1345 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1346 */ 1347 #define AssertLogRelFailed() \ 1348 do { \ 1349 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1350 RTAssertPanic(); \ 1351 } while (0) 1352 1353 /** @def AssertLogRelFailedReturn 1354 * An assertion failed. 1355 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1356 * 1357 * @param rc What is to be presented to return. 1358 */ 1359 #define AssertLogRelFailedReturn(rc) \ 1360 do { \ 1361 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1362 RTAssertPanic(); \ 1363 return (rc); \ 1364 } while (0) 1365 1366 /** @def AssertLogRelFailedReturnVoid 1367 * An assertion failed, hit a breakpoint and return. 1368 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1369 */ 1370 #define AssertLogRelFailedReturnVoid() \ 1371 do { \ 1372 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1373 RTAssertPanic(); \ 1374 return; \ 1375 } while (0) 1376 1377 /** @def AssertLogRelFailedBreak 1378 * An assertion failed, break. 1379 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1380 */ 1381 #define AssertLogRelFailedBreak() \ 1382 if (1) \ 1383 { \ 1384 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1385 RTAssertPanic(); \ 1386 break; \ 1387 } else \ 1388 break 1389 1390 /** @def AssertLogRelFailedBreakStmt 1391 * An assertion failed, execute \a stmt and break. 1392 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1393 * 1394 * @param stmt Statement to execute before break. 1395 */ 1396 #define AssertLogRelFailedBreakStmt(stmt) \ 1397 if (1) \ 1398 { \ 1399 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1400 RTAssertPanic(); \ 1401 stmt; \ 1402 break; \ 1403 } else \ 1404 break 1405 1406 /** @def AssertLogRelMsgFailed 1407 * An assertion failed. 1408 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1409 * 1410 * @param a printf argument list (in parenthesis). 1411 */ 1412 #define AssertLogRelMsgFailed(a) \ 1413 do { \ 1414 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1415 RTAssertLogRelMsg2(a); \ 1416 RTAssertPanic(); \ 1417 } while (0) 1418 1419 /** @def AssertLogRelMsgFailedStmt 1420 * An assertion failed, execute @a stmt. 1421 * 1422 * Strict builds will hit a breakpoint, non-strict will only do LogRel. The 1423 * statement will be executed in regardless of build type. 1424 * 1425 * @param a printf argument list (in parenthesis). 1426 * @param stmt Statement to execute after raising/logging the assertion. 1427 */ 1428 #define AssertLogRelMsgFailedStmt(a, stmt) \ 1429 do { \ 1430 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1431 RTAssertLogRelMsg2(a); \ 1432 RTAssertPanic(); \ 1433 stmt; \ 1434 } while (0) 1435 1436 /** @def AssertLogRelMsgFailedReturn 1437 * An assertion failed, return \a rc. 1438 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1439 * 1440 * @param a printf argument list (in parenthesis). 1441 * @param rc What is to be presented to return. 1442 */ 1443 #define AssertLogRelMsgFailedReturn(a, rc) \ 1444 do { \ 1445 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1446 RTAssertLogRelMsg2(a); \ 1447 RTAssertPanic(); \ 1448 return (rc); \ 1449 } while (0) 1450 1451 /** @def AssertLogRelMsgFailedReturnStmt 1452 * An assertion failed, execute @a stmt and return @a rc. 1453 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1454 * 1455 * @param a printf argument list (in parenthesis). 1456 * @param stmt Statement to execute before returning in case of a failed 1457 * assertion. 1458 * @param rc What is to be presented to return. 1459 */ 1460 #define AssertLogRelMsgFailedReturnStmt(a, stmt, rc) \ 1461 do { \ 1462 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1463 RTAssertLogRelMsg2(a); \ 1464 RTAssertPanic(); \ 1465 stmt; \ 1466 return (rc); \ 1467 } while (0) 1468 1469 /** @def AssertLogRelMsgFailedReturnVoid 1470 * An assertion failed, return void. 1471 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1472 * 1473 * @param a printf argument list (in parenthesis). 1474 */ 1475 #define AssertLogRelMsgFailedReturnVoid(a) \ 1476 do { \ 1477 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1478 RTAssertLogRelMsg2(a); \ 1479 RTAssertPanic(); \ 1480 return; \ 1481 } while (0) 1482 1483 /** @def AssertLogRelMsgFailedReturnVoidStmt 1484 * An assertion failed, execute @a stmt and return void. 1485 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1486 * 1487 * @param a printf argument list (in parenthesis). 1488 * @param stmt Statement to execute before returning in case of a failed 1489 * assertion. 1490 */ 1491 #define AssertLogRelMsgFailedReturnVoidStmt(a, stmt) \ 1492 do { \ 1493 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1494 RTAssertLogRelMsg2(a); \ 1495 RTAssertPanic(); \ 1496 stmt; \ 1497 return; \ 1498 } while (0) 1499 1500 /** @def AssertLogRelMsgFailedBreak 1501 * An assertion failed, break. 1502 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1503 * 1504 * @param a printf argument list (in parenthesis). 1505 */ 1506 #define AssertLogRelMsgFailedBreak(a) \ 1507 if (1)\ 1508 { \ 1509 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1510 RTAssertLogRelMsg2(a); \ 1511 RTAssertPanic(); \ 1512 break; \ 1513 } else \ 1514 break 1515 1516 /** @def AssertLogRelMsgFailedBreakStmt 1517 * An assertion failed, execute \a stmt and break. 1518 * Strict builds will hit a breakpoint, non-strict will only do LogRel. 1519 * 1520 * @param a printf argument list (in parenthesis). 1521 * @param stmt Statement to execute before break. 1522 */ 1523 #define AssertLogRelMsgFailedBreakStmt(a, stmt) \ 1524 if (1) \ 1525 { \ 1526 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1527 RTAssertLogRelMsg2(a); \ 1528 RTAssertPanic(); \ 1529 stmt; \ 1530 break; \ 1531 } else \ 1532 break 1533 1534 /** @} */ 1535 1536 1537 1538 /** @name Release Assertions 1539 * 1540 * These assertions are always enabled. 1541 * @{ 1542 */ 1543 1544 /** @def RTAssertReleasePanic() 1545 * Invokes RTAssertShouldPanic and RTAssertDoPanic. 1546 * 1547 * It might seem odd that RTAssertShouldPanic is necessary when its result isn't 1548 * checked, but it's done since RTAssertShouldPanic is overrideable and might be 1549 * used to bail out before taking down the system (the VMMR0 case). 1550 */ 1551 #define RTAssertReleasePanic() do { RTAssertShouldPanic(); RTAssertDoPanic(); } while (0) 1552 1553 1554 /** @def AssertRelease 1555 * Assert that an expression is true. If it's not hit a breakpoint. 1556 * 1557 * @param expr Expression which should be true. 1558 */ 1559 #define AssertRelease(expr) \ 1560 do { \ 1561 if (RT_LIKELY(!!(expr))) \ 1562 { /* likely */ } \ 1563 else \ 1564 { \ 1565 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 1566 RTAssertReleasePanic(); \ 1567 } \ 1568 } while (0) 1569 1570 /** @def AssertReleaseReturn 1571 * Assert that an expression is true, hit a breakpoint and return if it isn't. 1572 * 1573 * @param expr Expression which should be true. 1574 * @param rc What is to be presented to return. 1575 */ 1576 #define AssertReleaseReturn(expr, rc) \ 1577 do { \ 1578 if (RT_LIKELY(!!(expr))) \ 1579 { /* likely */ } \ 1580 else \ 1581 { \ 1582 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1583 RTAssertReleasePanic(); \ 1584 return (rc); \ 1585 } \ 1586 } while (0) 1587 1588 /** @def AssertReleaseReturnVoid 1589 * Assert that an expression is true, hit a breakpoint and return if it isn't. 1590 * 1591 * @param expr Expression which should be true. 1592 */ 1593 #define AssertReleaseReturnVoid(expr) \ 1594 do { \ 1595 if (RT_LIKELY(!!(expr))) \ 1596 { /* likely */ } \ 1597 else \ 1598 { \ 1599 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1600 RTAssertReleasePanic(); \ 1601 return; \ 1602 } \ 1603 } while (0) 1604 1605 1606 /** @def AssertReleaseBreak 1607 * Assert that an expression is true, hit a breakpoint and break if it isn't. 1608 * 1609 * @param expr Expression which should be true. 1610 */ 1611 #define AssertReleaseBreak(expr) \ 1612 if (RT_LIKELY(!!(expr))) \ 1613 { /* likely */ } \ 1614 else if (1) \ 1615 { \ 1616 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1617 RTAssertReleasePanic(); \ 1618 break; \ 1619 } else \ 1620 break 1621 1622 /** @def AssertReleaseBreakStmt 1623 * Assert that an expression is true, hit a breakpoint and break if it isn't. 1624 * 1625 * @param expr Expression which should be true. 1626 * @param stmt Statement to execute before break in case of a failed assertion. 1627 */ 1628 #define AssertReleaseBreakStmt(expr, stmt) \ 1629 if (RT_LIKELY(!!(expr))) \ 1630 { /* likely */ } \ 1631 else if (1) \ 1632 { \ 1633 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1634 RTAssertReleasePanic(); \ 1635 stmt; \ 1636 break; \ 1637 } else \ 1638 break 1639 1640 1641 /** @def AssertReleaseMsg 1642 * Assert that an expression is true, print the message and hit a breakpoint if it isn't. 1643 * 1644 * @param expr Expression which should be true. 1645 * @param a printf argument list (in parenthesis). 1646 */ 1647 #define AssertReleaseMsg(expr, a) \ 1648 do { \ 1649 if (RT_LIKELY(!!(expr))) \ 1650 { /* likely */ } \ 1651 else \ 1652 { \ 1653 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1654 RTAssertMsg2Weak a; \ 1655 RTAssertReleasePanic(); \ 1656 } \ 1657 } while (0) 1658 1659 /** @def AssertReleaseMsgReturn 1660 * Assert that an expression is true, print the message and hit a breakpoint and return if it isn't. 1661 * 1662 * @param expr Expression which should be true. 1663 * @param a printf argument list (in parenthesis). 1664 * @param rc What is to be presented to return. 1665 */ 1666 #define AssertReleaseMsgReturn(expr, a, rc) \ 1667 do { \ 1668 if (RT_LIKELY(!!(expr))) \ 1669 { /* likely */ } \ 1670 else \ 1671 { \ 1672 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1673 RTAssertMsg2Weak a; \ 1674 RTAssertReleasePanic(); \ 1675 return (rc); \ 1676 } \ 1677 } while (0) 1678 1679 /** @def AssertReleaseMsgReturnVoid 1680 * Assert that an expression is true, print the message and hit a breakpoint and return if it isn't. 1681 * 1682 * @param expr Expression which should be true. 1683 * @param a printf argument list (in parenthesis). 1684 */ 1685 #define AssertReleaseMsgReturnVoid(expr, a) \ 1686 do { \ 1687 if (RT_LIKELY(!!(expr))) \ 1688 { /* likely */ } \ 1689 else \ 1690 { \ 1691 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1692 RTAssertMsg2Weak a; \ 1693 RTAssertReleasePanic(); \ 1694 return; \ 1695 } \ 1696 } while (0) 1697 1698 1699 /** @def AssertReleaseMsgBreak 1700 * Assert that an expression is true, print the message and hit a breakpoint and break if it isn't. 1701 * 1702 * @param expr Expression which should be true. 1703 * @param a printf argument list (in parenthesis). 1704 */ 1705 #define AssertReleaseMsgBreak(expr, a) \ 1706 if (RT_LIKELY(!!(expr))) \ 1707 { /* likely */ } \ 1708 else if (1) \ 1709 { \ 1710 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1711 RTAssertMsg2Weak a; \ 1712 RTAssertReleasePanic(); \ 1713 break; \ 1714 } else \ 1715 break 1716 1717 /** @def AssertReleaseMsgBreakStmt 1718 * Assert that an expression is true, print the message and hit a breakpoint and break if it isn't. 1719 * 1720 * @param expr Expression which should be true. 1721 * @param a printf argument list (in parenthesis). 1722 * @param stmt Statement to execute before break in case of a failed assertion. 1723 */ 1724 #define AssertReleaseMsgBreakStmt(expr, a, stmt) \ 1725 if (RT_LIKELY(!!(expr))) \ 1726 { /* likely */ } \ 1727 else if (1) \ 1728 { \ 1729 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1730 RTAssertMsg2Weak a; \ 1731 RTAssertReleasePanic(); \ 1732 stmt; \ 1733 break; \ 1734 } else \ 1735 break 1736 1737 1738 /** @def AssertReleaseFailed 1739 * An assertion failed, hit a breakpoint. 1740 */ 1741 #define AssertReleaseFailed() \ 1742 do { \ 1743 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1744 RTAssertReleasePanic(); \ 1745 } while (0) 1746 1747 /** @def AssertReleaseFailedReturn 1748 * An assertion failed, hit a breakpoint and return. 1749 * 1750 * @param rc What is to be presented to return. 1751 */ 1752 #define AssertReleaseFailedReturn(rc) \ 1753 do { \ 1754 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1755 RTAssertReleasePanic(); \ 1756 return (rc); \ 1757 } while (0) 1758 1759 /** @def AssertReleaseFailedReturnVoid 1760 * An assertion failed, hit a breakpoint and return. 1761 */ 1762 #define AssertReleaseFailedReturnVoid() \ 1763 do { \ 1764 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1765 RTAssertReleasePanic(); \ 1766 return; \ 1767 } while (0) 1768 1769 1770 /** @def AssertReleaseFailedBreak 1771 * An assertion failed, hit a breakpoint and break. 1772 */ 1773 #define AssertReleaseFailedBreak() \ 1774 if (1) { \ 1775 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1776 RTAssertReleasePanic(); \ 1777 break; \ 1778 } else \ 1779 break 1780 1781 /** @def AssertReleaseFailedBreakStmt 1782 * An assertion failed, hit a breakpoint and break. 1783 * 1784 * @param stmt Statement to execute before break. 1785 */ 1786 #define AssertReleaseFailedBreakStmt(stmt) \ 1787 if (1) { \ 1788 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1789 RTAssertReleasePanic(); \ 1790 stmt; \ 1791 break; \ 1792 } else \ 1793 break 1794 1795 1796 /** @def AssertReleaseMsgFailed 1797 * An assertion failed, print a message and hit a breakpoint. 1798 * 1799 * @param a printf argument list (in parenthesis). 1800 */ 1801 #define AssertReleaseMsgFailed(a) \ 1802 do { \ 1803 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 1804 RTAssertMsg2Weak a; \ 1805 RTAssertReleasePanic(); \ 1806 } while (0) 1807 1808 /** @def AssertReleaseMsgFailedReturn 1809 * An assertion failed, print a message, hit a breakpoint and return. 1810 * 1811 * @param a printf argument list (in parenthesis). 1812 * @param rc What is to be presented to return. 1813 */ 1814 #define AssertReleaseMsgFailedReturn(a, rc) \ 1815 do { \ 1816 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1817 RTAssertMsg2Weak a; \ 1818 RTAssertReleasePanic(); \ 1819 return (rc); \ 1820 } while (0) 1821 1822 /** @def AssertReleaseMsgFailedReturnVoid 1823 * An assertion failed, print a message, hit a breakpoint and return. 1824 * 1825 * @param a printf argument list (in parenthesis). 1826 */ 1827 #define AssertReleaseMsgFailedReturnVoid(a) \ 1828 do { \ 1829 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1830 RTAssertMsg2Weak a; \ 1831 RTAssertReleasePanic(); \ 1832 return; \ 1833 } while (0) 1834 1835 1836 /** @def AssertReleaseMsgFailedBreak 1837 * An assertion failed, print a message, hit a breakpoint and break. 1838 * 1839 * @param a printf argument list (in parenthesis). 1840 */ 1841 #define AssertReleaseMsgFailedBreak(a) \ 1842 if (1) { \ 1843 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1844 RTAssertMsg2Weak a; \ 1845 RTAssertReleasePanic(); \ 1846 break; \ 1847 } else \ 1848 break 1849 1850 /** @def AssertReleaseMsgFailedBreakStmt 1851 * An assertion failed, print a message, hit a breakpoint and break. 1852 * 1853 * @param a printf argument list (in parenthesis). 1854 * @param stmt Statement to execute before break. 1855 */ 1856 #define AssertReleaseMsgFailedBreakStmt(a, stmt) \ 1857 if (1) { \ 1858 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1859 RTAssertMsg2Weak a; \ 1860 RTAssertReleasePanic(); \ 1861 stmt; \ 1862 break; \ 1863 } else \ 1864 break 1865 1866 /** @} */ 1867 1868 1869 1870 /** @name Fatal Assertions 1871 * These are similar to release assertions except that you cannot ignore them in 1872 * any way, they will loop for ever if RTAssertDoPanic returns. 1873 * 1874 * @{ 1875 */ 1876 1877 /** @def AssertFatal 1878 * Assert that an expression is true. If it's not hit a breakpoint (for ever). 1879 * 1880 * @param expr Expression which should be true. 1881 */ 1882 #define AssertFatal(expr) \ 1883 do { \ 1884 if (RT_LIKELY(!!(expr))) \ 1885 { /* likely */ } \ 1886 else \ 1887 for (;;) \ 1888 { \ 1889 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1890 RTAssertReleasePanic(); \ 1891 } \ 1892 } while (0) 1893 1894 /** @def AssertFatalMsg 1895 * Assert that an expression is true, print the message and hit a breakpoint (for ever) if it isn't. 1896 * 1897 * @param expr Expression which should be true. 1898 * @param a printf argument list (in parenthesis). 1899 */ 1900 #define AssertFatalMsg(expr, a) \ 1901 do { \ 1902 if (RT_LIKELY(!!(expr))) \ 1903 { /* likely */ } \ 1904 else \ 1905 for (;;) \ 1906 { \ 1907 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1908 RTAssertMsg2Weak a; \ 1909 RTAssertReleasePanic(); \ 1910 } \ 1911 } while (0) 1912 1913 /** @def AssertFatalFailed 1914 * An assertion failed, hit a breakpoint (for ever). 1915 */ 1916 #define AssertFatalFailed() \ 1917 do { \ 1918 for (;;) \ 1919 { \ 1920 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 1921 RTAssertReleasePanic(); \ 1922 } \ 1923 } while (0) 1924 1925 /** @def AssertFatalMsgFailed 1926 * An assertion failed, print a message and hit a breakpoint (for ever). 1927 * 1928 * @param a printf argument list (in parenthesis). 1929 */ 1930 #define AssertFatalMsgFailed(a) \ 1931 do { \ 1932 for (;;) \ 1933 { \ 1934 RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \ 1935 RTAssertMsg2Weak a; \ 1936 RTAssertReleasePanic(); \ 1937 } \ 1938 } while (0) 1939 1940 /** @} */ 1941 1942 1943 1944 /** @name Convenience Assertions Macros 1945 * @{ 1946 */ 1947 1948 /** @def AssertRC 1949 * Asserts a iprt status code successful. 1950 * 1951 * On failure it will print info about the rc and hit a breakpoint. 1952 * 1953 * @param rc iprt status code. 1954 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1955 */ 1956 #define AssertRC(rc) AssertMsgRC(rc, ("%Rra\n", (rc))) 1957 1958 /** @def AssertRCStmt 1959 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and execute 1960 * @a stmt if it isn't. 1961 * 1962 * @param rc iprt status code. 1963 * @param stmt Statement to execute before returning in case of a failed 1964 * assertion. 1965 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1966 */ 1967 #define AssertRCStmt(rc, stmt) AssertMsgRCStmt(rc, ("%Rra\n", (rc)), stmt) 1968 1969 /** @def AssertRCReturn 1348 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1349 */ 1350 #define ASSERT_GUEST_RC_STMT_RETURN(rc, stmt, rcRet) ASSERT_GUEST_MSG_RC_STMT_RETURN(rc, ("%Rra\n", (rc)), stmt, rcRet) 1351 1352 /** @def ASSERT_GUEST_RC_RETURN_VOID 1970 1353 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't. 1971 1354 * 1972 1355 * @param rc iprt status code. 1973 * @param rcRet What is to be presented to return. 1974 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1975 */ 1976 #define AssertRCReturn(rc, rcRet) AssertMsgRCReturn(rc, ("%Rra\n", (rc)), rcRet) 1977 1978 /** @def AssertRCReturnStmt 1979 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute 1980 * @a stmt and returns @a rcRet if it isn't. 1981 * 1982 * @param rc iprt status code. 1983 * @param stmt Statement to execute before returning in case of a failed 1984 * assertion. 1985 * @param rcRet What is to be presented to return. 1986 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1987 */ 1988 #define AssertRCReturnStmt(rc, stmt, rcRet) AssertMsgRCReturnStmt(rc, ("%Rra\n", (rc)), stmt, rcRet) 1989 1990 /** @def AssertRCReturnVoid 1991 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't. 1992 * 1993 * @param rc iprt status code. 1994 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1995 */ 1996 #define AssertRCReturnVoid(rc) AssertMsgRCReturnVoid(rc, ("%Rra\n", (rc))) 1997 1998 /** @def AssertRCReturnVoidStmt 1356 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1357 */ 1358 #define ASSERT_GUEST_RC_RETURN_VOID(rc) ASSERT_GUEST_MSG_RC_RETURN_VOID(rc, ("%Rra\n", (rc))) 1359 1360 /** @def ASSERT_GUEST_RC_STMT_RETURN_VOID 1999 1361 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), and 2000 1362 * execute the given statement/return if it isn't. … … 2004 1366 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2005 1367 */ 2006 #define A ssertRCReturnVoidStmt(rc, stmt) AssertMsgRCReturnVoidStmt(rc, ("%Rra\n", (rc)), stmt)2007 2008 /** @def A ssertRCBreak1368 #define ASSERT_GUEST_RC_STMT_RETURN_VOID(rc, stmt) ASSERT_GUEST_MSG_RC_STMT_RETURN_VOID(rc, ("%Rra\n", (rc)), stmt) 1369 1370 /** @def ASSERT_GUEST_RCBreak 2009 1371 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't. 2010 1372 * … … 2012 1374 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2013 1375 */ 2014 #define A ssertRCBreak(rc) AssertMsgRCBreak(rc, ("%Rra\n", (rc)))2015 2016 /** @def A ssertRCBreakStmt1376 #define ASSERT_GUEST_RC_BREAK(rc) ASSERT_GUEST_MSG_RC_BREAK(rc, ("%Rra\n", (rc))) 1377 1378 /** @def ASSERT_GUEST_RC_STMT_BREAK 2017 1379 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't. 2018 1380 * … … 2021 1383 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2022 1384 */ 2023 #define A ssertRCBreakStmt(rc, stmt) AssertMsgRCBreakStmt(rc, ("%Rra\n", (rc)), stmt)2024 2025 /** @def A ssertMsgRC1385 #define ASSERT_GUEST_RC_STMT_BREAK(rc, stmt) ASSERT_GUEST_MSG_RC_STMT_BREAK(rc, ("%Rra\n", (rc)), stmt) 1386 1387 /** @def ASSERT_GUEST_MSG_RC 2026 1388 * Asserts a iprt status code successful. 2027 1389 * … … 2032 1394 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2033 1395 */ 2034 #define A ssertMsgRC(rc, msg) \2035 do { A ssertMsg(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)2036 2037 /** @def A ssertMsgRCStmt1396 #define ASSERT_GUEST_MSG_RC(rc, msg) \ 1397 do { ASSERT_GUEST_MSG(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0) 1398 1399 /** @def ASSERT_GUEST_MSG_RCStmt 2038 1400 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and 2039 1401 * execute @a stmt if it isn't. … … 2045 1407 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2046 1408 */ 2047 #define A ssertMsgRCStmt(rc, msg, stmt) \2048 do { AssertMsgStmt(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } while (0)2049 2050 /** @def A ssertMsgRCReturn1409 #define ASSERT_GUEST_MSG_RC_STMT(rc, msg, stmt) \ 1410 do { ASSERT_GUEST_MSG_STMT(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } while (0) 1411 1412 /** @def ASSERT_GUEST_MSG_RC_RETURN 2051 1413 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return 2052 1414 * @a rcRet if it isn't. … … 2057 1419 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2058 1420 */ 2059 #define A ssertMsgRCReturn(rc, msg, rcRet) \2060 do { AssertMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet); NOREF(rc); } while (0)2061 2062 /** @def A ssertMsgRCReturnStmt1421 #define ASSERT_GUEST_MSG_RC_RETURN(rc, msg, rcRet) \ 1422 do { ASSERT_GUEST_MSG_RETURN(RT_SUCCESS_NP(rc), msg, rcRet); NOREF(rc); } while (0) 1423 1424 /** @def ASSERT_GUEST_MSG_RC_STMT_RETURN 2063 1425 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute 2064 1426 * @a stmt and return @a rcRet if it isn't. … … 2071 1433 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2072 1434 */ 2073 #define A ssertMsgRCReturnStmt(rc, msg, stmt, rcRet) \2074 do { AssertMsgReturnStmt(RT_SUCCESS_NP(rc), msg, stmt, rcRet); NOREF(rc); } while (0)2075 2076 /** @def A ssertMsgRCReturnVoid1435 #define ASSERT_GUEST_MSG_RC_STMT_RETURN(rc, msg, stmt, rcRet) \ 1436 do { ASSERT_GUEST_MSG_STMT_RETURN(RT_SUCCESS_NP(rc), msg, stmt, rcRet); NOREF(rc); } while (0) 1437 1438 /** @def ASSERT_GUEST_MSG_RC_RETURN_VOID 2077 1439 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return 2078 1440 * void if it isn't. … … 2082 1444 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2083 1445 */ 2084 #define A ssertMsgRCReturnVoid(rc, msg) \2085 do { AssertMsgReturnVoid(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)2086 2087 /** @def A ssertMsgRCReturnVoidStmt1446 #define ASSERT_GUEST_MSG_RC_RETURN_VOID(rc, msg) \ 1447 do { ASSERT_GUEST_MSG_RETURN_VOID(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0) 1448 1449 /** @def ASSERT_GUEST_MSG_RC_STMT_RETURN_VOID 2088 1450 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute 2089 1451 * @a stmt and return void if it isn't. … … 2094 1456 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2095 1457 */ 2096 #define A ssertMsgRCReturnVoidStmt(rc, msg, stmt) \2097 do { AssertMsgReturnVoidStmt(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } while (0)2098 2099 /** @def A ssertMsgRCBreak1458 #define ASSERT_GUEST_MSG_RC_STMT_RETURN_VOID(rc, msg, stmt) \ 1459 do { ASSERT_GUEST_MSG_STMT_RETURN_VOID(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } while (0) 1460 1461 /** @def ASSERT_GUEST_MSG_RC_BREAK 2100 1462 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break 2101 1463 * if it isn't. … … 2105 1467 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2106 1468 */ 2107 #define A ssertMsgRCBreak(rc, msg) \2108 if (1) { A ssertMsgBreak(RT_SUCCESS(rc), msg); NOREF(rc); } else do {} while (0)2109 2110 /** @def A ssertMsgRCBreakStmt1469 #define ASSERT_GUEST_MSG_RC_BREAK(rc, msg) \ 1470 if (1) { ASSERT_GUEST_MSG_BREAK(RT_SUCCESS(rc), msg); NOREF(rc); } else do {} while (0) 1471 1472 /** @def ASSERT_GUEST_MSG_RC_STMT_BREAK 2111 1473 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute 2112 1474 * @a stmt and break if it isn't. … … 2117 1479 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2118 1480 */ 2119 #define A ssertMsgRCBreakStmt(rc, msg, stmt) \2120 if (1) { A ssertMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } else do {} while (0)2121 2122 /** @def A ssertRCSuccess1481 #define ASSERT_GUEST_MSG_RC_STMT_BREAK(rc, msg, stmt) \ 1482 if (1) { ASSERT_GUEST_MSG_STMT_BREAK(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } else do {} while (0) 1483 1484 /** @def ASSERT_GUEST_RC_SUCCESS 2123 1485 * Asserts an iprt status code equals VINF_SUCCESS. 2124 1486 * … … 2128 1490 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2129 1491 */ 2130 #define A ssertRCSuccess(rc) do { AssertMsg((rc) == VINF_SUCCESS, ("%Rra\n", (rc))); NOREF(rc); } while (0)2131 2132 /** @def A ssertRCSuccessReturn1492 #define ASSERT_GUEST_RC_SUCCESS(rc) do { ASSERT_GUEST_MSG((rc) == VINF_SUCCESS, ("%Rra\n", (rc))); NOREF(rc); } while (0) 1493 1494 /** @def ASSERT_GUEST_RC_SUCCESS_RETURN 2133 1495 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't. 2134 1496 * … … 2137 1499 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2138 1500 */ 2139 #define A ssertRCSuccessReturn(rc, rcRet) AssertMsgReturn((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet)2140 2141 /** @def A ssertRCSuccessReturnVoid1501 #define ASSERT_GUEST_RC_SUCCESS_RETURN(rc, rcRet) ASSERT_GUEST_MSG_RETURN((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet) 1502 1503 /** @def ASSERT_GUEST_RC_SUCCESS_RETURN_VOID 2142 1504 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't. 2143 1505 * … … 2145 1507 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2146 1508 */ 2147 #define A ssertRCSuccessReturnVoid(rc) AssertMsgReturnVoid((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))2148 2149 /** @def A ssertRCSuccessBreak1509 #define ASSERT_GUEST_RC_SUCCESS_RETURN_VOID(rc) ASSERT_GUEST_MSG_RETURN_VOID((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 1510 1511 /** @def ASSERT_GUEST_RC_SUCCESS_BREAK 2150 1512 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't. 2151 1513 * … … 2153 1515 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2154 1516 */ 2155 #define A ssertRCSuccessBreak(rc) AssertMsgBreak((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))2156 2157 /** @def A ssertRCSuccessBreakStmt1517 #define ASSERT_GUEST_RC_SUCCESS_BREAK(rc) ASSERT_GUEST_MSG_BREAK((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 1518 1519 /** @def ASSERT_GUEST_RC_SUCCESSBreakStmt 2158 1520 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't. 2159 1521 * … … 2162 1524 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 2163 1525 */ 2164 #define AssertRCSuccessBreakStmt(rc, stmt) AssertMsgBreakStmt((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), stmt) 2165 2166 2167 /** @def AssertLogRelRC 1526 #define ASSERT_GUEST_RC_SUCCESS_STMT_BREAK(rc, stmt) ASSERT_GUEST_MSG_STMT_BREAK((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), stmt) 1527 1528 /** @def ASSERT_GUEST_GCPHYS32 1529 * Asserts that the high dword of a physical address is zero 1530 * 1531 * @param GCPhys The address (RTGCPHYS). 1532 */ 1533 #define ASSERT_GUEST_GCPHYS32(GCPhys) ASSERT_GUEST_MSG(VALID_PHYS32(GCPhys), ("%RGp\n", (RTGCPHYS)(GCPhys))) 1534 1535 1536 /** @def ASSERT_GUEST_RC 2168 1537 * Asserts a iprt status code successful. 2169 1538 * 1539 * On failure it will print info about the rc and hit a breakpoint. 1540 * 2170 1541 * @param rc iprt status code. 2171 * @remark rc is referenced multiple times. 2172 */ 2173 #define AssertLogRelRC(rc) AssertLogRelMsgRC(rc, ("%Rra\n", (rc))) 2174 2175 /** @def AssertLogRelRCReturn 2176 * Asserts a iprt status code successful, returning \a rc if it isn't. 1542 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1543 */ 1544 #define ASSERT_GUEST_LOGREL_RC(rc) ASSERT_GUEST_LOGREL_MSG_RC(rc, ("%Rra\n", (rc))) 1545 1546 /** @def ASSERT_GUEST_LOGREL_RC_STMT 1547 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and execute 1548 * @a stmt if it isn't. 1549 * 1550 * @param rc iprt status code. 1551 * @param stmt Statement to execute before returning in case of a failed 1552 * assertion. 1553 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1554 */ 1555 #define ASSERT_GUEST_LOGREL_RC_STMT(rc, stmt) ASSERT_GUEST_LOGREL_MSG_RC_STMT(rc, ("%Rra\n", (rc)), stmt) 1556 1557 /** @def ASSERT_GUEST_LOGREL_RC_RETURN 1558 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't. 2177 1559 * 2178 1560 * @param rc iprt status code. 2179 1561 * @param rcRet What is to be presented to return. 2180 * @remark rc is referenced multiple times. 2181 */ 2182 #define A ssertLogRelRCReturn(rc, rcRet) AssertLogRelMsgRCReturn(rc, ("%Rra\n", (rc)), rcRet)2183 2184 /** @def A ssertLogRelRCReturnStmt2185 * Asserts a iprt status code successful, executing \a stmt and returning \a rc2186 * if it isn't.1562 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1563 */ 1564 #define ASSERT_GUEST_LOGREL_RC_RETURN(rc, rcRet) ASSERT_GUEST_LOGREL_MSG_RC_RETURN(rc, ("%Rra\n", (rc)), rcRet) 1565 1566 /** @def ASSERT_GUEST_LOGREL_RC_STMT_RETURN 1567 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute 1568 * @a stmt and returns @a rcRet if it isn't. 2187 1569 * 2188 1570 * @param rc iprt status code. … … 2190 1572 * assertion. 2191 1573 * @param rcRet What is to be presented to return. 2192 * @remark rc is referenced multiple times. 2193 */ 2194 #define AssertLogRelRCReturnStmt(rc, stmt, rcRet) AssertLogRelMsgRCReturnStmt(rc, ("%Rra\n", (rc)), stmt, rcRet) 2195 2196 /** @def AssertLogRelRCReturnVoid 2197 * Asserts a iprt status code successful, returning (void) if it isn't. 2198 * 2199 * @param rc iprt status code. 2200 * @remark rc is referenced multiple times. 2201 */ 2202 #define AssertLogRelRCReturnVoid(rc) AssertLogRelMsgRCReturnVoid(rc, ("%Rra\n", (rc))) 2203 2204 /** @def AssertLogRelRCBreak 2205 * Asserts a iprt status code successful, breaking if it isn't. 2206 * 2207 * @param rc iprt status code. 2208 * @remark rc is referenced multiple times. 2209 */ 2210 #define AssertLogRelRCBreak(rc) AssertLogRelMsgRCBreak(rc, ("%Rra\n", (rc))) 2211 2212 /** @def AssertLogRelRCBreakStmt 2213 * Asserts a iprt status code successful, execute \a statement and break if it isn't. 1574 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1575 */ 1576 #define ASSERT_GUEST_LOGREL_RC_STMT_RETURN(rc, stmt, rcRet) ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN(rc, ("%Rra\n", (rc)), stmt, rcRet) 1577 1578 /** @def ASSERT_GUEST_LOGREL_RC_RETURN_VOID 1579 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't. 1580 * 1581 * @param rc iprt status code. 1582 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1583 */ 1584 #define ASSERT_GUEST_LOGREL_RC_RETURN_VOID(rc) ASSERT_GUEST_LOGREL_MSG_RC_RETURN_VOID(rc, ("%Rra\n", (rc))) 1585 1586 /** @def ASSERT_GUEST_LOGREL_RC_STMT_RETURN_VOID 1587 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), and 1588 * execute the given statement/return if it isn't. 1589 * 1590 * @param rc iprt status code. 1591 * @param stmt Statement to execute before returning on failure. 1592 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1593 */ 1594 #define ASSERT_GUEST_LOGREL_RC_STMT_RETURN_VOID(rc, stmt) ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN_VOID(rc, ("%Rra\n", (rc)), stmt) 1595 1596 /** @def ASSERT_GUEST_LOGREL_RCBreak 1597 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't. 1598 * 1599 * @param rc iprt status code. 1600 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1601 */ 1602 #define ASSERT_GUEST_LOGREL_RC_BREAK(rc) ASSERT_GUEST_LOGREL_MSG_RC_BREAK(rc, ("%Rra\n", (rc))) 1603 1604 /** @def ASSERT_GUEST_LOGREL_RC_STMT_BREAK 1605 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't. 2214 1606 * 2215 1607 * @param rc iprt status code. 2216 1608 * @param stmt Statement to execute before break in case of a failed assertion. 2217 * @remark rc is referenced multiple times. 2218 */ 2219 #define A ssertLogRelRCBreakStmt(rc, stmt) AssertLogRelMsgRCBreakStmt(rc, ("%Rra\n", (rc)), stmt)2220 2221 /** @def A ssertLogRelMsgRC1609 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1610 */ 1611 #define ASSERT_GUEST_LOGREL_RC_STMT_BREAK(rc, stmt) ASSERT_GUEST_LOGREL_MSG_RC_STMT_BREAK(rc, ("%Rra\n", (rc)), stmt) 1612 1613 /** @def ASSERT_GUEST_LOGREL_MSG_RC 2222 1614 * Asserts a iprt status code successful. 2223 1615 * 1616 * It prints a custom message and hits a breakpoint on FAILURE. 1617 * 2224 1618 * @param rc iprt status code. 2225 1619 * @param msg printf argument list (in parenthesis). 2226 * @remark rc is referenced multiple times. 2227 */ 2228 #define AssertLogRelMsgRC(rc, msg) AssertLogRelMsg(RT_SUCCESS_NP(rc), msg) 2229 2230 /** @def AssertLogRelMsgRCReturn 2231 * Asserts a iprt status code successful. 1620 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1621 */ 1622 #define ASSERT_GUEST_LOGREL_MSG_RC(rc, msg) \ 1623 do { ASSERT_GUEST_LOGREL_MSG(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0) 1624 1625 /** @def ASSERT_GUEST_LOGREL_MSG_RCStmt 1626 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and 1627 * execute @a stmt if it isn't. 1628 * 1629 * @param rc iprt status code. 1630 * @param msg printf argument list (in parenthesis). 1631 * @param stmt Statement to execute before returning in case of a failed 1632 * assertion. 1633 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1634 */ 1635 #define ASSERT_GUEST_LOGREL_MSG_RC_STMT(rc, msg, stmt) \ 1636 do { ASSERT_GUEST_LOGREL_MSG_STMT(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } while (0) 1637 1638 /** @def ASSERT_GUEST_LOGREL_MSG_RC_RETURN 1639 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return 1640 * @a rcRet if it isn't. 2232 1641 * 2233 1642 * @param rc iprt status code. 2234 1643 * @param msg printf argument list (in parenthesis). 2235 1644 * @param rcRet What is to be presented to return. 2236 * @remark rc is referenced multiple times. 2237 */ 2238 #define AssertLogRelMsgRCReturn(rc, msg, rcRet) AssertLogRelMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet) 2239 2240 /** @def AssertLogRelMsgRCReturnStmt 2241 * Asserts a iprt status code successful, execute \a stmt and return on 2242 * failure. 1645 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1646 */ 1647 #define ASSERT_GUEST_LOGREL_MSG_RC_RETURN(rc, msg, rcRet) \ 1648 do { ASSERT_GUEST_LOGREL_MSG_RETURN(RT_SUCCESS_NP(rc), msg, rcRet); NOREF(rc); } while (0) 1649 1650 /** @def ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN 1651 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute 1652 * @a stmt and return @a rcRet if it isn't. 2243 1653 * 2244 1654 * @param rc iprt status code. … … 2247 1657 * assertion. 2248 1658 * @param rcRet What is to be presented to return. 2249 * @remark rc is referenced multiple times. 2250 */ 2251 #define AssertLogRelMsgRCReturnStmt(rc, msg, stmt, rcRet) AssertLogRelMsgReturnStmt(RT_SUCCESS_NP(rc), msg, stmt, rcRet) 2252 2253 /** @def AssertLogRelMsgRCReturnVoid 2254 * Asserts a iprt status code successful. 1659 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1660 */ 1661 #define ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN(rc, msg, stmt, rcRet) \ 1662 do { ASSERT_GUEST_LOGREL_MSG_STMT_RETURN(RT_SUCCESS_NP(rc), msg, stmt, rcRet); NOREF(rc); } while (0) 1663 1664 /** @def ASSERT_GUEST_LOGREL_MSG_RC_RETURN_VOID 1665 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return 1666 * void if it isn't. 2255 1667 * 2256 1668 * @param rc iprt status code. 2257 1669 * @param msg printf argument list (in parenthesis). 2258 * @remark rc is referenced multiple times. 2259 */ 2260 #define AssertLogRelMsgRCReturnVoid(rc, msg) AssertLogRelMsgReturnVoid(RT_SUCCESS_NP(rc), msg) 2261 2262 /** @def AssertLogRelMsgRCBreak 2263 * Asserts a iprt status code successful. 2264 * 2265 * @param rc iprt status code. 2266 * @param msg printf argument list (in parenthesis). 2267 * @remark rc is referenced multiple times. 2268 */ 2269 #define AssertLogRelMsgRCBreak(rc, msg) AssertLogRelMsgBreak(RT_SUCCESS(rc), msg) 2270 2271 /** @def AssertLogRelMsgRCBreakStmt 2272 * Asserts a iprt status code successful, execute \a stmt and break if it isn't. 1670 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1671 */ 1672 #define ASSERT_GUEST_LOGREL_MSG_RC_RETURN_VOID(rc, msg) \ 1673 do { ASSERT_GUEST_LOGREL_MSG_RETURN_VOID(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0) 1674 1675 /** @def ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN_VOID 1676 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute 1677 * @a stmt and return void if it isn't. 2273 1678 * 2274 1679 * @param rc iprt status code. 2275 1680 * @param msg printf argument list (in parenthesis). 2276 1681 * @param stmt Statement to execute before break in case of a failed assertion. 2277 * @remark rc is referenced multiple times. 2278 */ 2279 #define AssertLogRelMsgRCBreakStmt(rc, msg, stmt) AssertLogRelMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt) 2280 2281 /** @def AssertLogRelRCSuccess 2282 * Asserts that an iprt status code equals VINF_SUCCESS. 2283 * 2284 * @param rc iprt status code. 2285 * @remark rc is referenced multiple times. 2286 */ 2287 #define AssertLogRelRCSuccess(rc) AssertLogRelMsg((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 2288 2289 /** @def AssertLogRelRCSuccessReturn 2290 * Asserts that an iprt status code equals VINF_SUCCESS. 2291 * 2292 * @param rc iprt status code. 2293 * @param rcRet What is to be presented to return. 2294 * @remark rc is referenced multiple times. 2295 */ 2296 #define AssertLogRelRCSuccessReturn(rc, rcRet) AssertLogRelMsgReturn((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet) 2297 2298 /** @def AssertLogRelRCSuccessReturnVoid 2299 * Asserts that an iprt status code equals VINF_SUCCESS. 2300 * 2301 * @param rc iprt status code. 2302 * @remark rc is referenced multiple times. 2303 */ 2304 #define AssertLogRelRCSuccessReturnVoid(rc) AssertLogRelMsgReturnVoid((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 2305 2306 /** @def AssertLogRelRCSuccessBreak 2307 * Asserts that an iprt status code equals VINF_SUCCESS. 2308 * 2309 * @param rc iprt status code. 2310 * @remark rc is referenced multiple times. 2311 */ 2312 #define AssertLogRelRCSuccessBreak(rc) AssertLogRelMsgBreak((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 2313 2314 /** @def AssertLogRelRCSuccessBreakStmt 2315 * Asserts that an iprt status code equals VINF_SUCCESS. 2316 * 2317 * @param rc iprt status code. 2318 * @param stmt Statement to execute before break in case of a failed assertion. 2319 * @remark rc is referenced multiple times. 2320 */ 2321 #define AssertLogRelRCSuccessBreakStmt(rc, stmt) AssertLogRelMsgBreakStmt((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), stmt) 2322 2323 2324 /** @def AssertReleaseRC 2325 * Asserts a iprt status code successful. 2326 * 2327 * On failure information about the error will be printed and a breakpoint hit. 2328 * 2329 * @param rc iprt status code. 2330 * @remark rc is referenced multiple times. 2331 */ 2332 #define AssertReleaseRC(rc) AssertReleaseMsgRC(rc, ("%Rra\n", (rc))) 2333 2334 /** @def AssertReleaseRCReturn 2335 * Asserts a iprt status code successful, returning if it isn't. 2336 * 2337 * On failure information about the error will be printed, a breakpoint hit 2338 * and finally returning from the function if the breakpoint is somehow ignored. 2339 * 2340 * @param rc iprt status code. 2341 * @param rcRet What is to be presented to return. 2342 * @remark rc is referenced multiple times. 2343 */ 2344 #define AssertReleaseRCReturn(rc, rcRet) AssertReleaseMsgRCReturn(rc, ("%Rra\n", (rc)), rcRet) 2345 2346 /** @def AssertReleaseRCReturnVoid 2347 * Asserts a iprt status code successful, returning if it isn't. 2348 * 2349 * On failure information about the error will be printed, a breakpoint hit 2350 * and finally returning from the function if the breakpoint is somehow ignored. 2351 * 2352 * @param rc iprt status code. 2353 * @remark rc is referenced multiple times. 2354 */ 2355 #define AssertReleaseRCReturnVoid(rc) AssertReleaseMsgRCReturnVoid(rc, ("%Rra\n", (rc))) 2356 2357 /** @def AssertReleaseRCBreak 2358 * Asserts a iprt status code successful, breaking if it isn't. 2359 * 2360 * On failure information about the error will be printed, a breakpoint hit 2361 * and finally breaking the current statement if the breakpoint is somehow ignored. 2362 * 2363 * @param rc iprt status code. 2364 * @remark rc is referenced multiple times. 2365 */ 2366 #define AssertReleaseRCBreak(rc) AssertReleaseMsgRCBreak(rc, ("%Rra\n", (rc))) 2367 2368 /** @def AssertReleaseRCBreakStmt 2369 * Asserts a iprt status code successful, break if it isn't. 2370 * 2371 * On failure information about the error will be printed, a breakpoint hit 2372 * and finally the break statement will be issued if the breakpoint is somehow ignored. 2373 * 2374 * @param rc iprt status code. 2375 * @param stmt Statement to execute before break in case of a failed assertion. 2376 * @remark rc is referenced multiple times. 2377 */ 2378 #define AssertReleaseRCBreakStmt(rc, stmt) AssertReleaseMsgRCBreakStmt(rc, ("%Rra\n", (rc)), stmt) 2379 2380 /** @def AssertReleaseMsgRC 2381 * Asserts a iprt status code successful. 2382 * 2383 * On failure a custom message is printed and a breakpoint is hit. 1682 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1683 */ 1684 #define ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN_VOID(rc, msg, stmt) \ 1685 do { ASSERT_GUEST_LOGREL_MSG_STMT_RETURN_VOID(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } while (0) 1686 1687 /** @def ASSERT_GUEST_LOGREL_MSG_RC_BREAK 1688 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break 1689 * if it isn't. 2384 1690 * 2385 1691 * @param rc iprt status code. 2386 1692 * @param msg printf argument list (in parenthesis). 2387 * @remark rc is referenced multiple times. 2388 */ 2389 #define AssertReleaseMsgRC(rc, msg) AssertReleaseMsg(RT_SUCCESS_NP(rc), msg) 2390 2391 /** @def AssertReleaseMsgRCReturn 2392 * Asserts a iprt status code successful. 2393 * 2394 * On failure a custom message is printed, a breakpoint is hit, and finally 2395 * returning from the function if the breakpoint is somehow ignored. 2396 * 2397 * @param rc iprt status code. 2398 * @param msg printf argument list (in parenthesis). 2399 * @param rcRet What is to be presented to return. 2400 * @remark rc is referenced multiple times. 2401 */ 2402 #define AssertReleaseMsgRCReturn(rc, msg, rcRet) AssertReleaseMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet) 2403 2404 /** @def AssertReleaseMsgRCReturnVoid 2405 * Asserts a iprt status code successful. 2406 * 2407 * On failure a custom message is printed, a breakpoint is hit, and finally 2408 * returning from the function if the breakpoint is somehow ignored. 2409 * 2410 * @param rc iprt status code. 2411 * @param msg printf argument list (in parenthesis). 2412 * @remark rc is referenced multiple times. 2413 */ 2414 #define AssertReleaseMsgRCReturnVoid(rc, msg) AssertReleaseMsgReturnVoid(RT_SUCCESS_NP(rc), msg) 2415 2416 /** @def AssertReleaseMsgRCBreak 2417 * Asserts a iprt status code successful. 2418 * 2419 * On failure a custom message is printed, a breakpoint is hit, and finally 2420 * breaking the current status if the breakpoint is somehow ignored. 2421 * 2422 * @param rc iprt status code. 2423 * @param msg printf argument list (in parenthesis). 2424 * @remark rc is referenced multiple times. 2425 */ 2426 #define AssertReleaseMsgRCBreak(rc, msg) AssertReleaseMsgBreak(RT_SUCCESS(rc), msg) 2427 2428 /** @def AssertReleaseMsgRCBreakStmt 2429 * Asserts a iprt status code successful. 2430 * 2431 * On failure a custom message is printed, a breakpoint is hit, and finally 2432 * the break statement is issued if the breakpoint is somehow ignored. 1693 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1694 */ 1695 #define ASSERT_GUEST_LOGREL_MSG_RC_BREAK(rc, msg) \ 1696 if (1) { ASSERT_GUEST_LOGREL_MSG_BREAK(RT_SUCCESS(rc), msg); NOREF(rc); } else do {} while (0) 1697 1698 /** @def ASSERT_GUEST_LOGREL_MSG_RC_STMT_BREAK 1699 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute 1700 * @a stmt and break if it isn't. 2433 1701 * 2434 1702 * @param rc iprt status code. 2435 1703 * @param msg printf argument list (in parenthesis). 2436 1704 * @param stmt Statement to execute before break in case of a failed assertion. 2437 * @remark rc is referenced multiple times. 2438 */ 2439 #define AssertReleaseMsgRCBreakStmt(rc, msg, stmt) AssertReleaseMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt) 2440 2441 /** @def AssertReleaseRCSuccess 2442 * Asserts that an iprt status code equals VINF_SUCCESS. 2443 * 2444 * On failure information about the error will be printed and a breakpoint hit. 1705 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1706 */ 1707 #define ASSERT_GUEST_LOGREL_MSG_RC_STMT_BREAK(rc, msg, stmt) \ 1708 if (1) { ASSERT_GUEST_LOGREL_MSG_STMT_BREAK(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } else do {} while (0) 1709 1710 /** @def ASSERT_GUEST_LOGREL_RC_SUCCESS 1711 * Asserts an iprt status code equals VINF_SUCCESS. 1712 * 1713 * On failure it will print info about the rc and hit a breakpoint. 2445 1714 * 2446 1715 * @param rc iprt status code. 2447 * @remark rc is referenced multiple times. 2448 */ 2449 #define AssertReleaseRCSuccess(rc) AssertReleaseMsg((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 2450 2451 /** @def AssertReleaseRCSuccessReturn 2452 * Asserts that an iprt status code equals VINF_SUCCESS. 2453 * 2454 * On failure information about the error will be printed, a breakpoint hit 2455 * and finally returning from the function if the breakpoint is somehow ignored. 1716 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1717 */ 1718 #define ASSERT_GUEST_LOGREL_RC_SUCCESS(rc) do { ASSERT_GUEST_LOGREL_MSG((rc) == VINF_SUCCESS, ("%Rra\n", (rc))); NOREF(rc); } while (0) 1719 1720 /** @def ASSERT_GUEST_LOGREL_RC_SUCCESS_RETURN 1721 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't. 2456 1722 * 2457 1723 * @param rc iprt status code. 2458 1724 * @param rcRet What is to be presented to return. 2459 * @remark rc is referenced multiple times. 2460 */ 2461 #define AssertReleaseRCSuccessReturn(rc, rcRet) AssertReleaseMsgReturn((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet) 2462 2463 /** @def AssertReleaseRCSuccessReturnVoid 2464 * Asserts that an iprt status code equals VINF_SUCCESS. 2465 * 2466 * On failure information about the error will be printed, a breakpoint hit 2467 * and finally returning from the function if the breakpoint is somehow ignored. 2468 * 2469 * @param rc iprt status code. 2470 * @remark rc is referenced multiple times. 2471 */ 2472 #define AssertReleaseRCSuccessReturnVoid(rc) AssertReleaseMsgReturnVoid((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 2473 2474 /** @def AssertReleaseRCSuccessBreak 2475 * Asserts that an iprt status code equals VINF_SUCCESS. 2476 * 2477 * On failure information about the error will be printed, a breakpoint hit 2478 * and finally breaking the current statement if the breakpoint is somehow ignored. 2479 * 2480 * @param rc iprt status code. 2481 * @remark rc is referenced multiple times. 2482 */ 2483 #define AssertReleaseRCSuccessBreak(rc) AssertReleaseMsgBreak((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 2484 2485 /** @def AssertReleaseRCSuccessBreakStmt 2486 * Asserts that an iprt status code equals VINF_SUCCESS. 2487 * 2488 * On failure information about the error will be printed, a breakpoint hit 2489 * and finally the break statement will be issued if the breakpoint is somehow ignored. 1725 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1726 */ 1727 #define ASSERT_GUEST_LOGREL_RC_SUCCESS_RETURN(rc, rcRet) ASSERT_GUEST_LOGREL_MSG_RETURN((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet) 1728 1729 /** @def ASSERT_GUEST_LOGREL_RC_SUCCESS_RETURN_VOID 1730 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't. 1731 * 1732 * @param rc iprt status code. 1733 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1734 */ 1735 #define ASSERT_GUEST_LOGREL_RC_SUCCESS_RETURN_VOID(rc) ASSERT_GUEST_LOGREL_MSG_RETURN_VOID((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 1736 1737 /** @def ASSERT_GUEST_LOGREL_RC_SUCCESS_BREAK 1738 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't. 1739 * 1740 * @param rc iprt status code. 1741 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1742 */ 1743 #define ASSERT_GUEST_LOGREL_RC_SUCCESS_BREAK(rc) ASSERT_GUEST_LOGREL_MSG_BREAK((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 1744 1745 /** @def ASSERT_GUEST_LOGREL_RC_SUCCESSBreakStmt 1746 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't. 2490 1747 * 2491 1748 * @param rc iprt status code. 2492 1749 * @param stmt Statement to execute before break in case of a failed assertion. 2493 * @remark rc is referenced multiple times. 2494 */ 2495 #define AssertReleaseRCSuccessBreakStmt(rc, stmt) AssertReleaseMsgBreakStmt((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), stmt) 2496 2497 2498 /** @def AssertFatalRC 2499 * Asserts a iprt status code successful. 2500 * 2501 * On failure information about the error will be printed and a breakpoint hit. 2502 * 2503 * @param rc iprt status code. 2504 * @remark rc is referenced multiple times. 2505 */ 2506 #define AssertFatalRC(rc) AssertFatalMsgRC(rc, ("%Rra\n", (rc))) 2507 2508 /** @def AssertReleaseMsgRC 2509 * Asserts a iprt status code successful. 2510 * 2511 * On failure a custom message is printed and a breakpoint is hit. 2512 * 2513 * @param rc iprt status code. 2514 * @param msg printf argument list (in parenthesis). 2515 * @remark rc is referenced multiple times. 2516 */ 2517 #define AssertFatalMsgRC(rc, msg) AssertFatalMsg(RT_SUCCESS_NP(rc), msg) 2518 2519 /** @def AssertFatalRCSuccess 2520 * Asserts that an iprt status code equals VINF_SUCCESS. 2521 * 2522 * On failure information about the error will be printed and a breakpoint hit. 2523 * 2524 * @param rc iprt status code. 2525 * @remark rc is referenced multiple times. 2526 */ 2527 #define AssertFatalRCSuccess(rc) AssertFatalMsg((rc) == VINF_SUCCESS, ("%Rra\n", (rc))) 2528 2529 2530 /** @def AssertPtr 2531 * Asserts that a pointer is valid. 2532 * 2533 * @param pv The pointer. 2534 */ 2535 #define AssertPtr(pv) AssertMsg(VALID_PTR(pv), ("%p\n", (pv))) 2536 2537 /** @def AssertPtrReturn 2538 * Asserts that a pointer is valid. 2539 * 2540 * @param pv The pointer. 2541 * @param rcRet What is to be presented to return. 2542 */ 2543 #define AssertPtrReturn(pv, rcRet) AssertMsgReturn(VALID_PTR(pv), ("%p\n", (pv)), rcRet) 2544 2545 /** @def AssertPtrReturnVoid 2546 * Asserts that a pointer is valid. 2547 * 2548 * @param pv The pointer. 2549 */ 2550 #define AssertPtrReturnVoid(pv) AssertMsgReturnVoid(VALID_PTR(pv), ("%p\n", (pv))) 2551 2552 /** @def AssertPtrBreak 2553 * Asserts that a pointer is valid. 2554 * 2555 * @param pv The pointer. 2556 */ 2557 #define AssertPtrBreak(pv) AssertMsgBreak(VALID_PTR(pv), ("%p\n", (pv))) 2558 2559 /** @def AssertPtrBreakStmt 2560 * Asserts that a pointer is valid. 2561 * 2562 * @param pv The pointer. 2563 * @param stmt Statement to execute before break in case of a failed assertion. 2564 */ 2565 #define AssertPtrBreakStmt(pv, stmt) AssertMsgBreakStmt(VALID_PTR(pv), ("%p\n", (pv)), stmt) 2566 2567 /** @def AssertPtrNull 2568 * Asserts that a pointer is valid or NULL. 2569 * 2570 * @param pv The pointer. 2571 */ 2572 #define AssertPtrNull(pv) AssertMsg(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv))) 2573 2574 /** @def AssertPtrNullReturn 2575 * Asserts that a pointer is valid or NULL. 2576 * 2577 * @param pv The pointer. 2578 * @param rcRet What is to be presented to return. 2579 */ 2580 #define AssertPtrNullReturn(pv, rcRet) AssertMsgReturn(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)), rcRet) 2581 2582 /** @def AssertPtrNullReturnVoid 2583 * Asserts that a pointer is valid or NULL. 2584 * 2585 * @param pv The pointer. 2586 */ 2587 #define AssertPtrNullReturnVoid(pv) AssertMsgReturnVoid(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv))) 2588 2589 /** @def AssertPtrNullBreak 2590 * Asserts that a pointer is valid or NULL. 2591 * 2592 * @param pv The pointer. 2593 */ 2594 #define AssertPtrNullBreak(pv) AssertMsgBreak(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv))) 2595 2596 /** @def AssertPtrNullBreakStmt 2597 * Asserts that a pointer is valid or NULL. 2598 * 2599 * @param pv The pointer. 2600 * @param stmt Statement to execute before break in case of a failed assertion. 2601 */ 2602 #define AssertPtrNullBreakStmt(pv, stmt) AssertMsgBreakStmt(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)), stmt) 2603 2604 /** @def AssertGCPhys32 1750 * @remark rc is referenced multiple times. In release mode is NOREF()'ed. 1751 */ 1752 #define ASSERT_GUEST_LOGREL_RC_SUCCESS_STMT_BREAK(rc, stmt) ASSERT_GUEST_LOGREL_MSG_STMT_BREAK((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), stmt) 1753 1754 /** @def ASSERT_GUEST_LOGREL_GCPHYS32 2605 1755 * Asserts that the high dword of a physical address is zero 2606 1756 * 2607 1757 * @param GCPhys The address (RTGCPHYS). 2608 1758 */ 2609 #define AssertGCPhys32(GCPhys) AssertMsg(VALID_PHYS32(GCPhys), ("%RGp\n", (RTGCPHYS)(GCPhys))) 2610 2611 /** @def AssertGCPtr32 2612 * Asserts that the high dword of a physical address is zero 2613 * 2614 * @param GCPtr The address (RTGCPTR). 2615 */ 2616 #if GC_ARCH_BITS == 32 2617 # define AssertGCPtr32(GCPtr) do { } while (0) 2618 #else 2619 # define AssertGCPtr32(GCPtr) AssertMsg(!((GCPtr) & UINT64_C(0xffffffff00000000)), ("%RGv\n", GCPtr)) 2620 #endif 2621 2622 /** @def AssertForEach 2623 * Equivalent to Assert for each value of the variable from the starting 2624 * value to the finishing one. 2625 * 2626 * @param var Name of the counter variable. 2627 * @param vartype Type of the counter variable. 2628 * @param first Lowest inclusive value of the counter variable. 2629 * This must be free from side effects. 2630 * @param end Highest exclusive value of the counter variable. 2631 * This must be free from side effects. 2632 * @param expr Expression which should be true for each value of @a var. 2633 */ 2634 #define AssertForEach(var, vartype, first, end, expr) \ 2635 do { \ 2636 vartype var; \ 2637 Assert((first) == (first) && (end) == (end)); /* partial check for side effects */ \ 2638 for (var = (first); var < (end); var++) \ 2639 AssertMsg(expr, ("%s = %#RX64 (%RI64)", #var, (uint64_t)var, (int64_t)var)); \ 2640 } while (0) 2641 2642 #ifdef RT_OS_WINDOWS 2643 2644 /** @def AssertNtStatus 2645 * Asserts that the NT_SUCCESS() returns true for the given NTSTATUS value. 2646 * 2647 * @param a_rcNt The NTSTATUS to check. Will be evaluated twice and 2648 * subjected to NOREF(). 2649 * @sa AssertRC() 2650 */ 2651 # define AssertNtStatus(a_rcNt) \ 2652 do { AssertMsg(NT_SUCCESS(a_rcNt), ("%#x\n", (a_rcNt))); NOREF(a_rcNt); } while (0) 2653 2654 /** @def AssertNtStatusSuccess 2655 * Asserts that the given NTSTATUS value equals STATUS_SUCCESS. 2656 * 2657 * @param a_rcNt The NTSTATUS to check. Will be evaluated twice and 2658 * subjected to NOREF(). 2659 * @sa AssertRCSuccess() 2660 */ 2661 # define AssertNtStatusSuccess(a_rcNt) \ 2662 do { AssertMsg((a_rcNt) == STATUS_SUCCESS, ("%#x\n", (a_rcNt))); NOREF(a_rcNt); } while (0) 2663 2664 #endif /* RT_OS_WINDOWS */ 1759 #define ASSERT_GUEST_LOGREL_GCPHYS32(GCPhys) ASSERT_GUEST_LOGREL_MSG(VALID_PHYS32(GCPhys), ("%RGp\n", (RTGCPHYS)(GCPhys))) 1760 2665 1761 2666 1762 /** @} */ 2667 1763 1764 2668 1765 /** @} */ 2669 1766 -
trunk/include/VBox/cdefs.h
r69107 r71606 30 30 31 31 32 /** @defgroup VBox Common Defintions and Macros32 /** @defgroup grp_vbox_cdefs VBox Common Defintions and Macros 33 33 * @{ 34 34 */ … … 51 51 # define VBOX_STRICT 52 52 # endif 53 #endif 54 55 /** @def VBOX_STRICT_GUEST 56 * Be strict on guest input. This can be overriden on the compiler command line 57 * or per source file by defining VBOX_NO_STRICT_GUEST. 58 * 59 * @sa VBox/assert.h and its ASSERT_GUEST_XXXX macros. 60 */ 61 #ifndef VBOX_STRICT_GUEST 62 # ifdef VBOX_STRICT 63 # define VBOX_STRICT_GUEST 64 # endif 65 #endif 66 /** @def VBOX_NO_STRICT_GUEST 67 * Define to override VBOX_STRICT_GUEST, disabling asserting on guest input. */ 68 #ifdef VBOX_NO_STRICT_GUEST 69 # undef VBOX_STRICT_GUEST 53 70 #endif 54 71
Note:
See TracChangeset
for help on using the changeset viewer.

