Skip to content

Commit 250c5aa

Browse files
committed
./mtr --gdb='b mysql_parse;r'
--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
1 parent 5789831 commit 250c5aa

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

mysql-test/mysql-test-run.pl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ sub command_line_setup {
11401140
'debug' => \$opt_debug,
11411141
'debug-common' => \$opt_debug_common,
11421142
'debug-server' => \$opt_debug_server,
1143-
'gdb' => \$opt_gdb,
1143+
'gdb=s' => \$opt_gdb,
11441144
'client-gdb' => \$opt_client_gdb,
11451145
'manual-gdb' => \$opt_manual_gdb,
11461146
'manual-lldb' => \$opt_manual_lldb,
@@ -1234,6 +1234,9 @@ sub command_line_setup {
12341234
'skip-test-list=s' => \@opt_skip_test_list
12351235
);
12361236

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

5995-
if ($type ne 'client' and $opt_valgrind_mysqld) {
5998+
if ($type eq 'client') {
5999+
mtr_tofile($gdb_init_file, "set args @$$args $input");
6000+
} elsif ($opt_valgrind_mysqld) {
59966001
my $v = $$exe;
59976002
my $vargs = [];
59986003
valgrind_arguments($vargs, \$v);
@@ -6002,7 +6007,11 @@ sub gdb_arguments {
60026007
target remote | /usr/lib64/valgrind/../../bin/vgdb
60036008
EOF
60046009
} else {
6005-
mtr_tofile($gdb_init_file, "set args @$$args $input\n");
6010+
mtr_tofile($gdb_init_file,
6011+
join("\n",
6012+
"set args @$$args $input",
6013+
split /;/, $opt_gdb || ""
6014+
));
60066015
}
60076016

60086017
if ( $opt_manual_gdb )

0 commit comments

Comments
 (0)