List of helpful C tools that will help you peek inside a process or an a.out file. Some are specific to Sun OS. I have compiled it into an easy-to-read summary of what each one does, and where to find them. Going through the man pages for each, and try running each on a couple of different a.out’s - the "hello world" program and a "big program".
Tool --> Where To Find It --> What it Does
Tool --> Where To Find It --> What it Does
Tool --> Where To Find It --> What it Does
Tool --> Where To Find It --> What it Does
What It identifies --> Typical Output --> How to Invoke It
Tools To Examine Source
Tool --> Where To Find It --> What it Does
- cb --> Comes with the Compiler --> C program beautifier. Run your source through this filter to put it in a standard layout and indentation.
- Indent --> comes with AT&T --> Does same as cb.
- cdecl --> _______ --> Unscrambles C declarations.
- cflow- --> Comes with the Compiler --> An interactive ASCII based C program browser. We can use it in the OS group to check the impact of changes to header files. It provides quick answers to questions like: "How many commands use libthread?" or "Who are all the kmem readers".
- ctags --> /usr/bin --> Creates a tag file for use in vi editor. Tags file speeds up examining program source by maintaining a table of where most objects are located.
- lint --> Comes with the Compiler --> A C program checker.
- sccs --> /usr/ccs/bin --> A source code version control system.
- vgrind --> /usr/bin --> A formatter for printing nice C listings.
Tools To Examine Executable
Tool --> Where To Find It --> What it Does
- dis --> /ur/ccs/bin --> Object code disassemble.
- dump –Lv --> /usr/ccs/bin - --> Prints dynamic linking of information.
- ldd --> /usr/bin --> Prints the dynamic libraries the file needs.
- nm --> /usr/ccs/bin --> Prints the symbol table information of an object file.
- strings --> /usr/bin --> Looks at the strings embedded in a library. Useful for looking at error messages a binary can generate, built-in file names, and sometimes symbol names or version and copyright information.
- sum --> /usr/bin --> Prints checksum and block count for a file. Answer the questions like: "Are two executables the same version?" "Did transmission go OK?"
Tools To Help With Debugging
Tool --> Where To Find It --> What it Does
- truss --> /usr/bin --> The SVr4 version of trace. This tool prints out the system calls that an executable makes. Use it to see what a binary is doing, and why it’s stuck or failing. This is a great help!.
- ps --> /usr/bin --> Displays process characteristics.
- ctrace --> Comes with the Compiler --> Interactive debugger.
- debugger --> Comes with the Compiler --> Modifies your source to print lines as they are executed. A great tool for small programs.
- file --> /usr/bin --> Tells you what a file contains (Ex:executable, data, ASCII, shell script, archive, etc...).
Tools To Perform Performance Tuning
Tool --> Where To Find It --> What it Does
- collector --> Comes with debugger --> (Sun OS only)Collects runtime performance data under the control of debugger.
- analyzer --> Comes with debugger --> (Sun OS only) Analyses collected performance data.
- gprof --> /usr/ccs/bin --> Displays the Call-graph profile data (identifies the compute intensive functions).
- prof --> /usr/ccs/bin --> Displays the percentage of time spent in each routine.
- tcov --> Comes with compiler --> Displays a count of how often each statement is executed(identifies the compute-intensive loops within a function).
- time --> /usr/bin/time --> Displays the total real and CPU time used by a program.
Tools To Help Identify Your Hardware
What It identifies --> Typical Output --> How to Invoke It
- Kernel Architecture --> sun4c --> /usr/kvm/arch –k
- Any OS patches applied --> no patches are installed --> /usr/bin/showrev –p
- Various hardware things --> lots --> /usr/sbin/prtconf
- CPU clock rate --> 40MHz processor --> /usr/sbin/psrinfo –v
- hosted --> 55417fe --> /usr/ucb/hosted
- memory --> 32Mb --> Displays on power up
- Serial number --> 4290302 --> Displays on power up
- ROM Version --> 2.4.1 --> Displayed on power up
- Mounted disk --> 198Mb disk --> /usr/bin/df –F ufs –k
- Swap space --> 40 Mb --> /etc/swap –s
- Ethernet addresss --> 9:0:6:6:6 --> /usr/sbin/ifconfig –a The Ethernet address is built into the machine
- IP address --> le0=129.144.248.36 --> /usr/sbin/ifconfig –a The IP address is built into the network
- Floating-point hardware --> FPU’s frequency appears to be 38.2 MHz --> fpversion comes with compiler.
References
- Stephen C. Tweedie (February 17 1999). Re: fsync on large files. Linux kernel mailing list.
- M. Bach. The Design of the UNIX Operating System. Prentice Hall, 1986 .


