12024234c590f408994b373abfb00bc2cd2a90c48njn
22024234c590f408994b373abfb00bc2cd2a90c48njn/*--------------------------------------------------------------------*/
32024234c590f408994b373abfb00bc2cd2a90c48njn/*--- Command line options.                     pub_core_options.h ---*/
42024234c590f408994b373abfb00bc2cd2a90c48njn/*--------------------------------------------------------------------*/
52024234c590f408994b373abfb00bc2cd2a90c48njn
62024234c590f408994b373abfb00bc2cd2a90c48njn/*
72024234c590f408994b373abfb00bc2cd2a90c48njn   This file is part of Valgrind, a dynamic binary instrumentation
82024234c590f408994b373abfb00bc2cd2a90c48njn   framework.
92024234c590f408994b373abfb00bc2cd2a90c48njn
10ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes   Copyright (C) 2000-2017 Julian Seward
112024234c590f408994b373abfb00bc2cd2a90c48njn      jseward@acm.org
122024234c590f408994b373abfb00bc2cd2a90c48njn
132024234c590f408994b373abfb00bc2cd2a90c48njn   This program is free software; you can redistribute it and/or
142024234c590f408994b373abfb00bc2cd2a90c48njn   modify it under the terms of the GNU General Public License as
152024234c590f408994b373abfb00bc2cd2a90c48njn   published by the Free Software Foundation; either version 2 of the
162024234c590f408994b373abfb00bc2cd2a90c48njn   License, or (at your option) any later version.
172024234c590f408994b373abfb00bc2cd2a90c48njn
182024234c590f408994b373abfb00bc2cd2a90c48njn   This program is distributed in the hope that it will be useful, but
192024234c590f408994b373abfb00bc2cd2a90c48njn   WITHOUT ANY WARRANTY; without even the implied warranty of
202024234c590f408994b373abfb00bc2cd2a90c48njn   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
212024234c590f408994b373abfb00bc2cd2a90c48njn   General Public License for more details.
222024234c590f408994b373abfb00bc2cd2a90c48njn
232024234c590f408994b373abfb00bc2cd2a90c48njn   You should have received a copy of the GNU General Public License
242024234c590f408994b373abfb00bc2cd2a90c48njn   along with this program; if not, write to the Free Software
252024234c590f408994b373abfb00bc2cd2a90c48njn   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
262024234c590f408994b373abfb00bc2cd2a90c48njn   02111-1307, USA.
272024234c590f408994b373abfb00bc2cd2a90c48njn
282024234c590f408994b373abfb00bc2cd2a90c48njn   The GNU General Public License is contained in the file COPYING.
292024234c590f408994b373abfb00bc2cd2a90c48njn*/
302024234c590f408994b373abfb00bc2cd2a90c48njn
312024234c590f408994b373abfb00bc2cd2a90c48njn#ifndef __PUB_CORE_OPTIONS_H
322024234c590f408994b373abfb00bc2cd2a90c48njn#define __PUB_CORE_OPTIONS_H
332024234c590f408994b373abfb00bc2cd2a90c48njn
342024234c590f408994b373abfb00bc2cd2a90c48njn//--------------------------------------------------------------------
352024234c590f408994b373abfb00bc2cd2a90c48njn// PURPOSE: This module holds the variables for all command line options,
362024234c590f408994b373abfb00bc2cd2a90c48njn// plus some functions and macros for manipulating them.  Almost every
372024234c590f408994b373abfb00bc2cd2a90c48njn// other module imports this one, if only for VG_(clo_verbosity).
382024234c590f408994b373abfb00bc2cd2a90c48njn//--------------------------------------------------------------------
392024234c590f408994b373abfb00bc2cd2a90c48njn#include "pub_tool_options.h"
407931627282eede4440f3f329b657c3ec68371e8aflorian#include "pub_core_xarray.h"
4114cdbf8f4ac7e49de2bced6546f7867b2e0655f0sewardj
42ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes/* Valgrind tool name. Defaults to "memcheck". */
43ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughesextern const HChar *VG_(clo_toolname);
44ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes
452024234c590f408994b373abfb00bc2cd2a90c48njn/* Should we stop collecting errors if too many appear?  default: YES */
462024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_error_limit);
47b9779088c43db2a576ae43bde0694411c036b1c4sewardj/* Alternative exit code to hand to parent if errors were found.
48b9779088c43db2a576ae43bde0694411c036b1c4sewardj   default: 0 (no, return the application's exit code in the normal
49b9779088c43db2a576ae43bde0694411c036b1c4sewardj   way. */
50b9779088c43db2a576ae43bde0694411c036b1c4sewardjextern Int   VG_(clo_error_exitcode);
513b290486cd4cd601b20e04340e593c9ed9717e5fsewardj
527b3d3565c1559b88c67f629bd6613c8b1a89691bphilippe/* Markers used to mark the begin/end of an error, when errors are
537b3d3565c1559b88c67f629bd6613c8b1a89691bphilippe   printed in textual (non xml) format.
547b3d3565c1559b88c67f629bd6613c8b1a89691bphilippe   [0] is the error begin marker, [1] is the error end marker.
557b3d3565c1559b88c67f629bd6613c8b1a89691bphilippe   default: no markers. */
567b3d3565c1559b88c67f629bd6613c8b1a89691bphilippeextern HChar *VG_(clo_error_markers)[2];
577b3d3565c1559b88c67f629bd6613c8b1a89691bphilippe
583b290486cd4cd601b20e04340e593c9ed9717e5fsewardjtypedef
593b290486cd4cd601b20e04340e593c9ed9717e5fsewardj   enum {
603b290486cd4cd601b20e04340e593c9ed9717e5fsewardj      Vg_VgdbNo,   // Do not activate gdbserver.
613b290486cd4cd601b20e04340e593c9ed9717e5fsewardj      Vg_VgdbYes,  // Activate gdbserver (default).
623b290486cd4cd601b20e04340e593c9ed9717e5fsewardj      Vg_VgdbFull, // ACtivate gdbserver in full mode, allowing
633b290486cd4cd601b20e04340e593c9ed9717e5fsewardj                   // a precise handling of watchpoints and single stepping
643b290486cd4cd601b20e04340e593c9ed9717e5fsewardj                   // at any moment.
653b290486cd4cd601b20e04340e593c9ed9717e5fsewardj   }
663b290486cd4cd601b20e04340e593c9ed9717e5fsewardj   VgVgdb;
673b290486cd4cd601b20e04340e593c9ed9717e5fsewardj/* if != Vg_VgdbNo, allows valgrind to serve vgdb/gdb. */
683b290486cd4cd601b20e04340e593c9ed9717e5fsewardjextern VgVgdb VG_(clo_vgdb);
693b290486cd4cd601b20e04340e593c9ed9717e5fsewardj/* if > 0, checks every VG_(clo_vgdb_poll) BBS if vgdb wants to be served. */
703b290486cd4cd601b20e04340e593c9ed9717e5fsewardjextern Int VG_(clo_vgdb_poll);
71cffe2a55d903655761ccc6025a23b823bee10170philippe
72180a7500bf2464d5b16cddb5618b91fb3f095998philippe/* Specify when Valgrind gdbserver stops the execution and wait
73180a7500bf2464d5b16cddb5618b91fb3f095998philippe   for a GDB to connect. */
74180a7500bf2464d5b16cddb5618b91fb3f095998philippetypedef
75180a7500bf2464d5b16cddb5618b91fb3f095998philippe   enum {                       // Stop :
76180a7500bf2464d5b16cddb5618b91fb3f095998philippe      VgdbStopAt_Startup,       // just before the client starts to execute.
77180a7500bf2464d5b16cddb5618b91fb3f095998philippe      VgdbStopAt_Exit,          // just before the client exits.
78180a7500bf2464d5b16cddb5618b91fb3f095998philippe      VgdbStopAt_ValgrindAbExit // on abnormal valgrind exit.
79180a7500bf2464d5b16cddb5618b91fb3f095998philippe   }
80180a7500bf2464d5b16cddb5618b91fb3f095998philippe   VgdbStopAt;
81180a7500bf2464d5b16cddb5618b91fb3f095998philippe// Build mask to check or set VgdbStop_At a membership
82180a7500bf2464d5b16cddb5618b91fb3f095998philippe#define VgdbStopAt2S(a) (1 << (a))
83180a7500bf2464d5b16cddb5618b91fb3f095998philippe// VgdbStopAt a is member of the Set s ?
84180a7500bf2464d5b16cddb5618b91fb3f095998philippe#define VgdbStopAtiS(a,s) ((s) & VgdbStopAt2S(a))
85180a7500bf2464d5b16cddb5618b91fb3f095998philippeextern UInt VG_(clo_vgdb_stop_at); // A set of VgdbStopAt reasons.
86180a7500bf2464d5b16cddb5618b91fb3f095998philippe
873b290486cd4cd601b20e04340e593c9ed9717e5fsewardj/* prefix for the named pipes (FIFOs) used by vgdb/gdb to communicate with valgrind */
88cffe2a55d903655761ccc6025a23b823bee10170philippeextern const HChar *VG_(clo_vgdb_prefix);
89cffe2a55d903655761ccc6025a23b823bee10170philippe
903b290486cd4cd601b20e04340e593c9ed9717e5fsewardj/* if True, gdbserver in valgrind will expose a target description containing
913b290486cd4cd601b20e04340e593c9ed9717e5fsewardj   shadow registers */
923b290486cd4cd601b20e04340e593c9ed9717e5fsewardjextern Bool  VG_(clo_vgdb_shadow_registers);
933b290486cd4cd601b20e04340e593c9ed9717e5fsewardj
942024234c590f408994b373abfb00bc2cd2a90c48njn/* Generating a suppression for each error?   default: 0 (NO)
952024234c590f408994b373abfb00bc2cd2a90c48njn   Other values: 1 (yes, but ask user), 2 (yes, don't ask user) */
96b9779088c43db2a576ae43bde0694411c036b1c4sewardjextern Int   VG_(clo_gen_suppressions);
972024234c590f408994b373abfb00bc2cd2a90c48njn/* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */
982024234c590f408994b373abfb00bc2cd2a90c48njnextern Int   VG_(clo_sanity_level);
992024234c590f408994b373abfb00bc2cd2a90c48njn/* Automatically attempt to demangle C++ names?  default: YES */
1002024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_demangle);
1011e470b5ec96bdd4fb46750d4e2e596e194af56fephilippe/* Soname synonyms : a string containing a list of pairs
1021e470b5ec96bdd4fb46750d4e2e596e194af56fephilippe   xxxxx=yyyyy separated by commas.
1031e470b5ec96bdd4fb46750d4e2e596e194af56fephilippe   E.g. --soname-synonyms=somalloc=libtcmalloc*.so*,solibtruc=NONE */
10419f91bbaedb4caef8a60ce94b0f507193cc0bc10florianextern const HChar* VG_(clo_soname_synonyms);
105b314d102d4474fd299affa644a0862daf0e88ebdphilippe/* Valgrind-ise child processes (follow execve)? default : NO */
1062024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_trace_children);
107064212709dc8988a48d2cbde5b90528952d8cd74sewardj/* String containing comma-separated patterns for executable names
108064212709dc8988a48d2cbde5b90528952d8cd74sewardj   that should not be traced into even when --trace-children=yes */
10919f91bbaedb4caef8a60ce94b0f507193cc0bc10florianextern const HChar* VG_(clo_trace_children_skip);
1109ab64a4d3043c251561419d0e0f51492172b1072sewardj/* The same as VG_(clo_trace_children), except that these patterns are
1119ab64a4d3043c251561419d0e0f51492172b1072sewardj   tested against the arguments for child processes, rather than the
1129ab64a4d3043c251561419d0e0f51492172b1072sewardj   executable name. */
11319f91bbaedb4caef8a60ce94b0f507193cc0bc10florianextern const HChar* VG_(clo_trace_children_skip_by_arg);
1146e31f80899f1c79a54f164955069f3f74fe8b7e2sewardj/* After a fork, the child's output can become confusingly
1156e31f80899f1c79a54f164955069f3f74fe8b7e2sewardj   intermingled with the parent's output.  This is especially
1166e31f80899f1c79a54f164955069f3f74fe8b7e2sewardj   problematic when VG_(clo_xml) is True.  Setting
1176e31f80899f1c79a54f164955069f3f74fe8b7e2sewardj   VG_(clo_child_silent_after_fork) causes children to fall silent
118738856f99eea33d86ce91dcb1d6cd5b151e307casewardj   after fork() calls.  Although note they become un-silent again
119738856f99eea33d86ce91dcb1d6cd5b151e307casewardj   after the subsequent exec(). */
1206e31f80899f1c79a54f164955069f3f74fe8b7e2sewardjextern Bool  VG_(clo_child_silent_after_fork);
1212024234c590f408994b373abfb00bc2cd2a90c48njn
122738856f99eea33d86ce91dcb1d6cd5b151e307casewardj/* If the user specified --log-file=STR and/or --xml-file=STR, these
123ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes   hold STR before expansion. */
124ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughesextern const HChar *VG_(clo_log_fname_unexpanded);
125ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughesextern const HChar *VG_(clo_xml_fname_unexpanded);
1262024234c590f408994b373abfb00bc2cd2a90c48njn
1272024234c590f408994b373abfb00bc2cd2a90c48njn/* Add timestamps to log messages?  default: NO */
1282024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_time_stamp);
1292024234c590f408994b373abfb00bc2cd2a90c48njn
1302024234c590f408994b373abfb00bc2cd2a90c48njn/* The file descriptor to read for input.  default: 0 == stdin */
1312024234c590f408994b373abfb00bc2cd2a90c48njnextern Int   VG_(clo_input_fd);
132f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj
1332c68e3eff3850e2d466774d152231e628107a28fbart/* Whether or not to load the default suppressions. */
1342c68e3eff3850e2d466774d152231e628107a28fbartextern Bool  VG_(clo_default_supp);
1357931627282eede4440f3f329b657c3ec68371e8aflorian
1362024234c590f408994b373abfb00bc2cd2a90c48njn/* The names of the suppression files. */
1377931627282eede4440f3f329b657c3ec68371e8aflorianextern XArray *VG_(clo_suppressions);
1382024234c590f408994b373abfb00bc2cd2a90c48njn
13914cdbf8f4ac7e49de2bced6546f7867b2e0655f0sewardj/* An array of strings harvested from --fullpath-after= flags. */
1407931627282eede4440f3f329b657c3ec68371e8aflorianextern XArray *VG_(clo_fullpath_after);
14114cdbf8f4ac7e49de2bced6546f7867b2e0655f0sewardj
1428b6573dd1f5b4ab512a6e70ce23eecd82733aae1sewardj/* Full path to additional path to search for debug symbols */
14371826f77dbaefb6a9c694d9711aa649ed0980cc7sewardjextern const HChar* VG_(clo_extra_debuginfo_path);
1448b6573dd1f5b4ab512a6e70ce23eecd82733aae1sewardj
1455d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardj/* Address of a debuginfo server to use.  Either an IPv4 address of
1465d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardj   the form "d.d.d.d" or that plus a port spec, hence of the form
1475d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardj   "d.d.d.d:d", where d is one or more digits. */
1485d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardjextern const HChar* VG_(clo_debuginfo_server);
1495d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardj
1505d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardj/* Do we allow reading debuginfo from debuginfo objects that don't
1515d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardj   match (in some sense) the main object?  This is dangerous, so the
1525d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardj   default is NO (False).  In any case it applies only to objects
1535d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardj   found either in _extra_debuginfo_path or via the
1545d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardj   _debuginfo_server. */
1555d616dfbb8439dfd51a40ddf1dba970938baa1ebsewardjextern Bool VG_(clo_allow_mismatched_debuginfo);
15614cdbf8f4ac7e49de2bced6546f7867b2e0655f0sewardj
1572024234c590f408994b373abfb00bc2cd2a90c48njn/* DEBUG: print generated code?  default: 00000000 ( == NO ) */
158b224a485994dff41ed3c7a153ff2d563da3ef385sewardjextern UChar VG_(clo_trace_flags);
15917c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj
16017c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj/* DEBUG: do SB profiling? default: False (== NO).  NOTE: does not
16117c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj   have an associated command line flag.  Is set to True whenever
16217c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj   --profile-flags= is specified. */
16317c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardjextern Bool  VG_(clo_profyle_sbs);
16417c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj/* DEBUG: if doing SB profiling, provides bits for which JIT stages
16517c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj   are shown.  Same meaning as for clo_trace_flags.  default: zero (==
16617c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj   show block counts only) */
16717c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardjextern UChar VG_(clo_profyle_flags);
16817c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj/* DEBUG: if doing SB profiling, dump blocks and zero counters after
16917c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj   this-many back edges (event checks).  default: zero (== show
17017c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj   profiling results only at the end of the run. */
17117c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardjextern ULong VG_(clo_profyle_interval);
17217c5e2e3a2f48970063ea43a9abee3e11c72cb04sewardj
17329e022d85378cd303e00c1ec7a8dd60aaed9145aflorian/* DEBUG: if tracing codegen, be quiet until after this bb */
1742024234c590f408994b373abfb00bc2cd2a90c48njnextern Int   VG_(clo_trace_notbelow);
17529e022d85378cd303e00c1ec7a8dd60aaed9145aflorian/* DEBUG: if tracing codegen, be quiet after this bb  */
17629e022d85378cd303e00c1ec7a8dd60aaed9145aflorianextern Int   VG_(clo_trace_notabove);
1772024234c590f408994b373abfb00bc2cd2a90c48njn/* DEBUG: print system calls?  default: NO */
1782024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_trace_syscalls);
1792024234c590f408994b373abfb00bc2cd2a90c48njn/* DEBUG: print signal details?  default: NO */
1802024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_trace_signals);
1812024234c590f408994b373abfb00bc2cd2a90c48njn/* DEBUG: print symtab details?  default: NO */
1822024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_trace_symtab);
183f767d967b9ef331dcd7d0cd4584f6570cd829333sewardj/* DEBUG: restrict symtab etc details to object name pattern.  Default: "*" */
18419f91bbaedb4caef8a60ce94b0f507193cc0bc10florianextern const HChar* VG_(clo_trace_symtab_patt);
1852024234c590f408994b373abfb00bc2cd2a90c48njn/* DEBUG: print call-frame-info details?  default: NO */
1862024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_trace_cfi);
187f767d967b9ef331dcd7d0cd4584f6570cd829333sewardj/* DEBUG:  mimic /usr/bin/readelf --syms?  default: NO */
188f767d967b9ef331dcd7d0cd4584f6570cd829333sewardjextern Bool  VG_(clo_debug_dump_syms);
189f767d967b9ef331dcd7d0cd4584f6570cd829333sewardj/* DEBUG: mimic /usr/bin/readelf --debug-dump=line?  default: NO */
190f767d967b9ef331dcd7d0cd4584f6570cd829333sewardjextern Bool  VG_(clo_debug_dump_line);
191f767d967b9ef331dcd7d0cd4584f6570cd829333sewardj/* DEBUG: mimic  /usr/bin/readelf --debug-dump=frames?  default: NO */
192f767d967b9ef331dcd7d0cd4584f6570cd829333sewardjextern Bool  VG_(clo_debug_dump_frames);
1932024234c590f408994b373abfb00bc2cd2a90c48njn/* DEBUG: print redirection details?  default: NO */
1942024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_trace_redir);
19578bfc711d3e684c76eeab5f89a94a78d40ed6f4bbart/* Enable fair scheduling on multicore systems? default: NO */
19678bfc711d3e684c76eeab5f89a94a78d40ed6f4bbartenum FairSchedType { disable_fair_sched, enable_fair_sched, try_fair_sched };
19778bfc711d3e684c76eeab5f89a94a78d40ed6f4bbartextern enum FairSchedType VG_(clo_fair_sched);
1982024234c590f408994b373abfb00bc2cd2a90c48njn/* DEBUG: print thread scheduling events?  default: NO */
1992024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_trace_sched);
2009c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj/* DEBUG: do heap profiling?  default: NO */
2019c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardjextern Bool  VG_(clo_profile_heap);
202d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippe#define MAX_REDZONE_SZB 128
203d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippe// Maximum for the default values for core arenas and for client
204d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippe// arena given by the tool.
205d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippe// 128 is no special figure, just something not too big
206d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippe#define MAX_CLO_REDZONE_SZB 4096
207d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippe// We allow the user to increase the redzone size to 4Kb :
208d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippe// This allows "off by one" in an array of pages to be detected.
209d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippe#define CORE_REDZONE_DEFAULT_SZB 4
210d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippeextern Int VG_(clo_core_redzone_size);
211d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippe// VG_(clo_redzone_size) has default value -1, indicating to keep
212d99c26a4bc18fd3b17c4626c9c1fbd1583388660philippe// the tool provided value.
2139c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj/* DEBUG: display gory details for the k'th most popular error.
2149c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   default: Infinity. */
2152024234c590f408994b373abfb00bc2cd2a90c48njnextern Int   VG_(clo_dump_error);
216ec905f7ed1659f2251045114c785659fbb11ea88philippe
2172024234c590f408994b373abfb00bc2cd2a90c48njn/* Engage miscellaneous weird hacks needed for some progs. */
218ec905f7ed1659f2251045114c785659fbb11ea88philippetypedef
219ec905f7ed1659f2251045114c785659fbb11ea88philippe   enum {
220ec905f7ed1659f2251045114c785659fbb11ea88philippe      SimHint_lax_ioctls,
2218eb8bab992e3998c33770b0cdb16059a8b918a06sewardj      SimHint_lax_doors,
2229848690cfe9c59a8a92d4be6e5b43c77786066eephilippe      SimHint_fuse_compatible,
2239848690cfe9c59a8a92d4be6e5b43c77786066eephilippe      SimHint_enable_outer,
2249848690cfe9c59a8a92d4be6e5b43c77786066eephilippe      SimHint_no_inner_prefix,
225ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes      SimHint_no_nptl_pthread_stackcache,
226ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes      SimHint_fallback_llsc
227ec905f7ed1659f2251045114c785659fbb11ea88philippe   }
228ec905f7ed1659f2251045114c785659fbb11ea88philippe   SimHint;
229ec905f7ed1659f2251045114c785659fbb11ea88philippe
230ec905f7ed1659f2251045114c785659fbb11ea88philippe// Build mask to check or set SimHint a membership
231ec905f7ed1659f2251045114c785659fbb11ea88philippe#define SimHint2S(a) (1 << (a))
232ec905f7ed1659f2251045114c785659fbb11ea88philippe// SimHint h is member of the Set s ?
233ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes#define SimHintiS(h,s) (((s) & SimHint2S(h)) != 0)
234ec905f7ed1659f2251045114c785659fbb11ea88philippeextern UInt VG_(clo_sim_hints);
235ec905f7ed1659f2251045114c785659fbb11ea88philippe
23641ded2cf9711091a1bc7a6c1dd2d177e978b05e9sewardj/* Show symbols in the form 'name+offset' ?  Default: NO */
23741ded2cf9711091a1bc7a6c1dd2d177e978b05e9sewardjextern Bool VG_(clo_sym_offsets);
238a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe/* Read DWARF3 inline info ? */
239a0a73939b0398b6608fd6dbde49820ce6530d12cphilippeextern Bool VG_(clo_read_inline_info);
240b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj/* Read DWARF3 variable info even if tool doesn't ask for it? */
241b8b79addf04dd5d0b558916e26df0b1927cbd758sewardjextern Bool VG_(clo_read_var_info);
2425dd0190bc0ea66f8ffa7218c66f5a2e1c7b51b30bart/* Which prefix to strip from full source file paths, if any. */
24319f91bbaedb4caef8a60ce94b0f507193cc0bc10florianextern const HChar* VG_(clo_prefix_to_strip);
2442024234c590f408994b373abfb00bc2cd2a90c48njn
245f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj/* An array of strings harvested from --require-text-symbol=
246f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   flags.
247f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj
248f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   Each string specifies a pair: a soname pattern and a text symbol
249f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   name pattern, separated by a colon.  The patterns can be written
250f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   using the normal "?" and "*" wildcards.  For example:
251f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   ":*libc.so*:foo?bar".
252f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj
253f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   These flags take effect when reading debuginfo from objects.  If an
254f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   object is loaded and the object's soname matches the soname
255f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   component of one of the specified pairs, then Valgrind will examine
256f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   all the text symbol names in the object.  If none of them match the
257f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   symbol name component of that same specification, then the run is
258f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   aborted, with an error message.
259f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj
260f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   The purpose of this is to support reliable usage of marked-up
261f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   libraries.  For example, suppose we have a version of GCC's
262f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   libgomp.so which has been marked up with annotations to support
263f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   Helgrind.  It is only too easy and confusing to load the 'wrong'
264f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   libgomp.so into the application.  So the idea is: add a text symbol
265f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   in the marked-up library (eg), "annotated_for_helgrind_3_6", and
266f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   then give the flag
267f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj
268f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj     --require-text-symbol=:*libgomp*so*:annotated_for_helgrind_3_6
269f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj
270f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   so that when libgomp.so is loaded, we scan the symbol table, and if
271f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   the symbol isn't present the run is aborted, rather than continuing
272f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   silently with the un-marked-up library.  Note that you should put
273f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   the entire flag in quotes to stop shells messing up the * and ?
274f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj   wildcards. */
2757931627282eede4440f3f329b657c3ec68371e8aflorianextern XArray *VG_(clo_req_tsyms);
276f9ebc3956087ce01561c4ab3faf5a8983b0f7c1csewardj
2772024234c590f408994b373abfb00bc2cd2a90c48njn/* Track open file descriptors? */
2782024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_track_fds);
2792024234c590f408994b373abfb00bc2cd2a90c48njn
2802024234c590f408994b373abfb00bc2cd2a90c48njn/* Should we run __libc_freeres at exit?  Sometimes causes crashes.
2812024234c590f408994b373abfb00bc2cd2a90c48njn   Default: YES.  Note this is subservient to VG_(needs).libc_freeres;
28219617ae5ba420da54f286aaf1ecceafeec6b766asewardj   if the latter says False, then the setting of VG_(clo_run_libc_freeres)
2832024234c590f408994b373abfb00bc2cd2a90c48njn   is ignored.  Ie if a tool says no, I don't want this to run, that
2842024234c590f408994b373abfb00bc2cd2a90c48njn   cannot be overridden from the command line. */
2852024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool  VG_(clo_run_libc_freeres);
2862024234c590f408994b373abfb00bc2cd2a90c48njn
287a0664b9ca67b594bd6f570a61d3301167a24750cElliott Hughes/* Should we run __gnu_cxx::__freeres at exit for C++ programs?
288a0664b9ca67b594bd6f570a61d3301167a24750cElliott Hughes   Default: YES.  Note this is subservient to VG_(needs).cxx_freeres;
289a0664b9ca67b594bd6f570a61d3301167a24750cElliott Hughes   if the latter says False, then the setting of VG_(clo_run_cxx_freeres)
290a0664b9ca67b594bd6f570a61d3301167a24750cElliott Hughes   is ignored.  Ie if a tool says no, I don't want this to run, that
291a0664b9ca67b594bd6f570a61d3301167a24750cElliott Hughes   cannot be overridden from the command line. */
292a0664b9ca67b594bd6f570a61d3301167a24750cElliott Hughesextern Bool  VG_(clo_run_cxx_freeres);
293a0664b9ca67b594bd6f570a61d3301167a24750cElliott Hughes
2942024234c590f408994b373abfb00bc2cd2a90c48njn/* Should we show VEX emulation warnings?  Default: NO */
2952024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool VG_(clo_show_emwarns);
2962024234c590f408994b373abfb00bc2cd2a90c48njn
2972024234c590f408994b373abfb00bc2cd2a90c48njn/* How much does the stack pointer have to change before tools
29891b470c367836f65177413ca2a19b25f32fb8ef0sewardj   consider a stack switch to have happened?  Default: 2000000 bytes
29991b470c367836f65177413ca2a19b25f32fb8ef0sewardj   NB: must be host-word-sized to be correct (hence Word). */
30091b470c367836f65177413ca2a19b25f32fb8ef0sewardjextern Word VG_(clo_max_stackframe);
30195d86c091a218e904e912354efa4f952a9712e82sewardj/* How large should Valgrind allow the primary thread's guest stack to
30295d86c091a218e904e912354efa4f952a9712e82sewardj   be? */
30395d86c091a218e904e912354efa4f952a9712e82sewardjextern Word VG_(clo_main_stacksize);
3042024234c590f408994b373abfb00bc2cd2a90c48njn
3051e802b6a8d0d4b7b630d2a1dd9683c7c889b01a3florian/* The maximum number of threads we support. */
3061e802b6a8d0d4b7b630d2a1dd9683c7c889b01a3florian#define MAX_THREADS_DEFAULT 500
3071e802b6a8d0d4b7b630d2a1dd9683c7c889b01a3florianextern UInt VG_(clo_max_threads);
3081e802b6a8d0d4b7b630d2a1dd9683c7c889b01a3florian
30946207652a0c99a2c8b0f05eafce3ca3ec533c121philippe/* If the same IP is found twice in a backtrace in a sequence of max
31046207652a0c99a2c8b0f05eafce3ca3ec533c121philippe   VG_(clo_merge_recursive_frames) frames, then the recursive call
31146207652a0c99a2c8b0f05eafce3ca3ec533c121philippe   is merged in the backtrace.
31246207652a0c99a2c8b0f05eafce3ca3ec533c121philippe   Note also that the merge is done during unwinding, to obtain
31346207652a0c99a2c8b0f05eafce3ca3ec533c121philippe   an much as possible significant backtrace.
31446207652a0c99a2c8b0f05eafce3ca3ec533c121philippe   Note that the value is changeable by a gdbsrv command. */
31546207652a0c99a2c8b0f05eafce3ca3ec533c121philippeextern Int VG_(clo_merge_recursive_frames);
31646207652a0c99a2c8b0f05eafce3ca3ec533c121philippe
3178e1bee406c191820bc3b22bf55cfa69ef5fdcd8bphilippe/* Max number of sectors that will be used by the translation code cache. */
3188e1bee406c191820bc3b22bf55cfa69ef5fdcd8bphilippeextern UInt VG_(clo_num_transtab_sectors);
3198e1bee406c191820bc3b22bf55cfa69ef5fdcd8bphilippe
320924c852b5883a7b42298dc8c7542116bd9a8a485philippe/* Average size of a transtab code entry. 0 means to use the tool
321924c852b5883a7b42298dc8c7542116bd9a8a485philippe   provided default. */
322924c852b5883a7b42298dc8c7542116bd9a8a485philippeextern UInt VG_(clo_avg_transtab_entry_size);
323924c852b5883a7b42298dc8c7542116bd9a8a485philippe
324e4d78123089e55bec64a4f848bdc09556192e259philippe/* Only client requested fixed mapping can be done below
325e4d78123089e55bec64a4f848bdc09556192e259philippe   VG_(clo_aspacem_minAddr). */
326e4d78123089e55bec64a4f848bdc09556192e259philippeextern Addr VG_(clo_aspacem_minAddr);
327e4d78123089e55bec64a4f848bdc09556192e259philippe
328d0720e4a624bdfe7ce2494d690e7a88f986b93c1philippe/* How large the Valgrind thread stacks should be.
329d0720e4a624bdfe7ce2494d690e7a88f986b93c1philippe   Will be rounded up to a page.. */
330d0720e4a624bdfe7ce2494d690e7a88f986b93c1philippeextern Word VG_(clo_valgrind_stacksize);
331d0720e4a624bdfe7ce2494d690e7a88f986b93c1philippe
3322024234c590f408994b373abfb00bc2cd2a90c48njn/* Delay startup to allow GDB to be attached?  Default: NO */
3332024234c590f408994b373abfb00bc2cd2a90c48njnextern Bool VG_(clo_wait_for_gdb);
3342024234c590f408994b373abfb00bc2cd2a90c48njn
33526412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj/* To what extent should self-checking translations be made?  These
33626412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj   are needed to deal with self-modifying code on uncooperative
33726412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj   platforms. */
33826412bd2c4ef3e55683141f132ebd1eb32d8530bsewardjtypedef
33926412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj   enum {
34026412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj      Vg_SmcNone,  // never generate self-checking translations
34126412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj      Vg_SmcStack, // generate s-c-t's for code found in stacks
34226412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj                   // (this is the default)
3436dbcc639e7138f80cf82f5bbcd426df0a293eb0dsewardj      Vg_SmcAll,   // make all translations self-checking.
3446dbcc639e7138f80cf82f5bbcd426df0a293eb0dsewardj      Vg_SmcAllNonFile // make all translations derived from
3456dbcc639e7138f80cf82f5bbcd426df0a293eb0dsewardj                   // non-file-backed memory self checking
34626412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj   }
34726412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj   VgSmc;
34826412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj
349ce5a566e128da79452a69db9cfe2ecb81395fdccsewardj/* Describe extent to which self-modifying-code should be
350ce5a566e128da79452a69db9cfe2ecb81395fdccsewardj   auto-detected. */
3516c3a219727dead14309abf431f72ca1f99b8ca37sewardjextern VgSmc VG_(clo_smc_check);
35226412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj
353ec905f7ed1659f2251045114c785659fbb11ea88philippe/* A set of minor kernel variants,
354ce5a566e128da79452a69db9cfe2ecb81395fdccsewardj   so they can be properly handled by m_syswrap. */
3554450a0efab6e08dc7e40a4dfb5dda7214edb557dsewardjtypedef
3564450a0efab6e08dc7e40a4dfb5dda7214edb557dsewardj   enum {
3574450a0efab6e08dc7e40a4dfb5dda7214edb557dsewardj      KernelVariant_bproc,
358124e56d42ca77510244fedc937057bd291faa039sewardj      KernelVariant_android_no_hw_tls,
3594450a0efab6e08dc7e40a4dfb5dda7214edb557dsewardj      KernelVariant_android_gpu_sgx5xx,
3604450a0efab6e08dc7e40a4dfb5dda7214edb557dsewardj      KernelVariant_android_gpu_adreno3xx
361ec905f7ed1659f2251045114c785659fbb11ea88philippe   }
362ec905f7ed1659f2251045114c785659fbb11ea88philippe   KernelVariant;
363ec905f7ed1659f2251045114c785659fbb11ea88philippe// Build mask to check or set KernelVariant a membership
364ec905f7ed1659f2251045114c785659fbb11ea88philippe#define KernelVariant2S(v) (1 << (v))
365ec905f7ed1659f2251045114c785659fbb11ea88philippe// KernelVariant v is member of the Set s ?
366ec905f7ed1659f2251045114c785659fbb11ea88philippe#define KernelVariantiS(v,s) ((s) & KernelVariant2S(v))
367ec905f7ed1659f2251045114c785659fbb11ea88philippeextern UInt VG_(clo_kernel_variant);
36826412bd2c4ef3e55683141f132ebd1eb32d8530bsewardj
369f76d27a697a7b0bf3b84490baf60623fc96a23afnjn/* Darwin-specific: automatically run /usr/bin/dsymutil to update
370f76d27a697a7b0bf3b84490baf60623fc96a23afnjn   .dSYM directories as necessary? */
37197db761d2a94fc7a349aee9359ef85828d9618b6njnextern Bool VG_(clo_dsymutil);
372f76d27a697a7b0bf3b84490baf60623fc96a23afnjn
373064212709dc8988a48d2cbde5b90528952d8cd74sewardj/* Should we trace into this child executable (across execve etc) ?
3749ab64a4d3043c251561419d0e0f51492172b1072sewardj   This involves considering --trace-children=,
3759ab64a4d3043c251561419d0e0f51492172b1072sewardj   --trace-children-skip=, --trace-children-skip-by-arg=, and the name
3769ab64a4d3043c251561419d0e0f51492172b1072sewardj   of the executable.  'child_argv' must not include the name of the
3779ab64a4d3043c251561419d0e0f51492172b1072sewardj   executable itself; iow child_argv[0] must be the first arg, if any,
3789ab64a4d3043c251561419d0e0f51492172b1072sewardj   for the child. */
379518850bf0da07ed3e2244e307268ae0fd80e93a8florianextern Bool VG_(should_we_trace_this_child) ( const HChar* child_exe_name,
380518850bf0da07ed3e2244e307268ae0fd80e93a8florian                                              const HChar** child_argv );
38163d1c00c4016258f8cd3ac3940818b50b21e8ddbsewardj
382c30cd9bdc3c13c79a2e0281302b115c3d220bc9dsewardj/* Whether illegal instructions should be reported/diagnosed.
383c30cd9bdc3c13c79a2e0281302b115c3d220bc9dsewardj   Can be explicitly set through --sigill-diagnostics otherwise
384c30cd9bdc3c13c79a2e0281302b115c3d220bc9dsewardj   depends on verbosity (False if -q). */
385c30cd9bdc3c13c79a2e0281302b115c3d220bc9dsewardjextern Bool VG_(clo_sigill_diag);
386c30cd9bdc3c13c79a2e0281302b115c3d220bc9dsewardj
38749984eadbda78d8edea43f7839f4651a04ca419asewardj/* Unwind using stack scanning (a nasty hack at the best of times)
38849984eadbda78d8edea43f7839f4651a04ca419asewardj   when the normal CFI/FP-chain scan fails.  If the number of
38949984eadbda78d8edea43f7839f4651a04ca419asewardj   "normally" recovered frames is below this number, stack scanning
39049984eadbda78d8edea43f7839f4651a04ca419asewardj   will be used (on platforms on which it is supported, currently only
39149984eadbda78d8edea43f7839f4651a04ca419asewardj   arm-linux).  The default value of zero has the effect of disabling
39249984eadbda78d8edea43f7839f4651a04ca419asewardj   stack scanning.  Default: zero*/
39349984eadbda78d8edea43f7839f4651a04ca419asewardjextern UInt VG_(clo_unw_stack_scan_thresh);
39449984eadbda78d8edea43f7839f4651a04ca419asewardj
39549984eadbda78d8edea43f7839f4651a04ca419asewardj/* If stack scanning is used, this is how many frames it may recover.
39649984eadbda78d8edea43f7839f4651a04ca419asewardj   Since it tends to pick up a lot of junk, this value is set pretty
39749984eadbda78d8edea43f7839f4651a04ca419asewardj   low by default.  Default: 5 */
39849984eadbda78d8edea43f7839f4651a04ca419asewardjextern UInt VG_(clo_unw_stack_scan_frames);
39949984eadbda78d8edea43f7839f4651a04ca419asewardj
40067f7c0384ad9a590a8c8a9737074168f897e1678sewardj/* Controls the resync-filter on MacOS.  Has no effect on Linux.
40167f7c0384ad9a590a8c8a9737074168f897e1678sewardj   0=disabled [default on Linux]   "no"
40267f7c0384ad9a590a8c8a9737074168f897e1678sewardj   1=enabled  [default on MacOS]   "yes"
40367f7c0384ad9a590a8c8a9737074168f897e1678sewardj   2=enabled and verbose.          "verbose" */
40467f7c0384ad9a590a8c8a9737074168f897e1678sewardjextern UInt VG_(clo_resync_filter);
40567f7c0384ad9a590a8c8a9737074168f897e1678sewardj
4062024234c590f408994b373abfb00bc2cd2a90c48njn#endif   // __PUB_CORE_OPTIONS_H
4072024234c590f408994b373abfb00bc2cd2a90c48njn
4082024234c590f408994b373abfb00bc2cd2a90c48njn/*--------------------------------------------------------------------*/
4092024234c590f408994b373abfb00bc2cd2a90c48njn/*--- end                                                          ---*/
4102024234c590f408994b373abfb00bc2cd2a90c48njn/*--------------------------------------------------------------------*/
411