<div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 4, 2021 at 5:23 PM Florian Klämpfl via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am 04.12.2021 um 14:04 schrieb Christo Crause via fpc-devel:<br>
> When compiling a simple test for esp32 (xtensa-freertos), the incorrect values for DW_AT_low_PC and DW_AT_high_PC are <br>
> generated. From my inspection of the generated assembler I cannot see anything wrong, but the values supplied by the <br>
> linker are wrong. Any ideas on how to fix this?<br>
> <br>
> This can be seen below, where there is no overlap between the unit's low/high PC and main's low/high PC:<br>
> <br>
> <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)<br>
> <c> DW_AT_name : test.pp<br>
> <14> DW_AT_producer : Free Pascal 3.3.1 2021/11/27<br>
> <31> DW_AT_comp_dir : /home/christo/fpc/xtensa/examples/test/<br>
> <59> DW_AT_language : 9 (ANSI Pascal)<br>
> <5a> DW_AT_identifier_case: 3 (case_insensitive)<br>
> <5b> DW_AT_stmt_list : 0x0<br>
> <5f> DW_AT_low_pc : 0x400e49e4<br>
> <63> DW_AT_high_pc : 0x400e49e4<br>
> <1><67>: Abbrev Number: 2 (DW_TAG_subprogram)<br>
> <68> DW_AT_name : $main<br>
> <6e> DW_AT_prototyped : 1<br>
> <6f> DW_AT_external : 1<br>
> <70> DW_AT_low_pc : 0x400d0a70<br>
> <74> DW_AT_high_pc : 0x400d0ab3<br>
> <br>
> From the compiler generated assembly it appears that the labels for these values are correctly placed<br>
> (DEBUGSTART_$P$TEST placed at start of code):<br>
> <br>
> .globl DEBUGSTART_$P$TEST<br>
> DEBUGSTART_$P$TEST:<br>
> # End asmlist al_begin<br>
> # Begin asmlist al_procedures<br>
> <br>
> .section .text.n_main,"ax"<br>
> .balign 4<br>
> .globl main<br>
> main:<br>
> .globl PASCALMAIN<br>
> PASCALMAIN:<br>
> .Lc2:<br>
> # Start of abi_windowed entry localsize=0<br>
> <br>
> Below the label is used in the debug info section:<br>
> <br>
> .section .debug_info<br>
> .Ldebug_info0:<br>
> .long .Ledebug_info0-.Lf2<br>
> .Lf2:<br>
> .short 3<br>
> .long .Ldebug_abbrev0<br>
> .byte 4<br>
> .uleb128 1<br>
> .ascii "test.pp\000"<br>
> .ascii "Free Pascal 3.3.1 2021/11/27\000"<br>
> .ascii "/home/christo/fpc/xtensa/examples/test/\000"<br>
> .byte 9<br>
> .byte 3<br>
> .long .Ldebug_line0<br>
> .long DEBUGSTART_$P$TEST<br>
> .long DEBUGEND_$P$TEST<br>
<br>
How does the debug info section look like for a gcc generated program?<br></blockquote><div><br></div><div>The debug info for the main file in the project (other file information looks similar):</div><div><br></div><div> Compilation Unit @ offset 0xf7476:<br> Length: 0x6347 (32-bit)<br> Version: 4<br> Abbrev Offset: 0xe85d<br> Pointer Size: 4<br> <0><f7481>: Abbrev Number: 1 (DW_TAG_compile_unit)<br> <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<br> <f7486> DW_AT_language : 12 (ANSI C99)<br> <f7487> DW_AT_name : (indirect string, offset: 0x14b84): ../main/sd_card_example_main.c<br> <f748b> DW_AT_comp_dir : (indirect string, offset: 0x689): /home/christo/xtensa/examples/sd_card/build<br> <f748f> DW_AT_ranges : 0x3148<br> <f7493> DW_AT_low_pc : 0x0<br> <f7497> DW_AT_stmt_list : 0x59c73<br> <1><f749b>: Abbrev Number: 2 (DW_TAG_base_type) </div></div></div>