1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef BERBERIS_BASE_CONFIG_GLOBALS_H_ 18 #define BERBERIS_BASE_CONFIG_GLOBALS_H_ 19 20 #include <cstdint> 21 #include <string_view> 22 23 namespace berberis { 24 25 class ConfigStr { 26 public: 27 ConfigStr(const char* env_name, const char* prop_name); get()28 [[nodiscard]] const char* get() const { return value_; } 29 30 private: 31 const char* value_ = nullptr; 32 }; 33 34 void SetMainExecutableRealPath(std::string_view path); 35 const char* GetMainExecutableRealPath(); 36 37 void SetAppPackageName(std::string_view name); 38 const char* GetAppPackageName(); 39 40 void SetAppPrivateDir(std::string_view name); 41 const char* GetAppPrivateDir(); 42 43 const char* GetTracingConfig(); 44 45 const char* GetTranslationModeConfig(); 46 47 const char* GetProfilingConfig(); 48 49 uintptr_t GetEntryPointOverride(); 50 51 enum ConfigFlag { 52 kTopByteIgnore, 53 kDisableRegMap, 54 kEnableDisjointRegionsTranslation, 55 kVerboseTranslation, 56 kAccurateSigsegv, 57 kNumConfigFlags 58 }; 59 60 [[nodiscard]] bool IsConfigFlagSet(ConfigFlag flag); 61 62 } // namespace berberis 63 64 #endif // BERBERIS_BASE_CONFIG_GLOBALS_H_ 65