diff options
author | philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2014-01-11 13:56:48 +0000 |
---|---|---|
committer | philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2014-01-11 13:56:48 +0000 |
commit | cffe2a55d903655761ccc6025a23b823bee10170 (patch) | |
tree | 8d2fcc31d62a749ee6f89cd9d284d9a7bbbf4270 /callgrind | |
parent | 3d24135101d712a59f9ec722e95d2a5670ea735e (diff) | |
download | valgrind-cffe2a55d903655761ccc6025a23b823bee10170.tar.gz |
add --vgdb-prefix arg to callgrind_control
If valgrind is started with --vgdb-prefix arg, then callgrind_control
cannot find and control this valgrind.
So, add an (optional) argument to callgrind_control,
and have callgrind tool report the needed vgdb prefix argument
if the user supplied this arg.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13769 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'callgrind')
-rw-r--r-- | callgrind/callgrind_control.in | 21 | ||||
-rw-r--r-- | callgrind/docs/cl-manual.xml | 11 | ||||
-rw-r--r-- | callgrind/main.c | 4 |
3 files changed, 28 insertions, 8 deletions
diff --git a/callgrind/callgrind_control.in b/callgrind/callgrind_control.in index 4a526d97e..1dd8cce68 100644 --- a/callgrind/callgrind_control.in +++ b/callgrind/callgrind_control.in @@ -27,7 +27,7 @@ sub getCallgrindPids { @pids = (); - open LIST, "vgdb -l|"; + open LIST, "vgdb $vgdbPrefixOption -l|"; while(<LIST>) { if (/^use --pid=(\d+) for \S*?valgrind\s+(.*?)\s*$/) { $pid = $1; @@ -78,6 +78,8 @@ sub printHelp { print " -z --zero Zero all event counters\n"; print " -k --kill Kill\n"; print " -i --instr=on|off Switch instrumentation state on/off\n"; + print "Uncommon options:\n"; + print " --vgdb-prefix=<prefix> Only provide this if the same was given to Valgrind\n"; print "\n"; exit; } @@ -185,6 +187,16 @@ sub print_events ($) # Main # +# To find the list of active pids, we need to have +# the --vgdb-prefix option if given. +$vgdbPrefixOption = ""; +foreach $arg (@ARGV) { + if ($arg =~ /^--vgdb-prefix=.*$/) { + $vgdbPrefixOption=$arg; + } + next; +} + getCallgrindPids; $requestEvents = 0; @@ -192,6 +204,7 @@ $requestDump = 0; $switchInstr = 0; $headerPrinted = 0; $dumpHint = ""; + $verbose = 0; %spids = (); @@ -206,6 +219,10 @@ foreach $arg (@ARGV) { elsif ($arg =~ /^--version$/) { printVersion; } + elsif ($arg =~ /^--vgdb-prefix=.*$/) { + # handled during the initial parsing. + next; + } elsif ($arg =~ /^-v$/) { $verbose++; next; @@ -346,7 +363,7 @@ foreach $pid (@pids) { } else { print "\n"; } - open RESULT, "vgdb --pid=$pid $vgdbCommand|"; + open RESULT, "vgdb $vgdbPrefixOption --pid=$pid $vgdbCommand|"; @tids = (); $ctid = 0; diff --git a/callgrind/docs/cl-manual.xml b/callgrind/docs/cl-manual.xml index 2f08ac865..369180ca5 100644 --- a/callgrind/docs/cl-manual.xml +++ b/callgrind/docs/cl-manual.xml @@ -1400,12 +1400,13 @@ their arguments.</para> </varlistentry> <varlistentry> - <term><option><![CDATA[-w=<dir>]]></option></term> + <term><option><![CDATA[--vgdb-prefix=<prefix>]]></option></term> <listitem> - <para>Specify the startup directory of an active Callgrind run. On some - systems, active Callgrind runs can not be detected. To be able to - control these, the failed auto-detection can be worked around by - specifying the directory where a Callgrind run was started.</para> + <para>Specify the vgdb prefix to use by callgrind_control. + callgrind_control internally uses vgdb to find and control the active + Callgrind runs. If the <option>--vgdb-prefix</option> option was used + for launching valgrind, then the same option must be given to + callgrind_control.</para> </listitem> </varlistentry> </variablelist> diff --git a/callgrind/main.c b/callgrind/main.c index a58bc00a0..fcd78a1ef 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -2024,7 +2024,9 @@ void CLG_(post_clo_init)(void) if (VG_(clo_verbosity > 0)) { VG_(message)(Vg_UserMsg, - "For interactive control, run 'callgrind_control -h'.\n"); + "For interactive control, run 'callgrind_control%s%s -h'.\n", + (VG_(arg_vgdb_prefix) ? " " : ""), + (VG_(arg_vgdb_prefix) ? VG_(arg_vgdb_prefix) : "")); } } |