469049 link failure on ppc64 (big endian) valgrind 3.20
469146 massif --ignore-fn does not ignore inlined functions
469768 Make it possible to install gdb scripts in a different location
+470121 Can't run callgrind_control with valgrind 3.21.0 because of perl errors
470520 Multiple realloc zero errors crash in MC_(eq_Error)
470713 Failure on the Yosys project: valgrind: m_libcfile.c:1802
(Bool vgPlain_realpath(const HChar *, HChar *)): Assertion 'resolved' failed
# vgdb_exe will be set to a vgdb found 'near' the callgrind_control file
my $vgdb_exe = "";
+my $vgdbPrefixOption = "";
+my $cmd = "";
+my %cmd;
+my %cmdline;
+my $pid = -1;
+my @pids = ();
sub getCallgrindPids {
close LIST;
}
+my $headerPrinted = 0;
+
sub printHeader {
if ($headerPrinted) { return; }
$headerPrinted = 1;
# Parts more or less copied from cg_annotate (author: Nicholas Nethercote)
#
+my $event = "";
+my $events = "";
+my %events = ();
+my @events = ();
+my @show_events = ();
+my @show_order = ();
+
sub prepareEvents {
@events = split(/\s+/, $events);
- %events = ();
- $n = 0;
+ my $n = 0;
foreach $event (@events) {
$events{$event} = $n;
$n++;
{
my ($CC_col_widths) = @_;
- foreach my $i (@show_order) {
+ foreach my $i (@show_order) {
my $event = $events[$i];
my $event_width = length($event);
my $col_width = $CC_col_widths->[$i];
# To find the list of active pids, we need to have
# the --vgdb-prefix option if given.
-$vgdbPrefixOption = "";
+my $arg = "";
foreach $arg (@ARGV) {
if ($arg =~ /^--vgdb-prefix=.*$/) {
$vgdbPrefixOption=$arg;
getCallgrindPids;
-$requestEvents = 0;
-$requestDump = 0;
-$switchInstr = 0;
-$headerPrinted = 0;
-$dumpHint = "";
+my $requestEvents = 0;
+my $requestDump = 0;
+my $switchInstr = 0;
+my $dumpHint = "";
+my $printBacktrace = 0;
+my $printStatus = 0;
+my $switchInstrMode = "";
+my $requestKill = "";
+my $requestZero = "";
-$verbose = 0;
+my $verbose = 0;
-%spids = ();
+my %spids = ();
foreach $arg (@ARGV) {
if ($arg =~ /^-/) {
if ($requestDump == 1) { $requestDump = 2; }
}
if (defined $cmd{$arg}) { $spids{$arg} = 1; next; }
- $nameFound = 0;
- foreach $p (@pids) {
+ my $nameFound = 0;
+ foreach my $p (@pids) {
if ($cmd{$p} =~ /$arg$/) {
$nameFound = 1;
$spids{$p} = 1;
exit;
}
-@spids = keys %spids;
+my @spids = keys %spids;
if (scalar @spids >0) { @pids = @spids; }
-$vgdbCommand = "";
-$waitForAnswer = 0;
+my $vgdbCommand = "";
+my $waitForAnswer = 0;
if ($requestDump) {
$vgdbCommand = "dump";
if ($dumpHint ne "") { $vgdbCommand .= " ".$dumpHint; }
}
foreach $pid (@pids) {
- $pidstr = "PID $pid: ";
+ my $pidstr = "PID $pid: ";
if ($pid >0) { print $pidstr.$cmdline{$pid}; }
if ($vgdbCommand eq "") {
}
open RESULT, $vgdb_exe . " $vgdbPrefixOption --pid=$pid $vgdbCommand|";
- @tids = ();
- $ctid = 0;
- %fcount = ();
- %func = ();
- %calls = ();
- %events = ();
- @events = ();
- @threads = ();
- %totals = ();
-
- $exec_bbs = 0;
- $dist_bbs = 0;
- $exec_calls = 0;
- $dist_calls = 0;
- $dist_ctxs = 0;
- $dist_funcs = 0;
- $threads = "";
- $events = "";
+ my @tids = ();
+ my $tid;
+ my $ctid = 0;
+ my %fcount = ();
+ my %func = ();
+ my %calls = ();
+ my @threads = ();
+ my %totals = ();
+ my $totals_width = [];
+
+ my $exec_bbs = 0;
+ my $dist_bbs = 0;
+ my $exec_calls = 0;
+ my $dist_calls = 0;
+ my $dist_ctxs = 0;
+ my $dist_funcs = 0;
+ my $threads = "";
+ my $instrumentation = "";
while(<RESULT>) {
if (/function-(\d+)-(\d+): (.+)$/) {
}
print "Backtrace for Thread $tid\n";
- $i = $fcount{$tid};
- $c = 0;
+ my $i = $fcount{$tid};
+ my $c = 0;
while($i>0 && $c<100) {
- $fc = substr(" $c",-2);
+ my $fc = substr(" $c",-2);
print " [$fc] ";
if ($requestEvents >0) {
print_CC($events{$tid,$i-1}, $totals_width);