| ... | @@ -2858,6 +2858,16 @@ pub const SafetyLock = struct { | ... | @@ -2858,6 +2858,16 @@ pub const SafetyLock = struct { |
| 2858 | } | 2858 | } |
| 2859 | }; | 2859 | }; |
| 2860 | | 2860 | |
| | 2861 | /// Detect whether the program is being executed in the Valgrind virtual machine. |
| | 2862 | /// |
| | 2863 | /// When Valgrind integrations are disabled, this returns comptime-known false. |
| | 2864 | /// Otherwise, the result is runtime-known. |
| | 2865 | pub inline fn inValgrind() bool { |
| | 2866 | if (@inComptime()) return false; |
| | 2867 | if (!builtin.valgrind_support) return false; |
| | 2868 | return std.valgrind.runningOnValgrind() > 0; |
| | 2869 | } |
| | 2870 | |
| 2861 | test { | 2871 | test { |
| 2862 | _ = &dump_hex; | 2872 | _ = &dump_hex; |
| 2863 | } | 2873 | } |