extra/valgrind to 3.21.0-2

This commit is contained in:
Kevin Mihelich 2023-07-02 03:06:16 +00:00
parent 5651d59134
commit 1a418413cb
2 changed files with 191 additions and 1 deletions

View file

@ -21,7 +21,7 @@ noautobuild=1
pkgname=valgrind
pkgver=3.21.0
pkgrel=1
pkgrel=2
pkgdesc='Tool to help find memory-management problems in programs'
arch=('x86_64')
license=('GPL')
@ -35,6 +35,7 @@ replaces=('valgrind-multilib')
options=('!emptydirs' '!strip')
source=(https://sourceware.org/pub/valgrind/valgrind-${pkgver}.tar.bz2{,.asc}
valgrind-3.7.0-respect-flags.patch
fix-perl-errors.patch
valgrind-3.13.0-arm64-hwcap.patch)
validpgpkeys=(
0E9FFD0C16A1856CF9C7C690BA0166E698FA6035 # Julian Seward <jseward@acm.org>
@ -43,10 +44,12 @@ validpgpkeys=(
sha512sums=('3e86cda2f2d6cd30807fac7933ba2c46a97a2b4a868db989e6b0cceeadf029af7ee34ba900466a346948289aacb30f4399799bb83b97cc49a4d2d810441e5cfd'
'SKIP'
'e0cec39381cefeca09ae4794cca309dfac7c8693e6315e137e64f5c33684598726d41cfbb4edf764fe985503b13ff596184ca5fc32b159d500ec092e4cf8838c'
'20b251bfc7bef8dfd232f9b679e907114c575299916164a608e2fe7fab5f30bf7241f25e37ab4194c56b0a21e682b3cea2fd892aab30fa2ce3863ef744f27f18'
'5af853399c6abdf8016fd1c2be854b3952b7d7e9ca16c870f84eed72e606e639d5f64de32e60105899f5201b53156380ae460111e05209e843301492742c9bfd')
b2sums=('1f7306d288eb5ecfb2b2f0b2dc68960ecd4a7213b96a2e4ecb9990a755e8c233b0e9d190c0f807019bde669f44a631c8dafe9eb521d739561e6f889f7bdaca5c'
'SKIP'
'af556fdf3c02e37892bfe9afebc954cf2f1b2fa9b75c1caacfa9f3b456ebc02bf078475f9ee30079b3af5d150d41415a947c3d04235c1ea8412cf92b959c484a'
'78e5ebeda69302ad380923fe0e76ef8fc3443ffa29cc3104fe629335c8ceda1b4198cb5c72bdefb0e47c77ea02d2ca7bfb478cbf8731f8ded0e0c7c5d83981ee'
'ff8cf51a6034c13ffbc412c387e83a32fa59f96e01be8faf6b52aa6d55bd5e5836c16d75f2291d87450709d0c75689b21870514006c603c6419940a9b977e609')
options=(!lto) # https://bugs.kde.org/show_bug.cgi?id=338252
@ -56,6 +59,8 @@ prepare() {
patch -Np1 < ../valgrind-3.13.0-arm64-hwcap.patch
sed -i 's|sgml/docbook/xsl-stylesheets|xml/docbook/xsl-stylesheets-1.79.2-nons|' docs/Makefile.am
patch -p1 -i ../fix-perl-errors.patch # https://bugs.kde.org/show_bug.cgi?id=470121
autoreconf -ifv
}

View file

@ -0,0 +1,185 @@
diff --git a/callgrind/callgrind_control.in b/callgrind/callgrind_control.in
index 083ffa29fc..bee6661efb 100644
--- a/callgrind/callgrind_control.in
+++ b/callgrind/callgrind_control.in
@@ -29,6 +29,12 @@ use File::Basename;
# 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 {
@@ -50,6 +56,8 @@ sub getCallgrindPids {
close LIST;
}
+my $headerPrinted = 0;
+
sub printHeader {
if ($headerPrinted) { return; }
$headerPrinted = 1;
@@ -95,11 +103,17 @@ sub printHelp {
# 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++;
@@ -178,7 +192,7 @@ sub print_events ($)
{
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];
@@ -209,7 +223,7 @@ if (-x $controldir . "/vgdb") {
# 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;
@@ -219,15 +233,19 @@ foreach $arg (@ARGV) {
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; }
@@ -329,8 +347,8 @@ foreach $arg (@ARGV) {
}
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;
@@ -353,11 +371,11 @@ if (scalar @pids == 0) {
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; }
@@ -371,7 +389,7 @@ if ($printStatus || $printBacktrace || $requestEvents) {
}
foreach $pid (@pids) {
- $pidstr = "PID $pid: ";
+ my $pidstr = "PID $pid: ";
if ($pid >0) { print $pidstr.$cmdline{$pid}; }
if ($vgdbCommand eq "") {
@@ -385,24 +403,24 @@ foreach $pid (@pids) {
}
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+): (.+)$/) {
@@ -485,10 +503,10 @@ foreach $pid (@pids) {
}
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);
--
2.39.3