PDA

View Full Version : Program trace...


devoro
04-Feb-2010, 02:51 PM
Hi,

Is there a way I could use Eurekalog to trace my program. I'm looking for a tool that could tell me each line number where the program went through.

Thanks.

Alex
11-Feb-2010, 11:37 AM
Hi,

Sorry for the late reply.

EurekaLog does not have such feature.

Sean Webb
26-Jul-2010, 10:27 AM
On 11/02/10 14:37, Alex wrote:
Hi,

Sorry for the late reply.

EurekaLog does not have such feature.
It does :), borrowing some code from one of your other posts..........
the function below gives me an array of strings loaded with the call
stack.....

sean


// astring -> type array of string;

function GetCallStack(cExcludelist:string=''):astring;
var
CallStackList: TStringList;
CallStack: TEurekaStackList;
i,n,nExclude:integer;
cText:ansistring;
aExclude:astring;

function Exclude:boolean;
var i:integer;
begin for i:= 0 to high(aExclude) do if pos(aExclude[i],upper(cText))<>0 then begin result:=true;
exit;
end;
result:=false;
end;

begin
setlength(aExclude,2);
aExclude[0]:='USER32.DLL';
aExclude[1]:='EUREKA.PAS'; // pas where this routine resides in my code if not empty([cExcludeList]) then begin nExclude:=chrcount(',',cExcludeList)+1; // list ',' separated routines to exclude setlength(aExclude,2+nExclude);
for i:=1 to nExclude do aExclude[1+1]:=upper(mytoken(cExcludeList,',',1));
end;
setlength(result,0);
CallStackList := TStringList.Create;
try
CallStack := GetCurrentCallStack;
try CallStackToStrings(CallStack, CallStackList);
setlength(result,callstacklist.count);
n:=-1;
for i:=0 to callstackList.Count - 1 do begin cText:=callstacklist.strings[i];
if not Exclude then begin inc(n);
result[n]:=callstacklist.strings[i];
end;
end;
setlength(result,n+1);
finally CallStack.Free;
end;
finally
CallStackList.Free;
end;
end;

Alex
26-Jul-2010, 01:39 PM
Hi,

Sorry, I misunderstood your question. You're asking for call stack, but I thought that you're asking for tracing feature (i.e. "proc A, line 1", "proc A, line 2", "proc A, line 3", "proc A, line 14", "proc A, line 15").

I'm glad that you could find a suitable solution!