Using Bad File Finder to identify changes in behavior between builds
The Bad File Finder tool performs a binary search that determines if a single file introduces a change in behavior between two different, but compatible, builds of a program. It also identifies the file in question. This tool can be very useful when migrating or upgrading from one version of classic XL or Open XL to another or when making optimization level changes. The Bad File Finder tool is located in /opt/IBM®/openxlC/17.1.2/tools and is named bad_file_finder.sh. Access the help using the command bad_file_finder.sh [-h]. Examples can be found in /opt/IBM/openxlC/17.1.2/tools/bad_file_finder/examples.
When to use Bad File Finder
- Migration or upgrade - moving to a different release of the compiler
- Optimization changes - when changing optimization levels results in different behavior
-
When a change is made to one file that causes an observable effect in a different file.
For example, changing the size of a memory allocation may result in a crash in a different file at a point in the execution that is far removed from the cause of the failure. In such scenarios, the search method employed by bad_file_finder.sh would identify the file containing the change to the memory allocation as the culprit file, as opposed to the file containing the point of failure.
-
When an observable effect may be different from the file containing the change is one involving changes to files that are included in other files.
For example, template definitions, inline functions and constants are often specified in header files and can cause changes to code in multiple files. It may be known that a particular change to a header file is problematic but it may not be known which including file is affected adversely by the change. In such situations, bad_file_finder.sh would identify the file containing the code that is adversely affected by the change, rather than the header file.
All commands issued to the tool pertaining to a particular search need to be issued in the same directory in which the start command was issued.
How Bad File Finder works
The steps that comprise a build are controlled by the user. Therefore, building and testing a build can consist of an arbitrary number of steps. The capture_good and capture_bad commands used in the tool indicate the start of a build process and the tool will monitor compilations using proxies. The proxies are programs that are used in place of the compiler and their purpose is to examine the compiler invocation, save information needed for the search process, and ultimately invoke the compiler. They are created by the tool and are used in place of the compiler while building (by setting CC/CXX when using a makefile, for example).
The proxies will record compilation steps until a good or bad command is issued. This means that building and testing can be arbitrarily complex, providing that they are not distributed across multiple systems and all object files are distinct. Files can be generated and then compiled, linked into libraries and archived as part of multiple builds; as long as the proxies are used in the compilation steps for the object files, they will be considered in the search.
In its search, the Bad File Finder tool considers only the parts directly shadowed with proxies. For example, consider a build where several libraries are built and then linked together as part of a single build. The tool will work with all of the source files, combining them into different versions of the built libraries as it searches for the problematic file. However, if the libraries are built by different build processes outside of the tool (that is, not using the proxies), it will not consider the files comprising those libraries in the search. The boundaries of what constitutes a build is controlled by the initial capture_good or capture_bad command and the corresponding good or bad command issued by the user.
Testing can also be arbitrarily complex, although any use of the compiler in the testing process should not use the proxies.
How to use Bad File Finder
The Bad File Finder tool is located in /opt/IBM/openxlC/17.1.2/tools and is named bad_file_finder.sh.
/opt/IBM/openxlC/17.1.2/tools/bad_file_finder.sh [-h]Examples on using the Bad File Finder tool can be found in /opt/IBM/openxlC/17.1.2/tools/bad_file_finder/examples.