On Sat, Dec 4, 2021 at 5:23 PM Florian Klämpfl via fpc-devel < fpc-devel@lists.freepascal.org> wrote:
> Am 04.12.2021 um 14:04 schrieb Christo Crause via fpc-devel: > > 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 > > How does the debug info section look like for a gcc generated program? > The debug info for the main file in the project (other file information looks similar): Compilation Unit @ offset 0xf7476: Length: 0x6347 (32-bit) Version: 4 Abbrev Offset: 0xe85d Pointer Size: 4 <0><f7481>: Abbrev Number: 1 (DW_TAG_compile_unit) <f7482> DW_AT_producer : (indirect string, offset: 0xa4): GNU C99 8.4.0 -mlongcalls -ggdb -Og -std=gnu99 -ffunction-sections -fdata-sections -fstrict-volatile-bitfields <f7486> DW_AT_language : 12 (ANSI C99) <f7487> DW_AT_name : (indirect string, offset: 0x14b84): ../main/sd_card_example_main.c <f748b> DW_AT_comp_dir : (indirect string, offset: 0x689): /home/christo/xtensa/examples/sd_card/build <f748f> DW_AT_ranges : 0x3148 <f7493> DW_AT_low_pc : 0x0 <f7497> DW_AT_stmt_list : 0x59c73 <1><f749b>: Abbrev Number: 2 (DW_TAG_base_type)
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel