From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Buettner To: gdb-patches@sources.redhat.com Subject: Re: [PATCH RFC] abort() to internal_error() Date: Tue, 20 Feb 2001 23:14:00 -0000 Message-id: <1010221071355.ZM27256@ocotillo.lan> References: <1010221065142.ZM27191@ocotillo.lan> X-SW-Source: 2001-02/msg00416.html On Feb 20, 11:51pm, Kevin Buettner wrote: > ... As is often the case for this sort of job, I used a Perl script > to perform the substitutions. I'll post the script as a reply to > this message. Below is the script that I used to create the patch consisting of the abort () -> internal_error () substitutions. This patch may be found at http://sources.redhat.com/ml/gdb-patches/2001-02/msg00415.html To run the script, simply cd to your gdb source directory (*not* the top level directory though) and do: subst-abort-internal_error . Note the dot. If you like, you can skip the ``cd'' step and simply provide the path to your gdb sources in place of the dot. Again, the path in question should be to your gdb directory, i.e, the one that contains the file "infptrace.c". Also note that most of you reading this message will not need to run this script as I will commit the changes to the FSF repository in the usual fashion. Those of you with diverging source trees may wish to run it on your sources to make your merging with the FSF repository easier. --- subst-abort-internal_error --- #!/usr/bin/perl -w use File::Find; use FileHandle; use IPC::Open3; use English; my ($root) = @ARGV; if (!defined($root)) { die "Usage: $0 root\n"; } @ARGV = (); find( sub { if ($_ eq 'testsuite' || $_ eq 'gdbserver' || (-d && /-share$/)) { $File::Find::prune = 1; } elsif (-f && -T && /\.[hc]$/ && $_ ne "gnu-regex.c") { push @ARGV, $File::Find::name; } }, $root ); $INPLACE_EDIT = ''; undef $/; # slurp entire files while (<>) { s/\babort\ ?\(\);/internal_error (__FILE__, __LINE__, "failed internal consistency check");/gx; print; } --- end subst-abort-internal_error ---