232232our $opt_client_ddd ;
233233my $opt_boot_ddd ;
234234our $opt_manual_gdb ;
235+ our $opt_manual_lldb ;
235236our $opt_manual_dbx ;
236237our $opt_manual_ddd ;
237238our $opt_manual_debug ;
@@ -1086,6 +1087,7 @@ sub command_line_setup {
10861087 ' gdb' => \$opt_gdb ,
10871088 ' client-gdb' => \$opt_client_gdb ,
10881089 ' manual-gdb' => \$opt_manual_gdb ,
1090+ ' manual-lldb' => \$opt_manual_lldb ,
10891091 ' boot-gdb' => \$opt_boot_gdb ,
10901092 ' manual-debug' => \$opt_manual_debug ,
10911093 ' ddd' => \$opt_ddd ,
@@ -1536,8 +1538,9 @@ sub command_line_setup {
15361538 $opt_debugger = undef ;
15371539 }
15381540
1539- if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_ddd ||
1540- $opt_manual_debug || $opt_debugger || $opt_dbx || $opt_manual_dbx )
1541+ if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_lldb ||
1542+ $opt_manual_ddd || $opt_manual_debug || $opt_debugger || $opt_dbx ||
1543+ $opt_manual_dbx )
15411544 {
15421545 mtr_error(" You need to use the client debug options for the" ,
15431546 " embedded server. Ex: --client-gdb" );
@@ -1564,7 +1567,7 @@ sub command_line_setup {
15641567 # Check debug related options
15651568 # --------------------------------------------------------------------------
15661569 if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
1567- $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
1570+ $opt_manual_gdb || $opt_manual_gdb || $ opt_manual_ddd || $opt_manual_debug ||
15681571 $opt_dbx || $opt_client_dbx || $opt_manual_dbx ||
15691572 $opt_debugger || $opt_client_debugger )
15701573 {
@@ -4985,6 +4988,10 @@ ($$)
49854988 {
49864989 gdb_arguments(\$args , \$exe , $mysqld -> name());
49874990 }
4991+ elsif ( $opt_manual_lldb )
4992+ {
4993+ lldb_arguments(\$args , \$exe , $mysqld -> name());
4994+ }
49884995 elsif ( $opt_ddd || $opt_manual_ddd )
49894996 {
49904997 ddd_arguments(\$args , \$exe , $mysqld -> name());
@@ -5730,6 +5737,33 @@ sub gdb_arguments {
57305737 $$exe = " xterm" ;
57315738}
57325739
5740+ #
5741+ # Modify the exe and args so that program is run in lldb
5742+ #
5743+ sub lldb_arguments {
5744+ my $args = shift ;
5745+ my $exe = shift ;
5746+ my $type = shift ;
5747+ my $input = shift ;
5748+
5749+ my $lldb_init_file = " $opt_vardir /tmp/lldbinit.$type " ;
5750+ unlink ($lldb_init_file );
5751+
5752+ my $str = join (" " , @$$args );
5753+ my $runline = $input ? " r $str < $input " : " r $str " ;
5754+
5755+ # write init file for mysqld or client
5756+ mtr_tofile($lldb_init_file ,
5757+ " b main\n " .
5758+ $runline );
5759+
5760+ print " \n To start lldb for $type , type in another window:\n " ;
5761+ print " cd $glob_mysql_test_dir && lldb -s $lldb_init_file $$exe \n " ;
5762+
5763+ # Indicate the exe should not be started
5764+ $$exe = undef ;
5765+ return ;
5766+ }
57335767
57345768#
57355769# Modify the exe and args so that program is run in ddd
@@ -6190,6 +6224,8 @@ ($)
61906224 test(s)
61916225 manual-dbx Let user manually start mysqld in dbx, before running
61926226 test(s)
6227+ manual-lldb Let user manually start mysqld in lldb, before running
6228+ test(s)
61936229 strace-client Create strace output for mysqltest client,
61946230 strace-server Create strace output for mysqltest server,
61956231 max-save-core Limit the number of core files saved (to avoid filling
0 commit comments