Max
Max

Reputation: 19994

Delphi trace tool

I was wondering if there's a tool or a component for Delphi that can trace method execution line by line and create a log file. With this kind of tool it is easy to compare how method performs on two sets of input data by comparing two log files.

EDIT:

Let's say there is a function


10: function MyFunction(aInput: Integer): Integer;
11: begin
12:   if aInput > 10 then
13:     Result := 10
14:   else
15:     Result := 0;
16: end;

I'm looking for a tool that would give the log which whould be similar to the following:

When aInput parameter is 1:


Line 10: 'function MyFunction(aInput: Integer): Integer;'
Line 11: 'begin'
Line 12: 'if aInput > 10 then'
Line 15: 'Result := 0;'
Line 16: 'end;'

and when aInput parameter is 11:


Line 10: 'function MyFunction(aInput: Integer): Integer;'
Line 11: 'begin'
Line 12: 'if aInput > 10 then'
Line 13: 'Result := 10;'
Line 16: 'end;'

The only information that should be required by the tool is the function name.

It's like stepping through the method under debugger, but in an automatic manner with logging every line of code.

Upvotes: 4

Views: 5319

Answers (5)

André
André

Reputation: 9112

Maybe you can do it (partial) with "Delphi code coverage"? (traces which lines are executed and which not) http://code.google.com/p/delphi-code-coverage/

Upvotes: 0

ibandyop
ibandyop

Reputation: 171

Perhaps a 'delphi profiler' will be useful. There are many suggested on stackoverflow.

Depending on the the profiler you will know what percent of aInput goes through each part of the if-then-else in your example and how long it takes to go through each section. Many profilers have logging., smartInspect for example., but I have not tried it.

Upvotes: 0

Max
Max

Reputation: 19994

After some time searching I can conclude that there's no such tool for Delphi.

Upvotes: 0

Mick
Mick

Reputation: 13475

If you are looking for a free solution, I've used TraceTool before. The viewer is written in Delphi, and you can also use TraceTool with C#, C++, ActiveX, and Java. With Delphi, you simply include a couple of helper units and add the appropriate logging as you go. It supports logging text, as well as objects and their data.

You can download it from SourceForge here.

alt text

Or, if you want something simpler and lighter weight for just primarily string output, you can always use OutputDebugString and view the output with TraceTool's viewer or with DbgView from SysInternals.

Upvotes: 2

Mohammed Nasman
Mohammed Nasman

Reputation: 11040

SmartInspect and CodeSite

You can read this question for more review about those and others.

Upvotes: 2

Related Questions