1 //===-- size_map_gen.cpp --------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "allocator_config.h" 10 #include "libsize_map_verify.h" 11 #include "size_class_map.h" 12 #include <iostream> 13 main()14int main() { 15 bool fullyPassed = true; 16 std::string NumBitsMessage; 17 std::string verifySizeMessage; 18 std::string optimizeMessage; 19 std::string dumpMessage; 20 21 fullyPassed = fullyPassed && 22 scudo::generateNumBits<scudo::AndroidNormalSizeClassConfig>( 23 NumBitsMessage); 24 fullyPassed = fullyPassed && 25 scudo::verifySizeClass<scudo::AndroidNormalSizeClassConfig>( 26 verifySizeMessage); 27 scudo::optimizeMidSizeLog<scudo::AndroidNormalSizeClassConfig>( 28 optimizeMessage); 29 scudo::dumpszTableInfo<scudo::AndroidNormalSizeClassConfig>(dumpMessage); 30 31 if (!NumBitsMessage.empty()) { 32 std::cout << "NumBits Calculator:" << std::endl; 33 std::cout << NumBitsMessage << std::endl; 34 } 35 if (!verifySizeMessage.empty()) { 36 std::cout << "Sizes Verification:" << std::endl; 37 std::cout << verifySizeMessage << std::endl; 38 } 39 if (!verifySizeMessage.empty()) { 40 std::cout << "Optimizations:" << std::endl; 41 std::cout << optimizeMessage << std::endl; 42 } 43 if (!verifySizeMessage.empty()) { 44 std::cout << "szTable Dump:" << std::endl; 45 std::cout << dumpMessage << std::endl; 46 } 47 48 if (fullyPassed == true) 49 std::cout << "All Parameters Passed.\n\n"; 50 else 51 std::cout << "Errors Detected. Check NumBits Calculator or Size " 52 "Verification\n\n"; 53 54 scudo::validateMap<scudo::AndroidNormalSizeClassMap>(); 55 56 return fullyPassed ? 0 : 1; 57 } 58