From patchwork Fri Sep 28 16:35:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Stezenbach X-Patchwork-Id: 187836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 2F7142C00CE for ; Sat, 29 Sep 2012 02:36:08 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sourceware.org; s=default; x=1349454968; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-Help: Sender:Delivered-To; bh=WsCrUOloYJ9q/76Bvmg3ZkqGBVA=; b=PuPy30Nz ruQfRB72WdJvFQJW+1wQ1qFFDHPu1D7km9+LQIqYE43qQAZdz2GMHlqSGFJKOLyy 7PVl7kAxaRj39tIvHFQrXb1giJPO1LUQvGJDiVxNaoG6YEr1NDpqdOX/djeTKSS1 Lm57t2L8tnLYBZTnAFX9OIZiEaeMZXF2+sk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=sourceware.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-Spam-21-Score:X-Spam-21-Report:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=CSt8JH59Sb7c9VlIuIwrAQhVz4unz6QfNtjD72tOa413WIzJBtHi/EDYGImkxe nIGoqsbdpq1hSrI0hr0icMWXH7yVqa0L4mDl6X6hHWXSB6+IVf1dIMAtwvAGhcm4 CWus+q2bXgydSpPD7pVkWaj6o2HACqAFot328ctAwLkpA=; Received: (qmail 12741 invoked by alias); 28 Sep 2012 16:36:01 -0000 Received: (qmail 12547 invoked by uid 22791); 28 Sep 2012 16:35:59 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from bar.sig21.net (HELO bar.sig21.net) (80.81.252.164) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Sep 2012 16:35:55 +0000 Received: from p5099b351.dip0.t-ipconnect.de ([80.153.179.81] helo=zzz.local) by bar.sig21.net with esmtpsa (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from ) id 1THdXY-00060S-13 for crossgcc@sourceware.org; Fri, 28 Sep 2012 18:35:53 +0200 Received: from js by zzz.local with local (Exim 4.80) (envelope-from ) id 1THdXX-0002yW-ID for crossgcc@sourceware.org; Fri, 28 Sep 2012 18:35:47 +0200 Date: Fri, 28 Sep 2012 18:35:47 +0200 From: Johannes Stezenbach To: crossgcc@sourceware.org Subject: [RFC] ct-ng build debugging Message-ID: <20120928163547.GB17447@sig21.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-21-Score: -2.9 (--) X-Spam-21-Report: No, score=-2.9 required=8.0 tests=ALL_TRUSTED=-1, BAYES_00=-1.9 autolearn=ham X-IsSubscribed: yes Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org Delivered-To: mailing list crossgcc@sourceware.org Hi, I hacked up the patch below which drops into a shell prompt when the ct-ng build breaks, with the environment properly set up. It allows one to check what went wrong and possibly hot-fix it. Of course a real patch should use a developer config option, but I'm out of time atm and can't finish it. If you find it useful it would be nice if someone could pick it up and polish it for inclusion. (The "backtrace" change at the top is actually a seperate bugfix for when things go wrong early in crosstool-NG.sh before CT_BUILD_DIR is set.) Signed-off-by: Johannes Stezenbach PS: I'm not good at writing bash scripts, maybe there's a better way to do it. It's also not much tested but it worked for re-running make and changing the gcc command to look at the cpp output from the glibc breakage I just reported. --- For unsubscribe information see http://sourceware.org/lists.html#faq diff -r 43ace4bb005e scripts/functions --- a/scripts/functions Wed Sep 26 16:37:31 2012 +0200 +++ b/scripts/functions Fri Sep 28 18:15:49 2012 +0200 @@ -11,8 +11,8 @@ # To avoid printing the backtace for each sub-shell # up to the top-level, just remember we've dumped it - if [ ! -f "${CT_BUILD_DIR}/backtrace" ]; then - touch "${CT_BUILD_DIR}/backtrace" + if [ ! -f "${CT_WORK_DIR}/backtrace" ]; then + touch "${CT_WORK_DIR}/backtrace" # Print steps backtrace step_depth=${CT_STEP_COUNT} @@ -50,7 +50,7 @@ CT_DoLog ERROR "" CT_DoEnd ERROR - rm -f "${CT_BUILD_DIR}/backtrace" + rm -f "${CT_WORK_DIR}/backtrace" fi exit $ret } @@ -157,6 +157,7 @@ # Usage: CT_DoExecLog [VAR=val...] [parameters...] CT_DoExecLog() { local level="$1" + local result shift ( for i in "$@"; do @@ -168,8 +169,41 @@ *) break;; esac done - CT_DoLog DEBUG "==> Executing: ${tmp_log}" - "${@}" 2>&1 |CT_DoLog "${level}" + trap ERR + while true; do + CT_DoLog DEBUG "==> Executing: ${tmp_log}" + "${@}" 2>&1 |CT_DoLog "${level}" + result=$? + if [ $result -eq 0 ]; then + break + fi + ( + exec >&6 + echo "command error $result:" + echo "$@" + echo "please fix it up and finish by exiting the shell" + while true; do + bash --rcfile <(echo "PS1='ct-ng:\w> '") -i + result=$? + case $result in + 1) result=0; break;; + 2) break;; + 3) break;; + *) echo "please exit with one of these values:" + echo "1 fixed, continue with next build command" + echo "2 repeat this build command" + echo "3 abort build" + ;; + esac + done + exit $result + ) + result=$? + if [ $result -ne 2 ]; then + break + fi + done + exit $result ) # Catch failure of the sub-shell [ $? -eq 0 ]