Skip to content

Commit

Permalink
Detect which debugger to use in t-gdb scripts: lldb or gdb
Browse files Browse the repository at this point in the history
Should make debugging on Mac and BSD less painful.

Make t-gdb fail with an error when no debugger was detected.

(cherry picked from commit da98a81)
(cherry picked from commit ea6bc72)
  • Loading branch information
qris committed Sep 24, 2017
1 parent 1cdca12 commit 38ba751
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 7 additions & 1 deletion infrastructure/m4/boxbackup_tests.m4
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,10 @@ fi
;;
esac


AC_CHECK_PROGS(default_debugger, [lldb gdb])
AC_ARG_WITH([debugger],
[AS_HELP_STRING([--with-debugger=<gdb|lldb|...>],
[use this debugger in t-gdb scripts to debug tests @<:@default=lldb if present, otherwise gdb@:>@])],
[],
[with_debugger=$default_debugger])
AC_SUBST([with_debugger])
16 changes: 13 additions & 3 deletions infrastructure/makebuildenv.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ $default_cflags =~ s/ -O2//g;
$default_cxxflags =~ s/ -O2//g;
my $debug_base_dir = 'debug';
my $release_base_dir = 'release';
my $debugger = '@with_debugger@';

my $release_flags = "-O2";
if ($target_windows)
Expand Down Expand Up @@ -606,9 +607,18 @@ __E

writetestfile("$mod/t", "GLIBCXX_FORCE_NEW=1 ".
'./_test' . $platform_exe_ext . ' "$@"', $mod);
writetestfile("$mod/t-gdb", "GLIBCXX_FORCE_NEW=1 ".
'gdb ./_test' . $platform_exe_ext . ' "$@"', $mod);


if($debugger)
{
writetestfile("$mod/t-gdb", "GLIBCXX_FORCE_NEW=1 ".
$debugger . ' ./_test' . $platform_exe_ext . ' "$@"', $mod);
}
else
{
writetestfile("$mod/t-gdb",
"echo 'No debugger was detected by configure script'\n".
"exit 2");
}
}

my @all_deps_for_module;
Expand Down

0 comments on commit 38ba751

Please sign in to comment.