If valgrind is called with absolute path (as qtcreator does),
callgrind_control found nothing, as it looked for
"... for valgrind ...", thus breaking qtcreator.
This also fixes expected behavior with client commands called with
absolute path. For "/usr/bin/valgrind --tool callgrind /usr/bin/foo",
running "callgrind_control foo" should catch this callgrind command.
Instead, you previously had to include the absolute path.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11905
@pids = ();
open LIST, "vgdb -l|";
while(<LIST>) {
- if (/^use --pid=(\d+) for valgrind\s+(.*)$/) {
+ if (/^use --pid=(\d+) for \S*?valgrind\s+(.*?)\s*$/) {
$pid = $1;
$cmd = $2;
if (!($cmd =~ /--tool=callgrind/)) { next; }
while($cmd =~ s/^-+\S+\s+//) {}
+ $cmdline{$pid} = $cmd;
+ $cmd =~ s/^(\S*).*/$1/;
$cmd{$pid} = $cmd;
+ #print "Found PID $pid, cmd '$cmd{$pid}', cmdline '$cmdline{$pid}'.\n";
push(@pids, $pid);
}
}
if (defined $cmd{$arg}) { $spids{$arg} = 1; next; }
$nameFound = 0;
foreach $p (@pids) {
- if ($cmd{$p} =~ /^$arg/) {
+ if ($cmd{$p} =~ /$arg$/) {
$nameFound = 1;
$spids{$p} = 1;
}
foreach $pid (@pids) {
$pidstr = "PID $pid: ";
- if ($pid >0) { print $pidstr.$cmd{$pid}; }
+ if ($pid >0) { print $pidstr.$cmdline{$pid}; }
if ($vgdbCommand eq "") {
print "\n";