Map Debug File (*.map)

From Appmethod Topics
Jump to: navigation, search

Go Up to File Types Index


Map files are plain text files that contain information about the global symbols of your program, source file, and source line numbers useful for debugging. For example, when your application crashes (for example, due to an access violation), you can use the resulting address to locate the module (method) where the application crashed.

Map Debug File Content and Format

By default, Appmethod generates a map file that contains general segment information that includes:

  • A list of segments with their names
  • The program start address and offset
  • The class:
    • CODE (which contains executable instructions)
    • DATA (which contains the global variables and static variables that are initialized by the programmer)
    • BSS (which contains the statically-allocated variables) or
    • TLS (thread local storage)
  • Any warning or error messages produced during linking
//hello.cpp
#include<iostream>
#include<string>
int main(int, char**)
{
  std::string s("hello world");
  std::cout<<s;
  return 0;
}

For example, for the previous code example, the map file created after you link the .cpp file looks like this:

 Start         Length      Name                 Class
 0001:00401000 0000214D4H _TEXT                  CODE
 0002:00423000 0000059B8H _DATA                  DATA
 0003:004289B8 000002F24H _BSS                   BSS
 0004:00000000 00000009CH _TLS                   TLS

When calling BCC32.EXE with the -M option, beside the default information, the map file has the following two sections:

 Address Publics by Name
 
 0002:000024C4  @std@%basic_filebuf$b19std@%char_traits$b%%@3
 0002:000010E8  @std@%basic_filebuf$c19std@%char_traits$c%%@3
 0002:00002450  @std@%basic_ios$b19std@%char_traits$b%%@3
 .
 .
 .
 
 Address Publics by Value
 
 0001:000000E4  _main
 0001:00000730  std::allocator<char>::allocator<char>()
 .
 .
 .

The Address Publics by Name section contains pairs of start addresses (segment:offset) and methods, variables, or other symbols. These pairs are sorted by the name of the symbols. The Address Publics by Value section contains the same pairs as the Address Publics by Name section, but sorted by value.

Generating Map Debug Files

When you build a Object Pascal project, Appmethod generates a map debug file if your project meets any of the following conditions:

  • You are building your project for 32-bit Windows, 64-bit Windows, Mac OS X, or iOS Simulator, and the value of the Map file option in Project > Options > Object Pascal Compiler > Linking is "Detailed".
  • You are building your project for 32-bit iOS Device or 64-bit iOS Device, and the value of the Map file ARM option in Project > Options > Object Pascal Compiler > Linking is "map file and .drc file".

When you build a C++ project, Appmethod always generates a map debug file.

The file name of your map debug file is:

  • In Object Pascal packages for Mac OS X: bpl<project>.dylib.map
  • In any other scenario: <project>.map

When you build your project, your map debug file is generated by default into the following folder:

  • In packages:
    • For 32-bit Windows: C:\Users\Public\Documents\Embarcadero\Studio\17.0\Bpl
    • For other platforms in Object Pascal and 64-bit Windows in C++: C:\Users\Public\Documents\Embarcadero\Studio\17.0\Bpl\<platform>
    • For other platforms in C++: C:\Users\Public\Documents\Embarcadero\Studio\17.0\Bpl\<platform>\<build configuration>
  • In other projects: C:\Users\<user>\Documents\Embarcadero\Studio\Projects\<project>\<platform>\<build configuration>

To change the output directory:

Topics

See Also