VirtualBox

source: vbox/trunk/include/VBox/AssertGuest.h@ 74189

Last change on this file since 74189 was 71610, checked in by vboxsync, 7 years ago

Introducing VBox/AssertGuest.h and a family of ASSERT_GUEST_XXXX macros that parallels iprt/assert.h. bugref:9094 [fixes]

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 58.9 KB
Line 
1/** @file
2 * VirtualBox - Guest input assertions.
3 */
4
5/*
6 * Copyright (C) 2006-2018 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
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
34 * @{
35 */
36
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 *
46 * @{
47 */
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
67 * Assert that an expression is true. If false, hit breakpoint.
68 * @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
87 * Assert that an expression is true. If false, hit breakpoint and execute the
88 * statement.
89 * @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
118 * Assert that an expression is true and returns if it isn't.
119 * 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
147 * Assert that an expression is true, if it isn't execute the given statement
148 * and return rc.
149 *
150 * In VBOX_STRICT_GUEST mode it will hit a breakpoint before executing the statement and
151 * returning.
152 *
153 * @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
184 * Assert that an expression is true and returns if it isn't.
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(); \
198 return; \
199 } \
200 } while (0)
201#else
202# define ASSERT_GUEST_RETURN_VOID(a_Expr) \
203 do { \
204 if (RT_LIKELY(!!(a_Expr))) \
205 { /* likely */ } \
206 else \
207 return; \
208 } while (0)
209#endif
210
211/** @def ASSERT_GUEST_STMT_RETURN_VOID
212 * Assert that an expression is true, if it isn't execute the given statement
213 * and return.
214 *
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; \
230 return; \
231 } \
232 } while (0)
233#else
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; \
241 return; \
242 } \
243 } while (0)
244#endif
245
246
247/** @def ASSERT_GUEST_BREAK
248 * Assert that an expression is true and breaks if it isn't.
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))) \
256 { /* likely */ } \
257 else if (1) \
258 { \
259 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
260 ASSERT_GUEST_PANIC(); \
261 break; \
262 } else \
263 break
264#else
265# define ASSERT_GUEST_BREAK(a_Expr) \
266 if (RT_LIKELY(!!(a_Expr))) \
267 { /* likely */ } \
268 else \
269 break
270#endif
271
272/** @def ASSERT_GUEST_CONTINUE
273 * Assert that an expression is true and continue if it isn't.
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))) \
281 { /* likely */ } \
282 else if (1) \
283 { \
284 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
285 ASSERT_GUEST_PANIC(); \
286 continue; \
287 } else do {} while (0)
288#else
289# define ASSERT_GUEST_CONTINUE(a_Expr) \
290 if (RT_LIKELY(!!(a_Expr))) \
291 { /* likely */ } \
292 else \
293 continue
294#endif
295
296/** @def ASSERT_GUEST_STMT_BREAK
297 * Assert that an expression is true and breaks if it isn't.
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))) \
306 { /* likely */ } \
307 else if (1) \
308 { \
309 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
310 ASSERT_GUEST_PANIC(); \
311 a_Stmt; \
312 break; \
313 } else do {} while (0)
314#else
315# define ASSERT_GUEST_STMT_BREAK(a_Expr, a_Stmt) \
316 if (RT_LIKELY(!!(a_Expr))) \
317 { /* likely */ } \
318 else if (1) \
319 { \
320 a_Stmt; \
321 break; \
322 } else do {} while (0)
323#endif
324
325
326/** @def ASSERT_GUEST_MSG
327 * Assert that an expression is true. If it's not print message and hit breakpoint.
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__); \
339 RTAssertMsg2Weak a; \
340 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
348 * Assert that an expression is true. If it's not print message and hit
349 * breakpoint and execute the statement.
350 *
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.
354 *
355 * @remarks The expression and statement will be evaluated in all build types.
356 */
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__); \
365 RTAssertMsg2Weak a; \
366 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
383 * Assert that an expression is true and returns if it isn't.
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__); \
398 RTAssertMsg2Weak a; \
399 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
414 * Assert that an expression is true, if it isn't execute the statement and
415 * return.
416 *
417 * 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
422 * assertion.
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__); \
433 RTAssertMsg2Weak a; \
434 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
453 * Assert that an expression is true and returns if it isn't.
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__); \
467 RTAssertMsg2Weak a; \
468 ASSERT_GUEST_PANIC(); \
469 return; \
470 } \
471 } while (0)
472#else
473# define ASSERT_GUEST_MSG_RETURN_VOID(a_Expr, a) \
474 do { \
475 if (RT_LIKELY(!!(a_Expr))) \
476 { /* likely */ } \
477 else \
478 return; \
479 } while (0)
480#endif
481
482/** @def ASSERT_GUEST_MSG_STMT_RETURN_VOID
483 * Assert that an expression is true, if it isn't execute the statement and
484 * return.
485 *
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__); \
500 RTAssertMsg2Weak a; \
501 ASSERT_GUEST_PANIC(); \
502 a_Stmt; \
503 return; \
504 } \
505 } while (0)
506#else
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; \
514 return; \
515 } \
516 } while (0)
517#endif
518
519
520/** @def ASSERT_GUEST_MSG_BREAK
521 * Assert that an expression is true and breaks if it isn't.
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))) \
530 { /* likely */ } \
531 else if (1) \
532 { \
533 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
534 RTAssertMsg2Weak a; \
535 ASSERT_GUEST_PANIC(); \
536 break; \
537 } else \
538 break
539#else
540# define ASSERT_GUEST_MSG_BREAK(a_Expr, a) \
541 if (RT_LIKELY(!!(a_Expr))) \
542 { /* likely */ } \
543 else \
544 break
545#endif
546
547/** @def ASSERT_GUEST_MSG_STMT_BREAK
548 * Assert that an expression is true and breaks if it isn't.
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))) \
558 { /* likely */ } \
559 else if (1) \
560 { \
561 ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
562 RTAssertMsg2Weak a; \
563 ASSERT_GUEST_PANIC(); \
564 a_Stmt; \
565 break; \
566 } else \
567 break
568#else
569# define ASSERT_GUEST_MSG_STMT_BREAK(a_Expr, a, a_Stmt) \
570 if (RT_LIKELY(!!(a_Expr))) \
571 { /* likely */ } \
572 else if (1) \
573 { \
574 a_Stmt; \
575 break; \
576 } else \
577 break
578#endif
579
580/** @def ASSERT_GUEST_FAILED
581 * An assertion failed, hit breakpoint.
582 */
583#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_FAILED_STMT
594 * An assertion failed, hit breakpoint and execute statement.
595 */
596#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
628 * statement and return a value.
629 *
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(); \
657 return; \
658 } while (0)
659#else
660# define ASSERT_GUEST_FAILED_RETURN_VOID() \
661 do { \
662 return; \
663 } while (0)
664#endif
665
666/** @def ASSERT_GUEST_FAILED_STMT_RETURN_VOID
667 * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute a
668 * statement and return.
669 *
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; \
678 return; \
679 } while (0)
680#else
681# define ASSERT_GUEST_FAILED_STMT_RETURN_VOID(a_Stmt) \
682 do { \
683 a_Stmt; \
684 return; \
685 } while (0)
686#endif
687
688
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() \
694 if (1) { \
695 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
696 ASSERT_GUEST_PANIC(); \
697 break; \
698 } else \
699 break
700#else
701# define ASSERT_GUEST_FAILED_BREAK() \
702 if (1) \
703 break; \
704 else \
705 break
706#endif
707
708/** @def ASSERT_GUEST_FAILED_STMT_BREAK
709 * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute
710 * the given statement and break.
711 *
712 * @param a_Stmt Statement to execute before break.
713 */
714#ifdef VBOX_STRICT_GUEST
715# define ASSERT_GUEST_FAILED_STMT_BREAK(a_Stmt) \
716 if (1) { \
717 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
718 ASSERT_GUEST_PANIC(); \
719 a_Stmt; \
720 break; \
721 } else \
722 break
723#else
724# define ASSERT_GUEST_FAILED_STMT_BREAK(a_Stmt) \
725 if (1) { \
726 a_Stmt; \
727 break; \
728 } else \
729 break
730#endif
731
732
733/** @def ASSERT_GUEST_MSG_FAILED
734 * An assertion failed print a message and a hit breakpoint.
735 *
736 * @param a printf argument list (in parenthesis).
737 */
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__); \
742 RTAssertMsg2Weak a; \
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_FAILED_RETURN
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__); \
759 RTAssertMsg2Weak a; \
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__); \
779 RTAssertMsg2Weak a; \
780 ASSERT_GUEST_PANIC(); \
781 return; \
782 } while (0)
783#else
784# define ASSERT_GUEST_MSG_FAILED_RETURN_VOID(a) \
785 do { \
786 return; \
787 } while (0)
788#endif
789
790
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) \
798 if (1) { \
799 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
800 RTAssertMsg2Weak a; \
801 ASSERT_GUEST_PANIC(); \
802 break; \
803 } else \
804 break
805#else
806# define ASSERT_GUEST_MSG_FAILED_BREAK(a) \
807 if (1) \
808 break; \
809 else \
810 break
811#endif
812
813/** @def ASSERT_GUEST_MSG_FAILED_STMT_BREAK
814 * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute
815 * the given statement and break.
816 *
817 * @param a printf argument list (in parenthesis).
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) \
822 if (1) { \
823 ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
824 RTAssertMsg2Weak a; \
825 ASSERT_GUEST_PANIC(); \
826 a_Stmt; \
827 break; \
828 } else \
829 break
830#else
831# define ASSERT_GUEST_MSG_FAILED_STMT_BREAK(a, a_Stmt) \
832 if (1) { \
833 a_Stmt; \
834 break; \
835 } else \
836 break
837#endif
838
839/** @} */
840
841
842
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.
849 *
850 * @{
851 */
852
853
854/** @def ASSERT_GUEST_LOGREL_MSG1
855 * RTAssertMsg1Weak (strict builds) / LogRel wrapper (non-strict).
856 */
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
866 * RTAssertMsg2Weak (strict builds) / LogRel wrapper (non-strict).
867 */
868#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
875 * Assert that an expression is true.
876 * Strict builds will hit a breakpoint, non-strict will only do LogRel.
877 *
878 * @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_LOGREL_RETURN
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
911 * Assert that an expression is true, return void if it isn't.
912 * Strict builds will hit a breakpoint, non-strict will only do LogRel.
913 *
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(); \
924 return; \
925 } \
926 } while (0)
927
928/** @def ASSERT_GUEST_LOGREL_BREAK
929 * Assert that an expression is true, break if it isn't.
930 * Strict builds will hit a breakpoint, non-strict will only do LogRel.
931 *
932 * @param a_Expr Expression which should be true.
933 */
934#define ASSERT_GUEST_LOGREL_BREAK(a_Expr) \
935 if (RT_LIKELY(!!(a_Expr))) \
936 { /* likely */ } \
937 else if (1) \
938 { \
939 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
940 ASSERT_GUEST_PANIC(); \
941 break; \
942 } \
943 else \
944 break
945
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))) \
955 { /* likely */ } \
956 else if (1) \
957 { \
958 ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
959 ASSERT_GUEST_PANIC(); \
960 a_Stmt; \
961 break; \
962 } else \
963 break
964
965/** @def ASSERT_GUEST_LOGREL_MSG
966 * Assert that an expression is true.
967 * Strict builds will hit a breakpoint, non-strict will only do LogRel.
968 *
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))) \
975 { /* likely */ } \
976 else\
977 { \
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))) \
995 { /* likely */ } \
996 else\
997 { \
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))) \
1016 { /* likely */ } \
1017 else\
1018 { \
1019 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
1028 * isn't.
1029 * Strict builds will hit a breakpoint, non-strict will only do LogRel.
1030 *
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("failed", __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("failed", __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("failed", __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("failed", __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("failed", __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("failed", __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("failed", __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("failed", __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("failed", __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("failed", __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("failed", __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("failed", __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("failed", __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.
1345 * @param stmt Statement to execute before returning in case of a failed
1346 * assertion.
1347 * @param rcRet What is to be presented to return.
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
1353 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
1354 *
1355 * @param rc iprt status code.
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
1361 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), and
1362 * execute the given statement/return if it isn't.
1363 *
1364 * @param rc iprt status code.
1365 * @param stmt Statement to execute before returning on failure.
1366 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1367 */
1368#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_RC_BREAK
1371 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
1372 *
1373 * @param rc iprt status code.
1374 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1375 */
1376#define ASSERT_GUEST_RC_BREAK(rc) ASSERT_GUEST_MSG_RC_BREAK(rc, ("%Rra\n", (rc)))
1377
1378/** @def ASSERT_GUEST_RC_STMT_BREAK
1379 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
1380 *
1381 * @param rc iprt status code.
1382 * @param stmt Statement to execute before break in case of a failed assertion.
1383 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1384 */
1385#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
1388 * Asserts a iprt status code successful.
1389 *
1390 * It prints a custom message and hits a breakpoint on FAILURE.
1391 *
1392 * @param rc iprt status code.
1393 * @param msg printf argument list (in parenthesis).
1394 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1395 */
1396#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_RC_STMT
1400 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and
1401 * execute @a stmt if it isn't.
1402 *
1403 * @param rc iprt status code.
1404 * @param msg printf argument list (in parenthesis).
1405 * @param stmt Statement to execute before returning in case of a failed
1406 * assertion.
1407 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1408 */
1409#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
1413 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return
1414 * @a rcRet if it isn't.
1415 *
1416 * @param rc iprt status code.
1417 * @param msg printf argument list (in parenthesis).
1418 * @param rcRet What is to be presented to return.
1419 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1420 */
1421#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
1425 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
1426 * @a stmt and return @a rcRet if it isn't.
1427 *
1428 * @param rc iprt status code.
1429 * @param msg printf argument list (in parenthesis).
1430 * @param stmt Statement to execute before returning in case of a failed
1431 * assertion.
1432 * @param rcRet What is to be presented to return.
1433 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1434 */
1435#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
1439 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return
1440 * void if it isn't.
1441 *
1442 * @param rc iprt status code.
1443 * @param msg printf argument list (in parenthesis).
1444 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1445 */
1446#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
1450 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
1451 * @a stmt and return void if it isn't.
1452 *
1453 * @param rc iprt status code.
1454 * @param msg printf argument list (in parenthesis).
1455 * @param stmt Statement to execute before break in case of a failed assertion.
1456 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1457 */
1458#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
1462 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break
1463 * if it isn't.
1464 *
1465 * @param rc iprt status code.
1466 * @param msg printf argument list (in parenthesis).
1467 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1468 */
1469#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
1473 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
1474 * @a stmt and break if it isn't.
1475 *
1476 * @param rc iprt status code.
1477 * @param msg printf argument list (in parenthesis).
1478 * @param stmt Statement to execute before break in case of a failed assertion.
1479 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1480 */
1481#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
1485 * Asserts an iprt status code equals VINF_SUCCESS.
1486 *
1487 * On failure it will print info about the rc and hit a breakpoint.
1488 *
1489 * @param rc iprt status code.
1490 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1491 */
1492#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
1495 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
1496 *
1497 * @param rc iprt status code.
1498 * @param rcRet What is to be presented to return.
1499 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1500 */
1501#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
1504 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
1505 *
1506 * @param rc iprt status code.
1507 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1508 */
1509#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
1512 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
1513 *
1514 * @param rc iprt status code.
1515 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1516 */
1517#define ASSERT_GUEST_RC_SUCCESS_BREAK(rc) ASSERT_GUEST_MSG_BREAK((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
1518
1519/** @def ASSERT_GUEST_RC_SUCCESS_STMT_BREAK
1520 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
1521 *
1522 * @param rc iprt status code.
1523 * @param stmt Statement to execute before break in case of a failed assertion.
1524 * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
1525 */
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
1537 * Asserts a iprt status code successful.
1538 *
1539 * On failure it will print info about the rc and hit a breakpoint.
1540 *
1541 * @param rc iprt status code.
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.
1559 *
1560 * @param rc iprt status code.
1561 * @param rcRet What is to be presented to return.
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.
1569 *
1570 * @param rc iprt status code.
1571 * @param stmt Statement to execute before returning in case of a failed
1572 * assertion.
1573 * @param rcRet What is to be presented to return.
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_RC_BREAK
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.
1606 *
1607 * @param rc iprt status code.
1608 * @param stmt Statement to execute before break in case of a failed assertion.
1609 * @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
1614 * Asserts a iprt status code successful.
1615 *
1616 * It prints a custom message and hits a breakpoint on FAILURE.
1617 *
1618 * @param rc iprt status code.
1619 * @param msg printf argument list (in parenthesis).
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_RC_STMT
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.
1641 *
1642 * @param rc iprt status code.
1643 * @param msg printf argument list (in parenthesis).
1644 * @param rcRet What is to be presented to return.
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.
1653 *
1654 * @param rc iprt status code.
1655 * @param msg printf argument list (in parenthesis).
1656 * @param stmt Statement to execute before returning in case of a failed
1657 * assertion.
1658 * @param rcRet What is to be presented to return.
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.
1667 *
1668 * @param rc iprt status code.
1669 * @param msg printf argument list (in parenthesis).
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.
1678 *
1679 * @param rc iprt status code.
1680 * @param msg printf argument list (in parenthesis).
1681 * @param stmt Statement to execute before break in case of a failed assertion.
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.
1690 *
1691 * @param rc iprt status code.
1692 * @param msg printf argument list (in parenthesis).
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.
1701 *
1702 * @param rc iprt status code.
1703 * @param msg printf argument list (in parenthesis).
1704 * @param stmt Statement to execute before break in case of a failed assertion.
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.
1714 *
1715 * @param rc iprt status code.
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.
1722 *
1723 * @param rc iprt status code.
1724 * @param rcRet What is to be presented to return.
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_SUCCESS_STMT_BREAK
1746 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
1747 *
1748 * @param rc iprt status code.
1749 * @param stmt Statement to execute before break in case of a failed assertion.
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
1755 * Asserts that the high dword of a physical address is zero
1756 *
1757 * @param GCPhys The address (RTGCPHYS).
1758 */
1759#define ASSERT_GUEST_LOGREL_GCPHYS32(GCPhys) ASSERT_GUEST_LOGREL_MSG(VALID_PHYS32(GCPhys), ("%RGp\n", (RTGCPHYS)(GCPhys)))
1760
1761
1762/** @} */
1763
1764
1765/** @} */
1766
1767#endif
1768
Note: See TracBrowser for help on using the repository browser.

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