From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3118 invoked by alias); 8 Jan 2003 23:59:26 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3094 invoked from network); 8 Jan 2003 23:59:20 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by 209.249.29.67 with SMTP; 8 Jan 2003 23:59:20 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 223453EC2; Wed, 8 Jan 2003 18:59:11 -0500 (EST) Message-ID: <3E1CBB4E.4090405@redhat.com> Date: Wed, 08 Jan 2003 23:59:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.1) Gecko/20021211 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh References: <200301022004.h02K4WT31218@duracef.shout.net> <3E1AEDEC.1040702@redhat.com> <20030107155435.GA12218@nevyn.them.org> Content-Type: multipart/mixed; boundary="------------060106050801020104050409" X-SW-Source: 2003-01/txt/msg00349.txt.bz2 This is a multi-part message in MIME format. --------------060106050801020104050409 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 925 > On Tue, Jan 07, 2003 at 10:10:36AM -0500, Andrew Cagney wrote: > >> >>Thoughts? > >> > >> > >> >The idea sounds good to me. >> > >> >Instead of ed'ing Gdb.log, how about just naming the first file >> >Gdb.out or Gdb-raw.log, and then sed'ing into Gdb.log. > >> >> I can save the unedited output. >> >> To make sed worthwhile, I'd need to construct a sed script that did all >> substitutions in a single pass. Otherwize the script ends up repeating: >> sed -e ... < input > output >> mv output input >> which is equivalent to ed. That, I think, is something for a rainy day. > > > It's as simple as "sed -e ... -e ... -e ... -e ... < input > output", > isn't it? Or via -f and a file, the same thing. Yes - `construct a sed script'. I've done it (attached, committed). Doesn't make it any faster though. The slow bit is: + func="`addr2line -f -e ./gdb/gdb -s ${addr} | sed -n -e 1p`" enjoy, Andrew --------------060106050801020104050409 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 1589 2003-01-08 Andrew Cagney * gdb_mbuild.sh: Edit the output of `maint print architecture' replacing hex constants with function names and stripping leading file name directory prefixes. Index: gdb_mbuild.sh =================================================================== RCS file: /cvs/src/src/gdb/gdb_mbuild.sh,v retrieving revision 1.3 diff -u -r1.3 gdb_mbuild.sh --- gdb_mbuild.sh 2 Jan 2003 16:40:33 -0000 1.3 +++ gdb_mbuild.sh 8 Jan 2003 23:46:52 -0000 @@ -279,12 +279,32 @@ fail "gdb printed no output" ! -s Gdb.log grep -e internal-error Gdb.log && fail "gdb panic" 1 + echo ... cleanup ${target} + + # Create a sed script that cleans up the output from GDB. + rm -f mbuild.sed + touch mbuild.sed || exit 1 + + # Rules to replace <0xNNNN> with the corresponding function's + # name. + sed -n -e '/<0x0*>/d' -e 's/^.*<0x\([0-9a-f]*\)>.*$/0x\1/p' Gdb.log \ + | sort -u \ + | while read addr + do + func="`addr2line -f -e ./gdb/gdb -s ${addr} | sed -n -e 1p`" + test ${verbose} -gt 0 && echo "${addr} ${func}" 1>&2 + 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 + # Replace the build directory with a file as semaphore that stops # a rebuild. (should the logs be saved?) cd ${builddir} rm -f ${target}.tmp - mv ${target}/Gdb.log ${target}.tmp + sed -f ${target}/mbuild.sed ${target}/Gdb.log > ${target}.tmp rm -rf ${target} mv ${target}.tmp ${target} --------------060106050801020104050409--