| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef _CONFIG_H |
| 6 | #define _CONFIG_H |
| 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | #include <list> |
| 11 | |
| 12 | using namespace std; |
| 13 | |
| 14 | typedef struct tagVariable { |
| 15 | int max_size; |
| 16 | bool is_pointer; |
| 17 | string sym_name; |
| 18 | }Variable; |
| 19 | |
| 20 | typedef enum tagRunMode { |
| 21 | DRY_RUN = 0, |
| 22 | NORMAL, |
| 23 | FAST, |
| 24 | }RunMode; |
| 25 | |
| 26 | typedef struct tagDumpConfig { |
| 27 | RunMode mode; |
| 28 | bool dump_pthread_list; |
| 29 | bool dump_robust_mutex_list; |
| 30 | bool current_thread_only; |
| 31 | int max_heap_size; /*Disable dump stack if set to zero*/ |
| 32 | int max_stack_size; /*Disable dump stack if set to zero*/ |
| 33 | int max_param_size; |
| 34 | int compress_level; |
| 35 | int shared_buffer_size; |
| 36 | long max_dump_bytes; |
| 37 | |
| 38 | string dump_dir; |
| 39 | string break_function; |
| 40 | list<string> modules; |
| 41 | vector<Variable> vars; |
| 42 | vector<int> sigs; |
| 43 | |
| 44 | bool log_debug; |
| 45 | bool log_to_stdout; |
| 46 | bool log_to_file; |
| 47 | int log_file_max_size; |
| 48 | int log_flush_threshold; |
| 49 | }DumpConfig; |
| 50 | |
| 51 | int load_config(DumpConfig& cfg); |
| 52 | |
| 53 | #endif /* end #ifndef _CONFIG_H */ |
| 54 | |