Debugging Tools
Debugging is both a science and an art. Sometimes, the simplest tool—the code listing—is the best debugging tool. At other times, however, you need to use other debugging tools. Three of these tools are splint
, gprof
, and gdb
.
Using splint to Check Source Code
The splint
command is similar to the traditional UNIX lint
command: It statically examines source code for possible problems, and it also has many additional features. Even if your C code meets the standards for C and compiles cleanly, it might still contain errors. splint
performs many types of checks and can provide extensive error information. For example, this simple program might compile cleanly and even run:
matthew@seymour:~$ gcc -o ...
Get Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.