Commit 3fef119d authored by Sayantan Dutta's avatar Sayantan Dutta

Bug #18964545 ADD MTR SUPPORT FOR DEBUGGING WITH LLDB

parent 2fceabfe
...@@ -223,8 +223,11 @@ our %gprof_dirs; ...@@ -223,8 +223,11 @@ our %gprof_dirs;
our $glob_debugger= 0; our $glob_debugger= 0;
our $opt_gdb; our $opt_gdb;
our $opt_lldb;
our $opt_client_gdb; our $opt_client_gdb;
our $opt_client_lldb;
my $opt_boot_gdb; my $opt_boot_gdb;
my $opt_boot_lldb;
our $opt_dbx; our $opt_dbx;
our $opt_client_dbx; our $opt_client_dbx;
my $opt_boot_dbx; my $opt_boot_dbx;
...@@ -1085,10 +1088,13 @@ sub command_line_setup { ...@@ -1085,10 +1088,13 @@ sub command_line_setup {
'debug-common' => \$opt_debug_common, 'debug-common' => \$opt_debug_common,
'debug-server' => \$opt_debug_server, 'debug-server' => \$opt_debug_server,
'gdb' => \$opt_gdb, 'gdb' => \$opt_gdb,
'lldb' => \$opt_lldb,
'client-gdb' => \$opt_client_gdb, 'client-gdb' => \$opt_client_gdb,
'client-lldb' => \$opt_client_lldb,
'manual-gdb' => \$opt_manual_gdb, 'manual-gdb' => \$opt_manual_gdb,
'manual-lldb' => \$opt_manual_lldb, 'manual-lldb' => \$opt_manual_lldb,
'boot-gdb' => \$opt_boot_gdb, 'boot-gdb' => \$opt_boot_gdb,
'boot-lldb' => \$opt_boot_lldb,
'manual-debug' => \$opt_manual_debug, 'manual-debug' => \$opt_manual_debug,
'ddd' => \$opt_ddd, 'ddd' => \$opt_ddd,
'client-ddd' => \$opt_client_ddd, 'client-ddd' => \$opt_client_ddd,
...@@ -1518,6 +1524,13 @@ sub command_line_setup { ...@@ -1518,6 +1524,13 @@ sub command_line_setup {
$opt_gdb= undef; $opt_gdb= undef;
} }
if ($opt_lldb)
{
mtr_warning("Silently converting --lldb to --client-lldb in embedded mode");
$opt_client_lldb= $opt_lldb;
$opt_lldb= undef;
}
if ($opt_ddd) if ($opt_ddd)
{ {
mtr_warning("Silently converting --ddd to --client-ddd in embedded mode"); mtr_warning("Silently converting --ddd to --client-ddd in embedded mode");
...@@ -1538,7 +1551,7 @@ sub command_line_setup { ...@@ -1538,7 +1551,7 @@ sub command_line_setup {
$opt_debugger= undef; $opt_debugger= undef;
} }
if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_lldb || if ( $opt_gdb || $opt_ddd || $opt_lldb || $opt_manual_gdb || $opt_manual_lldb ||
$opt_manual_ddd || $opt_manual_debug || $opt_debugger || $opt_dbx || $opt_manual_ddd || $opt_manual_debug || $opt_debugger || $opt_dbx ||
$opt_manual_dbx) $opt_manual_dbx)
{ {
...@@ -1566,10 +1579,10 @@ sub command_line_setup { ...@@ -1566,10 +1579,10 @@ sub command_line_setup {
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Check debug related options # Check debug related options
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || if ( $opt_gdb || $opt_client_gdb || $opt_lldb || $opt_client_lldb ||
$opt_manual_gdb || $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug || $opt_ddd || $opt_client_ddd || $opt_manual_gdb || $opt_manual_gdb ||
$opt_dbx || $opt_client_dbx || $opt_manual_dbx || $opt_manual_ddd || $opt_manual_debug || $opt_dbx || $opt_client_dbx ||
$opt_debugger || $opt_client_debugger ) $opt_manual_dbx || $opt_debugger || $opt_client_debugger )
{ {
# Indicate that we are using debugger # Indicate that we are using debugger
$glob_debugger= 1; $glob_debugger= 1;
...@@ -3328,6 +3341,10 @@ sub mysql_install_db { ...@@ -3328,6 +3341,10 @@ sub mysql_install_db {
gdb_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(), gdb_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
$bootstrap_sql_file); $bootstrap_sql_file);
} }
if ($opt_boot_lldb) {
lldb_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
$bootstrap_sql_file);
}
if ($opt_boot_dbx) { if ($opt_boot_dbx) {
dbx_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(), dbx_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
$bootstrap_sql_file); $bootstrap_sql_file);
...@@ -4988,7 +5005,7 @@ sub mysqld_start ($$) { ...@@ -4988,7 +5005,7 @@ sub mysqld_start ($$) {
{ {
gdb_arguments(\$args, \$exe, $mysqld->name()); gdb_arguments(\$args, \$exe, $mysqld->name());
} }
elsif ( $opt_manual_lldb ) elsif ( $opt_lldb || $opt_manual_lldb )
{ {
lldb_arguments(\$args, \$exe, $mysqld->name()); lldb_arguments(\$args, \$exe, $mysqld->name());
} }
...@@ -5659,6 +5676,10 @@ sub start_mysqltest ($) { ...@@ -5659,6 +5676,10 @@ sub start_mysqltest ($) {
{ {
gdb_arguments(\$args, \$exe, "client"); gdb_arguments(\$args, \$exe, "client");
} }
if ( $opt_client_lldb )
{
lldb_arguments(\$args, \$exe, "client");
}
elsif ( $opt_client_ddd ) elsif ( $opt_client_ddd )
{ {
ddd_arguments(\$args, \$exe, "client"); ddd_arguments(\$args, \$exe, "client");
...@@ -5772,12 +5793,30 @@ sub lldb_arguments { ...@@ -5772,12 +5793,30 @@ sub lldb_arguments {
"b main\n" . "b main\n" .
$runline); $runline);
if ( $opt_manual_ddd )
{
print "\nTo start lldb for $type, type in another window:\n"; print "\nTo start lldb for $type, type in another window:\n";
print "cd $glob_mysql_test_dir && lldb -s $lldb_init_file $$exe\n"; print "cd $glob_mysql_test_dir && lldb -s $lldb_init_file $$exe\n";
# Indicate the exe should not be started # Indicate the exe should not be started
$$exe= undef; $$exe= undef;
return; return;
}
my $save_exe= $$exe;
$$args= [];
if ( $exe_libtool )
{
$$exe= $exe_libtool;
mtr_add_arg($$args, "--mode=execute");
mtr_add_arg($$args, "lldb");
}
else
{
$$exe= "lldb";
}
mtr_add_arg($$args, "--command=$lldb_init_file");
mtr_add_arg($$args, "$save_exe");
} }
# #
......
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