[fpc-devel] function evaluation by gdb

Paul Ishenin webpirat at mail.ru
Fri Mar 27 19:44:19 CET 2009


Hello, FPC developers' list

I made a simple gui lazarus application with a form and a button on it. 
I also wrote a function in the same unit:

function GetValue(c: Char): Integer;
begin
  Result := Ord(c);
end;

In the Button1 OnClick handler I have next code:

var
  I: integer;
begin
  I := Ord('a') + GetValue('a');
  ShowMessage(IntToStr(I));
end;

I wrote it to force compiler to generate code for GetValue and for Ord 
functions.

I break after that line (if I break before gdb will return 0) and now I 
want to evaluate GetValue('a'):

[gdb log]
<-data-evaluate-expression GetValue('a')>
^done,value="194"
(gdb)
<ptype GetValue('a')>
&"ptype GetValue('a')\n"
~"type = LONGINT\n"
^done
[/gdb log]

and evaluate Ord('a'):

[gdb log]
<-data-evaluate-expression Ord('a')>
&"No symbol \"Ord\" in current context.\n"
^error,msg="No symbol \"Ord\" in current context."
[/gdb log]

and evaluate IntToStr(I):

[gdb log]
<-data-evaluate-expression IntToStr(I)>
&"too few arguments in function call\n"
^error,msg="too few arguments in function call"
[/gdb log]

Are that all gdb bugs or wrong debug info?

Best regards,
Paul Ishenin.



More information about the fpc-devel mailing list