1 | /** @file
|
---|
2 | * VirtualBox - Guest input assertions.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2019 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_INCLUDED_AssertGuest_h
|
---|
27 | #define VBOX_INCLUDED_AssertGuest_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/cdefs.h>
|
---|
33 | #include <iprt/assert.h>
|
---|
34 |
|
---|
35 |
|
---|
36 | /** @defgroup grp_vbox_assert_guest VBox Guest Input Assertion Macros
|
---|
37 | * @{
|
---|
38 | */
|
---|
39 |
|
---|
40 |
|
---|
41 | /** @name Guest input assertions
|
---|
42 | *
|
---|
43 | * These assertions will only trigger when VBOX_STRICT_GUEST is defined. When
|
---|
44 | * it is undefined they will all be no-ops and generate no code, unless they
|
---|
45 | * have other side effected (i.e. the _RETURN, _STMT, _BREAK variations).
|
---|
46 | *
|
---|
47 | * The assertions build on top of the functions in iprt/assert.h.
|
---|
48 | *
|
---|
49 | * @{
|
---|
50 | */
|
---|
51 |
|
---|
52 |
|
---|
53 | /** @def ASSERT_GUEST_PANIC()
|
---|
54 | * If VBOX_STRICT_GUEST is defined this macro will invoke RTAssertDoPanic if
|
---|
55 | * RTAssertShouldPanic returns true. If VBOX_STRICT_GUEST isn't defined it won't
|
---|
56 | * do any thing.
|
---|
57 | */
|
---|
58 | #if defined(VBOX_STRICT_GUEST) && !defined(VBOX_STRICT_GUEST_DONT_PANIC)
|
---|
59 | # define ASSERT_GUEST_PANIC() do { if (RTAssertShouldPanic()) RTAssertDoPanic(); } while (0)
|
---|
60 | #else
|
---|
61 | # define ASSERT_GUEST_PANIC() do { } while (0)
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | /** Wrapper around RTAssertMsg1Weak that prefixes the expression. */
|
---|
65 | #define ASSERT_GUEST_MSG1(szExpr, iLine, pszFile, pszFunction) \
|
---|
66 | RTAssertMsg1Weak("guest-input: " szExpr, iLine, pszFile, pszFunction)
|
---|
67 |
|
---|
68 |
|
---|
69 | /** @def ASSERT_GUEST
|
---|
70 | * Assert that an expression is true. If false, hit breakpoint.
|
---|
71 | * @param a_Expr Expression which should be true.
|
---|
72 | */
|
---|
73 | #ifdef VBOX_STRICT_GUEST
|
---|
74 | # define ASSERT_GUEST(a_Expr) \
|
---|
75 | do { \
|
---|
76 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
77 | { /* likely */ } \
|
---|
78 | else \
|
---|
79 | { \
|
---|
80 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
|
---|
81 | ASSERT_GUEST_PANIC(); \
|
---|
82 | } \
|
---|
83 | } while (0)
|
---|
84 | #else
|
---|
85 | # define ASSERT_GUEST(a_Expr) do { } while (0)
|
---|
86 | #endif
|
---|
87 |
|
---|
88 |
|
---|
89 | /** @def ASSERT_GUEST_STMT
|
---|
90 | * Assert that an expression is true. If false, hit breakpoint and execute the
|
---|
91 | * statement.
|
---|
92 | * @param a_Expr Expression which should be true.
|
---|
93 | * @param a_Stmt Statement to execute on failure.
|
---|
94 | */
|
---|
95 | #ifdef VBOX_STRICT_GUEST
|
---|
96 | # define ASSERT_GUEST_STMT(a_Expr, a_Stmt) \
|
---|
97 | do { \
|
---|
98 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
99 | { /* likely */ } \
|
---|
100 | else \
|
---|
101 | { \
|
---|
102 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
|
---|
103 | ASSERT_GUEST_PANIC(); \
|
---|
104 | a_Stmt; \
|
---|
105 | } \
|
---|
106 | } while (0)
|
---|
107 | #else
|
---|
108 | # define ASSERT_GUEST_STMT(a_Expr, a_Stmt) \
|
---|
109 | do { \
|
---|
110 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
111 | { /* likely */ } \
|
---|
112 | else \
|
---|
113 | { \
|
---|
114 | a_Stmt; \
|
---|
115 | } \
|
---|
116 | } while (0)
|
---|
117 | #endif
|
---|
118 |
|
---|
119 |
|
---|
120 | /** @def ASSERT_GUEST_RETURN
|
---|
121 | * Assert that an expression is true and returns if it isn't.
|
---|
122 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning.
|
---|
123 | *
|
---|
124 | * @param a_Expr Expression which should be true.
|
---|
125 | * @param a_rc What is to be presented to return.
|
---|
126 | */
|
---|
127 | #ifdef VBOX_STRICT_GUEST
|
---|
128 | # define ASSERT_GUEST_RETURN(a_Expr, a_rc) \
|
---|
129 | do { \
|
---|
130 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
131 | { /* likely */ } \
|
---|
132 | else \
|
---|
133 | { \
|
---|
134 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
|
---|
135 | ASSERT_GUEST_PANIC(); \
|
---|
136 | return (a_rc); \
|
---|
137 | } \
|
---|
138 | } while (0)
|
---|
139 | #else
|
---|
140 | # define ASSERT_GUEST_RETURN(a_Expr, a_rc) \
|
---|
141 | do { \
|
---|
142 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
143 | { /* likely */ } \
|
---|
144 | else \
|
---|
145 | return (a_rc); \
|
---|
146 | } while (0)
|
---|
147 | #endif
|
---|
148 |
|
---|
149 | /** @def ASSERT_GUEST_STMT_RETURN
|
---|
150 | * Assert that an expression is true, if it isn't execute the given statement
|
---|
151 | * and return rc.
|
---|
152 | *
|
---|
153 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before executing the statement and
|
---|
154 | * returning.
|
---|
155 | *
|
---|
156 | * @param a_Expr Expression which should be true.
|
---|
157 | * @param a_Stmt Statement to execute before returning on failure.
|
---|
158 | * @param a_rc What is to be presented to return.
|
---|
159 | */
|
---|
160 | #ifdef VBOX_STRICT_GUEST
|
---|
161 | # define ASSERT_GUEST_STMT_RETURN(a_Expr, a_Stmt, a_rc) \
|
---|
162 | do { \
|
---|
163 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
164 | { /* likely */ } \
|
---|
165 | else \
|
---|
166 | { \
|
---|
167 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
168 | ASSERT_GUEST_PANIC(); \
|
---|
169 | a_Stmt; \
|
---|
170 | return (a_rc); \
|
---|
171 | } \
|
---|
172 | } while (0)
|
---|
173 | #else
|
---|
174 | # define ASSERT_GUEST_STMT_RETURN(a_Expr, a_Stmt, a_rc) \
|
---|
175 | do { \
|
---|
176 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
177 | { /* likely */ } \
|
---|
178 | else \
|
---|
179 | { \
|
---|
180 | a_Stmt; \
|
---|
181 | return (a_rc); \
|
---|
182 | } \
|
---|
183 | } while (0)
|
---|
184 | #endif
|
---|
185 |
|
---|
186 | /** @def ASSERT_GUEST_RETURN_VOID
|
---|
187 | * Assert that an expression is true and returns if it isn't.
|
---|
188 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning.
|
---|
189 | *
|
---|
190 | * @param a_Expr Expression which should be true.
|
---|
191 | */
|
---|
192 | #ifdef VBOX_STRICT_GUEST
|
---|
193 | # define ASSERT_GUEST_RETURN_VOID(a_Expr) \
|
---|
194 | do { \
|
---|
195 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
196 | { /* likely */ } \
|
---|
197 | else \
|
---|
198 | { \
|
---|
199 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
|
---|
200 | ASSERT_GUEST_PANIC(); \
|
---|
201 | return; \
|
---|
202 | } \
|
---|
203 | } while (0)
|
---|
204 | #else
|
---|
205 | # define ASSERT_GUEST_RETURN_VOID(a_Expr) \
|
---|
206 | do { \
|
---|
207 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
208 | { /* likely */ } \
|
---|
209 | else \
|
---|
210 | return; \
|
---|
211 | } while (0)
|
---|
212 | #endif
|
---|
213 |
|
---|
214 | /** @def ASSERT_GUEST_STMT_RETURN_VOID
|
---|
215 | * Assert that an expression is true, if it isn't execute the given statement
|
---|
216 | * and return.
|
---|
217 | *
|
---|
218 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning.
|
---|
219 | *
|
---|
220 | * @param a_Expr Expression which should be true.
|
---|
221 | * @param a_Stmt Statement to execute before returning on failure.
|
---|
222 | */
|
---|
223 | #ifdef VBOX_STRICT_GUEST
|
---|
224 | # define ASSERT_GUEST_STMT_RETURN_VOID(a_Expr, a_Stmt) \
|
---|
225 | do { \
|
---|
226 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
227 | { /* likely */ } \
|
---|
228 | else \
|
---|
229 | { \
|
---|
230 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
231 | ASSERT_GUEST_PANIC(); \
|
---|
232 | a_Stmt; \
|
---|
233 | return; \
|
---|
234 | } \
|
---|
235 | } while (0)
|
---|
236 | #else
|
---|
237 | # define ASSERT_GUEST_STMT_RETURN_VOID(a_Expr, a_Stmt) \
|
---|
238 | do { \
|
---|
239 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
240 | { /* likely */ } \
|
---|
241 | else \
|
---|
242 | { \
|
---|
243 | a_Stmt; \
|
---|
244 | return; \
|
---|
245 | } \
|
---|
246 | } while (0)
|
---|
247 | #endif
|
---|
248 |
|
---|
249 |
|
---|
250 | /** @def ASSERT_GUEST_BREAK
|
---|
251 | * Assert that an expression is true and breaks if it isn't.
|
---|
252 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before breaking.
|
---|
253 | *
|
---|
254 | * @param a_Expr Expression which should be true.
|
---|
255 | */
|
---|
256 | #ifdef VBOX_STRICT_GUEST
|
---|
257 | # define ASSERT_GUEST_BREAK(a_Expr) \
|
---|
258 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
259 | { /* likely */ } \
|
---|
260 | else if (1) \
|
---|
261 | { \
|
---|
262 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
263 | ASSERT_GUEST_PANIC(); \
|
---|
264 | break; \
|
---|
265 | } else \
|
---|
266 | break
|
---|
267 | #else
|
---|
268 | # define ASSERT_GUEST_BREAK(a_Expr) \
|
---|
269 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
270 | { /* likely */ } \
|
---|
271 | else \
|
---|
272 | break
|
---|
273 | #endif
|
---|
274 |
|
---|
275 | /** @def ASSERT_GUEST_CONTINUE
|
---|
276 | * Assert that an expression is true and continue if it isn't.
|
---|
277 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before continuing.
|
---|
278 | *
|
---|
279 | * @param a_Expr Expression which should be true.
|
---|
280 | */
|
---|
281 | #ifdef VBOX_STRICT_GUEST
|
---|
282 | # define ASSERT_GUEST_CONTINUE(a_Expr) \
|
---|
283 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
284 | { /* likely */ } \
|
---|
285 | else if (1) \
|
---|
286 | { \
|
---|
287 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
288 | ASSERT_GUEST_PANIC(); \
|
---|
289 | continue; \
|
---|
290 | } else do {} while (0)
|
---|
291 | #else
|
---|
292 | # define ASSERT_GUEST_CONTINUE(a_Expr) \
|
---|
293 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
294 | { /* likely */ } \
|
---|
295 | else \
|
---|
296 | continue
|
---|
297 | #endif
|
---|
298 |
|
---|
299 | /** @def ASSERT_GUEST_STMT_BREAK
|
---|
300 | * Assert that an expression is true and breaks if it isn't.
|
---|
301 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before doing break.
|
---|
302 | *
|
---|
303 | * @param a_Expr Expression which should be true.
|
---|
304 | * @param a_Stmt Statement to execute before break in case of a failed assertion.
|
---|
305 | */
|
---|
306 | #ifdef VBOX_STRICT_GUEST
|
---|
307 | # define ASSERT_GUEST_STMT_BREAK(a_Expr, a_Stmt) \
|
---|
308 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
309 | { /* likely */ } \
|
---|
310 | else if (1) \
|
---|
311 | { \
|
---|
312 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
313 | ASSERT_GUEST_PANIC(); \
|
---|
314 | a_Stmt; \
|
---|
315 | break; \
|
---|
316 | } else do {} while (0)
|
---|
317 | #else
|
---|
318 | # define ASSERT_GUEST_STMT_BREAK(a_Expr, a_Stmt) \
|
---|
319 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
320 | { /* likely */ } \
|
---|
321 | else if (1) \
|
---|
322 | { \
|
---|
323 | a_Stmt; \
|
---|
324 | break; \
|
---|
325 | } else do {} while (0)
|
---|
326 | #endif
|
---|
327 |
|
---|
328 |
|
---|
329 | /** @def ASSERT_GUEST_MSG
|
---|
330 | * Assert that an expression is true. If it's not print message and hit breakpoint.
|
---|
331 | * @param a_Expr Expression which should be true.
|
---|
332 | * @param a printf argument list (in parenthesis).
|
---|
333 | */
|
---|
334 | #ifdef VBOX_STRICT_GUEST
|
---|
335 | # define ASSERT_GUEST_MSG(a_Expr, a) \
|
---|
336 | do { \
|
---|
337 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
338 | { /* likely */ } \
|
---|
339 | else \
|
---|
340 | { \
|
---|
341 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
|
---|
342 | RTAssertMsg2Weak a; \
|
---|
343 | ASSERT_GUEST_PANIC(); \
|
---|
344 | } \
|
---|
345 | } while (0)
|
---|
346 | #else
|
---|
347 | # define ASSERT_GUEST_MSG(a_Expr, a) do { } while (0)
|
---|
348 | #endif
|
---|
349 |
|
---|
350 | /** @def ASSERT_GUEST_MSG_STMT
|
---|
351 | * Assert that an expression is true. If it's not print message and hit
|
---|
352 | * breakpoint and execute the statement.
|
---|
353 | *
|
---|
354 | * @param a_Expr Expression which should be true.
|
---|
355 | * @param a printf argument list (in parenthesis).
|
---|
356 | * @param a_Stmt Statement to execute in case of a failed assertion.
|
---|
357 | *
|
---|
358 | * @remarks The expression and statement will be evaluated in all build types.
|
---|
359 | */
|
---|
360 | #ifdef VBOX_STRICT_GUEST
|
---|
361 | # define ASSERT_GUEST_MSG_STMT(a_Expr, a, a_Stmt) \
|
---|
362 | do { \
|
---|
363 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
364 | { /* likely */ } \
|
---|
365 | else \
|
---|
366 | { \
|
---|
367 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
368 | RTAssertMsg2Weak a; \
|
---|
369 | ASSERT_GUEST_PANIC(); \
|
---|
370 | a_Stmt; \
|
---|
371 | } \
|
---|
372 | } while (0)
|
---|
373 | #else
|
---|
374 | # define ASSERT_GUEST_MSG_STMT(a_Expr, a, a_Stmt) \
|
---|
375 | do { \
|
---|
376 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
377 | { /* likely */ } \
|
---|
378 | else \
|
---|
379 | { \
|
---|
380 | a_Stmt; \
|
---|
381 | } \
|
---|
382 | } while (0)
|
---|
383 | #endif
|
---|
384 |
|
---|
385 | /** @def ASSERT_GUEST_MSG_RETURN
|
---|
386 | * Assert that an expression is true and returns if it isn't.
|
---|
387 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning.
|
---|
388 | *
|
---|
389 | * @param a_Expr Expression which should be true.
|
---|
390 | * @param a printf argument list (in parenthesis).
|
---|
391 | * @param a_rc What is to be presented to return.
|
---|
392 | */
|
---|
393 | #ifdef VBOX_STRICT_GUEST
|
---|
394 | # define ASSERT_GUEST_MSG_RETURN(a_Expr, a, a_rc) \
|
---|
395 | do { \
|
---|
396 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
397 | { /* likely */ } \
|
---|
398 | else \
|
---|
399 | { \
|
---|
400 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
|
---|
401 | RTAssertMsg2Weak a; \
|
---|
402 | ASSERT_GUEST_PANIC(); \
|
---|
403 | return (a_rc); \
|
---|
404 | } \
|
---|
405 | } while (0)
|
---|
406 | #else
|
---|
407 | # define ASSERT_GUEST_MSG_RETURN(a_Expr, a, a_rc) \
|
---|
408 | do { \
|
---|
409 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
410 | { /* likely */ } \
|
---|
411 | else \
|
---|
412 | return (a_rc); \
|
---|
413 | } while (0)
|
---|
414 | #endif
|
---|
415 |
|
---|
416 | /** @def ASSERT_GUEST_MSG_STMT_RETURN
|
---|
417 | * Assert that an expression is true, if it isn't execute the statement and
|
---|
418 | * return.
|
---|
419 | *
|
---|
420 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning.
|
---|
421 | *
|
---|
422 | * @param a_Expr Expression which should be true.
|
---|
423 | * @param a printf argument list (in parenthesis).
|
---|
424 | * @param a_Stmt Statement to execute before returning in case of a failed
|
---|
425 | * assertion.
|
---|
426 | * @param a_rc What is to be presented to return.
|
---|
427 | */
|
---|
428 | #ifdef VBOX_STRICT_GUEST
|
---|
429 | # define ASSERT_GUEST_MSG_STMT_RETURN(a_Expr, a, a_Stmt, a_rc) \
|
---|
430 | do { \
|
---|
431 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
432 | { /* likely */ } \
|
---|
433 | else \
|
---|
434 | { \
|
---|
435 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
436 | RTAssertMsg2Weak a; \
|
---|
437 | ASSERT_GUEST_PANIC(); \
|
---|
438 | a_Stmt; \
|
---|
439 | return (a_rc); \
|
---|
440 | } \
|
---|
441 | } while (0)
|
---|
442 | #else
|
---|
443 | # define ASSERT_GUEST_MSG_STMT_RETURN(a_Expr, a, a_Stmt, a_rc) \
|
---|
444 | do { \
|
---|
445 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
446 | { /* likely */ } \
|
---|
447 | else \
|
---|
448 | { \
|
---|
449 | a_Stmt; \
|
---|
450 | return (a_rc); \
|
---|
451 | } \
|
---|
452 | } while (0)
|
---|
453 | #endif
|
---|
454 |
|
---|
455 | /** @def ASSERT_GUEST_MSG_RETURN_VOID
|
---|
456 | * Assert that an expression is true and returns if it isn't.
|
---|
457 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning.
|
---|
458 | *
|
---|
459 | * @param a_Expr Expression which should be true.
|
---|
460 | * @param a printf argument list (in parenthesis).
|
---|
461 | */
|
---|
462 | #ifdef VBOX_STRICT_GUEST
|
---|
463 | # define ASSERT_GUEST_MSG_RETURN_VOID(a_Expr, a) \
|
---|
464 | do { \
|
---|
465 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
466 | { /* likely */ } \
|
---|
467 | else \
|
---|
468 | { \
|
---|
469 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
|
---|
470 | RTAssertMsg2Weak a; \
|
---|
471 | ASSERT_GUEST_PANIC(); \
|
---|
472 | return; \
|
---|
473 | } \
|
---|
474 | } while (0)
|
---|
475 | #else
|
---|
476 | # define ASSERT_GUEST_MSG_RETURN_VOID(a_Expr, a) \
|
---|
477 | do { \
|
---|
478 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
479 | { /* likely */ } \
|
---|
480 | else \
|
---|
481 | return; \
|
---|
482 | } while (0)
|
---|
483 | #endif
|
---|
484 |
|
---|
485 | /** @def ASSERT_GUEST_MSG_STMT_RETURN_VOID
|
---|
486 | * Assert that an expression is true, if it isn't execute the statement and
|
---|
487 | * return.
|
---|
488 | *
|
---|
489 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning.
|
---|
490 | *
|
---|
491 | * @param a_Expr Expression which should be true.
|
---|
492 | * @param a printf argument list (in parenthesis).
|
---|
493 | * @param a_Stmt Statement to execute before return in case of a failed assertion.
|
---|
494 | */
|
---|
495 | #ifdef VBOX_STRICT_GUEST
|
---|
496 | # define ASSERT_GUEST_MSG_STMT_RETURN_VOID(a_Expr, a, a_Stmt) \
|
---|
497 | do { \
|
---|
498 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
499 | { /* likely */ } \
|
---|
500 | else \
|
---|
501 | { \
|
---|
502 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
503 | RTAssertMsg2Weak a; \
|
---|
504 | ASSERT_GUEST_PANIC(); \
|
---|
505 | a_Stmt; \
|
---|
506 | return; \
|
---|
507 | } \
|
---|
508 | } while (0)
|
---|
509 | #else
|
---|
510 | # define ASSERT_GUEST_MSG_STMT_RETURN_VOID(a_Expr, a, a_Stmt) \
|
---|
511 | do { \
|
---|
512 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
513 | { /* likely */ } \
|
---|
514 | else \
|
---|
515 | { \
|
---|
516 | a_Stmt; \
|
---|
517 | return; \
|
---|
518 | } \
|
---|
519 | } while (0)
|
---|
520 | #endif
|
---|
521 |
|
---|
522 |
|
---|
523 | /** @def ASSERT_GUEST_MSG_BREAK
|
---|
524 | * Assert that an expression is true and breaks if it isn't.
|
---|
525 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before returning.
|
---|
526 | *
|
---|
527 | * @param a_Expr Expression which should be true.
|
---|
528 | * @param a printf argument list (in parenthesis).
|
---|
529 | */
|
---|
530 | #ifdef VBOX_STRICT_GUEST
|
---|
531 | # define ASSERT_GUEST_MSG_BREAK(a_Expr, a) \
|
---|
532 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
533 | { /* likely */ } \
|
---|
534 | else if (1) \
|
---|
535 | { \
|
---|
536 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
537 | RTAssertMsg2Weak a; \
|
---|
538 | ASSERT_GUEST_PANIC(); \
|
---|
539 | break; \
|
---|
540 | } else \
|
---|
541 | break
|
---|
542 | #else
|
---|
543 | # define ASSERT_GUEST_MSG_BREAK(a_Expr, a) \
|
---|
544 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
545 | { /* likely */ } \
|
---|
546 | else \
|
---|
547 | break
|
---|
548 | #endif
|
---|
549 |
|
---|
550 | /** @def ASSERT_GUEST_MSG_STMT_BREAK
|
---|
551 | * Assert that an expression is true and breaks if it isn't.
|
---|
552 | * In VBOX_STRICT_GUEST mode it will hit a breakpoint before doing break.
|
---|
553 | *
|
---|
554 | * @param a_Expr Expression which should be true.
|
---|
555 | * @param a printf argument list (in parenthesis).
|
---|
556 | * @param a_Stmt Statement to execute before break in case of a failed assertion.
|
---|
557 | */
|
---|
558 | #ifdef VBOX_STRICT_GUEST
|
---|
559 | # define ASSERT_GUEST_MSG_STMT_BREAK(a_Expr, a, a_Stmt) \
|
---|
560 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
561 | { /* likely */ } \
|
---|
562 | else if (1) \
|
---|
563 | { \
|
---|
564 | ASSERT_GUEST_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
565 | RTAssertMsg2Weak a; \
|
---|
566 | ASSERT_GUEST_PANIC(); \
|
---|
567 | a_Stmt; \
|
---|
568 | break; \
|
---|
569 | } else \
|
---|
570 | break
|
---|
571 | #else
|
---|
572 | # define ASSERT_GUEST_MSG_STMT_BREAK(a_Expr, a, a_Stmt) \
|
---|
573 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
574 | { /* likely */ } \
|
---|
575 | else if (1) \
|
---|
576 | { \
|
---|
577 | a_Stmt; \
|
---|
578 | break; \
|
---|
579 | } else \
|
---|
580 | break
|
---|
581 | #endif
|
---|
582 |
|
---|
583 | /** @def ASSERT_GUEST_FAILED
|
---|
584 | * An assertion failed, hit breakpoint.
|
---|
585 | */
|
---|
586 | #ifdef VBOX_STRICT_GUEST
|
---|
587 | # define ASSERT_GUEST_FAILED() \
|
---|
588 | do { \
|
---|
589 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
|
---|
590 | ASSERT_GUEST_PANIC(); \
|
---|
591 | } while (0)
|
---|
592 | #else
|
---|
593 | # define ASSERT_GUEST_FAILED() do { } while (0)
|
---|
594 | #endif
|
---|
595 |
|
---|
596 | /** @def ASSERT_GUEST_FAILED_STMT
|
---|
597 | * An assertion failed, hit breakpoint and execute statement.
|
---|
598 | */
|
---|
599 | #ifdef VBOX_STRICT_GUEST
|
---|
600 | # define ASSERT_GUEST_FAILED_STMT(a_Stmt) \
|
---|
601 | do { \
|
---|
602 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
|
---|
603 | ASSERT_GUEST_PANIC(); \
|
---|
604 | a_Stmt; \
|
---|
605 | } while (0)
|
---|
606 | #else
|
---|
607 | # define ASSERT_GUEST_FAILED_STMT(a_Stmt) do { a_Stmt; } while (0)
|
---|
608 | #endif
|
---|
609 |
|
---|
610 | /** @def ASSERT_GUEST_FAILED_RETURN
|
---|
611 | * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only) and return.
|
---|
612 | *
|
---|
613 | * @param a_rc The a_rc to return.
|
---|
614 | */
|
---|
615 | #ifdef VBOX_STRICT_GUEST
|
---|
616 | # define ASSERT_GUEST_FAILED_RETURN(a_rc) \
|
---|
617 | do { \
|
---|
618 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
619 | ASSERT_GUEST_PANIC(); \
|
---|
620 | return (a_rc); \
|
---|
621 | } while (0)
|
---|
622 | #else
|
---|
623 | # define ASSERT_GUEST_FAILED_RETURN(a_rc) \
|
---|
624 | do { \
|
---|
625 | return (a_rc); \
|
---|
626 | } while (0)
|
---|
627 | #endif
|
---|
628 |
|
---|
629 | /** @def ASSERT_GUEST_FAILED_STMT_RETURN
|
---|
630 | * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute a
|
---|
631 | * statement and return a value.
|
---|
632 | *
|
---|
633 | * @param a_Stmt The statement to execute before returning.
|
---|
634 | * @param a_rc The value to return.
|
---|
635 | */
|
---|
636 | #ifdef VBOX_STRICT_GUEST
|
---|
637 | # define ASSERT_GUEST_FAILED_STMT_RETURN(a_Stmt, a_rc) \
|
---|
638 | do { \
|
---|
639 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
640 | ASSERT_GUEST_PANIC(); \
|
---|
641 | a_Stmt; \
|
---|
642 | return (a_rc); \
|
---|
643 | } while (0)
|
---|
644 | #else
|
---|
645 | # define ASSERT_GUEST_FAILED_STMT_RETURN(a_Stmt, a_rc) \
|
---|
646 | do { \
|
---|
647 | a_Stmt; \
|
---|
648 | return (a_rc); \
|
---|
649 | } while (0)
|
---|
650 | #endif
|
---|
651 |
|
---|
652 | /** @def ASSERT_GUEST_FAILED_RETURN_VOID
|
---|
653 | * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only) and return.
|
---|
654 | */
|
---|
655 | #ifdef VBOX_STRICT_GUEST
|
---|
656 | # define ASSERT_GUEST_FAILED_RETURN_VOID() \
|
---|
657 | do { \
|
---|
658 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
659 | ASSERT_GUEST_PANIC(); \
|
---|
660 | return; \
|
---|
661 | } while (0)
|
---|
662 | #else
|
---|
663 | # define ASSERT_GUEST_FAILED_RETURN_VOID() \
|
---|
664 | do { \
|
---|
665 | return; \
|
---|
666 | } while (0)
|
---|
667 | #endif
|
---|
668 |
|
---|
669 | /** @def ASSERT_GUEST_FAILED_STMT_RETURN_VOID
|
---|
670 | * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute a
|
---|
671 | * statement and return.
|
---|
672 | *
|
---|
673 | * @param a_Stmt The statement to execute before returning.
|
---|
674 | */
|
---|
675 | #ifdef VBOX_STRICT_GUEST
|
---|
676 | # define ASSERT_GUEST_FAILED_STMT_RETURN_VOID(a_Stmt) \
|
---|
677 | do { \
|
---|
678 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
679 | ASSERT_GUEST_PANIC(); \
|
---|
680 | a_Stmt; \
|
---|
681 | return; \
|
---|
682 | } while (0)
|
---|
683 | #else
|
---|
684 | # define ASSERT_GUEST_FAILED_STMT_RETURN_VOID(a_Stmt) \
|
---|
685 | do { \
|
---|
686 | a_Stmt; \
|
---|
687 | return; \
|
---|
688 | } while (0)
|
---|
689 | #endif
|
---|
690 |
|
---|
691 |
|
---|
692 | /** @def ASSERT_GUEST_FAILED_BREAK
|
---|
693 | * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only) and break.
|
---|
694 | */
|
---|
695 | #ifdef VBOX_STRICT_GUEST
|
---|
696 | # define ASSERT_GUEST_FAILED_BREAK() \
|
---|
697 | if (1) { \
|
---|
698 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
699 | ASSERT_GUEST_PANIC(); \
|
---|
700 | break; \
|
---|
701 | } else \
|
---|
702 | break
|
---|
703 | #else
|
---|
704 | # define ASSERT_GUEST_FAILED_BREAK() \
|
---|
705 | if (1) \
|
---|
706 | break; \
|
---|
707 | else \
|
---|
708 | break
|
---|
709 | #endif
|
---|
710 |
|
---|
711 | /** @def ASSERT_GUEST_FAILED_STMT_BREAK
|
---|
712 | * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute
|
---|
713 | * the given statement and break.
|
---|
714 | *
|
---|
715 | * @param a_Stmt Statement to execute before break.
|
---|
716 | */
|
---|
717 | #ifdef VBOX_STRICT_GUEST
|
---|
718 | # define ASSERT_GUEST_FAILED_STMT_BREAK(a_Stmt) \
|
---|
719 | if (1) { \
|
---|
720 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
721 | ASSERT_GUEST_PANIC(); \
|
---|
722 | a_Stmt; \
|
---|
723 | break; \
|
---|
724 | } else \
|
---|
725 | break
|
---|
726 | #else
|
---|
727 | # define ASSERT_GUEST_FAILED_STMT_BREAK(a_Stmt) \
|
---|
728 | if (1) { \
|
---|
729 | a_Stmt; \
|
---|
730 | break; \
|
---|
731 | } else \
|
---|
732 | break
|
---|
733 | #endif
|
---|
734 |
|
---|
735 |
|
---|
736 | /** @def ASSERT_GUEST_MSG_FAILED
|
---|
737 | * An assertion failed print a message and a hit breakpoint.
|
---|
738 | *
|
---|
739 | * @param a printf argument list (in parenthesis).
|
---|
740 | */
|
---|
741 | #ifdef VBOX_STRICT_GUEST
|
---|
742 | # define ASSERT_GUEST_MSG_FAILED(a) \
|
---|
743 | do { \
|
---|
744 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
|
---|
745 | RTAssertMsg2Weak a; \
|
---|
746 | ASSERT_GUEST_PANIC(); \
|
---|
747 | } while (0)
|
---|
748 | #else
|
---|
749 | # define ASSERT_GUEST_MSG_FAILED(a) do { } while (0)
|
---|
750 | #endif
|
---|
751 |
|
---|
752 | /** @def ASSERT_GUEST_MSG_FAILED_RETURN
|
---|
753 | * An assertion failed, hit breakpoint with message (VBOX_STRICT_GUEST mode only) and return.
|
---|
754 | *
|
---|
755 | * @param a printf argument list (in parenthesis).
|
---|
756 | * @param a_rc What is to be presented to return.
|
---|
757 | */
|
---|
758 | #ifdef VBOX_STRICT_GUEST
|
---|
759 | # define ASSERT_GUEST_MSG_FAILED_RETURN(a, a_rc) \
|
---|
760 | do { \
|
---|
761 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
762 | RTAssertMsg2Weak a; \
|
---|
763 | ASSERT_GUEST_PANIC(); \
|
---|
764 | return (a_rc); \
|
---|
765 | } while (0)
|
---|
766 | #else
|
---|
767 | # define ASSERT_GUEST_MSG_FAILED_RETURN(a, a_rc) \
|
---|
768 | do { \
|
---|
769 | return (a_rc); \
|
---|
770 | } while (0)
|
---|
771 | #endif
|
---|
772 |
|
---|
773 | /** @def ASSERT_GUEST_MSG_FAILED_RETURN_VOID
|
---|
774 | * An assertion failed, hit breakpoint with message (VBOX_STRICT_GUEST mode only) and return.
|
---|
775 | *
|
---|
776 | * @param a printf argument list (in parenthesis).
|
---|
777 | */
|
---|
778 | #ifdef VBOX_STRICT_GUEST
|
---|
779 | # define ASSERT_GUEST_MSG_FAILED_RETURN_VOID(a) \
|
---|
780 | do { \
|
---|
781 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
782 | RTAssertMsg2Weak a; \
|
---|
783 | ASSERT_GUEST_PANIC(); \
|
---|
784 | return; \
|
---|
785 | } while (0)
|
---|
786 | #else
|
---|
787 | # define ASSERT_GUEST_MSG_FAILED_RETURN_VOID(a) \
|
---|
788 | do { \
|
---|
789 | return; \
|
---|
790 | } while (0)
|
---|
791 | #endif
|
---|
792 |
|
---|
793 |
|
---|
794 | /** @def ASSERT_GUEST_MSG_FAILED_BREAK
|
---|
795 | * An assertion failed, hit breakpoint with message (VBOX_STRICT_GUEST mode only) and break.
|
---|
796 | *
|
---|
797 | * @param a printf argument list (in parenthesis).
|
---|
798 | */
|
---|
799 | #ifdef VBOX_STRICT_GUEST
|
---|
800 | # define ASSERT_GUEST_MSG_FAILED_BREAK(a) \
|
---|
801 | if (1) { \
|
---|
802 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
803 | RTAssertMsg2Weak a; \
|
---|
804 | ASSERT_GUEST_PANIC(); \
|
---|
805 | break; \
|
---|
806 | } else \
|
---|
807 | break
|
---|
808 | #else
|
---|
809 | # define ASSERT_GUEST_MSG_FAILED_BREAK(a) \
|
---|
810 | if (1) \
|
---|
811 | break; \
|
---|
812 | else \
|
---|
813 | break
|
---|
814 | #endif
|
---|
815 |
|
---|
816 | /** @def ASSERT_GUEST_MSG_FAILED_STMT_BREAK
|
---|
817 | * An assertion failed, hit breakpoint (VBOX_STRICT_GUEST mode only), execute
|
---|
818 | * the given statement and break.
|
---|
819 | *
|
---|
820 | * @param a printf argument list (in parenthesis).
|
---|
821 | * @param a_Stmt Statement to execute before break.
|
---|
822 | */
|
---|
823 | #ifdef VBOX_STRICT_GUEST
|
---|
824 | # define ASSERT_GUEST_MSG_FAILED_STMT_BREAK(a, a_Stmt) \
|
---|
825 | if (1) { \
|
---|
826 | ASSERT_GUEST_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
827 | RTAssertMsg2Weak a; \
|
---|
828 | ASSERT_GUEST_PANIC(); \
|
---|
829 | a_Stmt; \
|
---|
830 | break; \
|
---|
831 | } else \
|
---|
832 | break
|
---|
833 | #else
|
---|
834 | # define ASSERT_GUEST_MSG_FAILED_STMT_BREAK(a, a_Stmt) \
|
---|
835 | if (1) { \
|
---|
836 | a_Stmt; \
|
---|
837 | break; \
|
---|
838 | } else \
|
---|
839 | break
|
---|
840 | #endif
|
---|
841 |
|
---|
842 | /** @} */
|
---|
843 |
|
---|
844 |
|
---|
845 |
|
---|
846 | /** @name Guest input release log assertions
|
---|
847 | *
|
---|
848 | * These assertions will work like normal strict assertion when VBOX_STRICT_GUEST is
|
---|
849 | * defined and LogRel statements when VBOX_STRICT_GUEST is undefined. Typically
|
---|
850 | * used for important guest input that it would be helpful to find in VBox.log
|
---|
851 | * if the guest doesn't get it right.
|
---|
852 | *
|
---|
853 | * @{
|
---|
854 | */
|
---|
855 |
|
---|
856 |
|
---|
857 | /** @def ASSERT_GUEST_LOGREL_MSG1
|
---|
858 | * RTAssertMsg1Weak (strict builds) / LogRel wrapper (non-strict).
|
---|
859 | */
|
---|
860 | #ifdef VBOX_STRICT_GUEST
|
---|
861 | # define ASSERT_GUEST_LOGREL_MSG1(szExpr, iLine, pszFile, pszFunction) \
|
---|
862 | RTAssertMsg1Weak("guest-input: " szExpr, iLine, pszFile, pszFunction)
|
---|
863 | #else
|
---|
864 | # define ASSERT_GUEST_LOGREL_MSG1(szExpr, iLine, pszFile, pszFunction) \
|
---|
865 | LogRel(("ASSERT_GUEST_LOGREL %s(%d) %s: %s\n", (pszFile), (iLine), (pszFunction), (szExpr) ))
|
---|
866 | #endif
|
---|
867 |
|
---|
868 | /** @def ASSERT_GUEST_LOGREL_MSG2
|
---|
869 | * RTAssertMsg2Weak (strict builds) / LogRel wrapper (non-strict).
|
---|
870 | */
|
---|
871 | #ifdef VBOX_STRICT_GUEST
|
---|
872 | # define ASSERT_GUEST_LOGREL_MSG2(a) RTAssertMsg2Weak a
|
---|
873 | #else
|
---|
874 | # define ASSERT_GUEST_LOGREL_MSG2(a) LogRel(a)
|
---|
875 | #endif
|
---|
876 |
|
---|
877 | /** @def ASSERT_GUEST_LOGREL
|
---|
878 | * Assert that an expression is true.
|
---|
879 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
880 | *
|
---|
881 | * @param a_Expr Expression which should be true.
|
---|
882 | */
|
---|
883 | #define ASSERT_GUEST_LOGREL(a_Expr) \
|
---|
884 | do { \
|
---|
885 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
886 | { /* likely */ } \
|
---|
887 | else \
|
---|
888 | { \
|
---|
889 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
890 | ASSERT_GUEST_PANIC(); \
|
---|
891 | } \
|
---|
892 | } while (0)
|
---|
893 |
|
---|
894 | /** @def ASSERT_GUEST_LOGREL_RETURN
|
---|
895 | * Assert that an expression is true, return \a a_rc if it isn't.
|
---|
896 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
897 | *
|
---|
898 | * @param a_Expr Expression which should be true.
|
---|
899 | * @param a_rc What is to be presented to return.
|
---|
900 | */
|
---|
901 | #define ASSERT_GUEST_LOGREL_RETURN(a_Expr, a_rc) \
|
---|
902 | do { \
|
---|
903 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
904 | { /* likely */ } \
|
---|
905 | else \
|
---|
906 | { \
|
---|
907 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
908 | ASSERT_GUEST_PANIC(); \
|
---|
909 | return (a_rc); \
|
---|
910 | } \
|
---|
911 | } while (0)
|
---|
912 |
|
---|
913 | /** @def ASSERT_GUEST_LOGREL_RETURN_VOID
|
---|
914 | * Assert that an expression is true, return void if it isn't.
|
---|
915 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
916 | *
|
---|
917 | * @param a_Expr Expression which should be true.
|
---|
918 | */
|
---|
919 | #define ASSERT_GUEST_LOGREL_RETURN_VOID(a_Expr) \
|
---|
920 | do { \
|
---|
921 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
922 | { /* likely */ } \
|
---|
923 | else \
|
---|
924 | { \
|
---|
925 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
926 | ASSERT_GUEST_PANIC(); \
|
---|
927 | return; \
|
---|
928 | } \
|
---|
929 | } while (0)
|
---|
930 |
|
---|
931 | /** @def ASSERT_GUEST_LOGREL_BREAK
|
---|
932 | * Assert that an expression is true, break if it isn't.
|
---|
933 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
934 | *
|
---|
935 | * @param a_Expr Expression which should be true.
|
---|
936 | */
|
---|
937 | #define ASSERT_GUEST_LOGREL_BREAK(a_Expr) \
|
---|
938 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
939 | { /* likely */ } \
|
---|
940 | else if (1) \
|
---|
941 | { \
|
---|
942 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
943 | ASSERT_GUEST_PANIC(); \
|
---|
944 | break; \
|
---|
945 | } \
|
---|
946 | else \
|
---|
947 | break
|
---|
948 |
|
---|
949 | /** @def ASSERT_GUEST_LOGREL_STMT_BREAK
|
---|
950 | * Assert that an expression is true, execute \a a_Stmt and break if it isn't.
|
---|
951 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
952 | *
|
---|
953 | * @param a_Expr Expression which should be true.
|
---|
954 | * @param a_Stmt Statement to execute before break in case of a failed assertion.
|
---|
955 | */
|
---|
956 | #define ASSERT_GUEST_LOGREL_STMT_BREAK(a_Expr, a_Stmt) \
|
---|
957 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
958 | { /* likely */ } \
|
---|
959 | else if (1) \
|
---|
960 | { \
|
---|
961 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
962 | ASSERT_GUEST_PANIC(); \
|
---|
963 | a_Stmt; \
|
---|
964 | break; \
|
---|
965 | } else \
|
---|
966 | break
|
---|
967 |
|
---|
968 | /** @def ASSERT_GUEST_LOGREL_MSG
|
---|
969 | * Assert that an expression is true.
|
---|
970 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
971 | *
|
---|
972 | * @param a_Expr Expression which should be true.
|
---|
973 | * @param a printf argument list (in parenthesis).
|
---|
974 | */
|
---|
975 | #define ASSERT_GUEST_LOGREL_MSG(a_Expr, a) \
|
---|
976 | do { \
|
---|
977 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
978 | { /* likely */ } \
|
---|
979 | else\
|
---|
980 | { \
|
---|
981 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
982 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
983 | ASSERT_GUEST_PANIC(); \
|
---|
984 | } \
|
---|
985 | } while (0)
|
---|
986 |
|
---|
987 | /** @def ASSERT_GUEST_LOGREL_MSG_STMT
|
---|
988 | * Assert that an expression is true, execute \a a_Stmt and break if it isn't
|
---|
989 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
990 | *
|
---|
991 | * @param a_Expr Expression which should be true.
|
---|
992 | * @param a printf argument list (in parenthesis).
|
---|
993 | * @param a_Stmt Statement to execute in case of a failed assertion.
|
---|
994 | */
|
---|
995 | #define ASSERT_GUEST_LOGREL_MSG_STMT(a_Expr, a, a_Stmt) \
|
---|
996 | do { \
|
---|
997 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
998 | { /* likely */ } \
|
---|
999 | else\
|
---|
1000 | { \
|
---|
1001 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1002 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1003 | ASSERT_GUEST_PANIC(); \
|
---|
1004 | a_Stmt; \
|
---|
1005 | } \
|
---|
1006 | } while (0)
|
---|
1007 |
|
---|
1008 | /** @def ASSERT_GUEST_LOGREL_MSG_RETURN
|
---|
1009 | * Assert that an expression is true, return \a a_rc if it isn't.
|
---|
1010 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1011 | *
|
---|
1012 | * @param a_Expr Expression which should be true.
|
---|
1013 | * @param a printf argument list (in parenthesis).
|
---|
1014 | * @param a_rc What is to be presented to return.
|
---|
1015 | */
|
---|
1016 | #define ASSERT_GUEST_LOGREL_MSG_RETURN(a_Expr, a, a_rc) \
|
---|
1017 | do { \
|
---|
1018 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
1019 | { /* likely */ } \
|
---|
1020 | else\
|
---|
1021 | { \
|
---|
1022 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1023 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1024 | ASSERT_GUEST_PANIC(); \
|
---|
1025 | return (a_rc); \
|
---|
1026 | } \
|
---|
1027 | } while (0)
|
---|
1028 |
|
---|
1029 | /** @def ASSERT_GUEST_LOGREL_MSG_STMT_RETURN
|
---|
1030 | * Assert that an expression is true, execute @a a_Stmt and return @a rcRet if it
|
---|
1031 | * isn't.
|
---|
1032 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1033 | *
|
---|
1034 | * @param a_Expr Expression which should be true.
|
---|
1035 | * @param a printf argument list (in parenthesis).
|
---|
1036 | * @param a_Stmt Statement to execute before returning in case of a failed
|
---|
1037 | * assertion.
|
---|
1038 | * @param rcRet What is to be presented to return.
|
---|
1039 | */
|
---|
1040 | #define ASSERT_GUEST_LOGREL_MSG_STMT_RETURN(a_Expr, a, a_Stmt, rcRet) \
|
---|
1041 | do { \
|
---|
1042 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
1043 | { /* likely */ } \
|
---|
1044 | else\
|
---|
1045 | { \
|
---|
1046 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1047 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1048 | ASSERT_GUEST_PANIC(); \
|
---|
1049 | a_Stmt; \
|
---|
1050 | return (rcRet); \
|
---|
1051 | } \
|
---|
1052 | } while (0)
|
---|
1053 |
|
---|
1054 | /** @def ASSERT_GUEST_LOGREL_MSG_RETURN_VOID
|
---|
1055 | * Assert that an expression is true, return (void) if it isn't.
|
---|
1056 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1057 | *
|
---|
1058 | * @param a_Expr Expression which should be true.
|
---|
1059 | * @param a printf argument list (in parenthesis).
|
---|
1060 | */
|
---|
1061 | #define ASSERT_GUEST_LOGREL_MSG_RETURN_VOID(a_Expr, a) \
|
---|
1062 | do { \
|
---|
1063 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
1064 | { /* likely */ } \
|
---|
1065 | else\
|
---|
1066 | { \
|
---|
1067 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1068 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1069 | ASSERT_GUEST_PANIC(); \
|
---|
1070 | return; \
|
---|
1071 | } \
|
---|
1072 | } while (0)
|
---|
1073 |
|
---|
1074 | /** @def ASSERT_GUEST_LOGREL_MSG_BREAK
|
---|
1075 | * Assert that an expression is true, break if it isn't.
|
---|
1076 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1077 | *
|
---|
1078 | * @param a_Expr Expression which should be true.
|
---|
1079 | * @param a printf argument list (in parenthesis).
|
---|
1080 | */
|
---|
1081 | #define ASSERT_GUEST_LOGREL_MSG_BREAK(a_Expr, a) \
|
---|
1082 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
1083 | { /* likely */ } \
|
---|
1084 | else if (1) \
|
---|
1085 | { \
|
---|
1086 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1087 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1088 | ASSERT_GUEST_PANIC(); \
|
---|
1089 | break; \
|
---|
1090 | } \
|
---|
1091 | else \
|
---|
1092 | break
|
---|
1093 |
|
---|
1094 | /** @def ASSERT_GUEST_LOGREL_MSG_STMT_BREAK
|
---|
1095 | * Assert that an expression is true, execute \a a_Stmt and break if it isn't.
|
---|
1096 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1097 | *
|
---|
1098 | * @param a_Expr Expression which should be true.
|
---|
1099 | * @param a printf argument list (in parenthesis).
|
---|
1100 | * @param a_Stmt Statement to execute before break in case of a failed assertion.
|
---|
1101 | */
|
---|
1102 | #define ASSERT_GUEST_LOGREL_MSG_STMT_BREAK(a_Expr, a, a_Stmt) \
|
---|
1103 | if (RT_LIKELY(!!(a_Expr))) \
|
---|
1104 | { /* likely */ } \
|
---|
1105 | else if (1) \
|
---|
1106 | { \
|
---|
1107 | ASSERT_GUEST_LOGREL_MSG1(#a_Expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1108 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1109 | ASSERT_GUEST_PANIC(); \
|
---|
1110 | a_Stmt; \
|
---|
1111 | break; \
|
---|
1112 | } else \
|
---|
1113 | break
|
---|
1114 |
|
---|
1115 | /** @def ASSERT_GUEST_LOGREL_FAILED
|
---|
1116 | * An assertion failed.
|
---|
1117 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1118 | */
|
---|
1119 | #define ASSERT_GUEST_LOGREL_FAILED() \
|
---|
1120 | do { \
|
---|
1121 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1122 | ASSERT_GUEST_PANIC(); \
|
---|
1123 | } while (0)
|
---|
1124 |
|
---|
1125 | /** @def ASSERT_GUEST_LOGREL_FAILED_RETURN
|
---|
1126 | * An assertion failed.
|
---|
1127 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1128 | *
|
---|
1129 | * @param a_rc What is to be presented to return.
|
---|
1130 | */
|
---|
1131 | #define ASSERT_GUEST_LOGREL_FAILED_RETURN(a_rc) \
|
---|
1132 | do { \
|
---|
1133 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1134 | ASSERT_GUEST_PANIC(); \
|
---|
1135 | return (a_rc); \
|
---|
1136 | } while (0)
|
---|
1137 |
|
---|
1138 | /** @def ASSERT_GUEST_LOGREL_FAILED_RETURN_VOID
|
---|
1139 | * An assertion failed, hit a breakpoint and return.
|
---|
1140 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1141 | */
|
---|
1142 | #define ASSERT_GUEST_LOGREL_FAILED_RETURN_VOID() \
|
---|
1143 | do { \
|
---|
1144 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1145 | ASSERT_GUEST_PANIC(); \
|
---|
1146 | return; \
|
---|
1147 | } while (0)
|
---|
1148 |
|
---|
1149 | /** @def ASSERT_GUEST_LOGREL_FAILED_BREAK
|
---|
1150 | * An assertion failed, break.
|
---|
1151 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1152 | */
|
---|
1153 | #define ASSERT_GUEST_LOGREL_FAILED_BREAK() \
|
---|
1154 | if (1) \
|
---|
1155 | { \
|
---|
1156 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1157 | ASSERT_GUEST_PANIC(); \
|
---|
1158 | break; \
|
---|
1159 | } else \
|
---|
1160 | break
|
---|
1161 |
|
---|
1162 | /** @def ASSERT_GUEST_LOGREL_FAILED_STMT_BREAK
|
---|
1163 | * An assertion failed, execute \a a_Stmt and break.
|
---|
1164 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1165 | *
|
---|
1166 | * @param a_Stmt Statement to execute before break.
|
---|
1167 | */
|
---|
1168 | #define ASSERT_GUEST_LOGREL_FAILED_STMT_BREAK(a_Stmt) \
|
---|
1169 | if (1) \
|
---|
1170 | { \
|
---|
1171 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1172 | ASSERT_GUEST_PANIC(); \
|
---|
1173 | a_Stmt; \
|
---|
1174 | break; \
|
---|
1175 | } else \
|
---|
1176 | break
|
---|
1177 |
|
---|
1178 | /** @def ASSERT_GUEST_LOGREL_MSG_FAILED
|
---|
1179 | * An assertion failed.
|
---|
1180 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1181 | *
|
---|
1182 | * @param a printf argument list (in parenthesis).
|
---|
1183 | */
|
---|
1184 | #define ASSERT_GUEST_LOGREL_MSG_FAILED(a) \
|
---|
1185 | do { \
|
---|
1186 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1187 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1188 | ASSERT_GUEST_PANIC(); \
|
---|
1189 | } while (0)
|
---|
1190 |
|
---|
1191 | /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_STMT
|
---|
1192 | * An assertion failed, execute @a a_Stmt.
|
---|
1193 | *
|
---|
1194 | * Strict builds will hit a breakpoint, non-strict will only do LogRel. The
|
---|
1195 | * statement will be executed in regardless of build type.
|
---|
1196 | *
|
---|
1197 | * @param a printf argument list (in parenthesis).
|
---|
1198 | * @param a_Stmt Statement to execute after raising/logging the assertion.
|
---|
1199 | */
|
---|
1200 | #define ASSERT_GUEST_LOGREL_MSG_FAILED_STMT(a, a_Stmt) \
|
---|
1201 | do { \
|
---|
1202 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1203 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1204 | ASSERT_GUEST_PANIC(); \
|
---|
1205 | a_Stmt; \
|
---|
1206 | } while (0)
|
---|
1207 |
|
---|
1208 | /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_RETURN
|
---|
1209 | * An assertion failed, return \a a_rc.
|
---|
1210 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1211 | *
|
---|
1212 | * @param a printf argument list (in parenthesis).
|
---|
1213 | * @param a_rc What is to be presented to return.
|
---|
1214 | */
|
---|
1215 | #define ASSERT_GUEST_LOGREL_MSG_FAILED_RETURN(a, a_rc) \
|
---|
1216 | do { \
|
---|
1217 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1218 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1219 | ASSERT_GUEST_PANIC(); \
|
---|
1220 | return (a_rc); \
|
---|
1221 | } while (0)
|
---|
1222 |
|
---|
1223 | /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_RETURN
|
---|
1224 | * An assertion failed, execute @a a_Stmt and return @a a_rc.
|
---|
1225 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1226 | *
|
---|
1227 | * @param a printf argument list (in parenthesis).
|
---|
1228 | * @param a_Stmt Statement to execute before returning in case of a failed
|
---|
1229 | * assertion.
|
---|
1230 | * @param a_rc What is to be presented to return.
|
---|
1231 | */
|
---|
1232 | #define ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_RETURN(a, a_Stmt, a_rc) \
|
---|
1233 | do { \
|
---|
1234 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1235 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1236 | ASSERT_GUEST_PANIC(); \
|
---|
1237 | a_Stmt; \
|
---|
1238 | return (a_rc); \
|
---|
1239 | } while (0)
|
---|
1240 |
|
---|
1241 | /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_RETURN_VOID
|
---|
1242 | * An assertion failed, return void.
|
---|
1243 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1244 | *
|
---|
1245 | * @param a printf argument list (in parenthesis).
|
---|
1246 | */
|
---|
1247 | #define ASSERT_GUEST_LOGREL_MSG_FAILED_RETURN_VOID(a) \
|
---|
1248 | do { \
|
---|
1249 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1250 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1251 | ASSERT_GUEST_PANIC(); \
|
---|
1252 | return; \
|
---|
1253 | } while (0)
|
---|
1254 |
|
---|
1255 | /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_RETURN_VOID
|
---|
1256 | * An assertion failed, execute @a a_Stmt and return void.
|
---|
1257 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1258 | *
|
---|
1259 | * @param a printf argument list (in parenthesis).
|
---|
1260 | * @param a_Stmt Statement to execute before returning in case of a failed
|
---|
1261 | * assertion.
|
---|
1262 | */
|
---|
1263 | #define ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_RETURN_VOID(a, a_Stmt) \
|
---|
1264 | do { \
|
---|
1265 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1266 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1267 | ASSERT_GUEST_PANIC(); \
|
---|
1268 | a_Stmt; \
|
---|
1269 | return; \
|
---|
1270 | } while (0)
|
---|
1271 |
|
---|
1272 | /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_BREAK
|
---|
1273 | * An assertion failed, break.
|
---|
1274 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1275 | *
|
---|
1276 | * @param a printf argument list (in parenthesis).
|
---|
1277 | */
|
---|
1278 | #define ASSERT_GUEST_LOGREL_MSG_FAILED_BREAK(a) \
|
---|
1279 | if (1)\
|
---|
1280 | { \
|
---|
1281 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1282 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1283 | ASSERT_GUEST_PANIC(); \
|
---|
1284 | break; \
|
---|
1285 | } else \
|
---|
1286 | break
|
---|
1287 |
|
---|
1288 | /** @def ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_BREAK
|
---|
1289 | * An assertion failed, execute \a a_Stmt and break.
|
---|
1290 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1291 | *
|
---|
1292 | * @param a printf argument list (in parenthesis).
|
---|
1293 | * @param a_Stmt Statement to execute before break.
|
---|
1294 | */
|
---|
1295 | #define ASSERT_GUEST_LOGREL_MSG_FAILED_STMT_BREAK(a, a_Stmt) \
|
---|
1296 | if (1) \
|
---|
1297 | { \
|
---|
1298 | ASSERT_GUEST_LOGREL_MSG1("failed", __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1299 | ASSERT_GUEST_LOGREL_MSG2(a); \
|
---|
1300 | ASSERT_GUEST_PANIC(); \
|
---|
1301 | a_Stmt; \
|
---|
1302 | break; \
|
---|
1303 | } else \
|
---|
1304 | break
|
---|
1305 |
|
---|
1306 | /** @} */
|
---|
1307 |
|
---|
1308 |
|
---|
1309 | /** @name Convenience Assertions Macros
|
---|
1310 | * @{
|
---|
1311 | */
|
---|
1312 |
|
---|
1313 | /** @def ASSERT_GUEST_RC
|
---|
1314 | * Asserts a iprt status code successful.
|
---|
1315 | *
|
---|
1316 | * On failure it will print info about the rc and hit a breakpoint.
|
---|
1317 | *
|
---|
1318 | * @param rc iprt status code.
|
---|
1319 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1320 | */
|
---|
1321 | #define ASSERT_GUEST_RC(rc) ASSERT_GUEST_MSG_RC(rc, ("%Rra\n", (rc)))
|
---|
1322 |
|
---|
1323 | /** @def ASSERT_GUEST_RC_STMT
|
---|
1324 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and execute
|
---|
1325 | * @a stmt if it isn't.
|
---|
1326 | *
|
---|
1327 | * @param rc iprt status code.
|
---|
1328 | * @param stmt Statement to execute before returning in case of a failed
|
---|
1329 | * assertion.
|
---|
1330 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1331 | */
|
---|
1332 | #define ASSERT_GUEST_RC_STMT(rc, stmt) ASSERT_GUEST_MSG_RC_STMT(rc, ("%Rra\n", (rc)), stmt)
|
---|
1333 |
|
---|
1334 | /** @def ASSERT_GUEST_RC_RETURN
|
---|
1335 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1336 | *
|
---|
1337 | * @param rc iprt status code.
|
---|
1338 | * @param rcRet What is to be presented to return.
|
---|
1339 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1340 | */
|
---|
1341 | #define ASSERT_GUEST_RC_RETURN(rc, rcRet) ASSERT_GUEST_MSG_RC_RETURN(rc, ("%Rra\n", (rc)), rcRet)
|
---|
1342 |
|
---|
1343 | /** @def ASSERT_GUEST_RC_STMT_RETURN
|
---|
1344 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
|
---|
1345 | * @a stmt and returns @a rcRet if it isn't.
|
---|
1346 | *
|
---|
1347 | * @param rc iprt status code.
|
---|
1348 | * @param stmt Statement to execute before returning in case of a failed
|
---|
1349 | * assertion.
|
---|
1350 | * @param rcRet What is to be presented to return.
|
---|
1351 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1352 | */
|
---|
1353 | #define ASSERT_GUEST_RC_STMT_RETURN(rc, stmt, rcRet) ASSERT_GUEST_MSG_RC_STMT_RETURN(rc, ("%Rra\n", (rc)), stmt, rcRet)
|
---|
1354 |
|
---|
1355 | /** @def ASSERT_GUEST_RC_RETURN_VOID
|
---|
1356 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1357 | *
|
---|
1358 | * @param rc iprt status code.
|
---|
1359 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1360 | */
|
---|
1361 | #define ASSERT_GUEST_RC_RETURN_VOID(rc) ASSERT_GUEST_MSG_RC_RETURN_VOID(rc, ("%Rra\n", (rc)))
|
---|
1362 |
|
---|
1363 | /** @def ASSERT_GUEST_RC_STMT_RETURN_VOID
|
---|
1364 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only), and
|
---|
1365 | * execute the given statement/return if it isn't.
|
---|
1366 | *
|
---|
1367 | * @param rc iprt status code.
|
---|
1368 | * @param stmt Statement to execute before returning on failure.
|
---|
1369 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1370 | */
|
---|
1371 | #define ASSERT_GUEST_RC_STMT_RETURN_VOID(rc, stmt) ASSERT_GUEST_MSG_RC_STMT_RETURN_VOID(rc, ("%Rra\n", (rc)), stmt)
|
---|
1372 |
|
---|
1373 | /** @def ASSERT_GUEST_RC_BREAK
|
---|
1374 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1375 | *
|
---|
1376 | * @param rc iprt status code.
|
---|
1377 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1378 | */
|
---|
1379 | #define ASSERT_GUEST_RC_BREAK(rc) ASSERT_GUEST_MSG_RC_BREAK(rc, ("%Rra\n", (rc)))
|
---|
1380 |
|
---|
1381 | /** @def ASSERT_GUEST_RC_STMT_BREAK
|
---|
1382 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1383 | *
|
---|
1384 | * @param rc iprt status code.
|
---|
1385 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1386 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1387 | */
|
---|
1388 | #define ASSERT_GUEST_RC_STMT_BREAK(rc, stmt) ASSERT_GUEST_MSG_RC_STMT_BREAK(rc, ("%Rra\n", (rc)), stmt)
|
---|
1389 |
|
---|
1390 | /** @def ASSERT_GUEST_MSG_RC
|
---|
1391 | * Asserts a iprt status code successful.
|
---|
1392 | *
|
---|
1393 | * It prints a custom message and hits a breakpoint on FAILURE.
|
---|
1394 | *
|
---|
1395 | * @param rc iprt status code.
|
---|
1396 | * @param msg printf argument list (in parenthesis).
|
---|
1397 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1398 | */
|
---|
1399 | #define ASSERT_GUEST_MSG_RC(rc, msg) \
|
---|
1400 | do { ASSERT_GUEST_MSG(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)
|
---|
1401 |
|
---|
1402 | /** @def ASSERT_GUEST_MSG_RC_STMT
|
---|
1403 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and
|
---|
1404 | * execute @a stmt if it isn't.
|
---|
1405 | *
|
---|
1406 | * @param rc iprt status code.
|
---|
1407 | * @param msg printf argument list (in parenthesis).
|
---|
1408 | * @param stmt Statement to execute before returning in case of a failed
|
---|
1409 | * assertion.
|
---|
1410 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1411 | */
|
---|
1412 | #define ASSERT_GUEST_MSG_RC_STMT(rc, msg, stmt) \
|
---|
1413 | do { ASSERT_GUEST_MSG_STMT(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } while (0)
|
---|
1414 |
|
---|
1415 | /** @def ASSERT_GUEST_MSG_RC_RETURN
|
---|
1416 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return
|
---|
1417 | * @a rcRet if it isn't.
|
---|
1418 | *
|
---|
1419 | * @param rc iprt status code.
|
---|
1420 | * @param msg printf argument list (in parenthesis).
|
---|
1421 | * @param rcRet What is to be presented to return.
|
---|
1422 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1423 | */
|
---|
1424 | #define ASSERT_GUEST_MSG_RC_RETURN(rc, msg, rcRet) \
|
---|
1425 | do { ASSERT_GUEST_MSG_RETURN(RT_SUCCESS_NP(rc), msg, rcRet); NOREF(rc); } while (0)
|
---|
1426 |
|
---|
1427 | /** @def ASSERT_GUEST_MSG_RC_STMT_RETURN
|
---|
1428 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
|
---|
1429 | * @a stmt and return @a rcRet if it isn't.
|
---|
1430 | *
|
---|
1431 | * @param rc iprt status code.
|
---|
1432 | * @param msg printf argument list (in parenthesis).
|
---|
1433 | * @param stmt Statement to execute before returning in case of a failed
|
---|
1434 | * assertion.
|
---|
1435 | * @param rcRet What is to be presented to return.
|
---|
1436 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1437 | */
|
---|
1438 | #define ASSERT_GUEST_MSG_RC_STMT_RETURN(rc, msg, stmt, rcRet) \
|
---|
1439 | do { ASSERT_GUEST_MSG_STMT_RETURN(RT_SUCCESS_NP(rc), msg, stmt, rcRet); NOREF(rc); } while (0)
|
---|
1440 |
|
---|
1441 | /** @def ASSERT_GUEST_MSG_RC_RETURN_VOID
|
---|
1442 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return
|
---|
1443 | * void if it isn't.
|
---|
1444 | *
|
---|
1445 | * @param rc iprt status code.
|
---|
1446 | * @param msg printf argument list (in parenthesis).
|
---|
1447 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1448 | */
|
---|
1449 | #define ASSERT_GUEST_MSG_RC_RETURN_VOID(rc, msg) \
|
---|
1450 | do { ASSERT_GUEST_MSG_RETURN_VOID(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)
|
---|
1451 |
|
---|
1452 | /** @def ASSERT_GUEST_MSG_RC_STMT_RETURN_VOID
|
---|
1453 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
|
---|
1454 | * @a stmt and return void if it isn't.
|
---|
1455 | *
|
---|
1456 | * @param rc iprt status code.
|
---|
1457 | * @param msg printf argument list (in parenthesis).
|
---|
1458 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1459 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1460 | */
|
---|
1461 | #define ASSERT_GUEST_MSG_RC_STMT_RETURN_VOID(rc, msg, stmt) \
|
---|
1462 | do { ASSERT_GUEST_MSG_STMT_RETURN_VOID(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } while (0)
|
---|
1463 |
|
---|
1464 | /** @def ASSERT_GUEST_MSG_RC_BREAK
|
---|
1465 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break
|
---|
1466 | * if it isn't.
|
---|
1467 | *
|
---|
1468 | * @param rc iprt status code.
|
---|
1469 | * @param msg printf argument list (in parenthesis).
|
---|
1470 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1471 | */
|
---|
1472 | #define ASSERT_GUEST_MSG_RC_BREAK(rc, msg) \
|
---|
1473 | if (1) { ASSERT_GUEST_MSG_BREAK(RT_SUCCESS(rc), msg); NOREF(rc); } else do {} while (0)
|
---|
1474 |
|
---|
1475 | /** @def ASSERT_GUEST_MSG_RC_STMT_BREAK
|
---|
1476 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
|
---|
1477 | * @a stmt and break if it isn't.
|
---|
1478 | *
|
---|
1479 | * @param rc iprt status code.
|
---|
1480 | * @param msg printf argument list (in parenthesis).
|
---|
1481 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1482 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1483 | */
|
---|
1484 | #define ASSERT_GUEST_MSG_RC_STMT_BREAK(rc, msg, stmt) \
|
---|
1485 | if (1) { ASSERT_GUEST_MSG_STMT_BREAK(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } else do {} while (0)
|
---|
1486 |
|
---|
1487 | /** @def ASSERT_GUEST_RC_SUCCESS
|
---|
1488 | * Asserts an iprt status code equals VINF_SUCCESS.
|
---|
1489 | *
|
---|
1490 | * On failure it will print info about the rc and hit a breakpoint.
|
---|
1491 | *
|
---|
1492 | * @param rc iprt status code.
|
---|
1493 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1494 | */
|
---|
1495 | #define ASSERT_GUEST_RC_SUCCESS(rc) do { ASSERT_GUEST_MSG((rc) == VINF_SUCCESS, ("%Rra\n", (rc))); NOREF(rc); } while (0)
|
---|
1496 |
|
---|
1497 | /** @def ASSERT_GUEST_RC_SUCCESS_RETURN
|
---|
1498 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1499 | *
|
---|
1500 | * @param rc iprt status code.
|
---|
1501 | * @param rcRet What is to be presented to return.
|
---|
1502 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1503 | */
|
---|
1504 | #define ASSERT_GUEST_RC_SUCCESS_RETURN(rc, rcRet) ASSERT_GUEST_MSG_RETURN((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet)
|
---|
1505 |
|
---|
1506 | /** @def ASSERT_GUEST_RC_SUCCESS_RETURN_VOID
|
---|
1507 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1508 | *
|
---|
1509 | * @param rc iprt status code.
|
---|
1510 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1511 | */
|
---|
1512 | #define ASSERT_GUEST_RC_SUCCESS_RETURN_VOID(rc) ASSERT_GUEST_MSG_RETURN_VOID((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
|
---|
1513 |
|
---|
1514 | /** @def ASSERT_GUEST_RC_SUCCESS_BREAK
|
---|
1515 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1516 | *
|
---|
1517 | * @param rc iprt status code.
|
---|
1518 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1519 | */
|
---|
1520 | #define ASSERT_GUEST_RC_SUCCESS_BREAK(rc) ASSERT_GUEST_MSG_BREAK((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
|
---|
1521 |
|
---|
1522 | /** @def ASSERT_GUEST_RC_SUCCESS_STMT_BREAK
|
---|
1523 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1524 | *
|
---|
1525 | * @param rc iprt status code.
|
---|
1526 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1527 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1528 | */
|
---|
1529 | #define ASSERT_GUEST_RC_SUCCESS_STMT_BREAK(rc, stmt) ASSERT_GUEST_MSG_STMT_BREAK((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), stmt)
|
---|
1530 |
|
---|
1531 | /** @def ASSERT_GUEST_GCPHYS32
|
---|
1532 | * Asserts that the high dword of a physical address is zero
|
---|
1533 | *
|
---|
1534 | * @param GCPhys The address (RTGCPHYS).
|
---|
1535 | */
|
---|
1536 | #define ASSERT_GUEST_GCPHYS32(GCPhys) ASSERT_GUEST_MSG(VALID_PHYS32(GCPhys), ("%RGp\n", (RTGCPHYS)(GCPhys)))
|
---|
1537 |
|
---|
1538 |
|
---|
1539 | /** @def ASSERT_GUEST_RC
|
---|
1540 | * Asserts a iprt status code successful.
|
---|
1541 | *
|
---|
1542 | * On failure it will print info about the rc and hit a breakpoint.
|
---|
1543 | *
|
---|
1544 | * @param rc iprt status code.
|
---|
1545 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1546 | */
|
---|
1547 | #define ASSERT_GUEST_LOGREL_RC(rc) ASSERT_GUEST_LOGREL_MSG_RC(rc, ("%Rra\n", (rc)))
|
---|
1548 |
|
---|
1549 | /** @def ASSERT_GUEST_LOGREL_RC_STMT
|
---|
1550 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and execute
|
---|
1551 | * @a stmt if it isn't.
|
---|
1552 | *
|
---|
1553 | * @param rc iprt status code.
|
---|
1554 | * @param stmt Statement to execute before returning in case of a failed
|
---|
1555 | * assertion.
|
---|
1556 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1557 | */
|
---|
1558 | #define ASSERT_GUEST_LOGREL_RC_STMT(rc, stmt) ASSERT_GUEST_LOGREL_MSG_RC_STMT(rc, ("%Rra\n", (rc)), stmt)
|
---|
1559 |
|
---|
1560 | /** @def ASSERT_GUEST_LOGREL_RC_RETURN
|
---|
1561 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1562 | *
|
---|
1563 | * @param rc iprt status code.
|
---|
1564 | * @param rcRet What is to be presented to return.
|
---|
1565 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1566 | */
|
---|
1567 | #define ASSERT_GUEST_LOGREL_RC_RETURN(rc, rcRet) ASSERT_GUEST_LOGREL_MSG_RC_RETURN(rc, ("%Rra\n", (rc)), rcRet)
|
---|
1568 |
|
---|
1569 | /** @def ASSERT_GUEST_LOGREL_RC_STMT_RETURN
|
---|
1570 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
|
---|
1571 | * @a stmt and returns @a rcRet if it isn't.
|
---|
1572 | *
|
---|
1573 | * @param rc iprt status code.
|
---|
1574 | * @param stmt Statement to execute before returning in case of a failed
|
---|
1575 | * assertion.
|
---|
1576 | * @param rcRet What is to be presented to return.
|
---|
1577 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1578 | */
|
---|
1579 | #define ASSERT_GUEST_LOGREL_RC_STMT_RETURN(rc, stmt, rcRet) ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN(rc, ("%Rra\n", (rc)), stmt, rcRet)
|
---|
1580 |
|
---|
1581 | /** @def ASSERT_GUEST_LOGREL_RC_RETURN_VOID
|
---|
1582 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1583 | *
|
---|
1584 | * @param rc iprt status code.
|
---|
1585 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1586 | */
|
---|
1587 | #define ASSERT_GUEST_LOGREL_RC_RETURN_VOID(rc) ASSERT_GUEST_LOGREL_MSG_RC_RETURN_VOID(rc, ("%Rra\n", (rc)))
|
---|
1588 |
|
---|
1589 | /** @def ASSERT_GUEST_LOGREL_RC_STMT_RETURN_VOID
|
---|
1590 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only), and
|
---|
1591 | * execute the given statement/return if it isn't.
|
---|
1592 | *
|
---|
1593 | * @param rc iprt status code.
|
---|
1594 | * @param stmt Statement to execute before returning on failure.
|
---|
1595 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1596 | */
|
---|
1597 | #define ASSERT_GUEST_LOGREL_RC_STMT_RETURN_VOID(rc, stmt) ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN_VOID(rc, ("%Rra\n", (rc)), stmt)
|
---|
1598 |
|
---|
1599 | /** @def ASSERT_GUEST_LOGREL_RC_BREAK
|
---|
1600 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1601 | *
|
---|
1602 | * @param rc iprt status code.
|
---|
1603 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1604 | */
|
---|
1605 | #define ASSERT_GUEST_LOGREL_RC_BREAK(rc) ASSERT_GUEST_LOGREL_MSG_RC_BREAK(rc, ("%Rra\n", (rc)))
|
---|
1606 |
|
---|
1607 | /** @def ASSERT_GUEST_LOGREL_RC_STMT_BREAK
|
---|
1608 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1609 | *
|
---|
1610 | * @param rc iprt status code.
|
---|
1611 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1612 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1613 | */
|
---|
1614 | #define ASSERT_GUEST_LOGREL_RC_STMT_BREAK(rc, stmt) ASSERT_GUEST_LOGREL_MSG_RC_STMT_BREAK(rc, ("%Rra\n", (rc)), stmt)
|
---|
1615 |
|
---|
1616 | /** @def ASSERT_GUEST_LOGREL_MSG_RC
|
---|
1617 | * Asserts a iprt status code successful.
|
---|
1618 | *
|
---|
1619 | * It prints a custom message and hits a breakpoint on FAILURE.
|
---|
1620 | *
|
---|
1621 | * @param rc iprt status code.
|
---|
1622 | * @param msg printf argument list (in parenthesis).
|
---|
1623 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1624 | */
|
---|
1625 | #define ASSERT_GUEST_LOGREL_MSG_RC(rc, msg) \
|
---|
1626 | do { ASSERT_GUEST_LOGREL_MSG(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)
|
---|
1627 |
|
---|
1628 | /** @def ASSERT_GUEST_LOGREL_MSG_RC_STMT
|
---|
1629 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and
|
---|
1630 | * execute @a stmt if it isn't.
|
---|
1631 | *
|
---|
1632 | * @param rc iprt status code.
|
---|
1633 | * @param msg printf argument list (in parenthesis).
|
---|
1634 | * @param stmt Statement to execute before returning in case of a failed
|
---|
1635 | * assertion.
|
---|
1636 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1637 | */
|
---|
1638 | #define ASSERT_GUEST_LOGREL_MSG_RC_STMT(rc, msg, stmt) \
|
---|
1639 | do { ASSERT_GUEST_LOGREL_MSG_STMT(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } while (0)
|
---|
1640 |
|
---|
1641 | /** @def ASSERT_GUEST_LOGREL_MSG_RC_RETURN
|
---|
1642 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return
|
---|
1643 | * @a rcRet if it isn't.
|
---|
1644 | *
|
---|
1645 | * @param rc iprt status code.
|
---|
1646 | * @param msg printf argument list (in parenthesis).
|
---|
1647 | * @param rcRet What is to be presented to return.
|
---|
1648 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1649 | */
|
---|
1650 | #define ASSERT_GUEST_LOGREL_MSG_RC_RETURN(rc, msg, rcRet) \
|
---|
1651 | do { ASSERT_GUEST_LOGREL_MSG_RETURN(RT_SUCCESS_NP(rc), msg, rcRet); NOREF(rc); } while (0)
|
---|
1652 |
|
---|
1653 | /** @def ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN
|
---|
1654 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
|
---|
1655 | * @a stmt and return @a rcRet if it isn't.
|
---|
1656 | *
|
---|
1657 | * @param rc iprt status code.
|
---|
1658 | * @param msg printf argument list (in parenthesis).
|
---|
1659 | * @param stmt Statement to execute before returning in case of a failed
|
---|
1660 | * assertion.
|
---|
1661 | * @param rcRet What is to be presented to return.
|
---|
1662 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1663 | */
|
---|
1664 | #define ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN(rc, msg, stmt, rcRet) \
|
---|
1665 | do { ASSERT_GUEST_LOGREL_MSG_STMT_RETURN(RT_SUCCESS_NP(rc), msg, stmt, rcRet); NOREF(rc); } while (0)
|
---|
1666 |
|
---|
1667 | /** @def ASSERT_GUEST_LOGREL_MSG_RC_RETURN_VOID
|
---|
1668 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return
|
---|
1669 | * void if it isn't.
|
---|
1670 | *
|
---|
1671 | * @param rc iprt status code.
|
---|
1672 | * @param msg printf argument list (in parenthesis).
|
---|
1673 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1674 | */
|
---|
1675 | #define ASSERT_GUEST_LOGREL_MSG_RC_RETURN_VOID(rc, msg) \
|
---|
1676 | do { ASSERT_GUEST_LOGREL_MSG_RETURN_VOID(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)
|
---|
1677 |
|
---|
1678 | /** @def ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN_VOID
|
---|
1679 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
|
---|
1680 | * @a stmt and return void if it isn't.
|
---|
1681 | *
|
---|
1682 | * @param rc iprt status code.
|
---|
1683 | * @param msg printf argument list (in parenthesis).
|
---|
1684 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1685 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1686 | */
|
---|
1687 | #define ASSERT_GUEST_LOGREL_MSG_RC_STMT_RETURN_VOID(rc, msg, stmt) \
|
---|
1688 | do { ASSERT_GUEST_LOGREL_MSG_STMT_RETURN_VOID(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } while (0)
|
---|
1689 |
|
---|
1690 | /** @def ASSERT_GUEST_LOGREL_MSG_RC_BREAK
|
---|
1691 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break
|
---|
1692 | * if it isn't.
|
---|
1693 | *
|
---|
1694 | * @param rc iprt status code.
|
---|
1695 | * @param msg printf argument list (in parenthesis).
|
---|
1696 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1697 | */
|
---|
1698 | #define ASSERT_GUEST_LOGREL_MSG_RC_BREAK(rc, msg) \
|
---|
1699 | if (1) { ASSERT_GUEST_LOGREL_MSG_BREAK(RT_SUCCESS(rc), msg); NOREF(rc); } else do {} while (0)
|
---|
1700 |
|
---|
1701 | /** @def ASSERT_GUEST_LOGREL_MSG_RC_STMT_BREAK
|
---|
1702 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
|
---|
1703 | * @a stmt and break if it isn't.
|
---|
1704 | *
|
---|
1705 | * @param rc iprt status code.
|
---|
1706 | * @param msg printf argument list (in parenthesis).
|
---|
1707 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1708 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1709 | */
|
---|
1710 | #define ASSERT_GUEST_LOGREL_MSG_RC_STMT_BREAK(rc, msg, stmt) \
|
---|
1711 | if (1) { ASSERT_GUEST_LOGREL_MSG_STMT_BREAK(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } else do {} while (0)
|
---|
1712 |
|
---|
1713 | /** @def ASSERT_GUEST_LOGREL_RC_SUCCESS
|
---|
1714 | * Asserts an iprt status code equals VINF_SUCCESS.
|
---|
1715 | *
|
---|
1716 | * On failure it will print info about the rc and hit a breakpoint.
|
---|
1717 | *
|
---|
1718 | * @param rc iprt status code.
|
---|
1719 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1720 | */
|
---|
1721 | #define ASSERT_GUEST_LOGREL_RC_SUCCESS(rc) do { ASSERT_GUEST_LOGREL_MSG((rc) == VINF_SUCCESS, ("%Rra\n", (rc))); NOREF(rc); } while (0)
|
---|
1722 |
|
---|
1723 | /** @def ASSERT_GUEST_LOGREL_RC_SUCCESS_RETURN
|
---|
1724 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1725 | *
|
---|
1726 | * @param rc iprt status code.
|
---|
1727 | * @param rcRet What is to be presented to return.
|
---|
1728 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1729 | */
|
---|
1730 | #define ASSERT_GUEST_LOGREL_RC_SUCCESS_RETURN(rc, rcRet) ASSERT_GUEST_LOGREL_MSG_RETURN((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet)
|
---|
1731 |
|
---|
1732 | /** @def ASSERT_GUEST_LOGREL_RC_SUCCESS_RETURN_VOID
|
---|
1733 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1734 | *
|
---|
1735 | * @param rc iprt status code.
|
---|
1736 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1737 | */
|
---|
1738 | #define ASSERT_GUEST_LOGREL_RC_SUCCESS_RETURN_VOID(rc) ASSERT_GUEST_LOGREL_MSG_RETURN_VOID((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
|
---|
1739 |
|
---|
1740 | /** @def ASSERT_GUEST_LOGREL_RC_SUCCESS_BREAK
|
---|
1741 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1742 | *
|
---|
1743 | * @param rc iprt status code.
|
---|
1744 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1745 | */
|
---|
1746 | #define ASSERT_GUEST_LOGREL_RC_SUCCESS_BREAK(rc) ASSERT_GUEST_LOGREL_MSG_BREAK((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
|
---|
1747 |
|
---|
1748 | /** @def ASSERT_GUEST_LOGREL_RC_SUCCESS_STMT_BREAK
|
---|
1749 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1750 | *
|
---|
1751 | * @param rc iprt status code.
|
---|
1752 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1753 | * @remark rc is referenced multiple times. In release mode is NOREF()'ed.
|
---|
1754 | */
|
---|
1755 | #define ASSERT_GUEST_LOGREL_RC_SUCCESS_STMT_BREAK(rc, stmt) ASSERT_GUEST_LOGREL_MSG_STMT_BREAK((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), stmt)
|
---|
1756 |
|
---|
1757 | /** @def ASSERT_GUEST_LOGREL_GCPHYS32
|
---|
1758 | * Asserts that the high dword of a physical address is zero
|
---|
1759 | *
|
---|
1760 | * @param GCPhys The address (RTGCPHYS).
|
---|
1761 | */
|
---|
1762 | #define ASSERT_GUEST_LOGREL_GCPHYS32(GCPhys) ASSERT_GUEST_LOGREL_MSG(VALID_PHYS32(GCPhys), ("%RGp\n", (RTGCPHYS)(GCPhys)))
|
---|
1763 |
|
---|
1764 |
|
---|
1765 | /** @} */
|
---|
1766 |
|
---|
1767 |
|
---|
1768 | /** @} */
|
---|
1769 |
|
---|
1770 | #endif /* !VBOX_INCLUDED_AssertGuest_h */
|
---|
1771 |
|
---|