From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27275 invoked by alias); 29 Jan 2008 08:50:49 -0000 Received: (qmail 27266 invoked by uid 22791); 29 Jan 2008 08:50:47 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate8.de.ibm.com (HELO mtagate8.de.ibm.com) (195.212.29.157) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 29 Jan 2008 08:50:10 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate8.de.ibm.com (8.13.8/8.13.8) with ESMTP id m0T8o7e7022238 for ; Tue, 29 Jan 2008 08:50:07 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m0T8o7oe1171658 for ; Tue, 29 Jan 2008 09:50:07 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m0T8o65f032431 for ; Tue, 29 Jan 2008 09:50:06 +0100 Received: from bbkeks.de.ibm.com (dyn-9-152-248-39.boeblingen.de.ibm.com [9.152.248.39]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m0T8o5cd032244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 29 Jan 2008 09:50:06 +0100 Message-ID: <479EE84F.3030802@de.ibm.com> Date: Tue, 29 Jan 2008 12:23:00 -0000 From: Markus Deuling User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: GDB Patches Subject: [RFC]: New test scrupt gdb_buildall.sh Content-Type: multipart/mixed; boundary="------------080704050104000806080400" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00672.txt.bz2 This is a multi-part message in MIME format. --------------080704050104000806080400 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1845 Hi, since we have the "--enable-targets=all" flag now I wrote a little script (based on gdb_mbuild.sh) to make use of it for testing GDBs build. In comparison to gdb_mbuild this script builds a single GDB with --enable-targets=all flag (and --enable-64-bit-bfd if wanted). After a successfull build it tries to recognize the architectures supported by GDB. For this it invokes "set architecture" without a parameter and analyzes the output. The output looks like that: powerpc:rs64iii powerpc:7400 powerpc:e500 powerpc:MPC8XX powerpc:750 s390:31-bit s390:64-bit score sh sh2 sh2e sh-dsp sh3 It then sets the current architecure to each of thoses and stores the result from "maint print architecture" command to appropriate log files (.log). In the first run it found some errors (like the one I mentioned in http://sourceware.org/ml/gdb-patches/2008-01/msg00642.html). The script is kept as simple as possible. There is no flag to change the verbosity for example. This is an example of the scripts output: ... h1 OK ... mips OK ... mips:3000 OK ... mips:3900 ERR: gdb panic ... mips:4000 OK ... mips:4010 OK ... mips:4100 ERR: gdb panic ... mips:4111 OK The disadvantage of gdb_mbuild.h is the fact that it builds a complete GDB from source for each and every target which took quite a lot of time for a full build. For my opinion this shouldn't be needed anymore since we have "--enable-targets=all" flag now. Would this script be ok to commit it to mainline? I neither attached a ChangeLog nor a patch for documentation as this is just an RFC and I'd appreciate your opinion on this very much. If this comes out to be useful for mainline I'll add ChangeLog and documentation. Regards, Markus -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com --------------080704050104000806080400 Content-Type: text/plain; name="diff-all-build" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff-all-build" Content-length: 7061 diff -urpN src/gdb/gdb_buildall.sh dev/gdb/gdb_buildall.sh --- src/gdb/gdb_buildall.sh 1970-01-01 01:00:00.000000000 +0100 +++ dev/gdb/gdb_buildall.sh 2008-01-29 09:42:48.000000000 +0100 @@ -0,0 +1,261 @@ +#!/bin/sh + +# Build script to build GDB with all targets enabled. + +# Copyright (C) 2008 Free Software Foundation, Inc. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Make certain that the script is not running in an internationalized +# environment. The script is grepping for GDB's output. + +# Contributed by Markus Deuling . +# Based on gdb_mbuild.sh from Richard Earnshaw. + + +LANG=c ; export LANG +LC_ALL=c ; export LC_ALL + +# Prints a usage message. +usage() +{ + cat < ... ] + +Options: + + --bfd64 Enable 64-bit BFD. + --clean Delete build directory after check. + -e Regular expression for selecting the targets to build. + --force Force rebuild. + -j Run in parallel. Passed to make. + On a single cpu machine, 2 is recommended. + Arguments: + Source code directory. + Build directory. + + Environment variables examined (with default if not defined): + MAKE (make)" +EOF + exit 1 +} + +### Command line options. +makejobs= +force=false +targexp="" +bfd_flag="" +clean=false +while test $# -gt 0 +do + case "$1" in + -j ) + # Number of parallel make jobs. + shift + test $# -ge 1 || usage + makejobs="-j $1" + ;; + --clean ) + # Shall the build directory be deleted after processing? + clean=true + ;; + -e ) + # A regular expression for selecting targets + shift + test $# -ge 1 || usage + targexp="${targexp} -e ${1}" + ;; + --force ) + # Force a rebuild + force=true ; + ;; + --bfd64) + # Enable 64-bit BFD + bfd_flag="--enable-64-bit-bfd" + ;; + -* ) usage ;; + *) break ;; + esac + shift +done + +if test $# -ne 2 +then + usage +fi + +### Environment. + +# Convert these to absolute directory paths. +srcdir=`cd $1 && /bin/pwd` || exit 1 +builddir=`cd $2 && /bin/pwd` || exit 1 +# Version of make to use +make=${MAKE:-make} +MAKE=${make} +export MAKE +# We dont want GDB do dump cores. +ulimit -c 0 + +# Just make sure we're in the right directory. +maintainers=${srcdir}/gdb/MAINTAINERS +if [ ! -r ${maintainers} ] +then + echo Maintainers file ${maintainers} not found + exit 1 +fi + + +# Build GDB with all targets enabled. +echo "Starting gdb_buildall.sh ..." + +trap "exit 1" 1 2 15 +dir=${builddir}/ALL + +# Should a scratch rebuild be forced, for perhaps the entire build be skipped? +if ${force} +then + echo ... forcing rebuild + rm -rf ${dir} +fi + +# Did the previous configure attempt fail? If it did restart from scratch +if test -d ${dir} -a ! -r ${dir}/Makefile +then + echo ... removing partially configured + rm -rf ${dir} + if test -d ${dir} + then + echo "... ERROR: Unable to remove directory ${dir}" + exit 1 + fi +fi + +# Create build directory. +mkdir -p ${dir} +cd ${dir} || exit 1 + +# Configure GDB. +if test ! -r Makefile +then + # Default SIMOPTS to GDBOPTS. + test -z "${simopts}" && simopts="${gdbopts}" + + # The config options. + __build="--enable-targets=all" + __enable_gdb_build_warnings=`test -z "${gdbopts}" \ + || echo "--enable-gdb-build-warnings=${gdbopts}"` + __enable_sim_build_warnings=`test -z "${simopts}" \ + || echo "--enable-sim-build-warnings=${simopts}"` + __configure="${srcdir}/configure \ + ${__build} ${bfd_flag}\ + ${__enable_gdb_build_warnings} \ + ${__enable_sim_build_warnings}" + echo ... ${__configure} + trap "echo Removing partially configured ${dir} directory ...; rm -rf ${dir}; exit 1" 1 2 15 + ${__configure} > Config.log 2>&1 + trap "exit 1" 1 2 15 + + # Without Makefile GDB won't build. + if test ! -r Makefile + then + echo "... CONFIG ERROR: GDB couldn't be configured " | tee -a Config.log + echo "... CONFIG ERROR: see Config.log for details " + exit 1 + fi +fi + +# Build GDB, if not built. +if test ! -x gdb/gdb -a ! -x gdb/gdb.exe +then + echo ... ${make} ${makejobs} ${target} + ( ${make} ${makejobs} all-gdb || rm -f gdb/gdb gdb/gdb.exe + ) > Build.log 2>&1 + + # If the build fails, exit. + if test ! -x gdb/gdb -a ! -x gdb/gdb.exe + then + echo "... BUILD ERROR: GDB couldn't be compiled " | tee -a Build.log + echo "... BUILD ERROR: see Build.log for details " + exit 1 + fi +fi + + +# Retrieve a list of settable architectures by invoking "set architecture" +# without parameters. +cat < arch +set architecture +quit +EOF +./gdb/gdb --batch -nx -x arch 2>&1 | cat > gdb_archs +tail -n 1 gdb_archs | sed 's/auto./\n/g' | sed 's/,/\n/g' | sed 's/Requires an argument. Valid arguments are/\n/g' | sed '/^[ ]*$/d' > arch +mv arch gdb_archs + +if test "${targexp}" != "" +then + alltarg=`cat gdb_archs | grep ${targexp}` +else + alltarg=`cat gdb_archs` +fi +rm -f gdb_archs + +# Test all architectures available in ALLTARG +echo "maint print architecture for" +echo "$alltarg" | while read target +do + cat < x +set architecture ${target} +maint print architecture +quit +EOF + echo -n "... ${target}" + ./gdb/gdb -batch -nx -x x 2>&1 | cat > ${target}.log + # Check GDBs results + if test ! -s ${target}.log + then + echo " ERR: gdb printed no output" | tee -a ${target}.log + elif test `grep -o internal-error ${target}.log | tail -n 1` + then + echo " ERR: gdb panic" | tee -a ${target}.log + else + echo " OK" + fi + + # Create a sed script that cleans up the output from GDB. + rm -f mbuild.sed + # Rules to replace <0xNNNN> with the corresponding function's name. + sed -n -e '/<0x0*>/d' -e 's/^.*<0x\([0-9a-f]*\)>.*$/0x\1/p' ${target}.log \ + | sort -u \ + | while read addr + do + func="`addr2line -f -e ./gdb/gdb -s ${addr} | sed -n -e 1p`" + echo "s/<${addr}>/<${func}>/g" + done >> mbuild.sed + # Rules to strip the leading paths off of file names. + echo 's/"\/.*\/gdb\//"gdb\//g' >> mbuild.sed + # Run the script. + sed -f mbuild.sed ${target}.log > Mbuild.log + + mv Mbuild.log ${builddir}/${target}.log + rm -rf ${target}.log x mbuild.sed +done +echo "done." + +# Clean up build directory if necessary. +if ${clean} +then + echo "cleanning up $dir" + rm -rf ${dir} +fi + +exit 0 --------------080704050104000806080400--