mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
BUG#38817: please make mtr analyze crashes better
Post-push fixes making it work on pushbuild's valgrind host, and clarifying the output.
This commit is contained in:
parent
2d7c2274c2
commit
746734d974
1 changed files with 19 additions and 19 deletions
|
@ -29,33 +29,33 @@ sub _gdb {
|
||||||
|
|
||||||
return unless -f $core_name;
|
return unless -f $core_name;
|
||||||
|
|
||||||
my $dir = tempdir( CLEANUP => 1 );
|
# Find out name of binary that generated core
|
||||||
my ($tmp, $tmp_name) = tempfile( DIR => $dir );
|
`gdb -c '$core_name' --batch 2>&1` =~
|
||||||
|
/Core was generated by `([^\s\'\`]+)/;
|
||||||
|
my $binary= $1 or return;
|
||||||
|
print "Core generated by '$binary'\n";
|
||||||
|
|
||||||
|
# Create tempfile containing gdb commands
|
||||||
|
my ($tmp, $tmp_name) = tempfile();
|
||||||
print $tmp
|
print $tmp
|
||||||
|
"bt\n",
|
||||||
"thread apply all bt\n",
|
"thread apply all bt\n",
|
||||||
"quit\n";
|
"quit\n";
|
||||||
|
close $tmp or die "Error closing $tmp_name: $!";
|
||||||
|
|
||||||
# Find out name of binary that generated core
|
# Run gdb
|
||||||
my $list= `gdb -c $core_name -x $tmp_name -batch 2>&1`
|
my $gdb_output=
|
||||||
or return;
|
`gdb '$binary' -c '$core_name' -x '$tmp_name' --batch 2>&1`;
|
||||||
|
|
||||||
my $binary;
|
unlink $tmp_name or die "Error removing $tmp_name: $!";
|
||||||
foreach my $line (split('\n', $list))
|
|
||||||
{
|
|
||||||
$binary= $1
|
|
||||||
if ($line =~ /Core was generated by `(\S+)/);
|
|
||||||
}
|
|
||||||
|
|
||||||
return unless $binary;
|
return unless $gdb_output;
|
||||||
|
|
||||||
print " - core generated by '$binary'\n";
|
|
||||||
|
|
||||||
my $list= `gdb $binary -c $core_name -x $tmp_name -batch 2>&1`
|
|
||||||
or return;
|
|
||||||
|
|
||||||
print $list, "\n";
|
|
||||||
|
|
||||||
|
print <<EOF, $gdb_output, "\n";
|
||||||
|
Output from gdb follows. The first stack trace is from the failing thread.
|
||||||
|
The following stack traces are from all threads (so the failing one is
|
||||||
|
duplicated).
|
||||||
|
EOF
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue