[fpc-devel] Incorrect debug info for ESP32, linker error?
Christo Crause
christo.crause at gmail.com
Sat Dec 4 14:04:01 CET 2021
When compiling a simple test for esp32 (xtensa-freertos), the incorrect
values for DW_AT_low_PC and DW_AT_high_PC are generated. From my
inspection of the generated assembler I cannot see anything wrong, but the
values supplied by the linker are wrong. Any ideas on how to fix this?
This can be seen below, where there is no overlap between the unit's
low/high PC and main's low/high PC:
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
<c> DW_AT_name : test.pp
<14> DW_AT_producer : Free Pascal 3.3.1 2021/11/27
<31> DW_AT_comp_dir : /home/christo/fpc/xtensa/examples/test/
<59> DW_AT_language : 9 (ANSI Pascal)
<5a> DW_AT_identifier_case: 3 (case_insensitive)
<5b> DW_AT_stmt_list : 0x0
<5f> DW_AT_low_pc : 0x400e49e4
<63> DW_AT_high_pc : 0x400e49e4
<1><67>: Abbrev Number: 2 (DW_TAG_subprogram)
<68> DW_AT_name : $main
<6e> DW_AT_prototyped : 1
<6f> DW_AT_external : 1
<70> DW_AT_low_pc : 0x400d0a70
<74> DW_AT_high_pc : 0x400d0ab3
>From the compiler generated assembly it appears that the labels for these
values are correctly placed
(DEBUGSTART_$P$TEST placed at start of code):
.globl DEBUGSTART_$P$TEST
DEBUGSTART_$P$TEST:
# End asmlist al_begin
# Begin asmlist al_procedures
.section .text.n_main,"ax"
.balign 4
.globl main
main:
.globl PASCALMAIN
PASCALMAIN:
.Lc2:
# Start of abi_windowed entry localsize=0
Below the label is used in the debug info section:
.section .debug_info
.Ldebug_info0:
.long .Ledebug_info0-.Lf2
.Lf2:
.short 3
.long .Ldebug_abbrev0
.byte 4
.uleb128 1
.ascii "test.pp\000"
.ascii "Free Pascal 3.3.1 2021/11/27\000"
.ascii "/home/christo/fpc/xtensa/examples/test/\000"
.byte 9
.byte 3
.long .Ldebug_line0
.long DEBUGSTART_$P$TEST
.long DEBUGEND_$P$TEST
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20211204/b32bfc21/attachment.htm>
More information about the fpc-devel
mailing list