Changeset 13306
- Timestamp:
- 10/15/08 23:17:04 (3 months ago)
- Files:
-
- trunk/Config.kmk (modified) (1 diff)
- trunk/include/iprt/assert.h (modified) (69 diffs)
- trunk/src/VBox/HostDrivers/Support/linux/Makefile (modified) (2 diffs)
- trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c (modified) (1 diff)
- trunk/src/VBox/HostDrivers/Support/linux/files_vboxdrv (modified) (1 diff)
- trunk/src/VBox/Runtime/Makefile.kmk (modified) (11 diffs)
- trunk/src/VBox/Runtime/VBox/RTAssertShouldPanic-vbox.cpp (moved) (moved from trunk/src/VBox/Runtime/VBox/RTAssertDoBreakpoint-vbox.cpp) (6 diffs)
- trunk/src/VBox/Runtime/VBox/VBoxRTDeps.cpp (modified) (2 diffs)
- trunk/src/VBox/Runtime/VBox/log-vbox.cpp (modified) (1 diff)
- trunk/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp (moved) (moved from trunk/src/VBox/Runtime/generic/RTAssertDoBreakpoint-generic.cpp) (3 diffs)
- trunk/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp (modified) (3 diffs)
- trunk/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm (moved) (moved from trunk/src/VBox/Runtime/r0drv/os2/RTAssertDoBreakpoint-r0drv-os2.asm) (5 diffs)
- trunk/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c (modified) (3 diffs)
- trunk/src/VBox/Runtime/r3/alloc-ef.cpp (modified) (2 diffs)
- trunk/src/VBox/VMM/Makefile.kmk (modified) (1 diff)
- trunk/src/VBox/VMM/VMMGC/VMMGC.def (modified) (1 diff)
- trunk/src/VBox/VMM/VMMR0/VMMR0.cpp (modified) (1 diff)
- trunk/src/VBox/VMM/VMMR0/VMMR0.def (modified) (1 diff)
- trunk/src/recompiler/VBoxREMWrapper.cpp (modified) (1 diff)
- trunk/src/recompiler_new/VBoxREMWrapper.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Config.kmk
r13269 r13306 1958 1958 TEMPLATE_VBOXR0_ASTOOL = $(VBOX_ASTOOL) 1959 1959 TEMPLATE_VBOXR0_ASFLAGS = $(VBOX_ASFLAGS) 1960 TEMPLATE_VBOXR0_DEFS = IN_RING0 $(ARCH_BITS_DEFS)1960 TEMPLATE_VBOXR0_DEFS = IN_RING0 IN_RING0_AGNOSTIC $(ARCH_BITS_DEFS) 1961 1961 1962 1962 ifeq ($(VBOX_LDR_FMT),pe) trunk/include/iprt/assert.h
r11190 r13306 98 98 RTDECL(void) AssertMsg2(const char *pszFormat, ...); 99 99 100 #ifdef IN_RING0 100 101 /** 101 * Overridable function that decides whether assertions executes the breakpoint or not. 102 * Panics the system as the result of a fail assertion. 103 */ 104 RTR0DECL(void) RTR0AssertPanicSystem(void); 105 #endif /* IN_RING0 */ 106 107 /** 108 * Overridable function that decides whether assertions executes the panic 109 * (breakpoint) or not. 102 110 * 103 111 * The generic implementation will return true. 104 112 * 105 113 * @returns true if the breakpoint should be hit, false if it should be ignored. 106 * @remark The RTDECL() makes this a bit difficult to override on windows. Sorry. 107 */ 108 RTDECL(bool) RTAssertDoBreakpoint(void); 114 * 115 * @remark The RTDECL() makes this a bit difficult to override on Windows. So, 116 * you'll have ot use RTASSERT_HAVE_SHOULD_PANIC or 117 * RTASSERT_HAVE_SHOULD_PANIC_PRIVATE there to control the kind of 118 * prototype. 119 */ 120 #if !defined(RTASSERT_HAVE_SHOULD_PANIC) && !defined(RTASSERT_HAVE_SHOULD_PANIC_PRIVATE) 121 RTDECL(bool) RTAssertShouldPanic(void); 122 #elif defined(RTASSERT_HAVE_SHOULD_PANIC_PRIVATE) 123 bool RTAssertShouldPanic(void); 124 #else 125 DECLEXPORT(bool) RTCALL RTAssertShouldPanic(void); 126 #endif 109 127 110 128 /** The last assert message, 1st part. */ … … 115 133 __END_DECLS 116 134 117 118 /** @def AssertBreakpoint() 119 * Assertion Breakpoint. 120 * 121 * @remark In the gnu world we add a nop instruction after the int3 to 135 /** @def RTAssertDebugBreak() 136 * Debugger breakpoint instruction. 137 * 138 * @remarks In the gnu world we add a nop instruction after the int3 to 122 139 * force gdb to remain at the int3 source line. 123 * @remark The L4 kernel will try make sense of the breakpoint, thus the jmp. 124 */ 125 #ifdef RT_STRICT 126 # ifdef __GNUC__ 127 # ifndef __L4ENV__ 128 # define AssertBreakpoint() do { if (RTAssertDoBreakpoint()) { __asm__ __volatile__ ("int3\n\tnop"); } } while (0) 129 # else 130 # define AssertBreakpoint() do { if (RTAssertDoBreakpoint()) { __asm__ __volatile__ ("int3; jmp 1f; 1:"); } } while (0) 131 # endif 132 # elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING) 133 # define AssertBreakpoint() do { if (RTAssertDoBreakpoint()) { __debugbreak(); } } while (0) 140 * @remarks The L4 kernel will try make sense of the breakpoint, thus the jmp. 141 * @remarks This macro does not depend on RT_STRICT. 142 */ 143 #ifdef __GNUC__ 144 # ifndef __L4ENV__ 145 # define RTAssertDebugBreak() do { __asm__ __volatile__ ("int3\n\tnop"); } while (0) 134 146 # else 135 # error "Unknown compiler"147 # define RTAssertDebugBreak() do { __asm__ __volatile__ ("int3; jmp 1f; 1:"); } while (0) 136 148 # endif 137 #else 138 # define AssertBreakpoint() do { } while (0) 139 #endif 149 #elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING) 150 # define RTAssertDebugBreak() do { __debugbreak(); } while (0) 151 #else 152 # error "Unknown compiler" 153 #endif 154 155 156 157 /** @name Compile time assertions. 158 * 159 * These assertions are used to check structure sizes, memember/size alignments 160 * and similar compile time expressions. 161 * 162 * @{ 163 */ 140 164 141 165 /** … … 241 265 #endif 242 266 267 /** @} */ 268 269 270 271 /** @name Assertions 272 * 273 * These assertions will only trigger when RT_STRICT is defined. When it is 274 * undefined they will all be noops and generate no code. 275 * 276 * @{ 277 */ 278 279 /** @def RTAssertDoPanic 280 * Raises an assertion panic appropriate to the current context. 281 * @remarks This macro does not depend on RT_STRICT. 282 */ 283 #if (defined(IN_RING0) && !defined(IN_RING0_AGNOSTIC)) \ 284 && (defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS)) 285 # define RTAssertDoPanic() RTR0AssertPanicSystem 286 #else 287 # define RTAssertDoPanic() RTAssertDebugBreak() 288 #endif 289 290 /** @def AssertBreakpoint() 291 * Assertion Breakpoint. 292 * @deprecated Use RTAssertPanic or RTAssertDebugBreak instead. 293 */ 294 #ifdef RT_STRICT 295 # define AssertBreakpoint() RTAssertDebugBreak() 296 #else 297 # define AssertBreakpoint() do { } while (0) 298 #endif 299 300 /** @def rtAssertPanic() 301 * If RT_STRICT is defined this macro will invoke RTAssertDoPanic if 302 * RTAssertShouldPanic returns true. If RT_STRICT isn't defined it won't do any 303 * thing. 304 */ 305 #ifdef RT_STRICT 306 # define RTAssertPanic() do { if (RTAssertShouldPanic()) RTAssertDoPanic(); } while (0) 307 #else 308 # define RTAssertPanic() do { } while (0) 309 #endif 243 310 244 311 /** @def Assert … … 252 319 { \ 253 320 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 254 AssertBreakpoint(); \321 RTAssertPanic(); \ 255 322 } \ 256 323 } while (0) … … 273 340 { \ 274 341 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 275 AssertBreakpoint(); \342 RTAssertPanic(); \ 276 343 return (rc); \ 277 344 } \ … … 297 364 { \ 298 365 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 299 AssertBreakpoint(); \366 RTAssertPanic(); \ 300 367 return; \ 301 368 } \ … … 321 388 { \ 322 389 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 323 AssertBreakpoint(); \390 RTAssertPanic(); \ 324 391 break; \ 325 392 } else do {} while (0) … … 342 409 if (RT_UNLIKELY(!(expr))) { \ 343 410 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 344 AssertBreakpoint(); \411 RTAssertPanic(); \ 345 412 stmt; \ 346 413 break; \ … … 367 434 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 368 435 AssertMsg2 a; \ 369 AssertBreakpoint(); \436 RTAssertPanic(); \ 370 437 } \ 371 438 } while (0) … … 389 456 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 390 457 AssertMsg2 a; \ 391 AssertBreakpoint(); \458 RTAssertPanic(); \ 392 459 return (rc); \ 393 460 } \ … … 415 482 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 416 483 AssertMsg2 a; \ 417 AssertBreakpoint(); \484 RTAssertPanic(); \ 418 485 return; \ 419 486 } \ … … 441 508 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 442 509 AssertMsg2 a; \ 443 AssertBreakpoint(); \510 RTAssertPanic(); \ 444 511 break; \ 445 512 } else do {} while (0) … … 464 531 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 465 532 AssertMsg2 a; \ 466 AssertBreakpoint(); \533 RTAssertPanic(); \ 467 534 stmt; \ 468 535 break; \ … … 483 550 do { \ 484 551 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 485 AssertBreakpoint(); \552 RTAssertPanic(); \ 486 553 } while (0) 487 554 #else … … 498 565 do { \ 499 566 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 500 AssertBreakpoint(); \567 RTAssertPanic(); \ 501 568 return (rc); \ 502 569 } while (0) … … 515 582 do { \ 516 583 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 517 AssertBreakpoint(); \584 RTAssertPanic(); \ 518 585 return; \ 519 586 } while (0) … … 533 600 if (1) { \ 534 601 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 535 AssertBreakpoint(); \602 RTAssertPanic(); \ 536 603 break; \ 537 604 } else do {} while (0) … … 553 620 if (1) { \ 554 621 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 555 AssertBreakpoint(); \622 RTAssertPanic(); \ 556 623 stmt; \ 557 624 break; \ … … 576 643 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 577 644 AssertMsg2 a; \ 578 AssertBreakpoint(); \645 RTAssertPanic(); \ 579 646 } while (0) 580 647 #else … … 593 660 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 594 661 AssertMsg2 a; \ 595 AssertBreakpoint(); \662 RTAssertPanic(); \ 596 663 return (rc); \ 597 664 } while (0) … … 613 680 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 614 681 AssertMsg2 a; \ 615 AssertBreakpoint(); \682 RTAssertPanic(); \ 616 683 return; \ 617 684 } while (0) … … 634 701 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 635 702 AssertMsg2 a; \ 636 AssertBreakpoint(); \703 RTAssertPanic(); \ 637 704 break; \ 638 705 } else do {} while (0) … … 656 723 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 657 724 AssertMsg2 a; \ 658 AssertBreakpoint(); \725 RTAssertPanic(); \ 659 726 stmt; \ 660 727 break; \ … … 668 735 #endif 669 736 670 671 672 /** @def AssertLogRelBreakpoint() 673 * Assertion LogRel Breakpoint. 674 * 675 * NOP in non-strict (release) builds, hardware breakpoint in strict builds, 676 * 677 * @remark In the gnu world we add a nop instruction after the int3 to 678 * force gdb to remain at the int3 source line. 679 * @remark The L4 kernel will try make sense of the breakpoint, thus the jmp. 680 */ 681 #ifdef RT_STRICT 682 # ifdef __GNUC__ 683 # ifndef __L4ENV__ 684 # define AssertLogRelBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3\n\tnop"); } while (0) 685 # else 686 # define AssertLogRelBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3; jmp 1f; 1:"); } while (0) 687 # endif 688 # elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING) 689 # define AssertLogRelBreakpoint() do { RTAssertDoBreakpoint(); __debugbreak(); } while (0) 690 # else 691 # error "Unknown compiler" 692 # endif 693 #else /* !RT_STRICT */ 694 # define AssertLogRelBreakpoint() do { } while (0) 695 #endif /* !RT_STRICT */ 696 697 698 /** @def AssertLogRelMsg1 737 /** @} */ 738 739 740 741 /** @name Release Log Assertions 742 * 743 * These assertions will work like normal strict assertion when RT_STRICT is 744 * defined and LogRel statements when RT_STRICT is undefined. Typically used for 745 * things which shouldn't go wrong, but when it does you'd like to know one way 746 * or ther other. 747 * 748 * @{ 749 */ 750 751 /** @def RTAssertLogRelMsg1 699 752 * AssertMsg1 (strict builds) / LogRel wrapper (non-strict). 700 753 */ 701 754 #ifdef RT_STRICT 702 # define AssertLogRelMsg1(pszExpr, iLine, pszFile, pszFunction) \755 # define RTAssertLogRelMsg1(pszExpr, iLine, pszFile, pszFunction) \ 703 756 AssertMsg1(pszExpr, iLine, pszFile, pszFunction) 704 757 #else 705 # define AssertLogRelMsg1(pszExpr, iLine, pszFile, pszFunction) \758 # define RTAssertLogRelMsg1(pszExpr, iLine, pszFile, pszFunction) \ 706 759 LogRel(("AssertLogRel %s(%d) %s: %s\n",\ 707 760 (pszFile), (iLine), (pszFunction), (pszExpr) )) 708 761 #endif 709 762 710 /** @def AssertLogRelMsg2763 /** @def RTAssertLogRelMsg2 711 764 * AssertMsg2 (strict builds) / LogRel wrapper (non-strict). 712 765 */ 713 766 #ifdef RT_STRICT 714 # define AssertLogRelMsg2(a)AssertMsg2 a715 #else 716 # define AssertLogRelMsg2(a)LogRel(a)767 # define RTAssertLogRelMsg2(a) AssertMsg2 a 768 #else 769 # define RTAssertLogRelMsg2(a) LogRel(a) 717 770 #endif 718 771 … … 727 780 if (RT_UNLIKELY(!(expr))) \ 728 781 { \ 729 AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \730 AssertLogRelBreakpoint(); \782 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 783 RTAssertPanic(); \ 731 784 } \ 732 785 } while (0) … … 743 796 if (RT_UNLIKELY(!(expr))) \ 744 797 { \ 745 AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \746 AssertLogRelBreakpoint(); \798 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 799 RTAssertPanic(); \ 747 800 return (rc); \ 748 801 } \ … … 759 812 if (RT_UNLIKELY(!(expr))) \ 760 813 { \ 761 AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \762 AssertLogRelBreakpoint(); \814 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 815 RTAssertPanic(); \ 763 816 return; \ 764 817 } \ … … 774 827 if (RT_UNLIKELY(!(expr))) \ 775 828 { \ 776 AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \777 AssertLogRelBreakpoint(); \829 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 830 RTAssertPanic(); \ 778 831 break; \ 779 832 } \ … … 790 843 if (RT_UNLIKELY(!(expr))) \ 791 844 { \ 792 AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \793 AssertLogRelBreakpoint(); \845 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 846 RTAssertPanic(); \ 794 847 stmt; \ 795 848 break; \ … … 807 860 if (RT_UNLIKELY(!(expr))) \ 808 861 { \ 809 AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \810 AssertLogRelMsg2(a); \811 AssertLogRelBreakpoint(); \862 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 863 RTAssertLogRelMsg2(a); \ 864 RTAssertPanic(); \ 812 865 } \ 813 866 } while (0) … … 825 878 if (RT_UNLIKELY(!(expr))) \ 826 879 { \ 827 AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \828 AssertLogRelMsg2(a); \829 AssertLogRelBreakpoint(); \880 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 881 RTAssertLogRelMsg2(a); \ 882 RTAssertPanic(); \ 830 883 return (rc); \ 831 884 } \ … … 843 896 if (RT_UNLIKELY(!(expr))) \ 844 897 { \ 845 AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \846 AssertLogRelMsg2(a); \847 AssertLogRelBreakpoint(); \898 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 899 RTAssertLogRelMsg2(a); \ 900 RTAssertPanic(); \ 848 901 return; \ 849 902 } \ … … 860 913 if (RT_UNLIKELY(!(expr))) \ 861 914 { \ 862 AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \863 AssertLogRelMsg2(a); \864 AssertLogRelBreakpoint(); \915 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 916 RTAssertLogRelMsg2(a); \ 917 RTAssertPanic(); \ 865 918 break; \ 866 919 } \ … … 878 931 if (RT_UNLIKELY(!(expr))) \ 879 932 { \ 880 AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \881 AssertLogRelMsg2(a); \882 AssertLogRelBreakpoint(); \933 RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 934 RTAssertLogRelMsg2(a); \ 935 RTAssertPanic(); \ 883 936 stmt; \ 884 937 break; \ … … 891 944 #define AssertLogRelFailed() \ 892 945 do { \ 893 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \894 AssertLogRelBreakpoint(); \946 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 947 RTAssertPanic(); \ 895 948 } while (0) 896 949 … … 903 956 #define AssertLogRelFailedReturn(rc) \ 904 957 do { \ 905 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \906 AssertLogRelBreakpoint(); \958 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 959 RTAssertPanic(); \ 907 960 return (rc); \ 908 961 } while (0) … … 914 967 #define AssertLogRelFailedReturnVoid() \ 915 968 do { \ 916 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \917 AssertLogRelBreakpoint(); \969 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 970 RTAssertPanic(); \ 918 971 return; \ 919 972 } while (0) … … 926 979 if (1) \ 927 980 { \ 928 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \929 AssertLogRelBreakpoint(); \981 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 982 RTAssertPanic(); \ 930 983 break; \ 931 984 } else do {} while (0) … … 940 993 if (1) \ 941 994 { \ 942 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \943 AssertLogRelBreakpoint(); \995 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 996 RTAssertPanic(); \ 944 997 stmt; \ 945 998 break; \ … … 954 1007 #define AssertLogRelMsgFailed(a) \ 955 1008 do { \ 956 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \957 AssertLogRelMsg2(a); \958 AssertLogRelBreakpoint(); \1009 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1010 RTAssertLogRelMsg2(a); \ 1011 RTAssertPanic(); \ 959 1012 } while (0) 960 1013 … … 968 1021 #define AssertLogRelMsgFailedReturn(a, rc) \ 969 1022 do { \ 970 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \971 AssertLogRelMsg2(a); \972 AssertLogRelBreakpoint(); \1023 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1024 RTAssertLogRelMsg2(a); \ 1025 RTAssertPanic(); \ 973 1026 return (rc); \ 974 1027 } while (0) … … 982 1035 #define AssertLogRelMsgFailedReturnVoid(a) \ 983 1036 do { \ 984 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \985 AssertLogRelMsg2(a); \986 AssertLogRelBreakpoint(); \1037 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1038 RTAssertLogRelMsg2(a); \ 1039 RTAssertPanic(); \ 987 1040 return; \ 988 1041 } while (0) … … 997 1050 if (1)\ 998 1051 { \ 999 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \1000 AssertLogRelMsg2(a); \1001 AssertLogRelBreakpoint(); \1052 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1053 RTAssertLogRelMsg2(a); \ 1054 RTAssertPanic(); \ 1002 1055 break; \ 1003 1056 } else do {} while (0) … … 1013 1066 if (1) \ 1014 1067 { \ 1015 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \1016 AssertLogRelMsg2(a); \1017 AssertLogRelBreakpoint(); \1068 RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1069 RTAssertLogRelMsg2(a); \ 1070 RTAssertPanic(); \ 1018 1071 stmt; \ 1019 1072 break; \ 1020 1073 } else do {} while (0) 1021 1074 1022 1023 1024 /** @def AssertReleaseBreakpoint() 1025 * Assertion Breakpoint. 1026 * 1027 * @remark In the gnu world we add a nop instruction after the int3 to 1028 * force gdb to remain at the int3 source line. 1029 * @remark The L4 kernel will try make sense of the breakpoint, thus the jmp. 1030 */ 1031 #ifdef __GNUC__ 1032 # ifndef __L4ENV__ 1033 # define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3\n\tnop"); } while (0) 1034 # else 1035 # define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3; jmp 1f; 1:"); } while (0) 1036 # endif 1037 #elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING) 1038 # define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __debugbreak(); } while (0) 1039 #else 1040 # error "Unknown compiler" 1041 #endif 1075 /** @} */ 1076 1077 1078 1079 /** @name Release Asserions 1080 * 1081 * These assertions are always enabled. 1082 * @{ 1083 */ 1084 1085 /** @def RTAssertReleasePanic() 1086 * Invokes RTAssertShouldPanic and RTAssertDoPanic. 1087 * 1088 * It might seem odd that RTAssertShouldPanic is necessary when its result isn't 1089 * checked, but it's done since RTAssertShouldPanic is overrideable and might be 1090 * used to bail out before taking down the system (the VMMR0 case). 1091 */ 1092 #define RTAssertReleasePanic() do { RTAssertShouldPanic(); RTAssertDoPanic(); } while (0) 1042 1093 1043 1094 … … 1052 1103 { \ 1053 1104 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1054 AssertReleaseBreakpoint(); \1105 RTAssertReleasePanic(); \ 1055 1106 } \ 1056 1107 } while (0) … … 1067 1118 { \ 1068 1119 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1069 AssertReleaseBreakpoint(); \1120 RTAssertReleasePanic(); \ 1070 1121 return (rc); \ 1071 1122 } \ … … 1082 1133 { \ 1083 1134 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1084 AssertReleaseBreakpoint(); \1135 RTAssertReleasePanic(); \ 1085 1136 return; \ 1086 1137 } \ … … 1098 1149 { \ 1099 1150 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1100 AssertReleaseBreakpoint(); \1151 RTAssertReleasePanic(); \ 1101 1152 break; \ 1102 1153 } \ … … 1113 1164 { \ 1114 1165 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1115 AssertReleaseBreakpoint(); \1166 RTAssertReleasePanic(); \ 1116 1167 stmt; \ 1117 1168 break; \ … … 1131 1182 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1132 1183 AssertMsg2 a; \ 1133 AssertReleaseBreakpoint(); \1184 RTAssertReleasePanic(); \ 1134 1185 } \ 1135 1186 } while (0) … … 1148 1199 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1149 1200 AssertMsg2 a; \ 1150 AssertReleaseBreakpoint(); \1201 RTAssertReleasePanic(); \ 1151 1202 return (rc); \ 1152 1203 } \ … … 1165 1216 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1166 1217 AssertMsg2 a; \ 1167 AssertReleaseBreakpoint(); \1218 RTAssertReleasePanic(); \ 1168 1219 return; \ 1169 1220 } \ … … 1182 1233 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1183 1234 AssertMsg2 a; \ 1184 AssertReleaseBreakpoint(); \1235 RTAssertReleasePanic(); \ 1185 1236 break; \ 1186 1237 } else do {} while (0) … … 1197 1248 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1198 1249 AssertMsg2 a; \ 1199 AssertReleaseBreakpoint(); \1250 RTAssertReleasePanic(); \ 1200 1251 stmt; \ 1201 1252 break; \ … … 1209 1260 do { \ 1210 1261 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1211 AssertReleaseBreakpoint(); \1262 RTAssertReleasePanic(); \ 1212 1263 } while (0) 1213 1264 … … 1220 1271 do { \ 1221 1272 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1222 AssertReleaseBreakpoint(); \1273 RTAssertReleasePanic(); \ 1223 1274 return (rc); \ 1224 1275 } while (0) … … 1230 1281 do { \ 1231 1282 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1232 AssertReleaseBreakpoint(); \1283 RTAssertReleasePanic(); \ 1233 1284 return; \ 1234 1285 } while (0) … … 1241 1292 if (1) { \ 1242 1293 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1243 AssertReleaseBreakpoint(); \1294 RTAssertReleasePanic(); \ 1244 1295 break; \ 1245 1296 } else do {} while (0) … … 1253 1304 if (1) { \ 1254 1305 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1255 AssertReleaseBreakpoint(); \1306 RTAssertReleasePanic(); \ 1256 1307 stmt; \ 1257 1308 break; \ … … 1268 1319 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1269 1320 AssertMsg2 a; \ 1270 AssertReleaseBreakpoint(); \1321 RTAssertReleasePanic(); \ 1271 1322 } while (0) 1272 1323 … … 1281 1332 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1282 1333 AssertMsg2 a; \ 1283 AssertReleaseBreakpoint(); \1334 RTAssertReleasePanic(); \ 1284 1335 return (rc); \ 1285 1336 } while (0) … … 1294 1345 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1295 1346 AssertMsg2 a; \ 1296 AssertReleaseBreakpoint(); \1347 RTAssertReleasePanic(); \ 1297 1348 return; \ 1298 1349 } while (0) … … 1308 1359 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1309 1360 AssertMsg2 a; \ 1310 AssertReleaseBreakpoint(); \1361 RTAssertReleasePanic(); \ 1311 1362 break; \ 1312 1363 } else do {} while (0) … … 1322 1373 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1323 1374 AssertMsg2 a; \ 1324 AssertReleaseBreakpoint(); \1375 RTAssertReleasePanic(); \ 1325 1376 stmt; \ 1326 1377 break; \ 1327 1378 } else do {} while (0) 1328 1379 1380 /** @} */ 1381 1382 1383 1384 /** @name Fatal Assertions 1385 * These are similar to release assertions except that you cannot ignore them in 1386 * any way, they will loop for ever if RTAssertDoPanic returns. 1387 * 1388 * @{ 1389 */ 1329 1390 1330 1391 /** @def AssertFatal … … 1339 1400 { \ 1340 1401 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1341 AssertReleaseBreakpoint(); \1402 RTAssertReleasePanic(); \ 1342 1403 } \ 1343 1404 } while (0) … … 1356 1417 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1357 1418 AssertMsg2 a; \ 1358 AssertReleaseBreakpoint(); \1419 RTAssertReleasePanic(); \ 1359 1420 } \ 1360 1421 } while (0) … … 1368 1429 { \ 1369 1430 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1370 AssertReleaseBreakpoint(); \1431 RTAssertReleasePanic(); \ 1371 1432 } \ 1372 1433 } while (0) … … 1383 1444 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 1384 1445 AssertMsg2 a; \ 1385 AssertReleaseBreakpoint(); \1446 RTAssertReleasePanic(); \ 1386 1447 } \ 1387 1448 } while (0) 1388 1449 1450 /** @} */ 1451 1452 1453 1454 /** @name Convenience Assertions Macros 1455 * @{ 1456 */ 1389 1457 1390 1458 /** @def AssertRC … … 1958 2026 #define AssertGCPhys32(GCPhys) AssertMsg(VALID_PHYS32(GCPhys), ("%RGp\n", (RTGCPHYS)(GCPhys))) 1959 2027 1960 1961 2028 /** @} */ 1962 2029 1963 #endif 1964 2030 /** @} */ 2031 2032 #endif 2033 trunk/src/VBox/HostDrivers/Support/linux/Makefile
r13000 r13306 90 90 r0drv/linux/time-r0drv-linux.o \ 91 91 r0drv/linux/timer-r0drv-linux.o \ 92 common/err/RTErrConvertFromErrno.o 92 common/err/RTErrConvertFromErrno.o \ 93 generic/RTAssertShouldPanic-generic.o 93 94 ifeq ($(BUILD_TARGET_ARCH),x86) 94 95 OBJS += math/gcc/divdi3.o \ … … 237 238 238 239 # By default we use remap_pfn_range() kernel API to make kernel pages 239 # visible for userland. Unfortuately, it leads to situation that 240 # during debug session all structures on that page (such as PVM pointer) 241 # are not accessible to the debugger (see #3214). 242 # This code enables experimental support 240 # visible for userland. Unfortuately, it leads to situation that 241 # during debug session all structures on that page (such as PVM pointer) 242 # are not accessible to the debugger (see #3214). 243 # This code enables experimental support 243 244 # for vm_insert_page() kernel API, allowing to export kernel pages 244 # to the userland in more debugger-friendly way. Due to stability 245 # to the userland in more debugger-friendly way. Due to stability 245 246 # concerns, not enabled by default yet. 246 247 ifdef VBOX_USE_INSERT_PAGE trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r12360 r13306 946 946 947 947 /** @todo move to IPRT! */ 948 RTDECL(bool) RTAssertDoBreakpoint(void)949 {950 return true;951 }952 953 954 /** @todo move to IPRT! */955 948 RTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) 956 949 { trunk/src/VBox/HostDrivers/Support/linux/files_vboxdrv
r12099 r13306 89 89 ${PATH_ROOT}/src/VBox/Runtime/include/internal/string.h=>include/internal/string.h \ 90 90 ${PATH_ROOT}/src/VBox/Runtime/include/internal/thread.h=>include/internal/thread.h \ 91 ${PATH_ROOT}/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp=>generic/RTAssertShouldPanic-generic.c \ 91 92 ${PATH_ROOT}/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp=>generic/RTLogWriteStdErr-stub-generic.c \ 92 93 ${PATH_ROOT}/src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp=>generic/RTLogWriteStdOut-stub-generic.c \ trunk/src/VBox/Runtime/Makefile.kmk
r13300 r13306 282 282 RuntimeR3_SOURCES += \ 283 283 VBox/strformat-vbox.cpp \ 284 VBox/RTAssert DoBreakpoint-vbox.cpp \284 VBox/RTAssertShouldPanic-vbox.cpp \ 285 285 VBox/log-vbox.cpp 286 286 ifneq ($(KBUILD_TARGET),win) … … 650 650 common/string/utf-16.cpp \ 651 651 generic/pathhost-generic.cpp \ 652 generic/RTAssert DoBreakpoint-generic.cpp \652 generic/RTAssertShouldPanic-generic.cpp \ 653 653 r3/alloc.cpp \ 654 654 r3/fileio.cpp \ … … 873 873 common/table/avlu32.cpp \ 874 874 common/time/timesup.cpp \ 875 generic/RTAssert DoBreakpoint-generic.cpp \875 generic/RTAssertShouldPanic-generic.cpp \ 876 876 VBox/strformat-vbox.cpp 877 877 … … 973 973 common/string/strpbrk.cpp \ 974 974 common/err/RTErrConvertToErrno.cpp \ 975 generic/RTAssert DoBreakpoint-generic.cpp \975 generic/RTAssertShouldPanic-generic.cpp \ 976 976 generic/RTLogWriteStdOut-stub-generic.cpp \ 977 977 generic/mppresent-generic.cpp \ … … 1007 1007 common/string/strncmp.cpp \ 1008 1008 common/string/strpbrk.cpp \ 1009 generic/RTAssert DoBreakpoint-generic.cpp \1009 generic/RTAssertShouldPanic-generic.cpp \ 1010 1010 generic/RTLogWriteStdOut-stub-generic.cpp \ 1011 1011 generic/mppresent-generic.cpp \ … … 1042 1042 darwin/RTErrConvertFromDarwinIO.cpp \ 1043 1043 darwin/RTErrConvertFromDarwinKern.cpp \ 1044 generic/RTAssert DoBreakpoint-generic.cpp \1044 generic/RTAssertShouldPanic-generic.cpp \ 1045 1045 generic/RTMpCpuId-generic.cpp \ 1046 1046 generic/RTMpCpuIdFromSetIndex-generic.cpp \ … … 1120 1120 r0drv/os2/os2imports.imp \ 1121 1121 r0drv/os2/process-r0drv-os2.cpp \ 1122 r0drv/os2/RT AssertDoBreakpoint-r0drv-os2.asm \1122 r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm \ 1123 1123 r0drv/os2/RTR0Os2DHQueryDOSVar.asm \ 1124 1124 r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm \ … … 1142 1142 common/string/memcmp.asm \ 1143 1143 common/string/strchr.asm \ 1144 generic/RTAssert DoBreakpoint-generic.cpp \1144 generic/RTAssertShouldPanic-generic.cpp \ 1145 1145 generic/RTLogWriteDebugger-generic.cpp \ 1146 1146 generic/RTLogWriteStdOut-stub-generic.cpp \ … … 1181 1181 common/misc/thread.cpp \ 1182 1182 common/string/memchr.asm \ 1183 generic/RTAssert DoBreakpoint-generic.cpp \1183 generic/RTAssertShouldPanic-generic.cpp \ 1184 1184 generic/RTLogWriteStdOut-stub-generic.cpp \ 1185 1185 generic/RTTimerCreate-g

