4

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.

5 Answers 5

2

SmartInspect and CodeSite

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

1
  • I'm familiar with those tools, but they only allow one to put trace statements manually. I need a tool which would produce trace log automatically, without adding any statements manually.
    – Max
    Dec 28, 2009 at 15:30
2

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.

2
  • very nice tool...thank you for telling us about it! i wish it had existed a couple of years ago!
    – X-Ray
    Dec 28, 2009 at 15:59
  • Thanks. It seems to be a nice tool, but it is similar to SmartInspect and CodeSite. I've posted some clarifications to what I'm looking for
    – Max
    Dec 28, 2009 at 16:49
0

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

0

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.

0

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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.