[Not a bug / false report] DWARF-4 - Incorrect CFI header
Looking at DWARF-4 `6.4.1 Structure of Call Frame Information `
The header has 2 new fields:
> 5. address_size (ubyte)
> The size of a target address in this CIE and any FDEs that use it, in bytes. If a compilation unit exists for this frame, its address size must match the address size here.
> 6. segment_size (ubyte)
> The size of a segment selector in this CIE and any FDEs that use it, in bytes.
The code in compiler\cfidwarf.pas does not seem to have provisions for that?
2 additional bytes should be written, if the version is 4 or above.
```
procedure TDwarfAsmCFILowLevel.generate_code(list:TAsmList);
var
hp : tdwarfitem;
cielabel,
lenstartlabel,
lenendlabel : tasmlabel;
tc : tai_const;
begin
new_section(list,sec_debug_frame,'',0);
{ CIE
DWORD length
DWORD CIE_Id = 0xffffffff
BYTE version = 1
STRING augmentation = "" = BYTE 0
ULEB128 code alignment factor = 1
ULEB128 data alignment factor = -1
BYTE return address register
<...> start sequence
}
current_asmdata.getlabel(cielabel,alt_dbgframe);
list.concat(tai_label.create(cielabel));
current_asmdata.getlabel(lenstartlabel,alt_dbgframe);
current_asmdata.getlabel(lenendlabel,alt_dbgframe);
list.concat(tai_const.create_rel_sym(aitconst_32bit,lenstartlabel,lenendlabel));
list.concat(tai_label.create(lenstartlabel));
list.concat(tai_const.create_32bit(longint($ffffffff)));
list.concat(tai_const.create_8bit(1));
list.concat(tai_const.create_8bit(0)); { empty string }
list.concat(tai_const.create_uleb128bit(code_alignment_factor));
list.concat(tai_const.create_sleb128bit(data_alignment_factor));
list.concat(tai_const.create_8bit(dwarf_reg(NR_RETURN_ADDRESS_REG)));
```
The effects can be tested on Windows, by using a `try finally` => as the finally is a `hidden` subroutine.
Using GDB 17 (or FpDebug) on the following code (Windows / 64 bit)
```
program tst;
procedure foo;
begin
try
write;
finally
write; // << BREAKPOINT ON THIS LINE
write;
end;
end;
begin
foo;
end.
```
Test results for 3.2.3
with DWARF-3 the stack (the method `foo` is hidden by CFI, since the `$fin` actually is `foo`
```
#0 $fin$00000001(0x13ffe40) at project1.lpr:8
#1 $main at project1.lpr:14
```
with DWARF-4 the stack (CFI is not readable to the debugger)
```
#0 $fin$00000001(0x13ffe40) at project1.lpr:8
#1 foo at project1.lpr:5
#2 $main at project1.lpr:14
```
issue