Hello,
Jonas Maebe wrote 15 lines
This is quote from 2009, and I was wondering if there was no changes since then?
(I know that there were a number of improvements in dwarf debug info, but not sure what they actually were)
I'm looking at stabs (fpc 3.0.0) (even though I know I should look at dwarf) As of this time, the only issue I'm seeing is missing proper information about function result.
The code:
{$mode delphi}
function Calc(a,b: integer): Integer;
var
c : integer;
begin
c:=a;
c:=c+b;
Result:=a+c;
end;STABS:
N_FUN: other = 0; desc = 3; value = 4199456; 00401420; CALC:F1 N_RSYM: other = 0; desc = 3; value = 0; 00000000; A:R1 << the first parameter passed on eax
N_PSYM: other = 0; desc = 3; value = -4; FFFFFFFC; A:1 N_RSYM: other = 0; desc = 3; value = 2; 00000002; B:R1 << the second parameter passed on edx
N_PSYM: other = 0; desc = 3; value = -8; FFFFFFF8; B:1 N_PSYM: other = 0; desc = 3; value = -12; FFFFFFF4; result:1 N_PSYM: other = 0; desc = 5; value = -16; FFFFFFF0; C:1 N_PSYM: other = 0; desc = 0; value = -12; FFFFFFF4; CALC:X1 <<< shows the result to be on stack, while it supposed to be in eax? N_PSYM: other = 0; desc = 0; value = -12; FFFFFFF4; RESULT:X1 N_SOL: other = 0; desc = 0; value = 4199456; 00401420; test.pas N_SLINE: other = 0; desc = 6; value = 0; 00000000; N_SLINE: other = 0; desc = 7; value = 13; 0000000D; N_SLINE: other = 0; desc = 8; value = 19; 00000013; N_SLINE: other = 0; desc = 9; value = 25; 00000019; N_SLINE: other = 0; desc = 10; value = 31; 0000001F; N_LBRAC: other = 0; desc = 0; value = 0; 00000000; N_RBRAC: other = 0; desc = 0; value = 33; 00000021;
Ultimately a debugger could make "a guess" about the calling convention, based on the parameters passed.
thanks,
Dmitry
