Testing and debugging is an iterative process. Whenever a bug is found and then fixed, the application needs to go through another round of testing. Whether the application goes through a complete test cycle or just through a set of regression tests is a matter of choice. The main reason we go through a complete test cycle is to make sure a patch not only fixes the bug it was meant to fix, but that it does not cause other parts of the application to fail. If the patch was applied to a common library that is used by a large number of application functionalities, it is more advisable to run the application through a complete test cycle. If the patch only applies to some self-contained part of the code, however, it is safe to only run the application through a few tests that exercise that part of the code.
The GNU debugger is the debugger of choice on Linux.
Cscope is one of the best productivity tools recommended for use when porting or developing software applications. It alleviates the work of finding and cross-referencing symbols and functions used in small to very large application code.
Use of memory-debugging tools is a matter of preference. Some tools come in libraries that need to be linked in with the application; others wrap the application and analyze it without the need to link any libraries with the application.
Two views to application tuning exist. The internal view can help find application functions that can be optimized to perform better. The external view can help find the application's resource signature for systems planning. System utility tools such as top display application memory and CPU usage; code profilers such as OProfile can pinpoint what part of the application uses the most CPU.
With regard to the list of tools presented in this chapter, any seasoned software developer or porting personnel might say, "The more tools I have, the better." Indeed, to develop or port applications and to do this well, you must have the right tools. Although there may be other debugging and performance tools for Linux we forgot to mention, the tools described here are the most generally available and widely used in the open-source community. The beauty of open source is if a tool does not come standard with a particular Linux distribution, anyone can go to the specific tool's Web site and download it.