Exploring Debugger (ITI8510)

Allikas: Lambda
Redaktsioon seisuga 25. märts 2010, kell 14:55 kasutajalt Irve (arutelu | kaastöö)
(erin) ←Vanem redaktsioon | Viimane redaktsiooni (erin) | Uuem redaktsioon→ (erin)
Mine navigeerimisribale Mine otsikasti
Real-Time Operating Systems and Systems Programming
[ @ ]

This lab will show how a debugger could be used to explore a running program. We also try to use objdump program to disassembling.

Compilation

Since the compiler by default wants to generate the smallest possible executable (as far as effortless compilation is concerned), it removes data about function names from the file (it's called the symbol table). To prevent stripping the symbol table from the file, use -g for compilation.

gcc -g filename.c -o filename

Thus the need to create makefile for easier compilation.

Why the symbol table is needed? Debugger uses it to provide valuable additional data while debugging. Note that in the world of embedded real-time systems, any modifications to the executable, even the -g or optimizations might affect the performance characteristics.

In short: while developing a program, use the -g option for compilation.

Debugger