blob: 09b97fcd1f2dcbf5fbc436f914e49f0482267e9d [file] [log] [blame]
njn20242342005-05-16 23:31:24 +00001
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
sewardj9ebd6e02007-01-08 06:01:59 +000010 Copyright (C) 2000-2007 Julian Seward
njn20242342005-05-16 23:31:24 +000011 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
njn20242342005-05-16 23:31:24 +000042/* The max number of suppression files. */
43#define VG_CLO_MAX_SFILES 10
44
njn20242342005-05-16 23:31:24 +000045/* Should we stop collecting errors if too many appear? default: YES */
46extern Bool VG_(clo_error_limit);
sewardjb9779082006-05-12 23:50:15 +000047/* Alternative exit code to hand to parent if errors were found.
48 default: 0 (no, return the application's exit code in the normal
49 way. */
50extern Int VG_(clo_error_exitcode);
njn20242342005-05-16 23:31:24 +000051/* Enquire about whether to attach to a debugger at errors? default: NO */
52extern Bool VG_(clo_db_attach);
53/* The debugger command? default: whatever gdb ./configure found */
54extern Char* VG_(clo_db_command);
55/* Generating a suppression for each error? default: 0 (NO)
56 Other values: 1 (yes, but ask user), 2 (yes, don't ask user) */
sewardjb9779082006-05-12 23:50:15 +000057extern Int VG_(clo_gen_suppressions);
njn20242342005-05-16 23:31:24 +000058/* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */
59extern Int VG_(clo_sanity_level);
60/* Automatically attempt to demangle C++ names? default: YES */
61extern Bool VG_(clo_demangle);
62/* Simulate child processes? default: NO */
63extern Bool VG_(clo_trace_children);
64
65/* Where logging output is to be sent to.
66
67 With --log-fd (and by default), clo_log_fd holds the file id, and is
68 taken from the command line. (fd 2, stderr, is the default.)
69 clo_log_name is irrelevant.
70
71 With --log-file/--log-file-exactly, clo_log_name holds the log-file
72 name, and is taken from the command line. clo_log_fd is then
73 made to hold the relevant file id, by opening clo_log_name
74 (concatenated with the process ID) for writing.
75
sewardjad311162005-07-19 11:25:02 +000076 With --log-file, there is an additional twist: if
77 clo_log_file_qualifier is non-NULL, the contents of the environment
78 variable specified by clo_log_file_qualifier is incorporated into
79 the logfile name. This is useful in that it allows the logfile
80 name to incorporate environmental information.
81
njn20242342005-05-16 23:31:24 +000082 With --log-socket, clo_log_name holds the hostname:portnumber pair,
83 and is taken from the command line. clo_log_fd is then made to hold
84 the relevant file handle, by opening a connection to that
85 hostname:portnumber pair.
86
87 Global default is to set log_to == VgLogTo_Fd and log_fd == 2
88 (stderr). */
sewardjad311162005-07-19 11:25:02 +000089extern Int VG_(clo_log_fd);
90extern Char* VG_(clo_log_name);
sewardj4d56c7c2007-02-07 19:50:55 +000091/* extern Char* VG_(clo_log_file_qualifier); moved to pub_tool_options.h */
njn20242342005-05-16 23:31:24 +000092
93/* Add timestamps to log messages? default: NO */
94extern Bool VG_(clo_time_stamp);
95
96/* The file descriptor to read for input. default: 0 == stdin */
97extern Int VG_(clo_input_fd);
98/* The number of suppression files specified. */
99extern Int VG_(clo_n_suppressions);
100/* The names of the suppression files. */
101extern Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES];
102
103/* DEBUG: print generated code? default: 00000000 ( == NO ) */
sewardjb224a482007-02-09 17:45:09 +0000104extern UChar VG_(clo_trace_flags);
njn20242342005-05-16 23:31:24 +0000105/* DEBUG: do bb profiling? default: 00000000 ( == NO ) */
sewardjb224a482007-02-09 17:45:09 +0000106extern UChar VG_(clo_profile_flags);
njn20242342005-05-16 23:31:24 +0000107/* DEBUG: if tracing codegen, be quiet until after this bb ( 0 ) */
108extern Int VG_(clo_trace_notbelow);
109/* DEBUG: print system calls? default: NO */
110extern Bool VG_(clo_trace_syscalls);
111/* DEBUG: print signal details? default: NO */
112extern Bool VG_(clo_trace_signals);
113/* DEBUG: print symtab details? default: NO */
114extern Bool VG_(clo_trace_symtab);
sewardjf767d962007-02-12 17:47:14 +0000115/* DEBUG: restrict symtab etc details to object name pattern. Default: "*" */
116extern HChar* VG_(clo_trace_symtab_patt);
njn20242342005-05-16 23:31:24 +0000117/* DEBUG: print call-frame-info details? default: NO */
118extern Bool VG_(clo_trace_cfi);
sewardjf767d962007-02-12 17:47:14 +0000119/* DEBUG: mimic /usr/bin/readelf --syms? default: NO */
120extern Bool VG_(clo_debug_dump_syms);
121/* DEBUG: mimic /usr/bin/readelf --debug-dump=line? default: NO */
122extern Bool VG_(clo_debug_dump_line);
123/* DEBUG: mimic /usr/bin/readelf --debug-dump=frames? default: NO */
124extern Bool VG_(clo_debug_dump_frames);
njn20242342005-05-16 23:31:24 +0000125/* DEBUG: print redirection details? default: NO */
126extern Bool VG_(clo_trace_redir);
127/* DEBUG: print thread scheduling events? default: NO */
128extern Bool VG_(clo_trace_sched);
129/* DEBUG: print pthreads calls? default: NO */
130extern Bool VG_(clo_trace_pthreads);
131/* Display gory details for the k'th most popular error. default:
132 Infinity. */
133extern Int VG_(clo_dump_error);
134/* Number of parents of a backtrace. Default: 8. */
135extern Int VG_(clo_backtrace_size);
136/* Engage miscellaneous weird hacks needed for some progs. */
njn628add62005-11-12 18:21:40 +0000137extern Char* VG_(clo_sim_hints);
sewardj41ded2c2006-10-17 01:34:57 +0000138/* Show symbols in the form 'name+offset' ? Default: NO */
139extern Bool VG_(clo_sym_offsets);
njn20242342005-05-16 23:31:24 +0000140
141/* Track open file descriptors? */
142extern Bool VG_(clo_track_fds);
143
144/* Should we run __libc_freeres at exit? Sometimes causes crashes.
145 Default: YES. Note this is subservient to VG_(needs).libc_freeres;
sewardj19617ae2005-10-20 01:09:57 +0000146 if the latter says False, then the setting of VG_(clo_run_libc_freeres)
njn20242342005-05-16 23:31:24 +0000147 is ignored. Ie if a tool says no, I don't want this to run, that
148 cannot be overridden from the command line. */
149extern Bool VG_(clo_run_libc_freeres);
njn20242342005-05-16 23:31:24 +0000150/* Continue stack traces below main()? Default: NO */
151extern Bool VG_(clo_show_below_main);
njn20242342005-05-16 23:31:24 +0000152
njn20242342005-05-16 23:31:24 +0000153/* Should we show VEX emulation warnings? Default: NO */
154extern Bool VG_(clo_show_emwarns);
155
156/* How much does the stack pointer have to change before tools
sewardj91b470c2007-08-28 17:03:01 +0000157 consider a stack switch to have happened? Default: 2000000 bytes
158 NB: must be host-word-sized to be correct (hence Word). */
159extern Word VG_(clo_max_stackframe);
njn20242342005-05-16 23:31:24 +0000160
161/* Delay startup to allow GDB to be attached? Default: NO */
162extern Bool VG_(clo_wait_for_gdb);
163
sewardj26412bd2005-07-07 10:05:05 +0000164/* To what extent should self-checking translations be made? These
165 are needed to deal with self-modifying code on uncooperative
166 platforms. */
167typedef
168 enum {
169 Vg_SmcNone, // never generate self-checking translations
170 Vg_SmcStack, // generate s-c-t's for code found in stacks
sewardj26412bd2005-07-07 10:05:05 +0000171 // (this is the default)
172 Vg_SmcAll // make all translations self-checking.
173 }
174 VgSmc;
175
sewardjce5a5662005-10-06 03:19:49 +0000176/* Describe extent to which self-modifying-code should be
177 auto-detected. */
sewardj6c3a2192005-07-24 07:00:45 +0000178extern VgSmc VG_(clo_smc_check);
sewardj26412bd2005-07-07 10:05:05 +0000179
sewardjce5a5662005-10-06 03:19:49 +0000180/* String containing comma-separated names of minor kernel variants,
181 so they can be properly handled by m_syswrap. */
182extern HChar* VG_(clo_kernel_variant);
sewardj26412bd2005-07-07 10:05:05 +0000183
sewardj63d1c002006-10-19 17:31:37 +0000184/* --------- Functions --------- */
185
186/* Call this if the executable is missing. This function prints an
187 error message, then shuts down the entire system. */
188extern void VG_(err_missing_prog) ( void );
189
190/* Similarly - complain and stop if there is some kind of config
191 error. */
192extern void VG_(err_config_error) ( Char* msg );
193
194
njn20242342005-05-16 23:31:24 +0000195#endif // __PUB_CORE_OPTIONS_H
196
197/*--------------------------------------------------------------------*/
198/*--- end ---*/
199/*--------------------------------------------------------------------*/