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