Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | * Header file of Pure API function declarations. |
michael@0 | 3 | * |
michael@0 | 4 | * Explicitly no copyright. |
michael@0 | 5 | * You may recompile and redistribute these definitions as required. |
michael@0 | 6 | * |
michael@0 | 7 | * NOTE1: In some situations when compiling with MFC, you should |
michael@0 | 8 | * enable the setting 'Not using precompiled headers' in Visual C++ |
michael@0 | 9 | * to avoid a compiler diagnostic. |
michael@0 | 10 | * |
michael@0 | 11 | * NOTE2: This file works through the use of deep magic. Calls to functions |
michael@0 | 12 | * in this file are replaced with calls into the OCI runtime system |
michael@0 | 13 | * when an instrumented version of this program is run. |
michael@0 | 14 | * |
michael@0 | 15 | * NOTE3: The static vars avoidGy_n (where n is a unique number) are used |
michael@0 | 16 | * to prevent optimizing the functions away when compiler option |
michael@0 | 17 | * /Gy is set. This is needed so that NOTE2 works properly. |
michael@0 | 18 | */ |
michael@0 | 19 | |
michael@0 | 20 | // Chromium note: We used to only compile this code if PURIFY was defined, |
michael@0 | 21 | // because we did special builds with all optimizations turned off for Purify. |
michael@0 | 22 | // However, for profiling with Quantify, we want most/all optimizations turned |
michael@0 | 23 | // on so that we measure something closer to real execution. |
michael@0 | 24 | |
michael@0 | 25 | #ifdef _WINDOWS // we only use Purify/Quantify on Windows |
michael@0 | 26 | |
michael@0 | 27 | #pragma once |
michael@0 | 28 | extern int errno; |
michael@0 | 29 | typedef int ptrdiff_t; |
michael@0 | 30 | typedef unsigned int size_t; |
michael@0 | 31 | typedef unsigned short wchar_t; |
michael@0 | 32 | static int avoidGy_1 = 0; |
michael@0 | 33 | static int avoidGy_2 = 0; |
michael@0 | 34 | static int avoidGy_3 = 0; |
michael@0 | 35 | static int avoidGy_4 = 0; |
michael@0 | 36 | static int avoidGy_5 = 0; |
michael@0 | 37 | static int avoidGy_6 = 0; |
michael@0 | 38 | static int avoidGy_7 = 0; |
michael@0 | 39 | static int avoidGy_8 = 0; |
michael@0 | 40 | static int avoidGy_9 = 0; |
michael@0 | 41 | static int avoidGy_10 = 0; |
michael@0 | 42 | static int avoidGy_11 = 0; |
michael@0 | 43 | static int avoidGy_12 = 0; |
michael@0 | 44 | static int avoidGy_13 = 0; |
michael@0 | 45 | static int avoidGy_14 = 0; |
michael@0 | 46 | static int avoidGy_15 = 0; |
michael@0 | 47 | static int avoidGy_16 = 0; |
michael@0 | 48 | static int avoidGy_17 = 0; |
michael@0 | 49 | static int avoidGy_18 = 0; |
michael@0 | 50 | static int avoidGy_19 = 0; |
michael@0 | 51 | static int avoidGy_20 = 0; |
michael@0 | 52 | static int avoidGy_21 = 0; |
michael@0 | 53 | static int avoidGy_22 = 0; |
michael@0 | 54 | static int avoidGy_23 = 0; |
michael@0 | 55 | static int avoidGy_24 = 0; |
michael@0 | 56 | static int avoidGy_25 = 0; |
michael@0 | 57 | static int avoidGy_26 = 0; |
michael@0 | 58 | static int avoidGy_27 = 0; |
michael@0 | 59 | static int avoidGy_28 = 0; |
michael@0 | 60 | static int avoidGy_29 = 0; |
michael@0 | 61 | static int avoidGy_30 = 0; |
michael@0 | 62 | static int avoidGy_31 = 0; |
michael@0 | 63 | static int avoidGy_32 = 0; |
michael@0 | 64 | static int avoidGy_33 = 0; |
michael@0 | 65 | static int avoidGy_34 = 0; |
michael@0 | 66 | static int avoidGy_35 = 0; |
michael@0 | 67 | static int avoidGy_36 = 0; |
michael@0 | 68 | static int avoidGy_37 = 0; |
michael@0 | 69 | static int avoidGy_38 = 0; |
michael@0 | 70 | static int avoidGy_39 = 0; |
michael@0 | 71 | static int avoidGy_40 = 0; |
michael@0 | 72 | static int avoidGy_41 = 0; |
michael@0 | 73 | static int avoidGy_42 = 0; |
michael@0 | 74 | static int avoidGy_43 = 0; |
michael@0 | 75 | static int avoidGy_44 = 0; |
michael@0 | 76 | static int avoidGy_45 = 0; |
michael@0 | 77 | static int avoidGy_46 = 0; |
michael@0 | 78 | static int avoidGy_47 = 0; |
michael@0 | 79 | static int avoidGy_48 = 0; |
michael@0 | 80 | static int avoidGy_49 = 0; |
michael@0 | 81 | static int avoidGy_50 = 0; |
michael@0 | 82 | static int avoidGy_51 = 0; |
michael@0 | 83 | static int avoidGy_52 = 0; |
michael@0 | 84 | static int avoidGy_53 = 0; |
michael@0 | 85 | static int avoidGy_54 = 0; |
michael@0 | 86 | static int avoidGy_55 = 0; |
michael@0 | 87 | static int avoidGy_56 = 0; |
michael@0 | 88 | static int avoidGy_57 = 0; |
michael@0 | 89 | static int avoidGy_58 = 0; |
michael@0 | 90 | static int avoidGy_59 = 0; |
michael@0 | 91 | static int avoidGy_60 = 0; |
michael@0 | 92 | static int avoidGy_61 = 0; |
michael@0 | 93 | static int avoidGy_62 = 0; |
michael@0 | 94 | static int avoidGy_63 = 0; |
michael@0 | 95 | static int avoidGy_64 = 0; |
michael@0 | 96 | static int avoidGy_65 = 0; |
michael@0 | 97 | static int avoidGy_PL_01 = 0; |
michael@0 | 98 | static int avoidGy_PL_02 = 0; |
michael@0 | 99 | __declspec(dllexport) int __cdecl PurePrintf(const char *fmt, ...) { if(!++avoidGy_1); fmt; return 0; } |
michael@0 | 100 | __declspec(dllexport) int __cdecl PurifyIsRunning(void) { if(!++avoidGy_2); return 0; } |
michael@0 | 101 | __declspec(dllexport) int __cdecl PurifyPrintf(const char *fmt, ...) { if(!++avoidGy_3); fmt; return 0; } |
michael@0 | 102 | __declspec(dllexport) size_t __cdecl PurifyNewInuse(void) { if(!++avoidGy_4); return 0; } |
michael@0 | 103 | __declspec(dllexport) size_t __cdecl PurifyAllInuse(void) { if(!++avoidGy_5); return 0; } |
michael@0 | 104 | __declspec(dllexport) size_t __cdecl PurifyClearInuse(void) { if(!++avoidGy_6); return 0; } |
michael@0 | 105 | __declspec(dllexport) size_t __cdecl PurifyNewLeaks(void) { if(!++avoidGy_7); return 0; } |
michael@0 | 106 | __declspec(dllexport) size_t __cdecl PurifyAllLeaks(void) { if(!++avoidGy_8); return 0; } |
michael@0 | 107 | __declspec(dllexport) size_t __cdecl PurifyClearLeaks(void) { if(!++avoidGy_9); return 0; } |
michael@0 | 108 | __declspec(dllexport) size_t __cdecl PurifyAllHandlesInuse(void) { if(!++avoidGy_10); return 0; } |
michael@0 | 109 | __declspec(dllexport) size_t __cdecl PurifyNewHandlesInuse(void) { if(!++avoidGy_11); return 0; } |
michael@0 | 110 | __declspec(dllexport) size_t __cdecl PurifyDescribe(void *addr) { if(!++avoidGy_12); addr; return 0; } |
michael@0 | 111 | __declspec(dllexport) int __cdecl PurifyWhatColors(void *addr, size_t size) { if(!++avoidGy_13); addr; size; return 0; } |
michael@0 | 112 | __declspec(dllexport) int __cdecl PurifyAssertIsReadable(const void *addr, size_t size) { if(!++avoidGy_14); addr; size; return 1; } |
michael@0 | 113 | __declspec(dllexport) int __cdecl PurifyAssertIsWritable(const void *addr, size_t size) { if(!++avoidGy_15); addr; size; return 1; } |
michael@0 | 114 | __declspec(dllexport) int __cdecl PurifyIsReadable(const void *addr, size_t size) { if(!++avoidGy_16); addr; size; return 1; } |
michael@0 | 115 | __declspec(dllexport) int __cdecl PurifyIsWritable(const void *addr, size_t size) { if(!++avoidGy_17); addr; size; return 1; } |
michael@0 | 116 | __declspec(dllexport) int __cdecl PurifyIsInitialized(const void *addr, size_t size) { if(!++avoidGy_18); addr; size; return 1; } |
michael@0 | 117 | __declspec(dllexport) int __cdecl PurifyRed(void *addr, size_t size) { if(!++avoidGy_19); addr; size; return 0; } |
michael@0 | 118 | __declspec(dllexport) int __cdecl PurifyGreen(void *addr, size_t size) { if(!++avoidGy_20); addr; size; return 0; } |
michael@0 | 119 | __declspec(dllexport) int __cdecl PurifyYellow(void *addr, size_t size) { if(!++avoidGy_21); addr; size; return 0; } |
michael@0 | 120 | __declspec(dllexport) int __cdecl PurifyBlue(void *addr, size_t size) { if(!++avoidGy_22); addr; size; return 0; } |
michael@0 | 121 | __declspec(dllexport) int __cdecl PurifyMarkAsInitialized(void *addr, size_t size) { if(!++avoidGy_23); addr; size; return 0; } |
michael@0 | 122 | __declspec(dllexport) int __cdecl PurifyMarkAsUninitialized(void *addr, size_t size) { if(!++avoidGy_24); addr; size; return 0; } |
michael@0 | 123 | __declspec(dllexport) int __cdecl PurifyMarkForTrap(void *addr, size_t size) { if(!++avoidGy_25); addr; size; return 0; } |
michael@0 | 124 | __declspec(dllexport) int __cdecl PurifyMarkForNoTrap(void *addr, size_t size) { if(!++avoidGy_26); addr; size; return 0; } |
michael@0 | 125 | __declspec(dllexport) int __cdecl PurifyHeapValidate(unsigned int hHeap, unsigned int dwFlags, const void *addr) |
michael@0 | 126 | { if(!++avoidGy_27); hHeap; dwFlags; addr; return 1; } |
michael@0 | 127 | __declspec(dllexport) int __cdecl PurifySetLateDetectScanCounter(int counter) { if(!++avoidGy_28); counter; return 0; }; |
michael@0 | 128 | __declspec(dllexport) int __cdecl PurifySetLateDetectScanInterval(int seconds) { if(!++avoidGy_29); seconds; return 0; }; |
michael@0 | 129 | __declspec(dllexport) void __cdecl PurifySetPoolId(const void *mem, int id) { if(!++avoidGy_61); mem; id; return; }; |
michael@0 | 130 | __declspec(dllexport) int __cdecl PurifyGetPoolId(const void *mem) { if(!++avoidGy_62); mem; return 0; }; |
michael@0 | 131 | __declspec(dllexport) void __cdecl PurifySetUserData(const void *mem, void *data) { if(!++avoidGy_63); mem; data; return; }; |
michael@0 | 132 | __declspec(dllexport) void * __cdecl PurifyGetUserData(const void *mem) { if(!++avoidGy_64); mem; return 0; }; |
michael@0 | 133 | __declspec(dllexport) void __cdecl PurifyMapPool(int id, void(*fn)()) { if(!++avoidGy_65); id; fn; return; }; |
michael@0 | 134 | __declspec(dllexport) int __cdecl CoverageIsRunning(void) { if(!++avoidGy_30); return 0; } |
michael@0 | 135 | __declspec(dllexport) int __cdecl CoverageDisableRecordingData(void) { if(!++avoidGy_31); return 0; } |
michael@0 | 136 | __declspec(dllexport) int __cdecl CoverageStartRecordingData(void) { if(!++avoidGy_32); return 0; } |
michael@0 | 137 | __declspec(dllexport) int __cdecl CoverageStopRecordingData(void) { if(!++avoidGy_33); return 0; } |
michael@0 | 138 | __declspec(dllexport) int __cdecl CoverageClearData(void) { if(!++avoidGy_34); return 0; } |
michael@0 | 139 | __declspec(dllexport) int __cdecl CoverageIsRecordingData(void) { if(!++avoidGy_35); return 0; } |
michael@0 | 140 | __declspec(dllexport) int __cdecl CoverageAddAnnotation(char *str) { if(!++avoidGy_36); str; return 0; } |
michael@0 | 141 | __declspec(dllexport) int __cdecl CoverageSaveData(void) { if(!++avoidGy_37); return 0; } |
michael@0 | 142 | __declspec(dllexport) int __cdecl QuantifyIsRunning(void) { if(!++avoidGy_42); return 0; } |
michael@0 | 143 | __declspec(dllexport) int __cdecl QuantifyDisableRecordingData(void) { if(!++avoidGy_43); return 0; } |
michael@0 | 144 | __declspec(dllexport) int __cdecl QuantifyStartRecordingData(void) { if(!++avoidGy_44); return 0; } |
michael@0 | 145 | __declspec(dllexport) int __cdecl QuantifyStopRecordingData(void) { if(!++avoidGy_45); return 0; } |
michael@0 | 146 | __declspec(dllexport) int __cdecl QuantifyClearData(void) { if(!++avoidGy_46); return 0; } |
michael@0 | 147 | __declspec(dllexport) int __cdecl QuantifyIsRecordingData(void) { if(!++avoidGy_47); return 0; } |
michael@0 | 148 | __declspec(dllexport) int __cdecl QuantifyAddAnnotation(char *str) { if(!++avoidGy_48); str; return 0; } |
michael@0 | 149 | __declspec(dllexport) int __cdecl QuantifySaveData(void) { if(!++avoidGy_49); return 0; } |
michael@0 | 150 | __declspec(dllexport) int __cdecl QuantifySetThreadName(const char *szName) { if(!++avoidGy_50) ; szName; return 0; } |
michael@0 | 151 | |
michael@0 | 152 | #endif // _WINDOWS |