From: Daniel Jacobowitz <drow@false.org>
To: Jim Blandy <jimb@codesourcery.com>,
Jan Kratochvil <jan.kratochvil@redhat.com>,
gdb-patches@sourceware.org
Subject: Re: RFC: Access TLS symbols without DWARF debuginfo v2
Date: Mon, 09 Oct 2006 20:20:00 -0000 [thread overview]
Message-ID: <20061009202013.GE22848@nevyn.them.org> (raw)
In-Reply-To: <20060828182730.GA16500@nevyn.them.org>
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 <jan.kratochvil@redhat.com> 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 (<DFILE>) {
# 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
next prev parent reply other threads:[~2006-10-09 20:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-25 13:43 RFC: Ignore TLS symbols for non-TLS programs Jan Kratochvil
2006-08-25 16:43 ` Daniel Jacobowitz
2006-08-26 11:56 ` Daniel Jacobowitz
2006-08-25 13:48 ` RFC: Access TLS symbols without DWARF debuginfo Jan Kratochvil
2006-08-25 20:02 ` Daniel Jacobowitz
2006-08-28 18:27 ` RFC: Access TLS symbols without DWARF debuginfo v2 Jan Kratochvil
2006-08-28 21:02 ` Jim Blandy
2006-08-29 11:41 ` Daniel Jacobowitz
2006-10-09 20:20 ` Daniel Jacobowitz [this message]
2006-10-10 3:22 ` RFC: Access TLS symbols without DWARF debuginfo Daniel Jacobowitz
2006-10-10 4:25 ` Eli Zaretskii
2006-10-17 21:03 ` Daniel Jacobowitz
2006-10-17 22:03 ` Jan Kratochvil
2006-10-18 15:29 ` Daniel Jacobowitz
2006-10-18 4:27 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061009202013.GE22848@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=jimb@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox