X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2Ftest_debuginfo.pl;h=aaf90d95468cb91cc3860ba056778c499eaf6c6f;hb=47f0e3f434e2e43f951c3a826c40906cb15b7285;hp=fb61fb02616dd9d7dd40eec91f0cc4cb53bf2008;hpb=12b0179c14badcd2c50d4b6b33138bf9905cc1f8;p=oota-llvm.git diff --git a/utils/test_debuginfo.pl b/utils/test_debuginfo.pl index fb61fb02616..aaf90d95468 100755 --- a/utils/test_debuginfo.pl +++ b/utils/test_debuginfo.pl @@ -11,8 +11,13 @@ # and run the script generated from source program comments. Finally, # the debugger output is checked, using FileCheck, to validate # debugging information. +# +# On Darwin the default is to use the llgdb.py wrapper script which +# translates gdb commands into their lldb equivalents. use File::Basename; +use Config; +use Cwd; my $testcase_file = $ARGV[0]; my $executable_file = $ARGV[1]; @@ -23,8 +28,13 @@ my $output_dir = dirname $executable_file; my $debugger_script_file = "$output_dir/$input_filename.debugger.script"; my $output_file = "$output_dir/$input_filename.gdb.output"; +my %cmd_map = (); +# Assume lldb to be the debugger on Darwin. +my $use_lldb = 0; +$use_lldb = 1 if ($Config{osname} eq "darwin"); + # Extract debugger commands from testcase. They are marked with DEBUGGER: -# at the beginnign of a comment line. +# at the beginning of a comment line. open(INPUT, $testcase_file); open(OUTPUT, ">$debugger_script_file"); while() { @@ -44,16 +54,25 @@ close(OUTPUT); # setup debugger and debugger options to run a script. my $my_debugger = $ENV{'DEBUGGER'}; if (!$my_debugger) { - $my_debugger = "gdb"; + if ($use_lldb) { + my $path = dirname(Cwd::abs_path($0)); + $my_debugger = "/usr/bin/env python $path/../tools/clang/test/debuginfo-tests/llgdb.py"; + } else { + $my_debugger = "gdb"; + } } + +# quiet / exit after cmdline / no init file / execute script my $debugger_options = "-q -batch -n -x"; # run debugger and capture output. -system("$my_debugger $debugger_options $debugger_script_file $executable_file >& $output_file"); +system("$my_debugger $debugger_options $debugger_script_file $executable_file > $output_file 2>&1"); # validate output. system("FileCheck", "-input-file", "$output_file", "$testcase_file"); if ($?>>8 == 1) { + print "Debugger output was:\n"; + system("cat", "$output_file"); exit 1; } else {