summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2016-12-02 22:25:15 +0000
committerChris Wilson <chris+github@qwirx.com>2018-01-01 16:13:16 +0000
commitd22ea1891f8930b105665d896ad6c7d5034769cf (patch)
tree8302ffc0901e83ebc8210de94afffb4429c5fd34
parentd432128c6f9390a3749af1430c8a76fbc52badf7 (diff)
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)
-rw-r--r--infrastructure/m4/boxbackup_tests.m48
-rwxr-xr-xinfrastructure/makebuildenv.pl.in16
2 files changed, 20 insertions, 4 deletions
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=<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])
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;