Skip to content

Commit 97db761

Browse files
author
njn
committed
Various option-related tweaks:
- Match the ordering of the non-tool-specific options in the usage message with the order in the user manual. As a result, we now always print --alignment and --trace-malloc in the core's usage messages, which saves malloc-replacing tools from doing it themselves (and brings it in line with options that only apply to error-collecting tools). - Improved the presentation of the Vex options with --help-debug. - Removed documentation of -d in the manual because it's a debugging-only flag. - Documented --read-var-info in the manual. This fixes bug 201169. - Renamed --auto-run-dsymutil as --dsymutil and documented it in the usage message. - Fixed an XML error in manual-core-adv.xml. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10703 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent 2ec2b72 commit 97db761

File tree

20 files changed

+202
-160
lines changed

20 files changed

+202
-160
lines changed

NEWS

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ Release 3.5.0 (???)
99
- AMD64 (a.k.a. x86-64) are supported, but not as well.
1010
- Older PowerPC machines are not supported.
1111
- It requires Mac OS X 10.5 Leopard or later. Porting to 10.4 is not
12-
planned because it would require work and 10.4 is only becoming less common.
12+
planned because it would require work and 10.4 is only becoming less
13+
common.
1314

1415
Things that don't work:
1516
- Helgrind and Ptrcheck
@@ -25,6 +26,10 @@ Release 3.5.0 (???)
2526
Hijack's fault. See https://bugs.kde.org/show_bug.cgi?id=193917 for
2627
details and a simple work-around.
2728

29+
Usage notes:
30+
- You will likely find --dsymutil=yes a useful option, as error messages may
31+
be imprecise without it.
32+
2833
Many thanks to Greg Parker for developing this port over several years.
2934

3035
* XXX: something about improved Wine support?

coregrind/m_debuginfo/readmacho.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,8 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di )
917917
}
918918

919919
/* There was no dsym file, or it doesn't match. We'll have to try
920-
regenerating it, unless auto-run-dsymutil is disabled, in which
921-
case just complain instead. */
920+
regenerating it, unless --dsymutil=no, in which case just complain
921+
instead. */
922922

923923
/* If this looks like a lib that we shouldn't run dsymutil on, just
924924
give up. (possible reasons: is system lib, or in /usr etc, or
@@ -928,13 +928,13 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di )
928928
if (is_systemish_library_name(di->filename))
929929
goto success;
930930

931-
if (!VG_(clo_auto_run_dsymutil)) {
931+
if (!VG_(clo_dsymutil)) {
932932
if (VG_(clo_verbosity) == 1) {
933933
VG_(message)(Vg_DebugMsg, "%s:\n", di->filename);
934934
}
935935
if (VG_(clo_verbosity) > 0)
936936
VG_(message)(Vg_DebugMsg, "%sdSYM directory %s; consider using "
937-
"--auto-run-dsymutil=yes\n",
937+
"--dsymutil=yes\n",
938938
VG_(clo_verbosity) > 1 ? " " : "",
939939
dsymfilename ? "has wrong UUID" : "is missing");
940940
goto success;

coregrind/m_main.c

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -111,35 +111,23 @@ static void usage_NORETURN ( Bool debug_help )
111111
Char* usage1 =
112112
"usage: valgrind [options] prog-and-args\n"
113113
"\n"
114-
" common user options for all Valgrind tools, with defaults in [ ]:\n"
114+
" tool-selection option, with default in [ ]:\n"
115115
" --tool=<name> use the Valgrind tool named <name> [memcheck]\n"
116+
"\n"
117+
" basic user options for all Valgrind tools, with defaults in [ ]:\n"
116118
" -h --help show this message\n"
117119
" --help-debug show this message, plus debugging options\n"
118120
" --version show version\n"
119121
" -q --quiet run silently; only print error msgs\n"
120122
" -v --verbose be more verbose, incl counts of errors\n"
121123
" --trace-children=no|yes Valgrind-ise child processes (follow execve)? [no]\n"
122-
" --child-silent-after-fork=no|yes omit child output between fork & exec? [no]\n"
124+
" --child-silent-after-fork=no|yes omit child output between fork & exec? [no]\n"
123125
" --track-fds=no|yes track open file descriptors? [no]\n"
124126
" --time-stamp=no|yes add timestamps to log messages? [no]\n"
125127
" --log-fd=<number> log messages to file descriptor [2=stderr]\n"
126128
" --log-file=<file> log messages to <file>\n"
127129
" --log-socket=ipaddr:port log messages to socket ipaddr:port\n"
128130
"\n"
129-
" uncommon user options for all Valgrind tools:\n"
130-
" --run-libc-freeres=no|yes free up glibc memory at exit? [yes]\n"
131-
" --sim-hints=hint1,hint2,... known hints:\n"
132-
" lax-ioctls, enable-outer [none]\n"
133-
" --show-emwarns=no|yes show warnings about emulation limits? [no]\n"
134-
" --smc-check=none|stack|all checks for self-modifying code: none,\n"
135-
" only for code found in stacks, or all [stack]\n"
136-
" --kernel-variant=variant1,variant2,... known variants: bproc [none]\n"
137-
" handle non-standard kernel variants\n"
138-
" --read-var-info=yes|no read debug info on stack and global variables\n"
139-
" and use it to print better error messages in\n"
140-
" tools that make use of it (Memcheck, Helgrind,\n"
141-
" DRD)\n"
142-
"\n"
143131
" user options for Valgrind tools that report errors:\n"
144132
" --xml=yes emit error output in XML (some tools only)\n"
145133
" --xml-fd=<number> XML output to file descriptor\n"
@@ -156,15 +144,34 @@ static void usage_NORETURN ( Bool debug_help )
156144
" --db-attach=no|yes start debugger when errors detected? [no]\n"
157145
" --db-command=<command> command to start debugger [%s -nw %%f %%p]\n"
158146
" --input-fd=<number> file descriptor for input [0=stdin]\n"
147+
" --dsymutil=no|yes run dsymutil on Mac OS X when helpful? [no]\n"
159148
" --max-stackframe=<number> assume stack switch for SP changes larger\n"
160149
" than <number> bytes [2000000]\n"
161150
" --main-stacksize=<number> set size of main thread's stack (in bytes)\n"
162151
" [use current 'ulimit' value]\n"
152+
"\n"
153+
" user options for Valgrind tools that replace malloc:\n"
154+
" --alignment=<number> set minimum alignment of heap allocations [%ld]\n"
155+
"\n"
156+
" uncommon user options for all Valgrind tools:\n"
157+
" --smc-check=none|stack|all checks for self-modifying code: none,\n"
158+
" only for code found in stacks, or all [stack]\n"
159+
" --read-var-info=yes|no read debug info on stack and global variables\n"
160+
" and use it to print better error messages in\n"
161+
" tools that make use of it (Memcheck, Helgrind,\n"
162+
" DRD)\n"
163+
" --run-libc-freeres=no|yes free up glibc memory at exit on Linux? [yes]\n"
164+
" --sim-hints=hint1,hint2,... known hints:\n"
165+
" lax-ioctls, enable-outer [none]\n"
166+
" --kernel-variant=variant1,variant2,... known variants: bproc [none]\n"
167+
" handle non-standard kernel variants\n"
168+
" --show-emwarns=no|yes show warnings about emulation limits? [no]\n"
163169
"\n";
164170

165171
Char* usage2 =
166172
"\n"
167173
" debugging options for all Valgrind tools:\n"
174+
" -d show verbose debugging output\n"
168175
" --sanity-level=<number> level of sanity checking to do [1]\n"
169176
" --trace-flags=<XXXXXXXX> show generated code? (X = 0|1) [00000000]\n"
170177
" --profile-flags=<XXXXXXXX> ditto, but for profiling (X = 0|1) [00000000]\n"
@@ -184,13 +191,13 @@ static void usage_NORETURN ( Bool debug_help )
184191
" --sym-offsets=yes|no show syms in form 'name+offset' ? [no]\n"
185192
" --command-line-only=no|yes only use command line options [no]\n"
186193
"\n"
187-
" --vex-iropt-verbosity 0 .. 9 [0]\n"
188-
" --vex-iropt-level 0 .. 2 [2]\n"
189-
" --vex-iropt-precise-memory-exns [no]\n"
190-
" --vex-iropt-unroll-thresh 0 .. 400 [120]\n"
191-
" --vex-guest-max-insns 1 .. 100 [50]\n"
192-
" --vex-guest-chase-thresh 0 .. 99 [10]\n"
193-
"\n"
194+
" Vex options for all Valgrind tools:\n"
195+
" --vex-iropt-verbosity=<0..9> [0]\n"
196+
" --vex-iropt-level=<0..2> [2]\n"
197+
" --vex-iropt-precise-memory-exns=no|yes [no]\n"
198+
" --vex-iropt-unroll-thresh=<0..400> [120]\n"
199+
" --vex-guest-max-insns=<1..100> [50]\n"
200+
" --vex-guest-chase-thresh=<0..99> [10]\n"
194201
" --trace-flags and --profile-flags values (omit the middle space):\n"
195202
" 1000 0000 show conversion into IR\n"
196203
" 0100 0000 show after initial opt\n"
@@ -205,6 +212,9 @@ static void usage_NORETURN ( Bool debug_help )
205212
" debugging options for Valgrind tools that report errors\n"
206213
" --dump-error=<number> show translation for basic block associated\n"
207214
" with <number>'th error context [0=show none]\n"
215+
"\n"
216+
" debugging options for Valgrind tools that replace malloc:\n"
217+
" --trace-malloc=no|yes show client malloc details? [no]\n"
208218
"\n";
209219

210220
Char* usage3 =
@@ -224,8 +234,8 @@ static void usage_NORETURN ( Bool debug_help )
224234
VG_(log_output_sink).fd = 1;
225235
VG_(log_output_sink).is_socket = False;
226236

227-
/* 'usage1' expects one char* argument */
228-
VG_(printf)(usage1, gdb_path);
237+
/* 'usage1' expects one char* argument and one SizeT argument. */
238+
VG_(printf)(usage1, gdb_path, VG_MIN_MALLOC_SZB);
229239
if (VG_(details).name) {
230240
VG_(printf)(" user options for %s:\n", VG_(details).name);
231241
if (VG_(needs).command_line_options)
@@ -474,10 +484,9 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd,
474484
else if VG_XACT_CLO(arg, "--smc-check=all", VG_(clo_smc_check),
475485
Vg_SmcAll);
476486

477-
else if VG_STR_CLO (arg, "--kernel-variant", VG_(clo_kernel_variant)) {}
487+
else if VG_STR_CLO (arg, "--kernel-variant", VG_(clo_kernel_variant)) {}
478488

479-
else if VG_BOOL_CLO(arg, "--auto-run-dsymutil",
480-
VG_(clo_auto_run_dsymutil)) {}
489+
else if VG_BOOL_CLO(arg, "--dsymutil", VG_(clo_dsymutil)) {}
481490

482491
else if VG_BINT_CLO(arg, "--vex-iropt-verbosity",
483492
VG_(clo_vex_control).iropt_verbosity, 0, 10) {}

coregrind/m_options.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Word VG_(clo_main_stacksize) = 0; /* use client's rlimit.stack */
9090
Bool VG_(clo_wait_for_gdb) = False;
9191
VgSmc VG_(clo_smc_check) = Vg_SmcStack;
9292
HChar* VG_(clo_kernel_variant) = NULL;
93-
Bool VG_(clo_auto_run_dsymutil) = False;
93+
Bool VG_(clo_dsymutil) = False;
9494

9595

9696
/*====================================================================*/

coregrind/m_replacemalloc/replacemalloc_core.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,6 @@ Bool VG_(replacement_malloc_process_cmd_line_option)(Char* arg)
7474
return True;
7575
}
7676

77-
void VG_(replacement_malloc_print_usage)(void)
78-
{
79-
VG_(printf)(
80-
" --alignment=<number> set minimum alignment of allocations [%d]\n",
81-
VG_MIN_MALLOC_SZB
82-
);
83-
}
84-
85-
void VG_(replacement_malloc_print_debug_usage)(void)
86-
{
87-
VG_(printf)(
88-
" --trace-malloc=no|yes show client malloc details? [no]\n"
89-
);
90-
}
91-
9277
/*------------------------------------------------------------*/
9378
/*--- Useful functions ---*/
9479
/*------------------------------------------------------------*/

coregrind/pub_core_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ extern HChar* VG_(clo_kernel_variant);
168168

169169
/* Darwin-specific: automatically run /usr/bin/dsymutil to update
170170
.dSYM directories as necessary? */
171-
extern Bool VG_(clo_auto_run_dsymutil);
171+
extern Bool VG_(clo_dsymutil);
172172

173173
/* --------- Functions --------- */
174174

docs/xml/manual-core-adv.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ tool-specific macros).</para>
228228
<varlistentry>
229229
<term><command><computeroutput>VALGRIND_PRINTF_BACKTRACE(format, ...)</computeroutput>:</command></term>
230230
<listitem>
231-
<para>Like <computeroutput>VALGRIND_PRINTF<computeroutput>, but prints
231+
<para>Like <computeroutput>VALGRIND_PRINTF</computeroutput>, but prints
232232
a stack backtrace immediately afterwards.</para>
233233
</listitem>
234234
</varlistentry>

0 commit comments

Comments
 (0)