From d22ea1891f8930b105665d896ad6c7d5034769cf Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 2 Dec 2016 22:25:15 +0000 Subject: Detect which debugger to use in t-gdb scripts: lldb or gdb 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 da98a8183737fb1fcb658cebd9612791a4750c4c) (cherry picked from commit ea6bc722131222d1fad08521e61f552f16941b01) (cherry picked from commit 38ba7510f2cad9accf445d5633c64e98a637a139) (cherry picked from commit 02bfd7e5bdd2abc185b12f37e1f536269db6817a) --- infrastructure/m4/boxbackup_tests.m4 | 8 +++++++- infrastructure/makebuildenv.pl.in | 16 +++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'infrastructure') diff --git a/infrastructure/m4/boxbackup_tests.m4 b/infrastructure/m4/boxbackup_tests.m4 index 7410159a..59467e66 100644 --- a/infrastructure/m4/boxbackup_tests.m4 +++ b/infrastructure/m4/boxbackup_tests.m4 @@ -357,4 +357,10 @@ fi ;; esac - +AC_CHECK_PROGS(default_debugger, [lldb gdb]) +AC_ARG_WITH([debugger], + [AS_HELP_STRING([--with-debugger=], + [use this debugger in t-gdb scripts to debug tests @<:@default=lldb if present, otherwise gdb@:>@])], + [], + [with_debugger=$default_debugger]) +AC_SUBST([with_debugger]) diff --git a/infrastructure/makebuildenv.pl.in b/infrastructure/makebuildenv.pl.in index 597b6f82..e4379824 100755 --- a/infrastructure/makebuildenv.pl.in +++ b/infrastructure/makebuildenv.pl.in @@ -379,6 +379,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) @@ -614,9 +615,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; -- cgit v1.2.3