Debugging Memory Problems with MemoryScape : Chapter 4 Creating Programs for Memory Debugging : Compiling Programs

Compiling Programs
The first step in getting a program ready for MemoryScape is to add your compiler’s –g debugging command-line option. This option tells your compiler to generate symbol table debugging information; for example:
cc –g –o executable source_program
You can also use MemoryScape on programs that you did not compile using the –g option, or programs for which you do not have source code. However, MemoryScape may not be able to provide source code information.
The following table presents some general considerations
 
Generates debugging information in the symbol table.
Before debugging any program with MemoryScape.
Rearranges code to optimize your program’s execution.
Some compilers won’t let you use the –O option and the –g option at the same time.
Even if your compiler lets you use the –O option, don’t use it when debugging your program, since strange results often occur.
After you finish debugging your program.
Multiprocess programming library (usually dbfork)
Uses special versions of the fork() and execve() system calls.
In some cases, you need to use the –lpthread option.
For more information about dbfork, see “Linking with the dbfork Library” in this chapter.
Before debugging a multiprocess program that explicitly calls fork() or execve().

Rogue Wave Software, Inc.
Voice: (303) 473-9118
rwonlinedocs@roguewave.com