mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Finally! Make './mtr --valgrind-mysqld --gdb' to work.
It has its limitations, e.g. it assumes that there's only one gdb and only one valgrind process is running. And a hard-coded one-second delay might be too short for slow machines. Still, it's better than "doesn't work at all"
This commit is contained in:
parent
f2408e7e6a
commit
d9c460b84e
2 changed files with 14 additions and 5 deletions
|
@ -84,7 +84,7 @@ sub is_child {
|
|||
}
|
||||
|
||||
|
||||
my @safe_process_cmd;
|
||||
our @safe_process_cmd;
|
||||
my $safe_kill;
|
||||
my $bindir;
|
||||
|
||||
|
|
|
@ -5378,7 +5378,7 @@ sub mysqld_start ($$) {
|
|||
my $args;
|
||||
mtr_init_args(\$args);
|
||||
|
||||
if ( $opt_valgrind_mysqld )
|
||||
if ( $opt_valgrind_mysqld and not $opt_gdb and not $opt_manual_gdb )
|
||||
{
|
||||
valgrind_arguments($args, \$exe);
|
||||
}
|
||||
|
@ -5981,11 +5981,20 @@ sub gdb_arguments {
|
|||
unlink($gdb_init_file);
|
||||
|
||||
# Put $args into a single string
|
||||
my $str= join(" ", @$$args);
|
||||
$input = $input ? "< $input" : "";
|
||||
|
||||
# write init file for mysqld or client
|
||||
mtr_tofile($gdb_init_file, "set args $str $input\n");
|
||||
if ($type ne 'client' and $opt_valgrind_mysqld) {
|
||||
my $v = $$exe;
|
||||
my $vargs = [];
|
||||
valgrind_arguments($vargs, \$v);
|
||||
mtr_tofile($gdb_init_file, <<EOF);
|
||||
shell @My::SafeProcess::safe_process_cmd --parent-pid=`pgrep -x gdb` -- $v --vgdb-error=0 @$vargs @$$args &
|
||||
shell sleep 1
|
||||
target remote | /usr/lib64/valgrind/../../bin/vgdb
|
||||
EOF
|
||||
} else {
|
||||
mtr_tofile($gdb_init_file, "set args @$$args $input\n");
|
||||
}
|
||||
|
||||
if ( $opt_manual_gdb )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue