]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Added module m_options for holding all the command-line option stuff.
authorNicholas Nethercote <njn@valgrind.org>
Mon, 16 May 2005 23:31:24 +0000 (23:31 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Mon, 16 May 2005 23:31:24 +0000 (23:31 +0000)
Perhaps parts of process_cmd_line_option() should go in here, but I've
not done that for now.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3751

33 files changed:
auxprogs/valgrind-listener.c
cachegrind/cg_main.c
coregrind/Makefile.am
coregrind/core.h
coregrind/linux/core_os.c
coregrind/m_aspacemgr/aspacemgr.c
coregrind/m_demangle/demangle.c
coregrind/m_errormgr.c
coregrind/m_execontext.c
coregrind/m_mallocfree.c
coregrind/m_options.c [new file with mode: 0644]
coregrind/m_replacemalloc/replacemalloc_core.c
coregrind/m_sigframe/sigframe-amd64-linux.c
coregrind/m_sigframe/sigframe-x86-linux.c
coregrind/m_stacktrace.c
coregrind/m_syscalls/priv_syscalls.h
coregrind/m_translate.c
coregrind/m_transtab.c
coregrind/pub_core_options.h [new file with mode: 0644]
coregrind/vg_dwarf.c
coregrind/vg_main.c
coregrind/vg_messages.c
coregrind/vg_mylibc.c
coregrind/vg_redir.c
coregrind/vg_scheduler.c
coregrind/vg_signals.c
coregrind/vg_symtab2.c
helgrind/hg_main.c
include/Makefile.am
include/pub_tool_options.h [new file with mode: 0644]
include/tool.h
massif/ms_main.c
memcheck/mac_shared.h

index 488b842853e4b7b544015338103867a4607b6d83..17155c9876b73e82c06da72cd0b8eaedf979e71e 100644 (file)
@@ -47,6 +47,7 @@
 
 /* For VG_CLO_DEFAULT_LOGPORT and VG_BUGS_TO. */
 #include "core.h"
+#include "pub_core_options.h"
 
 
 /*---------------------------------------------------------------*/
index 1d134b1e18f3154ebb6e978bb0f09f0064345e48..036176cc57ca4e23e7d89b88039d2033bcf25984 100644 (file)
@@ -32,6 +32,7 @@
 #include "tool.h"
 #include "pub_tool_hashtable.h"
 #include "pub_tool_mallocfree.h"
+#include "pub_tool_options.h"
 #include "pub_tool_tooliface.h"
 
 #include "cg_arch.h"
index 1aa8dcb8e4bf7731514ef46dd796997252bce2ff..ed1a206edca173ddf2ad27265842047d7d0e35c1 100644 (file)
@@ -47,6 +47,7 @@ noinst_HEADERS = \
        pub_core_execontext.h   \
        pub_core_hashtable.h    \
        pub_core_mallocfree.h   \
+       pub_core_options.h      \
        pub_core_replacemalloc.h\
        pub_core_sigframe.h     \
        pub_core_skiplist.h     \
@@ -80,6 +81,7 @@ stage2_SOURCES = \
        m_execontext.c \
        m_hashtable.c \
        m_mallocfree.c \
+       m_options.c \
        m_skiplist.c \
        m_stacktrace.c \
        m_tooliface.c \
index 5a3503f812b9325378f785018a9e6ae7adaead3a..c5e170bd69efadf817eee6488c0a8f542f226685 100644 (file)
@@ -92,136 +92,10 @@ typedef struct _ThreadState ThreadState;
 #define VALGRINDCLO    "_VALGRIND_CLO"
 
 
-/* ---------------------------------------------------------------------
-   Command-line-settable options
-   ------------------------------------------------------------------ */
-
-/* Default destination port to be used in logging over a network, if
-   none specified. */
-#define VG_CLO_DEFAULT_LOGPORT 1500
-
-/* The max number of suppression files. */
-#define VG_CLO_MAX_SFILES 10
-
 /* Application-visible file descriptor limits */
 extern Int VG_(fd_soft_limit);
 extern Int VG_(fd_hard_limit);
 
-/* Vex iropt control */
-extern VexControl VG_(clo_vex_control);
-/* Should we stop collecting errors if too many appear?  default: YES */
-extern Bool  VG_(clo_error_limit);
-/* Enquire about whether to attach to a debugger at errors?   default: NO */
-extern Bool  VG_(clo_db_attach);
-/* The debugger command?  default: whatever gdb ./configure found */
-extern Char* VG_(clo_db_command);
-/* Generating a suppression for each error?   default: 0 (NO)
-   Other values: 1 (yes, but ask user), 2 (yes, don't ask user) */
-extern Int  VG_(clo_gen_suppressions);
-/* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */
-extern Int   VG_(clo_sanity_level);
-/* Automatically attempt to demangle C++ names?  default: YES */
-extern Bool  VG_(clo_demangle);
-/* Simulate child processes? default: NO */
-extern Bool  VG_(clo_trace_children);
-
-/* Where logging output is to be sent to.
-
-   With --log-fd (and by default), clo_log_fd holds the file id, and is
-   taken from the command line.  (fd 2, stderr, is the default.)
-   clo_log_name is irrelevant.
-
-   With --log-file/--log-file-exactly, clo_log_name holds the log-file
-   name, and is taken from the command line.  clo_log_fd is then
-   made to hold the relevant file id, by opening clo_log_name
-   (concatenated with the process ID) for writing.
-
-   With --log-socket, clo_log_name holds the hostname:portnumber pair,
-   and is taken from the command line.  clo_log_fd is then made to hold
-   the relevant file handle, by opening a connection to that
-   hostname:portnumber pair. 
-
-   Global default is to set log_to == VgLogTo_Fd and log_fd == 2
-   (stderr). */
-extern Int     VG_(clo_log_fd);
-extern Char*   VG_(clo_log_name);
-
-/* Add timestamps to log messages?  default: NO */
-extern Bool  VG_(clo_time_stamp);
-
-/* The file descriptor to read for input.  default: 0 == stdin */
-extern Int   VG_(clo_input_fd);
-/* The number of suppression files specified. */
-extern Int   VG_(clo_n_suppressions);
-/* The names of the suppression files. */
-extern Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES];
-
-/* DEBUG: print generated code?  default: 00000000 ( == NO ) */
-extern Bool  VG_(clo_trace_flags);
-/* DEBUG: do bb profiling?  default: 00000000 ( == NO ) */
-extern Bool  VG_(clo_profile_flags);
-/* DEBUG: if tracing codegen, be quiet until after this bb ( 0 ) */
-extern Int   VG_(clo_trace_notbelow);
-/* DEBUG: print system calls?  default: NO */
-extern Bool  VG_(clo_trace_syscalls);
-/* DEBUG: print signal details?  default: NO */
-extern Bool  VG_(clo_trace_signals);
-/* DEBUG: print symtab details?  default: NO */
-extern Bool  VG_(clo_trace_symtab);
-/* DEBUG: print call-frame-info details?  default: NO */
-extern Bool  VG_(clo_trace_cfi);
-/* DEBUG: print redirection details?  default: NO */
-extern Bool  VG_(clo_trace_redir);
-/* DEBUG: print thread scheduling events?  default: NO */
-extern Bool  VG_(clo_trace_sched);
-/* DEBUG: print pthreads calls?  default: NO */
-extern Bool  VG_(clo_trace_pthreads);
-/* Display gory details for the k'th most popular error.  default:
-   Infinity. */
-extern Int   VG_(clo_dump_error);
-/* Number of parents of a backtrace.  Default: 8.  */
-extern Int   VG_(clo_backtrace_size);
-/* Engage miscellaneous weird hacks needed for some progs. */
-extern Char* VG_(clo_weird_hacks);
-
-/* Track open file descriptors? */
-extern Bool  VG_(clo_track_fds);
-
-/* Should we run __libc_freeres at exit?  Sometimes causes crashes.
-   Default: YES.  Note this is subservient to VG_(needs).libc_freeres;
-   if the latter says False, then the setting of VG_(clo_weird_hacks)
-   is ignored.  Ie if a tool says no, I don't want this to run, that
-   cannot be overridden from the command line. */
-extern Bool  VG_(clo_run_libc_freeres);
-/* Generate branch-prediction hints? */
-extern Bool VG_(clo_branchpred);
-/* Continue stack traces below main()?  Default: NO */
-extern Bool VG_(clo_show_below_main);
-/* Test each client pointer dereference to check it's within the
-   client address space bounds */
-extern Bool VG_(clo_pointercheck);
-/* Model the pthread library */
-extern Bool VG_(clo_model_pthreads);
-
-/* HACK: Use hacked version of clone for Quadrics Elan3 drivers */
-extern Bool VG_(clo_support_elan3);
-
-/* Should we show VEX emulation warnings?  Default: NO */
-extern Bool VG_(clo_show_emwarns);
-
-/* How much does the stack pointer have to change before tools
-   consider a stack switch to have happened?  Default: 2000000 bytes */
-extern Int VG_(clo_max_stackframe);
-
-/* Set up the libc freeres wrapper */
-extern void VGA_(intercept_libc_freeres_wrapper)(Addr);
-
-// Clean up the client by calling before the final reports
-extern void VGA_(final_tidyup)(ThreadId tid);
-
-// Arch-specific client requests
-extern Bool VGA_(client_requests)(ThreadId tid, UWord *args);
-
 /* ---------------------------------------------------------------------
    Profiling stuff
    ------------------------------------------------------------------ */
@@ -819,6 +693,15 @@ extern Int  VGA_(ptrace_setregs_from_tst) ( Int pid, ThreadArchState* arch );
 // Used by leakcheck
 extern void VGA_(mark_from_registers)(ThreadId tid, void (*marker)(Addr));
 
+// Set up the libc freeres wrapper
+extern void VGA_(intercept_libc_freeres_wrapper)(Addr);
+
+// Clean up the client by calling before the final reports
+extern void VGA_(final_tidyup)(ThreadId tid);
+
+// Arch-specific client requests
+extern Bool VGA_(client_requests)(ThreadId tid, UWord *args);
+
 
 // ---------------------------------------------------------------------
 // Platform-specific things defined in eg. x86/*.c
index 93a16611915d980e41349187f7df188a9714d7c4..d0cd7a713938c1eca3cec9491cdc7e4b350f5b38 100644 (file)
@@ -29,6 +29,7 @@
 */
 
 #include "core.h"
+#include "pub_core_options.h"
 #include "pub_core_tooliface.h"
 
 void VGA_(os_state_clear)(ThreadState *tst)
index 4e609e02c1733eff45e5eb8cbccb401870909f08..97dd33448498f8de34518fffd385fbd4d513368e 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "core.h"
 #include "pub_core_aspacemgr.h"
+#include "pub_core_options.h"
 #include "pub_core_syscalls.h"
 #include "pub_core_tooliface.h"
 #include "pub_core_transtab.h"
index b83d431bd58f414136f7a4e78c215711f95b9c51..8c3a03e0ddb72103cd3783c8ecc5d135b834ccfb 100644 (file)
@@ -29,6 +29,7 @@
 */
 
 #include "core.h"
+#include "pub_core_options.h"
 #include "demangle.h"
 
 void VG_(demangle) ( Char* orig, Char* result, Int result_size )
index a63620100037f35b3deb6f3cd65a0d88ec8eac75..df05c20e26f8e0f1c36f28af90fa1b98ca2f49f4 100644 (file)
@@ -31,6 +31,7 @@
 #include "core.h"
 #include "pub_core_errormgr.h"
 #include "pub_core_execontext.h"
+#include "pub_core_options.h"
 #include "pub_core_stacktrace.h"
 #include "pub_core_tooliface.h"
 #include "pub_core_translate.h"
index 59ea65c7789a59828ab68650702cc0ad9365e667..b27ec7db3a187066476fa38024758a5d6950880f 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "core.h"
 #include "pub_core_execontext.h"
+#include "pub_core_options.h"
 
 /*------------------------------------------------------------*/
 /*--- Low-level ExeContext storage.                        ---*/
index 7bb12c0fcbc72d012b551f5b26bbd95a18296321..f1f930f1d99ef8cfcd2c38c13392c3088faf73f9 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "core.h"
 #include "pub_core_aspacemgr.h"
+#include "pub_core_options.h"
 #include "valgrind.h"
 
 //zz#include "memcheck/memcheck.h"
diff --git a/coregrind/m_options.c b/coregrind/m_options.c
new file mode 100644 (file)
index 0000000..e69de29
index 9ef336e2d300f6810d9c7409b63fc9772c59d420..bb3c7d3b5fff7afbbdf5fcfe5ee047fb54bb3951 100644 (file)
@@ -29,6 +29,7 @@
 */
 
 #include "core.h"
+#include "pub_core_options.h"
 #include "pub_core_replacemalloc.h"
 
 /*------------------------------------------------------------*/
index df1e085434381184fa4943705e045fbfabcd15cb..a4e0ce3bf0e7f8c84a520e524a7131467b00dc95 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "core.h"
 #include "pub_core_aspacemgr.h"
+#include "pub_core_options.h"
 #include "pub_core_sigframe.h"
 #include "pub_core_tooliface.h"
 
index 9df64f9298378928be1b5970eb9aa90c2f26145d..884f41b98f74f044fd8f617ba87b750957f14f53 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "core.h"
 #include "pub_core_aspacemgr.h" /* find_segment */
+#include "pub_core_options.h"
 #include "pub_core_sigframe.h"
 #include "pub_core_tooliface.h"
 
index 9cb3ffccccd72cd9bd662ad4e553f423b0a2b9d4..2c56d6677646ecbf734ce70125965b32f7ff5a3e 100644 (file)
@@ -29,6 +29,7 @@
 */
 
 #include "core.h"
+#include "pub_core_options.h"
 #include "pub_core_stacktrace.h"
 
 /*------------------------------------------------------------*/
index 1d2100fa10bc928009da661b4f8a4f0909a0a6e1..2dc0b1df057c06857eb56c419ea8200f129a167a 100644 (file)
@@ -30,6 +30,8 @@
 #ifndef __PRIV_SYSCALLS_H
 #define __PRIV_SYSCALLS_H
 
+#include "pub_core_options.h"
+
 // This is ugly, but the alternatives (ie. doing it "properly" with -I options
 // and directories and more Makefiles) are even worse.
 #if defined(VGP_amd64_linux)
index 4ec0043a77b6b84009ddbebb51dc1990231f1668..fd5b286abb05308a7717f5cc4abdf1ef28648c22 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "core.h"
 #include "pub_core_aspacemgr.h"
+#include "pub_core_options.h"
 #include "pub_core_tooliface.h"
 #include "pub_core_translate.h"
 #include "pub_core_transtab.h"
index 9c44d4c73e7abfe747068312fa7c3a8d34469c5b..8846dd4778dc791b3c223e12c797fe8e0e7ef3d9 100644 (file)
@@ -30,6 +30,7 @@
 */
 
 #include "core.h"
+#include "pub_core_options.h"
 #include "pub_core_tooliface.h"
 // XXX: this module should not depend on m_translate!
 #include "pub_core_translate.h"
diff --git a/coregrind/pub_core_options.h b/coregrind/pub_core_options.h
new file mode 100644 (file)
index 0000000..bcdb0e4
--- /dev/null
@@ -0,0 +1,162 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Command line options.                     pub_core_options.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+   This file is part of Valgrind, a dynamic binary instrumentation
+   framework.
+
+   Copyright (C) 2000-2005 Julian Seward
+      jseward@acm.org
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307, USA.
+
+   The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __PUB_CORE_OPTIONS_H
+#define __PUB_CORE_OPTIONS_H
+
+//--------------------------------------------------------------------
+// PURPOSE: This module holds the variables for all command line options,
+// plus some functions and macros for manipulating them.  Almost every
+// other module imports this one, if only for VG_(clo_verbosity).
+//--------------------------------------------------------------------
+
+#include "pub_tool_options.h"
+
+/* Default destination port to be used in logging over a network, if
+   none specified. */
+#define VG_CLO_DEFAULT_LOGPORT 1500
+
+/* The max number of suppression files. */
+#define VG_CLO_MAX_SFILES 10
+
+/* Vex iropt control */
+extern VexControl VG_(clo_vex_control);
+/* Should we stop collecting errors if too many appear?  default: YES */
+extern Bool  VG_(clo_error_limit);
+/* Enquire about whether to attach to a debugger at errors?   default: NO */
+extern Bool  VG_(clo_db_attach);
+/* The debugger command?  default: whatever gdb ./configure found */
+extern Char* VG_(clo_db_command);
+/* Generating a suppression for each error?   default: 0 (NO)
+   Other values: 1 (yes, but ask user), 2 (yes, don't ask user) */
+extern Int  VG_(clo_gen_suppressions);
+/* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */
+extern Int   VG_(clo_sanity_level);
+/* Automatically attempt to demangle C++ names?  default: YES */
+extern Bool  VG_(clo_demangle);
+/* Simulate child processes? default: NO */
+extern Bool  VG_(clo_trace_children);
+
+/* Where logging output is to be sent to.
+
+   With --log-fd (and by default), clo_log_fd holds the file id, and is
+   taken from the command line.  (fd 2, stderr, is the default.)
+   clo_log_name is irrelevant.
+
+   With --log-file/--log-file-exactly, clo_log_name holds the log-file
+   name, and is taken from the command line.  clo_log_fd is then
+   made to hold the relevant file id, by opening clo_log_name
+   (concatenated with the process ID) for writing.
+
+   With --log-socket, clo_log_name holds the hostname:portnumber pair,
+   and is taken from the command line.  clo_log_fd is then made to hold
+   the relevant file handle, by opening a connection to that
+   hostname:portnumber pair. 
+
+   Global default is to set log_to == VgLogTo_Fd and log_fd == 2
+   (stderr). */
+extern Int     VG_(clo_log_fd);
+extern Char*   VG_(clo_log_name);
+
+/* Add timestamps to log messages?  default: NO */
+extern Bool  VG_(clo_time_stamp);
+
+/* The file descriptor to read for input.  default: 0 == stdin */
+extern Int   VG_(clo_input_fd);
+/* The number of suppression files specified. */
+extern Int   VG_(clo_n_suppressions);
+/* The names of the suppression files. */
+extern Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES];
+
+/* DEBUG: print generated code?  default: 00000000 ( == NO ) */
+extern Bool  VG_(clo_trace_flags);
+/* DEBUG: do bb profiling?  default: 00000000 ( == NO ) */
+extern Bool  VG_(clo_profile_flags);
+/* DEBUG: if tracing codegen, be quiet until after this bb ( 0 ) */
+extern Int   VG_(clo_trace_notbelow);
+/* DEBUG: print system calls?  default: NO */
+extern Bool  VG_(clo_trace_syscalls);
+/* DEBUG: print signal details?  default: NO */
+extern Bool  VG_(clo_trace_signals);
+/* DEBUG: print symtab details?  default: NO */
+extern Bool  VG_(clo_trace_symtab);
+/* DEBUG: print call-frame-info details?  default: NO */
+extern Bool  VG_(clo_trace_cfi);
+/* DEBUG: print redirection details?  default: NO */
+extern Bool  VG_(clo_trace_redir);
+/* DEBUG: print thread scheduling events?  default: NO */
+extern Bool  VG_(clo_trace_sched);
+/* DEBUG: print pthreads calls?  default: NO */
+extern Bool  VG_(clo_trace_pthreads);
+/* Display gory details for the k'th most popular error.  default:
+   Infinity. */
+extern Int   VG_(clo_dump_error);
+/* Number of parents of a backtrace.  Default: 8.  */
+extern Int   VG_(clo_backtrace_size);
+/* Engage miscellaneous weird hacks needed for some progs. */
+extern Char* VG_(clo_weird_hacks);
+
+/* Track open file descriptors? */
+extern Bool  VG_(clo_track_fds);
+
+/* Should we run __libc_freeres at exit?  Sometimes causes crashes.
+   Default: YES.  Note this is subservient to VG_(needs).libc_freeres;
+   if the latter says False, then the setting of VG_(clo_weird_hacks)
+   is ignored.  Ie if a tool says no, I don't want this to run, that
+   cannot be overridden from the command line. */
+extern Bool  VG_(clo_run_libc_freeres);
+/* Generate branch-prediction hints? */
+extern Bool VG_(clo_branchpred);
+/* Continue stack traces below main()?  Default: NO */
+extern Bool VG_(clo_show_below_main);
+/* Test each client pointer dereference to check it's within the
+   client address space bounds */
+extern Bool VG_(clo_pointercheck);
+/* Model the pthread library */
+extern Bool VG_(clo_model_pthreads);
+
+/* HACK: Use hacked version of clone for Quadrics Elan3 drivers */
+extern Bool VG_(clo_support_elan3);
+
+/* Should we show VEX emulation warnings?  Default: NO */
+extern Bool VG_(clo_show_emwarns);
+
+/* How much does the stack pointer have to change before tools
+   consider a stack switch to have happened?  Default: 2000000 bytes */
+extern Int VG_(clo_max_stackframe);
+
+/* Delay startup to allow GDB to be attached?  Default: NO */
+extern Bool VG_(clo_wait_for_gdb);
+
+#endif   // __PUB_CORE_OPTIONS_H
+
+/*--------------------------------------------------------------------*/
+/*--- end                                                          ---*/
+/*--------------------------------------------------------------------*/
index fc7d0c289054e3abc167ac55ebc7efa3431a030e..ba73a8fcd92e54330b1c75eb89d9d5258ffc343e 100644 (file)
@@ -30,6 +30,7 @@
 #include "core.h"
 #include "vg_symtab2.h"
 
+#include "pub_core_options.h"
 
 /* Structure found in the .debug_line section.  */
 typedef struct
index 4d09939ef413321f75fb4b1766feace4919ab5e7..0924c84859ad427b3fc55e6e3daab6dad3399e53 100644 (file)
@@ -36,6 +36,7 @@
 #include "pub_core_debuglog.h"
 #include "pub_core_errormgr.h"
 #include "pub_core_execontext.h"
+#include "pub_core_options.h"
 #include "pub_core_syscalls.h"
 #include "pub_core_tooliface.h"
 #include "pub_core_transtab.h"
@@ -1399,6 +1400,8 @@ static void as_closepadfile(int padfile)
 /*=== Command-line: variables, processing, etc                     ===*/
 /*====================================================================*/
 
+// See pub_{core,tool}_options.h for explanations of all these.
+
 /* Define, and set defaults. */
 VexControl VG_(clo_vex_control);
 Bool   VG_(clo_error_limit)    = True;
@@ -1409,13 +1412,9 @@ Int    VG_(clo_sanity_level)   = 1;
 Int    VG_(clo_verbosity)      = 1;
 Bool   VG_(clo_demangle)       = True;
 Bool   VG_(clo_trace_children) = False;
-
-/* See big comment in core.h for meaning of these two. */
-Int     VG_(clo_log_fd)        = 2;
-Char*   VG_(clo_log_name)      = NULL;
-
+Int    VG_(clo_log_fd)         = 2;
+Char*  VG_(clo_log_name)       = NULL;
 Bool   VG_(clo_time_stamp)     = False;
-
 Int    VG_(clo_input_fd)       = 0; /* stdin */
 Int    VG_(clo_n_suppressions) = 0;
 Char*  VG_(clo_suppressions)[VG_CLO_MAX_SFILES];
@@ -1435,15 +1434,14 @@ Int    VG_(clo_backtrace_size) = 12;
 Char*  VG_(clo_weird_hacks)    = NULL;
 Bool   VG_(clo_run_libc_freeres) = True;
 Bool   VG_(clo_track_fds)      = False;
-Bool   VG_(clo_show_below_main) = False;
+Bool   VG_(clo_show_below_main)= False;
 Bool   VG_(clo_pointercheck)   = True;
 Bool   VG_(clo_support_elan3)  = False;
 Bool   VG_(clo_branchpred)     = False;
 Bool   VG_(clo_model_pthreads) = False;
 Bool   VG_(clo_show_emwarns)   = False;
 Int    VG_(clo_max_stackframe) = 2000000;
-
-static Bool   VG_(clo_wait_for_gdb)   = False;
+Bool   VG_(clo_wait_for_gdb)   = False;
 
 
 static void usage ( Bool debug_help )
index 2780d6e9dd7a5c6873d7e73c14df69cf085946e1..ad5928f3d0b844ee8ac2cb67e40c3cab1ecbbfd2 100644 (file)
@@ -32,6 +32,8 @@
 #include "core.h"
 #include "valgrind.h"
 
+#include "pub_core_options.h"
+
 #include <time.h>
 #include <sys/time.h>
 
index ec19b6ca0dc15e522a3725663b2d7641b24819ee..206f1e84b89fa8c8e72165084576333b264b242a 100644 (file)
@@ -33,6 +33,7 @@
 #include "core.h"
 #include "pub_core_aspacemgr.h"
 #include "pub_core_debuglog.h"    /* VG_(debugLog_vprintf) */
+#include "pub_core_options.h"
 #include "pub_core_stacktrace.h"
 #include "pub_core_syscalls.h"
 #include "pub_core_tooliface.h"
index caada36859aa3eb631ddddb8e0dd5dbce4cfc8a7..1214e5839f93f6a1a41bb677866174a7e6ae51e6 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "pub_core_aspacemgr.h"
 #include "pub_core_skiplist.h"
+#include "pub_core_options.h"
 #include "pub_core_transtab.h"
 
 /*------------------------------------------------------------*/
index b44f66ec0c7ea359080cc82f73bb05b914e9cce9..d6c0a87c00b8a6813a30d2e5f4781fd2a9a73fa8 100644 (file)
@@ -62,6 +62,7 @@
 
 #include "pub_core_dispatch.h"
 #include "pub_core_errormgr.h"
+#include "pub_core_options.h"
 #include "pub_core_replacemalloc.h"
 #include "pub_core_stacktrace.h"
 #include "pub_core_syscalls.h"
index 24f7c0999727445280b9b51c85558d811dbb2b2e..c9e36c4a49752496049274f2dce4db72a30c2d14 100644 (file)
@@ -83,6 +83,7 @@
 
 #include "pub_core_aspacemgr.h"
 #include "pub_core_errormgr.h"
+#include "pub_core_options.h"
 #include "pub_core_sigframe.h"
 #include "pub_core_syscalls.h"
 #include "pub_core_tooliface.h"
index ab9dcecef065c06938d81d9a776f24d6bbb3b4da..a05f1308a71b6b7529165a5dc113a19f876333e0 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "pub_core_aspacemgr.h"
 #include "pub_core_demangle.h"
+#include "pub_core_options.h"
 #include "pub_core_tooliface.h"
 
 #include <elf.h>          /* ELF defns */
index 09f22527bc41bfdd09a59463dba513c6195e9030..efc76543fe029647bb8f2678daa3ad51c738ca93 100644 (file)
@@ -32,6 +32,7 @@
 #include "tool.h"
 #include "pub_tool_hashtable.h"
 #include "pub_tool_mallocfree.h"
+#include "pub_tool_options.h"
 #include "pub_tool_replacemalloc.h"
 #include "pub_tool_tooliface.h"
 
index f83190676817b686d0e45eba75c441a975a67c76..d35e71b46d76b912ae8430acd2a775ef34d8abd8 100644 (file)
@@ -12,6 +12,7 @@ incinc_HEADERS = \
        pub_tool_execontext.h           \
        pub_tool_hashtable.h            \
        pub_tool_mallocfree.h           \
+       pub_tool_options.h              \
        pub_tool_replacemalloc.h        \
        pub_tool_skiplist.h             \
        pub_tool_stacktrace.h           \
diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h
new file mode 100644 (file)
index 0000000..e321635
--- /dev/null
@@ -0,0 +1,78 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Command line options.                     pub_tool_options.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+   This file is part of Valgrind, a dynamic binary instrumentation
+   framework.
+
+   Copyright (C) 2000-2005 Julian Seward
+      jseward@acm.org
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307, USA.
+
+   The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __PUB_TOOL_OPTIONS_H
+#define __PUB_TOOL_OPTIONS_H
+
+/* Use these for recognising tool command line options -- stops comparing
+   once whitespace is reached. */
+#define VG_CLO_STREQ(s1,s2)     (0==VG_(strcmp_ws)((s1),(s2)))
+#define VG_CLO_STREQN(nn,s1,s2) (0==VG_(strncmp_ws)((s1),(s2),(nn)))
+
+/* Higher-level command-line option recognisers;  use in if/else chains */
+
+#define VG_BOOL_CLO(qq_arg, qq_option, qq_var) \
+        if (VG_CLO_STREQ(qq_arg, qq_option"=yes")) { (qq_var) = True; } \
+   else if (VG_CLO_STREQ(qq_arg, qq_option"=no"))  { (qq_var) = False; }
+
+#define VG_STR_CLO(qq_arg, qq_option, qq_var) \
+   if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
+      (qq_var) = &qq_arg[ VG_(strlen)(qq_option)+1 ]; \
+   }
+
+#define VG_NUM_CLO(qq_arg, qq_option, qq_var) \
+   if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
+      (qq_var) = (Int)VG_(atoll)( &qq_arg[ VG_(strlen)(qq_option)+1 ] ); \
+   }
+
+/* Bounded integer arg */
+#define VG_BNUM_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
+   if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
+      (qq_var) = (Int)VG_(atoll)( &qq_arg[ VG_(strlen)(qq_option)+1 ] ); \
+      if ((qq_var) < (qq_lo)) (qq_var) = (qq_lo); \
+      if ((qq_var) > (qq_hi)) (qq_var) = (qq_hi); \
+   }
+
+/* Verbosity level: 0 = silent, 1 (default), > 1 = more verbose. */
+extern Int   VG_(clo_verbosity);
+
+/* Profile? */
+extern Bool  VG_(clo_profile);
+
+/* Call this if a recognised option was bad for some reason.
+   Note: don't use it just because an option was unrecognised -- return 'False'
+   from VG_(tdict).tool_process_cmd_line_option) to indicate that. */
+extern void VG_(bad_option) ( Char* opt );
+
+#endif   // __PUB_TOOL_OPTIONS_H
+
+/*--------------------------------------------------------------------*/
+/*--- end                                                          ---*/
+/*--------------------------------------------------------------------*/
index a930165c17056eedcdecd88c860f64a60e1c7e96..904bc76bf16c2da304a880b96d8045ecdc28eedd 100644 (file)
 extern const Char *VG_(libdir);
 
 
-/*====================================================================*/
-/*=== Command-line options                                         ===*/
-/*====================================================================*/
-
 /* Use this for normal null-termination-style string comparison */
 #define VG_STREQ(s1,s2) (s1 != NULL && s2 != NULL \
                          && VG_(strcmp)((s1),(s2))==0)
 
-/* Use these for recognising tool command line options -- stops comparing
-   once whitespace is reached. */
-#define VG_CLO_STREQ(s1,s2)     (0==VG_(strcmp_ws)((s1),(s2)))
-#define VG_CLO_STREQN(nn,s1,s2) (0==VG_(strncmp_ws)((s1),(s2),(nn)))
-
-/* Higher-level command-line option recognisers;  use in if/else chains */
-
-#define VG_BOOL_CLO(qq_arg, qq_option, qq_var) \
-        if (VG_CLO_STREQ(qq_arg, qq_option"=yes")) { (qq_var) = True; } \
-   else if (VG_CLO_STREQ(qq_arg, qq_option"=no"))  { (qq_var) = False; }
-
-#define VG_STR_CLO(qq_arg, qq_option, qq_var) \
-   if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
-      (qq_var) = &qq_arg[ VG_(strlen)(qq_option)+1 ]; \
-   }
-
-#define VG_NUM_CLO(qq_arg, qq_option, qq_var) \
-   if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
-      (qq_var) = (Int)VG_(atoll)( &qq_arg[ VG_(strlen)(qq_option)+1 ] ); \
-   }
-
-/* Bounded integer arg */
-#define VG_BNUM_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
-   if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
-      (qq_var) = (Int)VG_(atoll)( &qq_arg[ VG_(strlen)(qq_option)+1 ] ); \
-      if ((qq_var) < (qq_lo)) (qq_var) = (qq_lo); \
-      if ((qq_var) > (qq_hi)) (qq_var) = (qq_hi); \
-   }
-
-
-/* Verbosity level: 0 = silent, 1 (default), > 1 = more verbose. */
-extern Int   VG_(clo_verbosity);
-
-/* Profile? */
-extern Bool  VG_(clo_profile);
-
-/* Call this if a recognised option was bad for some reason.
-   Note: don't use it just because an option was unrecognised -- return 'False'
-   from VG_(tdict).tool_process_cmd_line_option) to indicate that. */
-extern void VG_(bad_option) ( Char* opt );
-
 /* Client args */
 extern Int    VG_(client_argc);
 extern Char** VG_(client_argv);
index 6f789e9d413e0690475c8fbfe84121efe14ba144..ce5deeef9c6b819eb2aada98442787946d6b26ea 100644 (file)
@@ -37,6 +37,7 @@
 #include "tool.h"
 #include "pub_tool_hashtable.h"
 #include "pub_tool_mallocfree.h"
+#include "pub_tool_options.h"
 #include "pub_tool_replacemalloc.h"
 #include "pub_tool_stacktrace.h"
 #include "pub_tool_tooliface.h"
index 9a56bc39fdb1ad2b2e05bff978da2733cbc79d94..1554fc696974a470ceacc6695266dd6257e80e12 100644 (file)
@@ -39,6 +39,7 @@
 #include "tool.h"
 #include "pub_tool_hashtable.h"
 #include "pub_tool_mallocfree.h"
+#include "pub_tool_options.h"
 #include "pub_tool_replacemalloc.h"
 #include "pub_tool_tooliface.h"