MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:March 19 2009 1:08pm
Subject:bzr commit into mysql-5.1-mtr branch (Bjorn.Munch:2772) Bug#43074
View as plain text  
#At file:///home/bm136801/mysql/corepath-51/

 2772 Bjorn Munch	2009-03-19
      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
      modified:
        mysql-test/lib/My/CoreDump.pm

=== modified file 'mysql-test/lib/My/CoreDump.pm'
--- a/mysql-test/lib/My/CoreDump.pm	2009-02-12 16:13:56 +0000
+++ b/mysql-test/lib/My/CoreDump.pm	2009-03-19 13:06:23 +0000
@@ -22,6 +22,26 @@ use My::Platform;
 
 use File::Temp qw/ tempfile tempdir /;
 
+# 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'
+
+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 /
+    `strings '$core_name' | grep "/mysql[^/. ]*\$" | tail -1` =~ /(\/.*)/;
+    $binpath= $1 or return;
+    print "Guessing that core was generated by '$binpath'\n";
+  }
+
+  return $binpath;
+}
+
 sub _gdb {
   my ($core_name)= @_;
 
@@ -33,7 +53,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 +94,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;

Thread
bzr commit into mysql-5.1-mtr branch (Bjorn.Munch:2772) Bug#43074Bjorn Munch19 Mar