]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/coregrind/pub_core_options.h
update
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / coregrind / pub_core_options.h
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-2010 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
42 /* The max number of suppression files. */
43 #define VG_CLO_MAX_SFILES 100
44
45 /* The max number of --require-text-symbol= specification strings. */
46 #define VG_CLO_MAX_REQ_TSYMS 100
47
48 /* The max number of --fullpath-after= parameters. */
49 #define VG_CLO_MAX_FULLPATH_AFTER 100
50
51 /* Should we stop collecting errors if too many appear?  default: YES */
52 extern Bool  VG_(clo_error_limit);
53 /* Alternative exit code to hand to parent if errors were found.
54    default: 0 (no, return the application's exit code in the normal
55    way. */
56 extern Int   VG_(clo_error_exitcode);
57
58 typedef 
59    enum { 
60       Vg_VgdbNo,   // Do not activate gdbserver.
61       Vg_VgdbYes,  // Activate gdbserver (default).
62       Vg_VgdbFull, // ACtivate gdbserver in full mode, allowing
63                    // a precise handling of watchpoints and single stepping
64                    // at any moment.
65    } 
66    VgVgdb;
67 /* if != Vg_VgdbNo, allows valgrind to serve vgdb/gdb. */
68 extern VgVgdb VG_(clo_vgdb);
69 /* if > 0, checks every VG_(clo_vgdb_poll) BBS if vgdb wants to be served. */
70 extern Int VG_(clo_vgdb_poll);
71 /* prefix for the named pipes (FIFOs) used by vgdb/gdb to communicate with valgrind */
72 extern Char* VG_(clo_vgdb_prefix);
73 /* if True, gdbserver in valgrind will expose a target description containing
74    shadow registers */
75 extern Bool  VG_(clo_vgdb_shadow_registers);
76 #define VG_CLO_VGDB_PREFIX_DEFAULT "/tmp/vgdb-pipe"
77
78 /* Enquire about whether to attach to a debugger at errors?   default: NO */
79 extern Bool  VG_(clo_db_attach);
80 /* The debugger command?  default: whatever gdb ./configure found */
81 extern Char* VG_(clo_db_command);
82 /* Generating a suppression for each error?   default: 0 (NO)
83    Other values: 1 (yes, but ask user), 2 (yes, don't ask user) */
84 extern Int   VG_(clo_gen_suppressions);
85 /* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */
86 extern Int   VG_(clo_sanity_level);
87 /* Automatically attempt to demangle C++ names?  default: YES */
88 extern Bool  VG_(clo_demangle);
89 /* Simulate child processes? default: NO */
90 extern Bool  VG_(clo_trace_children);
91 /* String containing comma-separated patterns for executable names
92    that should not be traced into even when --trace-children=yes */
93 extern HChar* VG_(clo_trace_children_skip);
94 /* The same as VG_(clo_trace_children), except that these patterns are
95    tested against the arguments for child processes, rather than the
96    executable name. */
97 extern HChar* VG_(clo_trace_children_skip_by_arg);
98 /* After a fork, the child's output can become confusingly
99    intermingled with the parent's output.  This is especially
100    problematic when VG_(clo_xml) is True.  Setting
101    VG_(clo_child_silent_after_fork) causes children to fall silent
102    after fork() calls.  Although note they become un-silent again
103    after the subsequent exec(). */
104 extern Bool  VG_(clo_child_silent_after_fork);
105
106 /* If the user specified --log-file=STR and/or --xml-file=STR, these
107    hold STR after expansion of the %p and %q templates. */
108 extern Char* VG_(clo_log_fname_expanded);
109 extern Char* VG_(clo_xml_fname_expanded);
110
111 /* Add timestamps to log messages?  default: NO */
112 extern Bool  VG_(clo_time_stamp);
113
114 /* The file descriptor to read for input.  default: 0 == stdin */
115 extern Int   VG_(clo_input_fd);
116
117 /* The number of suppression files specified. */
118 extern Int   VG_(clo_n_suppressions);
119 /* The names of the suppression files. */
120 extern Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES];
121
122 /* An array of strings harvested from --fullpath-after= flags. */
123 extern Int   VG_(clo_n_fullpath_after);
124 extern Char* VG_(clo_fullpath_after)[VG_CLO_MAX_FULLPATH_AFTER];
125
126 /* DEBUG: print generated code?  default: 00000000 ( == NO ) */
127 extern UChar VG_(clo_trace_flags);
128 /* DEBUG: do bb profiling?  default: 00000000 ( == NO ) */
129 extern UChar VG_(clo_profile_flags);
130 /* DEBUG: if tracing codegen, be quiet until after this bb ( 0 ) */
131 extern Int   VG_(clo_trace_notbelow);
132 /* DEBUG: print system calls?  default: NO */
133 extern Bool  VG_(clo_trace_syscalls);
134 /* DEBUG: print signal details?  default: NO */
135 extern Bool  VG_(clo_trace_signals);
136 /* DEBUG: print symtab details?  default: NO */
137 extern Bool  VG_(clo_trace_symtab);
138 /* DEBUG: restrict symtab etc details to object name pattern.  Default: "*" */
139 extern HChar* VG_(clo_trace_symtab_patt);
140 /* DEBUG: print call-frame-info details?  default: NO */
141 extern Bool  VG_(clo_trace_cfi);
142 /* DEBUG:  mimic /usr/bin/readelf --syms?  default: NO */
143 extern Bool  VG_(clo_debug_dump_syms);
144 /* DEBUG: mimic /usr/bin/readelf --debug-dump=line?  default: NO */
145 extern Bool  VG_(clo_debug_dump_line);
146 /* DEBUG: mimic  /usr/bin/readelf --debug-dump=frames?  default: NO */
147 extern Bool  VG_(clo_debug_dump_frames);
148 /* DEBUG: print redirection details?  default: NO */
149 extern Bool  VG_(clo_trace_redir);
150 /* DEBUG: print thread scheduling events?  default: NO */
151 extern Bool  VG_(clo_trace_sched);
152 /* DEBUG: do heap profiling?  default: NO */
153 extern Bool  VG_(clo_profile_heap);
154 /* DEBUG: display gory details for the k'th most popular error.
155    default: Infinity. */
156 extern Int   VG_(clo_dump_error);
157 /* Engage miscellaneous weird hacks needed for some progs. */
158 extern Char* VG_(clo_sim_hints);
159 /* Show symbols in the form 'name+offset' ?  Default: NO */
160 extern Bool VG_(clo_sym_offsets);
161 /* Read DWARF3 variable info even if tool doesn't ask for it? */
162 extern Bool VG_(clo_read_var_info);
163 /* Which prefix to strip from full source file paths, if any. */
164 extern Char* VG_(clo_prefix_to_strip);
165
166 /* An array of strings harvested from --require-text-symbol= 
167    flags.
168
169    Each string specifies a pair: a soname pattern and a text symbol
170    name pattern, separated by a colon.  The patterns can be written
171    using the normal "?" and "*" wildcards.  For example:
172    ":*libc.so*:foo?bar".
173
174    These flags take effect when reading debuginfo from objects.  If an
175    object is loaded and the object's soname matches the soname
176    component of one of the specified pairs, then Valgrind will examine
177    all the text symbol names in the object.  If none of them match the
178    symbol name component of that same specification, then the run is
179    aborted, with an error message.
180
181    The purpose of this is to support reliable usage of marked-up
182    libraries.  For example, suppose we have a version of GCC's
183    libgomp.so which has been marked up with annotations to support
184    Helgrind.  It is only too easy and confusing to load the 'wrong'
185    libgomp.so into the application.  So the idea is: add a text symbol
186    in the marked-up library (eg), "annotated_for_helgrind_3_6", and
187    then give the flag
188
189      --require-text-symbol=:*libgomp*so*:annotated_for_helgrind_3_6
190
191    so that when libgomp.so is loaded, we scan the symbol table, and if
192    the symbol isn't present the run is aborted, rather than continuing
193    silently with the un-marked-up library.  Note that you should put
194    the entire flag in quotes to stop shells messing up the * and ?
195    wildcards. */
196 extern Int    VG_(clo_n_req_tsyms);
197 extern HChar* VG_(clo_req_tsyms)[VG_CLO_MAX_REQ_TSYMS];
198
199 /* Track open file descriptors? */
200 extern Bool  VG_(clo_track_fds);
201
202 /* Should we run __libc_freeres at exit?  Sometimes causes crashes.
203    Default: YES.  Note this is subservient to VG_(needs).libc_freeres;
204    if the latter says False, then the setting of VG_(clo_run_libc_freeres)
205    is ignored.  Ie if a tool says no, I don't want this to run, that
206    cannot be overridden from the command line. */
207 extern Bool  VG_(clo_run_libc_freeres);
208
209 /* Should we show VEX emulation warnings?  Default: NO */
210 extern Bool VG_(clo_show_emwarns);
211
212 /* How much does the stack pointer have to change before tools
213    consider a stack switch to have happened?  Default: 2000000 bytes
214    NB: must be host-word-sized to be correct (hence Word). */
215 extern Word VG_(clo_max_stackframe);
216 /* How large should Valgrind allow the primary thread's guest stack to
217    be? */
218 extern Word VG_(clo_main_stacksize);
219
220 /* Delay startup to allow GDB to be attached?  Default: NO */
221 extern Bool VG_(clo_wait_for_gdb);
222
223 /* To what extent should self-checking translations be made?  These
224    are needed to deal with self-modifying code on uncooperative
225    platforms. */
226 typedef 
227    enum { 
228       Vg_SmcNone,  // never generate self-checking translations
229       Vg_SmcStack, // generate s-c-t's for code found in stacks
230                    // (this is the default)
231       Vg_SmcAll    // make all translations self-checking.
232    } 
233    VgSmc;
234
235 /* Describe extent to which self-modifying-code should be
236    auto-detected. */
237 extern VgSmc VG_(clo_smc_check);
238
239 /* String containing comma-separated names of minor kernel variants,
240    so they can be properly handled by m_syswrap. */
241 extern HChar* VG_(clo_kernel_variant);
242
243 /* Darwin-specific: automatically run /usr/bin/dsymutil to update
244    .dSYM directories as necessary? */
245 extern Bool VG_(clo_dsymutil);
246
247 /* Should we trace into this child executable (across execve etc) ?
248    This involves considering --trace-children=,
249    --trace-children-skip=, --trace-children-skip-by-arg=, and the name
250    of the executable.  'child_argv' must not include the name of the
251    executable itself; iow child_argv[0] must be the first arg, if any,
252    for the child. */
253 extern Bool VG_(should_we_trace_this_child) ( HChar* child_exe_name,
254                                               HChar** child_argv );
255
256 #endif   // __PUB_CORE_OPTIONS_H
257
258 /*--------------------------------------------------------------------*/
259 /*--- end                                                          ---*/
260 /*--------------------------------------------------------------------*/