[fpc-devel] probably incorrect debug-line-info generated by fpc 2.6.2 and trunk

Martin lazarus at mfriebe.de
Sun Nov 10 22:24:27 CET 2013


Is the below a BUG (I assume it is) Shall I put it in mantis?

Below is
- a small function
- an extract of what fpc generates with -la
- from the -la output, the debug info

This was generated without optimization

the statement for "i:=1" ends after " movl    $1,%eax ".
it ends before the value is written to memory (the "movl %eax,-12(%ebp)" 
is part of the next command)

This means the debugger can not show the correct value.

See also http://forum.lazarus.freepascal.org/index.php/topic,22598.0.html


procedure TForm1.Button1Click(Sender: TObject);
var
   i: Integer;
begin
   i := 1;
   // After this line Delphi Evaluate/Modify shows '1', Lazarus still a 
random (uninitialized?) integer
   i := i + 1;
   // Ater this line Delphi & Lazarus both show '2'
   ShowMessageFmt('%d',[i]);
end;

-------------------------------------------
.Ll3:
# [36] i := 1;
     movl    $1,%eax
.Ll4:
# [38] i := i + 1;
     movl    %eax,-12(%ebp)
     addl    $1,%eax
     jno    .Lj11
     call    FPC_OVERFLOW
.Lj11:
     movl    %eax,-12(%ebp)
.Ll5:

---------------------------------------
# file_names
     .ascii    "unit1.pas\000"
     .uleb128    0
     .uleb128    0
     .uleb128    0
     .byte    0
.Lehdebug_line0:
# === header end ===
# function: UNIT1$_$TFORM1_$__$$_BUTTON1CLICK$TOBJECT
# [35:1]
     .byte    0
     .uleb128    5
     .byte    2
     .long    .Ll1
     .byte    5
     .uleb128    1
     .byte    46
# [35:1]
     .byte    2
     .uleb128    .Ll2-.Ll1
     .byte    1
# [36:3]
     .byte    2
     .uleb128    .Ll3-.Ll2
     .byte    5
     .uleb128    3
     .byte    13
# [38:10]
     .byte    2
     .uleb128    .Ll4-.Ll3
     .byte    5
     .uleb128    10
     .byte    14
# [40:26]
     .byte    2
     .uleb128    .Ll5-.Ll4
     .byte    5
     .uleb128    26
     .byte    14



More information about the fpc-devel mailing list