GetLineInfo works only if first сall was made with valid address
Original Reporter info from Mantis: zamtmn @zamtmn
-
Reporter name: Andrey Zubarev
Original Reporter info from Mantis: zamtmn @zamtmn
- Reporter name: Andrey Zubarev
Description:
Sample program:
program Project1;
uses sysutils;
procedure dotest(addr:pointer);
var
func,source:shortstring;
line:longint;
begin
lineinfo.GetLineInfo(ptruint(addr),func,source,line);
if (func<>'')or(source<>'')then writeln(format('func:%s source:%s line:%d',[func,source,line]))
else writeln('wrong addres')
end;
begin
dotest(pointer(100));//comment this line and everything is working well
dotest(@dotest);
dotest(pointer(100));
dotest(@dotest);
end.
if first line not commented, output:
D:\temp>project1.exe
wrong addres
wrong addres
wrong addres
wrong addres
if first line commented, output:
D:\temp>project1.exe
func:DOTEST source:d:/temp/project1.lpr line:0
wrong addres
func:DOTEST source:d:/temp/project1.lpr line:0
Mantis conversion info:
- Mantis ID: 28288
- Fixed in version: 3.1.1
- Fixed in revision: 32918 (#5e9c34ff)
- Monitored by: » dezlov (Denis Kozlov)
- Target version: 3.0.2