12024234c590f408994b373abfb00bc2cd2a90c48njn 22024234c590f408994b373abfb00bc2cd2a90c48njn/*--------------------------------------------------------------------*/ 32024234c590f408994b373abfb00bc2cd2a90c48njn/*--- Command line options. pub_tool_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_TOOL_OPTIONS_H 322024234c590f408994b373abfb00bc2cd2a90c48njn#define __PUB_TOOL_OPTIONS_H 332024234c590f408994b373abfb00bc2cd2a90c48njn 34535fb1b49a80f2e880f755ee618381de3e222ddfflorian#include "pub_tool_basics.h" // for VG_ macro 35f9b5b7de773bb764b239483c937b4ac2698b31d3sewardj#include "libvex.h" // for VexControl 36f9b5b7de773bb764b239483c937b4ac2698b31d3sewardj 37f9b5b7de773bb764b239483c937b4ac2698b31d3sewardj 3883df0b67a14425c484d8dda42b53f3ff0b598894njn// Higher-level command-line option recognisers; use in if/else chains. 3983df0b67a14425c484d8dda42b53f3ff0b598894njn// Note that they assign a value to the 'qq_var' argument. So often they 4083df0b67a14425c484d8dda42b53f3ff0b598894njn// can be used like this: 4183df0b67a14425c484d8dda42b53f3ff0b598894njn// 4283df0b67a14425c484d8dda42b53f3ff0b598894njn// if VG_STR_CLO(arg, "--foo", clo_foo) { } 4383df0b67a14425c484d8dda42b53f3ff0b598894njn// 4483df0b67a14425c484d8dda42b53f3ff0b598894njn// But if you want to do further checking or processing, you can do this: 4583df0b67a14425c484d8dda42b53f3ff0b598894njn// 4683df0b67a14425c484d8dda42b53f3ff0b598894njn// if VG_STR_CLO(arg, "--foo", clo_foo) { <further checking or processing> } 4783df0b67a14425c484d8dda42b53f3ff0b598894njn// 4883df0b67a14425c484d8dda42b53f3ff0b598894njn// They use GNU statement expressions to do the qq_var assignment within a 4983df0b67a14425c484d8dda42b53f3ff0b598894njn// conditional expression. 5083df0b67a14425c484d8dda42b53f3ff0b598894njn 5183df0b67a14425c484d8dda42b53f3ff0b598894njn// String argument, eg. --foo=yes or --foo=no 522024234c590f408994b373abfb00bc2cd2a90c48njn#define VG_BOOL_CLO(qq_arg, qq_option, qq_var) \ 5383df0b67a14425c484d8dda42b53f3ff0b598894njn (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ 5483df0b67a14425c484d8dda42b53f3ff0b598894njn ({ \ 5519f91bbaedb4caef8a60ce94b0f507193cc0bc10florian const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ 5683df0b67a14425c484d8dda42b53f3ff0b598894njn if VG_STREQ(val, "yes") (qq_var) = True; \ 5783df0b67a14425c484d8dda42b53f3ff0b598894njn else if VG_STREQ(val, "no") (qq_var) = False; \ 5836f3c798c81137b1f7e357b09e81377133dfc81csewardj else VG_(fmsg_bad_option)(qq_arg, "Invalid boolean value '%s'" \ 5936f3c798c81137b1f7e357b09e81377133dfc81csewardj " (should be 'yes' or 'no')\n", val); \ 6083df0b67a14425c484d8dda42b53f3ff0b598894njn True; \ 6183df0b67a14425c484d8dda42b53f3ff0b598894njn }) \ 6283df0b67a14425c484d8dda42b53f3ff0b598894njn ) 6383df0b67a14425c484d8dda42b53f3ff0b598894njn 6483df0b67a14425c484d8dda42b53f3ff0b598894njn// String argument, eg. --foo=bar 652024234c590f408994b373abfb00bc2cd2a90c48njn#define VG_STR_CLO(qq_arg, qq_option, qq_var) \ 6683df0b67a14425c484d8dda42b53f3ff0b598894njn (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ 6783df0b67a14425c484d8dda42b53f3ff0b598894njn ({ \ 6819f91bbaedb4caef8a60ce94b0f507193cc0bc10florian const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ 6983df0b67a14425c484d8dda42b53f3ff0b598894njn (qq_var) = val; \ 7083df0b67a14425c484d8dda42b53f3ff0b598894njn True; \ 7183df0b67a14425c484d8dda42b53f3ff0b598894njn }) \ 7283df0b67a14425c484d8dda42b53f3ff0b598894njn ) 7383df0b67a14425c484d8dda42b53f3ff0b598894njn 74ec905f7ed1659f2251045114c785659fbb11ea88philippe// UInt enum set arg, eg. --foo=fubar,bar,baz or --foo=none 75ec905f7ed1659f2251045114c785659fbb11ea88philippe// or --foo=all (if qq_all is True) 76ec905f7ed1659f2251045114c785659fbb11ea88philippe#define VG_USETGEN_CLO(qq_arg, qq_option, qq_vals, qq_var, qq_all) \ 77ec905f7ed1659f2251045114c785659fbb11ea88philippe (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ 78ec905f7ed1659f2251045114c785659fbb11ea88philippe ({ \ 79ec905f7ed1659f2251045114c785659fbb11ea88philippe const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ 80ec905f7ed1659f2251045114c785659fbb11ea88philippe if (!VG_(parse_enum_set)(qq_vals, \ 81ec905f7ed1659f2251045114c785659fbb11ea88philippe qq_all,/*allow_all*/ \ 82ec905f7ed1659f2251045114c785659fbb11ea88philippe val, \ 83ec905f7ed1659f2251045114c785659fbb11ea88philippe &(qq_var))) \ 84ec905f7ed1659f2251045114c785659fbb11ea88philippe VG_(fmsg_bad_option)(qq_arg, "%s is an invalid %s set\n", \ 85ec905f7ed1659f2251045114c785659fbb11ea88philippe val, qq_option+2); \ 86ec905f7ed1659f2251045114c785659fbb11ea88philippe True; \ 87ec905f7ed1659f2251045114c785659fbb11ea88philippe }) \ 88ec905f7ed1659f2251045114c785659fbb11ea88philippe ) 89ec905f7ed1659f2251045114c785659fbb11ea88philippe 90ec905f7ed1659f2251045114c785659fbb11ea88philippe// UInt enum set arg, eg. --foo=fubar,bar,baz or --foo=none or --foo=all 91ec905f7ed1659f2251045114c785659fbb11ea88philippe#define VG_USET_CLO(qq_arg, qq_option, qq_vals, qq_var) \ 92ec905f7ed1659f2251045114c785659fbb11ea88philippe VG_USETGEN_CLO((qq_arg), qq_option, (qq_vals), (qq_var), True) 93ec905f7ed1659f2251045114c785659fbb11ea88philippe 94ec905f7ed1659f2251045114c785659fbb11ea88philippe/* Same as VG_USET_CLO but not allowing --foo=all. 95ec905f7ed1659f2251045114c785659fbb11ea88philippe To be used when some or all of the enum set are mutually eXclusive. */ 96ec905f7ed1659f2251045114c785659fbb11ea88philippe#define VG_USETX_CLO(qq_arg, qq_option, qq_vals, qq_var) \ 97ec905f7ed1659f2251045114c785659fbb11ea88philippe VG_USETGEN_CLO((qq_arg), qq_option, (qq_vals), (qq_var), False) 98ec905f7ed1659f2251045114c785659fbb11ea88philippe 9983df0b67a14425c484d8dda42b53f3ff0b598894njn// Unbounded integer arg, eg. --foo=10 10083df0b67a14425c484d8dda42b53f3ff0b598894njn#define VG_INT_CLO(qq_arg, qq_option, qq_var) \ 10183df0b67a14425c484d8dda42b53f3ff0b598894njn (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ 10283df0b67a14425c484d8dda42b53f3ff0b598894njn ({ \ 10319f91bbaedb4caef8a60ce94b0f507193cc0bc10florian const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ 10419f91bbaedb4caef8a60ce94b0f507193cc0bc10florian HChar* s; \ 10583df0b67a14425c484d8dda42b53f3ff0b598894njn Long n = VG_(strtoll10)( val, &s ); \ 106ea5d2357bc8d93a8d796853e7f78db2927d47980njn (qq_var) = n; \ 10783df0b67a14425c484d8dda42b53f3ff0b598894njn /* Check for non-numeralness, or overflow. */ \ 1085b99e6669a0b2a925bb3fb2604259cc317963b6dflorian if ('\0' != s[0] || (qq_var) != n) VG_(fmsg_bad_option)(qq_arg, \ 1095b99e6669a0b2a925bb3fb2604259cc317963b6dflorian "Invalid integer value '%s'\n", val); \ 11083df0b67a14425c484d8dda42b53f3ff0b598894njn True; \ 11183df0b67a14425c484d8dda42b53f3ff0b598894njn }) \ 11283df0b67a14425c484d8dda42b53f3ff0b598894njn ) 11383df0b67a14425c484d8dda42b53f3ff0b598894njn 11483df0b67a14425c484d8dda42b53f3ff0b598894njn// Bounded integer arg, eg. --foo=10 ; if the value exceeds the bounds it 11583df0b67a14425c484d8dda42b53f3ff0b598894njn// causes an abort. 'qq_base' can be 10 or 16. 11683df0b67a14425c484d8dda42b53f3ff0b598894njn#define VG_BINTN_CLO(qq_base, qq_arg, qq_option, qq_var, qq_lo, qq_hi) \ 11783df0b67a14425c484d8dda42b53f3ff0b598894njn (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ 11883df0b67a14425c484d8dda42b53f3ff0b598894njn ({ \ 11919f91bbaedb4caef8a60ce94b0f507193cc0bc10florian const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ 12019f91bbaedb4caef8a60ce94b0f507193cc0bc10florian HChar* s; \ 12183df0b67a14425c484d8dda42b53f3ff0b598894njn Long n = VG_(strtoll##qq_base)( val, &s ); \ 12262721e90cec685b202424719f7237620e2c5780dnjn (qq_var) = n; \ 123b1cc5d666cc8f8065419e4a8c819ed0b8256a764njn /* MMM: separate the two cases, and explain the problem; likewise */ \ 124b1cc5d666cc8f8065419e4a8c819ed0b8256a764njn /* for all the other macros in this file. */ \ 12583df0b67a14425c484d8dda42b53f3ff0b598894njn /* Check for non-numeralness, or overflow. */ \ 12683df0b67a14425c484d8dda42b53f3ff0b598894njn /* Nb: it will overflow if qq_var is unsigned and qq_val is negative! */ \ 1275b99e6669a0b2a925bb3fb2604259cc317963b6dflorian if ('\0' != s[0] || (qq_var) != n) VG_(fmsg_bad_option)(qq_arg, \ 1285b99e6669a0b2a925bb3fb2604259cc317963b6dflorian "Invalid integer value '%s'\n", val); \ 12983df0b67a14425c484d8dda42b53f3ff0b598894njn /* Check bounds. */ \ 13083df0b67a14425c484d8dda42b53f3ff0b598894njn if ((qq_var) < (qq_lo) || (qq_var) > (qq_hi)) { \ 131b1cc5d666cc8f8065419e4a8c819ed0b8256a764njn VG_(fmsg_bad_option)(qq_arg, \ 132b1cc5d666cc8f8065419e4a8c819ed0b8256a764njn "'%s' argument must be between %lld and %lld\n", \ 133b1cc5d666cc8f8065419e4a8c819ed0b8256a764njn (qq_option), (Long)(qq_lo), (Long)(qq_hi)); \ 13483df0b67a14425c484d8dda42b53f3ff0b598894njn } \ 13583df0b67a14425c484d8dda42b53f3ff0b598894njn True; \ 13683df0b67a14425c484d8dda42b53f3ff0b598894njn }) \ 13783df0b67a14425c484d8dda42b53f3ff0b598894njn ) 13883df0b67a14425c484d8dda42b53f3ff0b598894njn 13983df0b67a14425c484d8dda42b53f3ff0b598894njn// Bounded decimal integer arg, eg. --foo=100 14083df0b67a14425c484d8dda42b53f3ff0b598894njn#define VG_BINT_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \ 14183df0b67a14425c484d8dda42b53f3ff0b598894njn VG_BINTN_CLO(10, (qq_arg), qq_option, (qq_var), (qq_lo), (qq_hi)) 14283df0b67a14425c484d8dda42b53f3ff0b598894njn 14383df0b67a14425c484d8dda42b53f3ff0b598894njn// Bounded hexadecimal integer arg, eg. --foo=0x1fa8 144eb0fa9345010077e1e4852b238dde303b8f271b3sewardj#define VG_BHEX_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \ 14583df0b67a14425c484d8dda42b53f3ff0b598894njn VG_BINTN_CLO(16, (qq_arg), qq_option, (qq_var), (qq_lo), (qq_hi)) 146eb0fa9345010077e1e4852b238dde303b8f271b3sewardj 14783df0b67a14425c484d8dda42b53f3ff0b598894njn// Double (decimal) arg, eg. --foo=4.6 14883df0b67a14425c484d8dda42b53f3ff0b598894njn// XXX: there's not VG_BDBL_CLO because we don't have a good way of printing 14983df0b67a14425c484d8dda42b53f3ff0b598894njn// floats at the moment! 15062721e90cec685b202424719f7237620e2c5780dnjn#define VG_DBL_CLO(qq_arg, qq_option, qq_var) \ 15183df0b67a14425c484d8dda42b53f3ff0b598894njn (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ 15283df0b67a14425c484d8dda42b53f3ff0b598894njn ({ \ 15319f91bbaedb4caef8a60ce94b0f507193cc0bc10florian const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ 15419f91bbaedb4caef8a60ce94b0f507193cc0bc10florian HChar* s; \ 15583df0b67a14425c484d8dda42b53f3ff0b598894njn double n = VG_(strtod)( val, &s ); \ 15662721e90cec685b202424719f7237620e2c5780dnjn (qq_var) = n; \ 15762721e90cec685b202424719f7237620e2c5780dnjn /* Check for non-numeralness */ \ 1585b99e6669a0b2a925bb3fb2604259cc317963b6dflorian if ('\0' != s[0]) VG_(fmsg_bad_option)(qq_arg, \ 1595b99e6669a0b2a925bb3fb2604259cc317963b6dflorian "Invalid floating point value '%s'\n",val); \ 16083df0b67a14425c484d8dda42b53f3ff0b598894njn True; \ 16183df0b67a14425c484d8dda42b53f3ff0b598894njn }) \ 16283df0b67a14425c484d8dda42b53f3ff0b598894njn ) 16383df0b67a14425c484d8dda42b53f3ff0b598894njn 16483df0b67a14425c484d8dda42b53f3ff0b598894njn// Arg whose value is denoted by the exact presence of the given string; 16583df0b67a14425c484d8dda42b53f3ff0b598894njn// if it matches, qq_var is assigned the value in qq_val. 16683df0b67a14425c484d8dda42b53f3ff0b598894njn#define VG_XACT_CLO(qq_arg, qq_option, qq_var, qq_val) \ 16783df0b67a14425c484d8dda42b53f3ff0b598894njn (VG_STREQ((qq_arg), (qq_option)) && \ 16883df0b67a14425c484d8dda42b53f3ff0b598894njn ({ \ 16983df0b67a14425c484d8dda42b53f3ff0b598894njn (qq_var) = (qq_val); \ 17083df0b67a14425c484d8dda42b53f3ff0b598894njn True; \ 17183df0b67a14425c484d8dda42b53f3ff0b598894njn }) \ 17283df0b67a14425c484d8dda42b53f3ff0b598894njn ) 173f767d967b9ef331dcd7d0cd4584f6570cd829333sewardj 1748d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj// Arg that can be one of a set of strings, as specified in an NULL 1758d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj// terminated array. Returns the index of the string in |qq_ix|, or 1768d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj// aborts if not found. 1778d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj#define VG_STRINDEX_CLO(qq_arg, qq_option, qq_strings, qq_ix) \ 1788d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ 1798d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj ({ \ 1808d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ 1818d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj for (qq_ix = 0; (qq_strings)[qq_ix]; qq_ix++) { \ 1828d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj if (VG_STREQ(val, (qq_strings)[qq_ix])) \ 1838d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj break; \ 1848d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj } \ 1858d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj if ((qq_strings)[qq_ix] == NULL) \ 1868d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj VG_(fmsg_bad_option)(qq_arg, \ 1878d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj "Invalid string '%s' in '%s'\n", val, qq_arg); \ 1888d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj True; \ 1898d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj }) \ 1908d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj ) 1918d47a61e503b69ffbc783717f5faf09d0bbc4723sewardj 1922024234c590f408994b373abfb00bc2cd2a90c48njn/* Verbosity level: 0 = silent, 1 (default), > 1 = more verbose. */ 19371bc3cbb1b6da72fe1d3a9fea90e53847c5b0a6fsewardjextern Int VG_(clo_verbosity); 1942024234c590f408994b373abfb00bc2cd2a90c48njn 1952d9e874b7a628ada216f09cc4f065798c65fffa4sewardj/* Show tool and core statistics */ 1962d9e874b7a628ada216f09cc4f065798c65fffa4sewardjextern Bool VG_(clo_stats); 1972d9e874b7a628ada216f09cc4f065798c65fffa4sewardj 1983b290486cd4cd601b20e04340e593c9ed9717e5fsewardj/* wait for vgdb/gdb after reporting that amount of error. 1993b290486cd4cd601b20e04340e593c9ed9717e5fsewardj Note that this is the initial value provided from the command line. 2003b290486cd4cd601b20e04340e593c9ed9717e5fsewardj The real value is maintained in VG_(dyn_vgdb_error) and 2013b290486cd4cd601b20e04340e593c9ed9717e5fsewardj can be changed dynamically.*/ 2023b290486cd4cd601b20e04340e593c9ed9717e5fsewardjextern Int VG_(clo_vgdb_error); 2033b290486cd4cd601b20e04340e593c9ed9717e5fsewardj 204cffe2a55d903655761ccc6025a23b823bee10170philippe/* If user has provided the --vgdb-prefix command line option, 205cffe2a55d903655761ccc6025a23b823bee10170philippe VG_(arg_vgdb_prefix) points at the provided argument (including the 206cffe2a55d903655761ccc6025a23b823bee10170philippe '--vgdb-prefix=' string). 207cffe2a55d903655761ccc6025a23b823bee10170philippe Otherwise, it is NULL. 208cffe2a55d903655761ccc6025a23b823bee10170philippe Typically, this is used by tools to produce user message with the 209cffe2a55d903655761ccc6025a23b823bee10170philippe expected vgdb prefix argument, if the user has changed the default. */ 210cffe2a55d903655761ccc6025a23b823bee10170philippeextern const HChar *VG_(arg_vgdb_prefix); 211cffe2a55d903655761ccc6025a23b823bee10170philippe 21271bc3cbb1b6da72fe1d3a9fea90e53847c5b0a6fsewardj/* Emit all messages as XML? default: NO */ 21371bc3cbb1b6da72fe1d3a9fea90e53847c5b0a6fsewardj/* If clo_xml is set, various other options are set in a non-default 21471bc3cbb1b6da72fe1d3a9fea90e53847c5b0a6fsewardj way. See vg_main.c and mc_main.c. */ 21571bc3cbb1b6da72fe1d3a9fea90e53847c5b0a6fsewardjextern Bool VG_(clo_xml); 2162024234c590f408994b373abfb00bc2cd2a90c48njn 217768db0eac5cd57ab3245f49b0e54fa51b63bc09fsewardj/* An arbitrary user-supplied string which is copied into the 218768db0eac5cd57ab3245f49b0e54fa51b63bc09fsewardj XML output, in between <usercomment> tags. */ 21919f91bbaedb4caef8a60ce94b0f507193cc0bc10florianextern const HChar* VG_(clo_xml_user_comment); 220768db0eac5cd57ab3245f49b0e54fa51b63bc09fsewardj 221f9b5b7de773bb764b239483c937b4ac2698b31d3sewardj/* Vex iropt control. Tool-visible so tools can make Vex optimise 222f9b5b7de773bb764b239483c937b4ac2698b31d3sewardj less aggressively if that is needed (callgrind needs this). */ 223f9b5b7de773bb764b239483c937b4ac2698b31d3sewardjextern VexControl VG_(clo_vex_control); 2248d47a61e503b69ffbc783717f5faf09d0bbc4723sewardjextern VexRegisterUpdates VG_(clo_px_file_backed); 225f9b5b7de773bb764b239483c937b4ac2698b31d3sewardj 226ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughesextern Int VG_(clo_redzone_size); 227ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes 228ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughestypedef 229ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes enum { 230ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes Vg_XTMemory_None, // Do not do any xtree memory profiling. 231ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes Vg_XTMemory_Allocs, // Currently allocated size xtree memory profiling 232ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes Vg_XTMemory_Full, // Full profiling : Current allocated size, total 233ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes // allocated size, nr of blocks, total freed size, ... 234ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes } 235ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes VgXTMemory; 236ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes// Tools that replace malloc can optionally implement memory profiling 237ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes// following the value of VG_(clo_xtree_profile_memory) to produce a report 238ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes// at the end of execution. 239ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughesextern VgXTMemory VG_(clo_xtree_memory); 240ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes/* Holds the filename to use for xtree memory profiling output, before expansion 241ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes of %p and %q templates. */ 242ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughesextern const HChar* VG_(clo_xtree_memory_file); 243ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes/* Compress strings in xtree dumps. */ 244ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughesextern Bool VG_(clo_xtree_compress_strings); 245ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes 2465914aec86e121a21ef14ee06085789efdf26aeaaflorian/* Number of parents of a backtrace. Default: 12 */ 247da09859cea34f58de8ba2263e3c4c4ce778ff636sewardjextern Int VG_(clo_backtrace_size); 248da09859cea34f58de8ba2263e3c4c4ce778ff636sewardj 2496882443ef154bca367bc591287de641e43a9e108njn/* Continue stack traces below main()? Default: NO */ 2506882443ef154bca367bc591287de641e43a9e108njnextern Bool VG_(clo_show_below_main); 2516882443ef154bca367bc591287de641e43a9e108njn 2526882443ef154bca367bc591287de641e43a9e108njn 2535eed741886ed78a2d6d0116355144f6eb0d50f0esewardj/* Used to expand file names. "option_name" is the option name, eg. 254374a36dbfb6d08ed8d77c31a88e198a861ffadf0njn "--log-file". 'format' is what follows, eg. "cachegrind.out.%p". In 255374a36dbfb6d08ed8d77c31a88e198a861ffadf0njn 'format': 256374a36dbfb6d08ed8d77c31a88e198a861ffadf0njn - "%p" is replaced with PID. 257374a36dbfb6d08ed8d77c31a88e198a861ffadf0njn - "%q{QUAL}" is replaced with the environment variable $QUAL. If $QUAL 258374a36dbfb6d08ed8d77c31a88e198a861ffadf0njn isn't set, we abort. If the "{QUAL}" part is malformed, we abort. 259374a36dbfb6d08ed8d77c31a88e198a861ffadf0njn - "%%" is replaced with "%". 260374a36dbfb6d08ed8d77c31a88e198a861ffadf0njn Anything else after '%' causes an abort. 2612dd08f575042c604cebf32f2c2002a0fba0ed800njn If the format specifies a relative file name, it's put in the program's 2622dd08f575042c604cebf32f2c2002a0fba0ed800njn initial working directory. If it specifies an absolute file name (ie. 2632dd08f575042c604cebf32f2c2002a0fba0ed800njn starts with '/') then it is put there. 2645eed741886ed78a2d6d0116355144f6eb0d50f0esewardj 2655eed741886ed78a2d6d0116355144f6eb0d50f0esewardj Note that "option_name" has no effect on the returned string: the 2665eed741886ed78a2d6d0116355144f6eb0d50f0esewardj returned string depends only on "format" and the PIDs and 2675eed741886ed78a2d6d0116355144f6eb0d50f0esewardj environment variables that it references (if any). "option_name" is 2685eed741886ed78a2d6d0116355144f6eb0d50f0esewardj merely used in printing error messages, if an error message needs 2695eed741886ed78a2d6d0116355144f6eb0d50f0esewardj to be printed due to malformedness of the "format" argument. 270374a36dbfb6d08ed8d77c31a88e198a861ffadf0njn*/ 27119f91bbaedb4caef8a60ce94b0f507193cc0bc10florianextern HChar* VG_(expand_file_name)(const HChar* option_name, 27219f91bbaedb4caef8a60ce94b0f507193cc0bc10florian const HChar* format); 2736893d65852940741dbebbc6ba1480e89cf34e30fsewardj 2742024234c590f408994b373abfb00bc2cd2a90c48njn#endif // __PUB_TOOL_OPTIONS_H 2752024234c590f408994b373abfb00bc2cd2a90c48njn 2762024234c590f408994b373abfb00bc2cd2a90c48njn/*--------------------------------------------------------------------*/ 2772024234c590f408994b373abfb00bc2cd2a90c48njn/*--- end ---*/ 2782024234c590f408994b373abfb00bc2cd2a90c48njn/*--------------------------------------------------------------------*/ 279