1

I have implemented a back trace for my android app compiled in XE6 using the Posix.Backtrace from https://bitbucket.org/shadow_cs/delphi-arm-backtrace. As it is now I get the backtrace but not the line numbers.

I am looking to create the map file for my android .so so that I can feed the addresses at runtime to addr2line so that my bug report will contain the line numbers.

I looked to the IDE to create a map file as I would for a Win32 Delphi app by selecting

Project > Options > Delphi Compiler > Linking.

There is no option for map file if Android Platform is selected. Selecting All Configurations Android seems explicitly excluded: Map File ARM, iOS Device Platform only; Map file, 32-bitWindows, OSx, iOS simulator only. I tried it anyway with optimization off, and debug on, and got no .map file.

Is there a way to create a .map file for an Android app in Delphi?

Thank you!

Charaf Eddine Mechalikh
  • 1,248
  • 2
  • 10
  • 20
  • You are right, it's not even there in XE7 – Rohit Gupta May 01 '15 at 00:07
  • In both XE2 and 10.2 (the only versions I currently have), the option to generate a map file is in the Project Options > Linking page, about half-way down. You can set 4 different levels of detail in the generated file. – SteveS Apr 13 '21 at 11:14

1 Answers1

1

If you run up a RAD Studio Command Prompt and invoke dccaarm.exe you will see that despite the IDE not surfacing it, the compiler supports the -G and -GD command-line switches, both of which emit a map file.

Invoke the project options dialog (Ctrl+Shift+F11) and in the options tree choose Delphi Compiler, Compiling. Now select Other options, Additional options to pass to the compiler and enter -G

Recompile your project and a map file will be produced, e.g. project_folder\Android\Debug\libProject1.so.map

Note, the IDE linker option is still absent in Delphi 10.1 Berlin, which I'm looking at - the question relates to Delphi XE7 and so some of the specifics of the steps outlined above may need minor tweaking.

blong
  • 2,145
  • 13
  • 23
  • Thank you! We are now on Delphi 10 Seattle. Your suggestion worked perfectly. I now have a map file for my android so. – user3747202 Sep 22 '16 at 23:37
  • I understand it is a bug - an oversight in Delphi XE5 that no one has noticed across all these versions.... until now. I will endeavour to report it at some point. – blong Sep 22 '16 at 23:41