njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- Command line options. pub_core_options.h ---*/ |
| 4 | /*--------------------------------------------------------------------*/ |
| 5 | |
| 6 | /* |
| 7 | This file is part of Valgrind, a dynamic binary instrumentation |
| 8 | framework. |
| 9 | |
| 10 | Copyright (C) 2000-2005 Julian Seward |
| 11 | jseward@acm.org |
| 12 | |
| 13 | This program is free software; you can redistribute it and/or |
| 14 | modify it under the terms of the GNU General Public License as |
| 15 | published by the Free Software Foundation; either version 2 of the |
| 16 | License, or (at your option) any later version. |
| 17 | |
| 18 | This program is distributed in the hope that it will be useful, but |
| 19 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | General Public License for more details. |
| 22 | |
| 23 | You should have received a copy of the GNU General Public License |
| 24 | along with this program; if not, write to the Free Software |
| 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 26 | 02111-1307, USA. |
| 27 | |
| 28 | The GNU General Public License is contained in the file COPYING. |
| 29 | */ |
| 30 | |
| 31 | #ifndef __PUB_CORE_OPTIONS_H |
| 32 | #define __PUB_CORE_OPTIONS_H |
| 33 | |
| 34 | //-------------------------------------------------------------------- |
| 35 | // PURPOSE: This module holds the variables for all command line options, |
| 36 | // plus some functions and macros for manipulating them. Almost every |
| 37 | // other module imports this one, if only for VG_(clo_verbosity). |
| 38 | //-------------------------------------------------------------------- |
| 39 | |
| 40 | #include "pub_tool_options.h" |
| 41 | |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 42 | /* The max number of suppression files. */ |
| 43 | #define VG_CLO_MAX_SFILES 10 |
| 44 | |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 45 | /* Should we stop collecting errors if too many appear? default: YES */ |
| 46 | extern Bool VG_(clo_error_limit); |
| 47 | /* Enquire about whether to attach to a debugger at errors? default: NO */ |
| 48 | extern Bool VG_(clo_db_attach); |
| 49 | /* The debugger command? default: whatever gdb ./configure found */ |
| 50 | extern Char* VG_(clo_db_command); |
| 51 | /* Generating a suppression for each error? default: 0 (NO) |
| 52 | Other values: 1 (yes, but ask user), 2 (yes, don't ask user) */ |
| 53 | extern Int VG_(clo_gen_suppressions); |
| 54 | /* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */ |
| 55 | extern Int VG_(clo_sanity_level); |
| 56 | /* Automatically attempt to demangle C++ names? default: YES */ |
| 57 | extern Bool VG_(clo_demangle); |
| 58 | /* Simulate child processes? default: NO */ |
| 59 | extern Bool VG_(clo_trace_children); |
| 60 | |
| 61 | /* Where logging output is to be sent to. |
| 62 | |
| 63 | With --log-fd (and by default), clo_log_fd holds the file id, and is |
| 64 | taken from the command line. (fd 2, stderr, is the default.) |
| 65 | clo_log_name is irrelevant. |
| 66 | |
| 67 | With --log-file/--log-file-exactly, clo_log_name holds the log-file |
| 68 | name, and is taken from the command line. clo_log_fd is then |
| 69 | made to hold the relevant file id, by opening clo_log_name |
| 70 | (concatenated with the process ID) for writing. |
| 71 | |
sewardj | ad31116 | 2005-07-19 11:25:02 +0000 | [diff] [blame] | 72 | With --log-file, there is an additional twist: if |
| 73 | clo_log_file_qualifier is non-NULL, the contents of the environment |
| 74 | variable specified by clo_log_file_qualifier is incorporated into |
| 75 | the logfile name. This is useful in that it allows the logfile |
| 76 | name to incorporate environmental information. |
| 77 | |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 78 | With --log-socket, clo_log_name holds the hostname:portnumber pair, |
| 79 | and is taken from the command line. clo_log_fd is then made to hold |
| 80 | the relevant file handle, by opening a connection to that |
| 81 | hostname:portnumber pair. |
| 82 | |
| 83 | Global default is to set log_to == VgLogTo_Fd and log_fd == 2 |
| 84 | (stderr). */ |
sewardj | ad31116 | 2005-07-19 11:25:02 +0000 | [diff] [blame] | 85 | extern Int VG_(clo_log_fd); |
| 86 | extern Char* VG_(clo_log_name); |
| 87 | extern Char* VG_(clo_log_file_qualifier); |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 88 | |
| 89 | /* Add timestamps to log messages? default: NO */ |
| 90 | extern Bool VG_(clo_time_stamp); |
| 91 | |
| 92 | /* The file descriptor to read for input. default: 0 == stdin */ |
| 93 | extern Int VG_(clo_input_fd); |
| 94 | /* The number of suppression files specified. */ |
| 95 | extern Int VG_(clo_n_suppressions); |
| 96 | /* The names of the suppression files. */ |
| 97 | extern Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES]; |
| 98 | |
| 99 | /* DEBUG: print generated code? default: 00000000 ( == NO ) */ |
| 100 | extern Bool VG_(clo_trace_flags); |
| 101 | /* DEBUG: do bb profiling? default: 00000000 ( == NO ) */ |
| 102 | extern Bool VG_(clo_profile_flags); |
| 103 | /* DEBUG: if tracing codegen, be quiet until after this bb ( 0 ) */ |
| 104 | extern Int VG_(clo_trace_notbelow); |
| 105 | /* DEBUG: print system calls? default: NO */ |
| 106 | extern Bool VG_(clo_trace_syscalls); |
| 107 | /* DEBUG: print signal details? default: NO */ |
| 108 | extern Bool VG_(clo_trace_signals); |
| 109 | /* DEBUG: print symtab details? default: NO */ |
| 110 | extern Bool VG_(clo_trace_symtab); |
| 111 | /* DEBUG: print call-frame-info details? default: NO */ |
| 112 | extern Bool VG_(clo_trace_cfi); |
| 113 | /* DEBUG: print redirection details? default: NO */ |
| 114 | extern Bool VG_(clo_trace_redir); |
| 115 | /* DEBUG: print thread scheduling events? default: NO */ |
| 116 | extern Bool VG_(clo_trace_sched); |
| 117 | /* DEBUG: print pthreads calls? default: NO */ |
| 118 | extern Bool VG_(clo_trace_pthreads); |
| 119 | /* Display gory details for the k'th most popular error. default: |
| 120 | Infinity. */ |
| 121 | extern Int VG_(clo_dump_error); |
| 122 | /* Number of parents of a backtrace. Default: 8. */ |
| 123 | extern Int VG_(clo_backtrace_size); |
| 124 | /* Engage miscellaneous weird hacks needed for some progs. */ |
sewardj | 19617ae | 2005-10-20 01:09:57 +0000 | [diff] [blame] | 125 | extern Char* VG_(clo_simulation_hints); |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 126 | |
| 127 | /* Track open file descriptors? */ |
| 128 | extern Bool VG_(clo_track_fds); |
| 129 | |
| 130 | /* Should we run __libc_freeres at exit? Sometimes causes crashes. |
| 131 | Default: YES. Note this is subservient to VG_(needs).libc_freeres; |
sewardj | 19617ae | 2005-10-20 01:09:57 +0000 | [diff] [blame] | 132 | if the latter says False, then the setting of VG_(clo_run_libc_freeres) |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 133 | is ignored. Ie if a tool says no, I don't want this to run, that |
| 134 | cannot be overridden from the command line. */ |
| 135 | extern Bool VG_(clo_run_libc_freeres); |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 136 | /* Continue stack traces below main()? Default: NO */ |
| 137 | extern Bool VG_(clo_show_below_main); |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 138 | /* Model the pthread library */ |
| 139 | extern Bool VG_(clo_model_pthreads); |
| 140 | |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 141 | /* Should we show VEX emulation warnings? Default: NO */ |
| 142 | extern Bool VG_(clo_show_emwarns); |
| 143 | |
| 144 | /* How much does the stack pointer have to change before tools |
| 145 | consider a stack switch to have happened? Default: 2000000 bytes */ |
| 146 | extern Int VG_(clo_max_stackframe); |
| 147 | |
| 148 | /* Delay startup to allow GDB to be attached? Default: NO */ |
| 149 | extern Bool VG_(clo_wait_for_gdb); |
| 150 | |
sewardj | 26412bd | 2005-07-07 10:05:05 +0000 | [diff] [blame] | 151 | /* To what extent should self-checking translations be made? These |
| 152 | are needed to deal with self-modifying code on uncooperative |
| 153 | platforms. */ |
| 154 | typedef |
| 155 | enum { |
| 156 | Vg_SmcNone, // never generate self-checking translations |
| 157 | Vg_SmcStack, // generate s-c-t's for code found in stacks |
sewardj | 26412bd | 2005-07-07 10:05:05 +0000 | [diff] [blame] | 158 | // (this is the default) |
| 159 | Vg_SmcAll // make all translations self-checking. |
| 160 | } |
| 161 | VgSmc; |
| 162 | |
sewardj | ce5a566 | 2005-10-06 03:19:49 +0000 | [diff] [blame] | 163 | /* Describe extent to which self-modifying-code should be |
| 164 | auto-detected. */ |
sewardj | 6c3a219 | 2005-07-24 07:00:45 +0000 | [diff] [blame] | 165 | extern VgSmc VG_(clo_smc_check); |
sewardj | 26412bd | 2005-07-07 10:05:05 +0000 | [diff] [blame] | 166 | |
sewardj | ce5a566 | 2005-10-06 03:19:49 +0000 | [diff] [blame] | 167 | /* String containing comma-separated names of minor kernel variants, |
| 168 | so they can be properly handled by m_syswrap. */ |
| 169 | extern HChar* VG_(clo_kernel_variant); |
sewardj | 26412bd | 2005-07-07 10:05:05 +0000 | [diff] [blame] | 170 | |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 171 | #endif // __PUB_CORE_OPTIONS_H |
| 172 | |
| 173 | /*--------------------------------------------------------------------*/ |
| 174 | /*--- end ---*/ |
| 175 | /*--------------------------------------------------------------------*/ |