Tuesday, April 04, 2006

Tips and Tricks using the GCC, CPP and Binutils

For the http://www.lug-salem.de/ I am preparing a short presentation for showing how to use the gcc and cpp and so for collecting information.

the general idea is to specialize the information more and more, adding in more constants.
By dealing with the output of the preprocessor we can get a concise overview of the source code in one file. By looking at the assembler, we can see all types of information that is otherwise hard to find.

Here is the outline:

1. unpacking the project

looking through the files available

2. configuration and debugging
m4, shell, sed, grep,test and friends
aclocale, automake, autoconf

3. modification of the makefiles,
turning on the verbose mode and save temps in CFLAGS
creating of new rules

4. CPP and various options
DEPENDANCIES

4. compilation with the gcc, what are the passes.

4. What dump options are available
I files
S files
tree files
RTL
flow graphs
MAP FILES

5. binutils NM, OBJDUMP, ReadElf for getting at the results
Finding out the sizes of objects
finding names of functions out of the addresses
unmangling names

6. using and scripting GDB for debugging and data collection

7. Dealing with core dumps
stopping the command immediatly with a kill sig stop
debugging without debug information (map files and objdump)
libbacktrace
mapping OBJ files to ASM

8. Doxygen and Co

9. GraphViz

10. Profiling, gprof, cache grid, memory profiles, strace, oprofile