[fpc-devel] RTL StackTrace patch

Peter Vreman peter at freepascal.org
Thu Jan 17 10:14:05 CET 2008

> Fabio Dell'Aria schreef:
>> Hi to all,
>> I'm writing a patch to can use an external .dbg file during the
>> debugging process.
>> All works fine but when an unhandled exception is raised the RTL show
>> stacktrace without debug info (no sources line).
>> How I can instruct the RTL to search the debug symbols in a
>> project.dbg file (if not found in the executable)?
> Write support for it in the lineinfo and lnfodwrf units. You can find those units in
>   fpc\rtl\inc.

See http://sourceware.org/gdb/download/onlinedocs/gdb_16.html#SEC154 how to find the external .dbg
file from the .gnu_debuglink section.

Note that the build-id support still needs to be added to fpc and thus the crc checksum
verification needs to be implemented to verify that the correct .dbg is found. In the final
situation both options shall be implemented.

If you are going to implement something first refactor the part that handles the opening and
reading of the executable file and can find the position of sections. Most of these routines are
already available in lineinfo.pp for multiple platforms. Both lineinfo and lnfodwrf shall use the
new unit.  Keep also in mind that only routines from the system unit can be used, so no streams
from classes unit.


More information about the fpc-devel mailing list