From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25276 invoked by alias); 9 Oct 2006 20:20:20 -0000 Received: (qmail 25268 invoked by uid 22791); 9 Oct 2006 20:20:19 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 09 Oct 2006 20:20:17 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1GX1bh-0006ZZ-9n; Mon, 09 Oct 2006 16:20:13 -0400 Date: Mon, 09 Oct 2006 20:20:00 -0000 From: Daniel Jacobowitz To: Jim Blandy , Jan Kratochvil , gdb-patches@sourceware.org Subject: Re: RFC: Access TLS symbols without DWARF debuginfo v2 Message-ID: <20061009202013.GE22848@nevyn.them.org> Mail-Followup-To: Jim Blandy , Jan Kratochvil , gdb-patches@sourceware.org References: <20060825021311.GB30225@host0.dyn.jankratochvil.net> <20060825034301.GA24479@nevyn.them.org> <20060825134750.GA5857@nevyn.them.org> <20060825021304.GA30225@host0.dyn.jankratochvil.net> <20060825134315.GA4994@nevyn.them.org> <20060825021311.GB30225@host0.dyn.jankratochvil.net> <20060825034301.GA24479@nevyn.them.org> <20060825200112.GA18780@host0.dyn.jankratochvil.net> <20060828182730.GA16500@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060828182730.GA16500@nevyn.them.org> User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00085.txt.bz2 On Mon, Aug 28, 2006 at 02:27:30PM -0400, Daniel Jacobowitz wrote: > On Mon, Aug 28, 2006 at 11:08:11AM -0700, Jim Blandy wrote: > > Jan Kratochvil writes: > > > Forgot again, last time, sorry. Isn't there some tool to generate this > > > changelog type templates from the diff? > > > > If you write one, let me know. :) > > Several exit, I think. I'm pretty sure I originally got this from "exist" > Diego Novillo, and then maybe fixed a bug in it. Or this might be one > I didn't get from Diego; I didn't leave myself any notes about it :-) I just stumbled over this message... in fact, I attached a hacky one I wrote myself last time. The one I got from Diego, and then fixed bugs in, is actually much nicer. #!/usr/bin/perl # $Id: mklog,v 1.3 2006-10-05 19:43:40 drow Exp $ # # This script parses a .diff file generated with 'diff -up' or 'diff -cp' # and writes a skeleton ChangeLog file to stdout. It does not try to be # very smart when parsing function names, but it produces a reasonable # approximation. # Change these settings to reflect your profile. $name = "Daniel Jacobowitz"; $addr = "dan\@codesourcery.com"; $date = `date +%Y-%m-%d`; chop ($date); #----------------------------------------------------------------------------- # Program starts here. You should not need to edit anything below this # line. #----------------------------------------------------------------------------- if ( $#ARGV != 0 ) { $prog = `basename $0`; chop ($prog); print "usage: $prog file.diff\n\n"; print "Adds a ChangeLog template to the start of file.diff\n"; print "It assumes that file.diff has been created with -up or -cp.\n"; exit 1; } $diff = $ARGV[0]; $dir = `dirname $diff`; chop ($dir); $base = `basename $diff`; chop ($base); $cl = `mktemp /tmp/$base.XXXXXX` || exit 1; chop ($cl); $hdrline = "$date $name <$addr>"; open (CLFILE, ">$cl") or die "Could not open file $cl for writing"; print CLFILE "$hdrline\n\n"; # For every file in the .diff print all the function names in ChangeLog # format. $bof = 0; open (DFILE, $diff) or die "Could not open file $diff for reading"; while () { # Check if we found a new file. if (/^Index: (.*)$/) { # If we have not seen any function names in the previous file (ie, # $bof == 1), we just write out a ':' before starting the next # file. if ($bof == 1) { print CLFILE ":\n"; } $filename = $1; print CLFILE "\t* $filename"; $bof = 1; } # If we find a new function, print it in brackets. Special case if # this is the first function in a file. # # Note that we don't try too hard to find good matches. This should # return a superset of the actual set of functions in the .diff file. # # The first two patterns work with context diff files (diff -c). The # third pattern works with unified diff files (diff -u). my $linestart = "[-a-zA-Z0-9_.]+"; if (/^\*\*\*\*\*\** ($linestart)/ || /^[\-\+\!] ($linestart)[ \t]*\(.*/ || /^@@ .* @@ ($linestart)/) { $fn = $1; if ($seen_names{$fn} == 0) { # If this is the first function in the file, we display it next # to the filename, so we need an extra space before the opening # brace. if ($bof) { print CLFILE " "; $bof = 0; } else { print CLFILE "\t"; } print CLFILE "($fn):\n"; $seen_names{$fn} = 1; } } } # If we have not seen any function names (ie, $bof == 1), we just # write out a ':'. This happens when there is only one file with no # functions. if ($bof == 1) { print CLFILE ":\n"; } print CLFILE "\n"; close (DFILE); # Concatenate the ChangeLog template and the original .diff file. system ("cat $diff >>$cl && mv $cl $diff") == 0 or die "Could not add the ChangeLog entry to $diff"; exit 0; -- Daniel Jacobowitz CodeSourcery