Link to home
Start Free TrialLog in
Avatar of JJSANES
JJSANES

asked on

Any suggestions of a Trace utility for Delphi?

Those of you who used Basic in those old MS-DOS times will surely remember that TRACE ON/OFF command (or TRON/TROFF), inherent to interpreted languages. I wonder if there is such an utility for Delphi. I am currently using Delphi 7 on a W10 Pro.
Avatar of Manuel Lopez-Michelone
Manuel Lopez-Michelone
Flag of Mexico image

Maybe I am not understanding you but in fact you have, by far, a much better debugger in delphi 7 than in Basic with the Trace on off command. Check the documentation or help file
I'm not familiar with the trace on/off functionality, can you elaborate on what you are trying to achieve?
Avatar of JJSANES
JJSANES

ASKER

@lopem and @MerijnB, thanks for your time and interest.

Function keys F4, F8 and F9 are good help for standard applications. But when an app includes a thread, it becomes impossible to follow the process. Or at least I couldn't.

I thought if I could "read" the trail left by the app I could figure where the problem / bug is. In interpreted languages like Basic, the user would read an output like:
[line 180]
[line 181]
[line 182]
    [line 263]
    [line 264]
    [line 265]
    [line 266]
    [line 267]
[line 183]
...
With such utility or component, I would expect something like:
[procedure prReadData]
[line 630]
[line 631]
[line 632]
   [function fnOutputSelect]
   [line 1709]
   [line 1710]
   [line 1718]
   [line 1722]
[line 634]
[line 635]

As I said, the use of threads makes useless the built-in debugger, and I actually know the app is not running as it should for bad programming reasons, because I have copied, pasted and adapted lines of code from several people but I surely forgot something or I simply did something wrong. And I think such a tool would save a lot of time trying to find the error.
Unfortunately, I dont use often threads, so I cant help you really. (By the way, I am form México and I read your messge in spanish without problems, but here most people expect to write in english). If I find a good idea to solve your difficulties, I will be here soon.

regards
Manuel López (lopem)
the best debugger is the human brain in threaded programs
unfortunately it hasn't got an usb interface yet ...

the second best system is logging
per thread write into a logfile ... with timestamp including milliseconds
formatdatetime(now, 'yyyymmdd hh:nn:ss.zzz')

a very long time ago (in delphi 3 or 4) i came across prodelphi ... a profiler
http://www.prodelphi.de/

threads ... and pitfalls
did you lock your common resources ?

is the hanging (deadlocks) or is it crashing ?

if you want an output as you described in a log file
technically you would use a critical section (or mrew or event or ...) and lock it before writing to the logfile and then unlock
SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think Geert Gruwez's ideas are on the right track.

regards
Lopem
i often see that mistake ...

the Enter should go before the second try, not after

  try
    EnterCriticalSection(LockAddToLog);
    try

Open in new window


if you'd do the same for creating objects, you'd get a compiler warning about an object might not be initialized
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial