blob: 030f78c70d27a3b5ea43feb920556a8d4ae8abf2 [file] [log] [blame]
sewardj32824022005-05-17 13:45:04 +00001
2/*--------------------------------------------------------------------*/
3/*--- Command line options. ---*/
4/*--- m_options.c ---*/
5/*--------------------------------------------------------------------*/
6
7/*
8 This file is part of Valgrind, a dynamic binary instrumentation
9 framework.
10
sewardj9ebd6e02007-01-08 06:01:59 +000011 Copyright (C) 2000-2007 Nicholas Nethercote
sewardj32824022005-05-17 13:45:04 +000012 njn@valgrind.org
13
14 This program is free software; you can redistribute it and/or
15 modify it under the terms of the GNU General Public License as
16 published by the Free Software Foundation; either version 2 of the
17 License, or (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
27 02111-1307, USA.
28
29 The GNU General Public License is contained in the file COPYING.
30*/
31
njnc7561b92005-06-19 01:24:32 +000032#include "pub_core_basics.h"
njna3506d32005-05-18 04:36:01 +000033#include "pub_core_options.h"
sewardj6893d652006-10-15 01:25:13 +000034#include "pub_core_libcassert.h"
35#include "pub_core_libcprint.h"
sewardj32824022005-05-17 13:45:04 +000036
njna3506d32005-05-18 04:36:01 +000037// See pub_{core,tool}_options.h for explanations of all these.
38
39
40/* Define, and set defaults. */
41VexControl VG_(clo_vex_control);
42Bool VG_(clo_error_limit) = True;
sewardjb9779082006-05-12 23:50:15 +000043Int VG_(clo_error_exitcode) = 0;
njna3506d32005-05-18 04:36:01 +000044Bool VG_(clo_db_attach) = False;
45Char* VG_(clo_db_command) = GDB_PATH " -nw %f %p";
46Int VG_(clo_gen_suppressions) = 0;
47Int VG_(clo_sanity_level) = 1;
48Int VG_(clo_verbosity) = 1;
sewardj71bc3cb2005-05-19 00:25:45 +000049Bool VG_(clo_xml) = False;
sewardj768db0e2005-07-19 14:18:56 +000050HChar* VG_(clo_xml_user_comment) = NULL;
njna3506d32005-05-18 04:36:01 +000051Bool VG_(clo_demangle) = True;
52Bool VG_(clo_trace_children) = False;
53Int VG_(clo_log_fd) = 2;
54Char* VG_(clo_log_name) = NULL;
sewardjad311162005-07-19 11:25:02 +000055Char* VG_(clo_log_file_qualifier) = NULL;
njna3506d32005-05-18 04:36:01 +000056Bool VG_(clo_time_stamp) = False;
57Int VG_(clo_input_fd) = 0; /* stdin */
58Int VG_(clo_n_suppressions) = 0;
59Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES];
njna3506d32005-05-18 04:36:01 +000060UChar VG_(clo_trace_flags) = 0; // 00000000b
61UChar VG_(clo_profile_flags) = 0; // 00000000b
sewardj33afdb52006-01-17 02:36:40 +000062Int VG_(clo_trace_notbelow) = 999999999;
njna3506d32005-05-18 04:36:01 +000063Bool VG_(clo_trace_syscalls) = False;
64Bool VG_(clo_trace_signals) = False;
65Bool VG_(clo_trace_symtab) = False;
sewardjf767d962007-02-12 17:47:14 +000066HChar* VG_(clo_trace_symtab_patt) = "*";
njna3506d32005-05-18 04:36:01 +000067Bool VG_(clo_trace_cfi) = False;
sewardjf767d962007-02-12 17:47:14 +000068Bool VG_(clo_debug_dump_syms) = False;
69Bool VG_(clo_debug_dump_line) = False;
70Bool VG_(clo_debug_dump_frames) = False;
njna3506d32005-05-18 04:36:01 +000071Bool VG_(clo_trace_redir) = False;
72Bool VG_(clo_trace_sched) = False;
73Bool VG_(clo_trace_pthreads) = False;
74Int VG_(clo_dump_error) = 0;
75Int VG_(clo_backtrace_size) = 12;
njn628add62005-11-12 18:21:40 +000076Char* VG_(clo_sim_hints) = NULL;
sewardj41ded2c2006-10-17 01:34:57 +000077Bool VG_(clo_sym_offsets) = False;
njna3506d32005-05-18 04:36:01 +000078Bool VG_(clo_run_libc_freeres) = True;
79Bool VG_(clo_track_fds) = False;
80Bool VG_(clo_show_below_main)= False;
njna3506d32005-05-18 04:36:01 +000081Bool VG_(clo_show_emwarns) = False;
82Int VG_(clo_max_stackframe) = 2000000;
83Bool VG_(clo_wait_for_gdb) = False;
sewardj6c3a2192005-07-24 07:00:45 +000084VgSmc VG_(clo_smc_check) = Vg_SmcStack;
sewardjce5a5662005-10-06 03:19:49 +000085HChar* VG_(clo_kernel_variant) = NULL;
sewardj26412bd2005-07-07 10:05:05 +000086
sewardj32824022005-05-17 13:45:04 +000087
sewardj6893d652006-10-15 01:25:13 +000088/*====================================================================*/
89/*=== Command line errors ===*/
90/*====================================================================*/
91
92static void revert_to_stderr ( void )
93{
94 vg_assert( !VG_(logging_to_socket) );
95 VG_(clo_log_fd) = 2; /* stderr */
96}
97
98void VG_(err_bad_option) ( Char* opt )
99{
100 revert_to_stderr();
101 VG_(printf)("valgrind: Bad option '%s'; aborting.\n", opt);
102 VG_(printf)("valgrind: Use --help for more information.\n");
103 VG_(exit)(1);
104}
105
106void VG_(err_missing_prog) ( void )
107{
108 revert_to_stderr();
109 VG_(printf)("valgrind: no program specified\n");
110 VG_(printf)("valgrind: Use --help for more information.\n");
111 VG_(exit)(1);
112}
113
114void VG_(err_config_error) ( Char* msg )
115{
116 revert_to_stderr();
117 VG_(printf)("valgrind: Startup or configuration error:\n %s\n", msg);
118 VG_(printf)("valgrind: Unable to start up properly. Giving up.\n");
119 VG_(exit)(1);
120}
121
122
sewardj32824022005-05-17 13:45:04 +0000123/*--------------------------------------------------------------------*/
124/*--- end m_options.c ---*/
125/*--------------------------------------------------------------------*/