Commit 250c5aa0 authored by Sergei Golubchik's avatar Sergei Golubchik

./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 c47c0ca5 5441bbd3 339b9055
parent 57898316
......@@ -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,
......@@ -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;
......@@ -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);
......@@ -6002,7 +6007,11 @@ shell sleep 1
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 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment