Modernize llgdb script and make it easier to debug.

This commit is contained in:
Adrian Prantl
2024-03-12 16:11:45 -07:00
parent 422d240dc9
commit 418f0066eb

View File

@@ -56,7 +56,7 @@ my $my_debugger = $ENV{'DEBUGGER'};
if (!$my_debugger) {
if ($use_lldb) {
my $path = dirname(Cwd::abs_path($0));
$my_debugger = "/usr/bin/env python3 $path/llgdb.py";
$my_debugger = "/usr/bin/xcrun python3 $path/llgdb.py";
} else {
$my_debugger = "gdb";
}
@@ -66,12 +66,18 @@ if (!$my_debugger) {
my $debugger_options = "-q -batch -n -x";
# run debugger and capture output.
print("Running debugger\n");
system("$my_debugger $debugger_options $debugger_script_file $executable_file > $output_file 2>&1");
if ($?) {
print("Debugger output was:\n");
system("cat", "$output_file");
exit 1;
}
# validate output.
print("Running FileCheck\n");
system("FileCheck", "-input-file", "$output_file", "$testcase_file");
if ($?>>8 == 1) {
print "Debugger output was:\n";
if ($?) {
print("Debugger output was:\n");
system("cat", "$output_file");
exit 1;
}