summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
authorBjorn Munch <Bjorn.Munch@sun.com>2009-03-20 16:39:06 +0100
committerBjorn Munch <Bjorn.Munch@sun.com>2009-03-20 16:39:06 +0100
commitdd6356acca1cb6aaca995c6d3619af89681aef99 (patch)
treed245eca54bb1a84957e9e8d52bf7a504af5de929 /mysql-test/lib
parent776bb04abfed3f3fc3b1b63ffaab804f9603e139 (diff)
downloadmariadb-git-dd6356acca1cb6aaca995c6d3619af89681aef99.tar.gz
Bug #43074 MTR2 is not accessing core dumps when a path is too long
Executable path is truncated in core If we see truncated path, try to guess using strings and grep If that doesn't work either, use known mysqld path
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/My/CoreDump.pm36
1 files changed, 33 insertions, 3 deletions
diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm
index f3e9f521384..0591602d365 100644
--- a/mysql-test/lib/My/CoreDump.pm
+++ b/mysql-test/lib/My/CoreDump.pm
@@ -22,6 +22,33 @@ use My::Platform;
use File::Temp qw/ tempfile tempdir /;
+my $hint_mysqld; # Last resort guess for executable path
+
+# If path in core file is 79 chars we assume it's been truncated
+# Looks like we can still find the full path using 'strings'
+# If that doesn't work, use the hint (mysqld path) as last resort.
+
+sub _verify_binpath {
+ my ($binary, $core_name)= @_;
+ my $binpath;
+
+ if (length $binary != 79) {
+ $binpath= $binary;
+ print "Core generated by '$binpath'\n";
+ } else {
+ # Last occurrence of path ending in /mysql*, cut from first /
+ if (`strings '$core_name' | grep "/mysql[^/. ]*\$" | tail -1` =~ /(\/.*)/) {
+ $binpath= $1;
+ print "Guessing that core was generated by '$binpath'\n";
+ } else {
+ return unless $hint_mysqld;
+ $binpath= $hint_mysqld;
+ print "Wild guess that core was generated by '$binpath'\n";
+ }
+ }
+ return $binpath;
+}
+
sub _gdb {
my ($core_name)= @_;
@@ -33,7 +60,8 @@ sub _gdb {
`gdb -c '$core_name' --batch 2>&1` =~
/Core was generated by `([^\s\'\`]+)/;
my $binary= $1 or return;
- print "Core generated by '$binary'\n";
+
+ $binary= _verify_binpath ($binary, $core_name) or return;
# Create tempfile containing gdb commands
my ($tmp, $tmp_name) = tempfile();
@@ -73,7 +101,8 @@ sub _dbx {
`echo | dbx - '$core_name' 2>&1` =~
/Corefile specified executable: "([^"]+)"/;
my $binary= $1 or return;
- print "Core generated by '$binary'\n";
+
+ $binary= _verify_binpath ($binary, $core_name) or return;
# Find all threads
my @thr_ids = `echo threads | dbx '$binary' '$core_name' 2>&1` =~ /t@\d+/g;
@@ -225,7 +254,8 @@ EOF
sub show {
- my ($class, $core_name)= @_;
+ my ($class, $core_name, $exe_mysqld)= @_;
+ $hint_mysqld= $exe_mysqld;
# On Windows, rely on cdb to be there...
if (IS_WINDOWS)