1 /** 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef PANDA_VERIFICATION_OPTIONS_H__ 17 #define PANDA_VERIFICATION_OPTIONS_H__ 18 19 #include "utils/pandargs.h" 20 #include "runtime/include/runtime_options.h" 21 #include "runtime/include/mem/panda_containers.h" 22 #include "runtime/include/mem/panda_string.h" 23 #include "verification/cflow/cflow_check_options.h" 24 #include "verification/config/options/method_options_config.h" 25 26 #include <string> 27 #include <unordered_map> 28 29 namespace panda::verifier { 30 31 struct VerificationOptions { 32 std::string ConfigFile = "default"; 33 VerificationMode Mode = VerificationMode::DISABLED; 34 struct { 35 bool Status = false; 36 } Show; 37 CflowOptions Cflow; 38 bool VerifyRuntimeLibraries = false; 39 bool SyncOnClassInitialization = false; 40 size_t VerificationThreads = 1; 41 struct { 42 std::string File; 43 bool UpdateOnExit = false; 44 } Cache; 45 struct { 46 struct { 47 bool RegChanges = false; 48 bool Context = false; 49 bool TypeSystem = false; 50 } Show; 51 struct { 52 bool UndefinedClass = false; 53 bool UndefinedMethod = false; 54 bool UndefinedField = false; 55 bool UndefinedType = false; 56 bool UndefinedString = false; 57 bool MethodAccessViolation = false; 58 bool ErrorInExceptionHandler = false; 59 bool PermanentRuntimeException = false; 60 bool FieldAccessViolation = false; 61 bool WrongSubclassingInMethodArgs = false; 62 } Allow; 63 MethodOptionsConfig *MethodOptions = nullptr; GetMethodOptionsVerificationOptions::__anon09626343030864 MethodOptionsConfig &GetMethodOptions() 65 { 66 return *MethodOptions; 67 } GetMethodOptionsVerificationOptions::__anon09626343030868 const MethodOptionsConfig &GetMethodOptions() const 69 { 70 return *MethodOptions; 71 } 72 } Debug; 73 void Initialize(const panda::RuntimeOptions &runtime_options); 74 void Destroy(); 75 IsEnabledVerificationOptions76 bool IsEnabled() const 77 { 78 return Mode != VerificationMode::DISABLED; 79 } 80 IsOnlyVerifyVerificationOptions81 bool IsOnlyVerify() const 82 { 83 return Mode == VerificationMode::AHEAD_OF_TIME || Mode == VerificationMode::DEBUG; 84 } 85 }; 86 87 } // namespace panda::verifier 88 89 #endif // !PANDA_VERIFICATION_OPTIONS_H__ 90