Skip to content

Commit

Permalink
./mtr --gdb='b mysql_parse;r'
Browse files Browse the repository at this point in the history
--gdb now accepts an argument, it will be passed to gdb as a command.
multiple commands can be separated by a (non-standard and not escapable)
delimiter - semicolon (;).

Old usage with a bare --gdb continues to work too, of course.

Cherry-picked c47c0ca 5441bbd 339b905
  • Loading branch information
vuvova committed Oct 30, 2018
1 parent 5789831 commit 250c5aa
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ sub command_line_setup {
'debug' => \$opt_debug,
'debug-common' => \$opt_debug_common,
'debug-server' => \$opt_debug_server,
'gdb' => \$opt_gdb,
'gdb=s' => \$opt_gdb,
'client-gdb' => \$opt_client_gdb,
'manual-gdb' => \$opt_manual_gdb,
'manual-lldb' => \$opt_manual_lldb,
Expand Down Expand Up @@ -1234,6 +1234,9 @@ sub command_line_setup {
'skip-test-list=s' => \@opt_skip_test_list
);

# fix options (that take an optional argument and *only* after = sign
my %fixopt = ( '--gdb' => '--gdb=#' );
@ARGV = map { $fixopt{$_} or $_ } @ARGV;
GetOptions(%options) or usage("Can't read options");
usage("") if $opt_usage;
list_options(\%options) if $opt_list_options;
Expand Down Expand Up @@ -5992,7 +5995,9 @@ sub gdb_arguments {
# Put $args into a single string
$input = $input ? "< $input" : "";

if ($type ne 'client' and $opt_valgrind_mysqld) {
if ($type eq 'client') {
mtr_tofile($gdb_init_file, "set args @$$args $input");
} elsif ($opt_valgrind_mysqld) {
my $v = $$exe;
my $vargs = [];
valgrind_arguments($vargs, \$v);
Expand All @@ -6002,7 +6007,11 @@ sub gdb_arguments {
target remote | /usr/lib64/valgrind/../../bin/vgdb
EOF
} else {
mtr_tofile($gdb_init_file, "set args @$$args $input\n");
mtr_tofile($gdb_init_file,
join("\n",
"set args @$$args $input",
split /;/, $opt_gdb || ""
));
}

if ( $opt_manual_gdb )
Expand Down

0 comments on commit 250c5aa

Please sign in to comment.