User`s manual

100 digi.com Debugging with Dynamic C
6.3.7 MAP File
Map files have been generated for compiled programs since Dynamic C 7.02.
Pros The map file is full of useful information. It contains,
• location and size of code and data segments
• a list of all symbols used, their location, size and their file of origin
• a list of all macros used, their file of origin and the line number within that file
where the macro is defined
• function call graph
A valid map file is produced after a successful compile, so it is available when
a program crashes.
Cons If the compile was not successful, for example you get a message that says you
ran out of root code space, the map file will still be created, but will contain in-
complete and possibly incorrect information.
Uses Map files are useful when you want to gather more data or are trying to get a
comprehensive overview of the program. A map file can help you make better
use of memory in cases where you are running short or are experiencing stack
overflow problems.
Example Say you are pushing the limits of memory in your application and want to see
where you can shave bytes. The map file contains sizes for all the data used in
your program.The screen shot below shows some code and part of its map file.
Maybe you meant to type “200” as the size for my_array and added a zero on
the end by mistake. (This is a good place to mention that using hard-coded val-
ues is more prone to error than defining and using constants.)
Scanning the size column, the mistake jumps out at you more readily than look-
ing at the code, maybe because you expect to see “200” and so your brain filters
out the extra zero. For whatever reason, looking at the same information in a dif-
ferent format allows you to see more.
The size value for functions might not be accurate because it measures code dis-
tance. In other words, if a function spans a gap created with a follows action, the
size reported for the function will be much greater than the actual number of