Changeset 295661 in webkit for trunk/Source/JavaScriptCore/tools/Integrity.cpp
- Timestamp:
- Jun 18, 2022, 9:13:05 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/tools/Integrity.cpp
r295660 r295661 35 35 #include "Options.h" 36 36 #include "VMInspectorInlines.h" 37 #include <wtf/DataLog.h> 38 #include <wtf/OSLogPrintStream.h> 37 39 38 40 namespace JSC { … … 41 43 namespace IntegrityInternal { 42 44 static constexpr bool verbose = false; 45 } 46 47 PrintStream& logFile() 48 { 49 #if OS(DARWIN) 50 static PrintStream* s_file; 51 static std::once_flag once; 52 std::call_once(once, [] { 53 // We want to use OS_LOG_TYPE_ERROR because we want to guarantee that the log makes it into 54 // the file system, and is not potentially stuck in some memory buffer. Integrity audit logs 55 // are used for debugging error states. So, this is an appropriate use of OS_LOG_TYPE_ERROR. 56 s_file = OSLogPrintStream::open("com.apple.JavaScriptCore", "Integrity", OS_LOG_TYPE_ERROR).release(); 57 }); 58 return *s_file; 59 #else 60 return WTF::dataFile(); 61 #endif 62 } 63 64 void logF(const char* format, ...) 65 { 66 va_list argList; 67 va_start(argList, format); 68 logFile().vprintf(format, argList); 69 va_end(argList); 70 } 71 72 void logLnF(const char* format, ...) 73 { 74 va_list argList; 75 va_start(argList, format); 76 logFile().vprintf(format, argList); 77 va_end(argList); 78 logFile().println(); 43 79 } 44 80 … … 141 177 #define AUDIT_VERIFY(cond, format, ...) do { \ 142 178 IA_ASSERT_WITH_ACTION(cond, { \ 143 WTFLogAlways(" cell %p", cell); \179 Integrity::logLnF(" cell %p", cell); \ 144 180 if (action == Action::LogAndCrash) \ 145 RELEASE_ASSERT((cond) , ##__VA_ARGS__); \181 RELEASE_ASSERT((cond)); \ 146 182 else \ 147 183 return false; \ 148 } , format, ##__VA_ARGS__); \184 }); \ 149 185 } while (false) 150 186 … … 153 189 #define AUDIT_VERIFY(cond, format, ...) do { \ 154 190 IA_ASSERT_WITH_ACTION(cond, { \ 155 WTFLogAlways(" cell %p", cell); \191 Integrity::logLnF(" cell %p", cell); \ 156 192 if (action == Action::LogAndCrash) \ 157 193 RELEASE_ASSERT((cond) __VA_OPT__(,) __VA_ARGS__); \ … … 291 327 { 292 328 bool valid = Analyzer::analyzeCell(cell, Analyzer::Action::LogOnly); 293 WTFLogAlways("Cell %p is %s", cell, valid ? "VALID" : "INVALID");329 Integrity::logLnF("Cell %p is %s", cell, valid ? "VALID" : "INVALID"); 294 330 return valid; 295 331 } … … 298 334 { 299 335 bool valid = Analyzer::analyzeCell(vm, cell, Analyzer::Action::LogOnly); 300 WTFLogAlways("Cell %p is %s", cell, valid ? "VALID" : "INVALID");336 Integrity::logLnF("Cell %p is %s", cell, valid ? "VALID" : "INVALID"); 301 337 return valid; 302 338 }
Note:
See TracChangeset
for help on using the changeset viewer.