summaryrefslogtreecommitdiff
path: root/scripts/crosstool-NG.sh.in
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@free.fr>2012-10-06 21:48:07 (GMT)
committerYann E. MORIN" <yann.morin.1998@free.fr>2012-10-06 21:48:07 (GMT)
commitdd98145bc182af39645ba6bea0e5441afd84a1d3 (patch)
tree757098117f03c960017353fbcbb20a08c077d2f6 /scripts/crosstool-NG.sh.in
parentdf3be9eef3cc4e0b111d25d75b12fa5ed69a3c1d (diff)
scripts: add option to start an interactive debug shell
Add an option that, when a command fails: - starts an interactive shell with the failed command's environment - attempts re-execution of the failed command, continues, or aborts at user's whim. Before starting the debug-shell, the backtrace is printed. When exiting for an abort, the standard error message is printed. Based on an idea and a patch from: Johannes Stezenbach <js@sig21.net> http://sourceware.org/ml/crossgcc/2012-09/msg00144.html Signed-off-by: Johannes Stezenbach <js@sig21.net> [yann.morin.1998@free.fr: integrate in the fault handler] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Acked-by: Johannes Stezenbach <js@sig21.net> Patchwork-Id: 191571 Patchwork-Id: 191668
Diffstat (limited to 'scripts/crosstool-NG.sh.in')
-rw-r--r--scripts/crosstool-NG.sh.in8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
index 1f1ffdb..a7a8015 100644
--- a/scripts/crosstool-NG.sh.in
+++ b/scripts/crosstool-NG.sh.in
@@ -25,6 +25,14 @@
. .config.2
# Yes! We can do full logging from now on!
+# If we want an interactive debug-shell, we must ensure these FDs
+# are indeed connected to a terminal (and not redirected in any way).
+if [ "${CT_DEBUG_INTERACTIVE}" = "y" -a ! \( -t 0 -a -t 6 -a -t 2 \) ]; then
+ CT_DoLog ERROR "Can't spawn interactive debug-shell,"
+ CT_DoLog ERROR "because stdout/stderr has been redirected."
+ exit 1
+fi
+
# Override the locale early, in case we ever translate crosstool-NG messages
if [ -z "${CT_NO_OVERIDE_LC_MESSAGES}" ]; then
export LC_ALL=C