summaryrefslogtreecommitdiffstats
path: root/bin/trace
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2005-12-02 18:46:20 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2005-12-02 18:46:20 (GMT)
commit25576025eb5261a6bc90dc75ab28f40208ef2fdd (patch)
tree0c6454f1a5a8667f080782d7aae3a70b750a77c9 /bin/trace
parent151e0e16201a87edfd3346fb49efdc5a357a5262 (diff)
downloadhdf5-25576025eb5261a6bc90dc75ab28f40208ef2fdd.zip
hdf5-25576025eb5261a6bc90dc75ab28f40208ef2fdd.tar.gz
hdf5-25576025eb5261a6bc90dc75ab28f40208ef2fdd.tar.bz2
[svn-r11754] Purpose:
Feature Description: bin/reconfigure now allows users to define the paths to the autotools on their system. bin/reconfigure also runs the trace script when it is invoked. Solution: The autotools are specified using environment variables: AUTOCONF, AUTOMAKE, ACLOCAL, AUTOHEADER, and LIBTOOL_DIR. See bin/reconfigure for the defaults. The version of each of the autotools is checked before they are run, so users can't invoke the wrong version of any autotool. The trace script is run on all the .c files in the src directory when reconfigure is invoked. Ideally, bin/reconfigure should be run when any new function is added to the library, but if the tracing information is out of date the library will still work. The trace script has also been modified to ignore the multi and stdio file drivers (per Quincey's suggestion). Platforms tested: mir, shanti
Diffstat (limited to 'bin/trace')
-rwxr-xr-xbin/trace44
1 files changed, 24 insertions, 20 deletions
diff --git a/bin/trace b/bin/trace
index f921fb7..c1cc61e 100755
--- a/bin/trace
+++ b/bin/trace
@@ -265,27 +265,31 @@ sub rewrite_func ($$$$$) {
#
my $total_api = 0;
for $file (@ARGV) {
- # Snarf up the entire file
- open SOURCE, $file or die "$file: $!\n";
- $Source = join "", <SOURCE>;
- close SOURCE;
-
- # Make modifications
- my $original = $Source;
- my $napi = $Source =~ s/\n([A-Za-z]\w*(\s+[a-z]\w*)*)\s*\n #type
- (H5[A-Z]{0,2}[^_A-Z0-9]\w*) #name
- \s*\((.*?)\)\s* #args
- (\{.*?\n\}[^\n]*) #body
- /rewrite_func($file,$1,$3,$4,$5)/segx;
- $total_api += $napi;
+ # Ignore some files that do not need tracing macros
+ unless ($file eq "H5FDmulti.c" or $file eq "src/H5FDmulti.c" or $file eq "H5FDstdio.c" or $file eq "src/H5FDstdio.c") {
- # If the source changed then print out the new version
- if ($original ne $Source) {
- printf "%s: instrumented %d API function%s\n",
- $file, $napi, 1==$napi?"":"s";
- rename $file, "$file~" or die "unable to make backup";
- open SOURCE, ">$file" or die "unable to modify source";
- print SOURCE $Source;
+ # Snarf up the entire file
+ open SOURCE, $file or die "$file: $!\n";
+ $Source = join "", <SOURCE>;
close SOURCE;
+
+ # Make modifications
+ my $original = $Source;
+ my $napi = $Source =~ s/\n([A-Za-z]\w*(\s+[a-z]\w*)*)\s*\n #type
+ (H5[A-Z]{0,2}[^_A-Z0-9]\w*) #name
+ \s*\((.*?)\)\s* #args
+ (\{.*?\n\}[^\n]*) #body
+ /rewrite_func($file,$1,$3,$4,$5)/segx;
+ $total_api += $napi;
+
+ # If the source changed then print out the new version
+ if ($original ne $Source) {
+ printf "%s: instrumented %d API function%s\n",
+ $file, $napi, 1==$napi?"":"s";
+ rename $file, "$file~" or die "unable to make backup";
+ open SOURCE, ">$file" or die "unable to modify source";
+ print SOURCE $Source;
+ close SOURCE;
+ }
}
}