Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-10

DebugLn vs writeln

7 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Frank Church

Is the purpose of DebugLn over write line its ability to write automatically to a debug log text file?

Are there some build settings that will automatically disable DebugLn from executing at runtime, or does it always have to be switch on and off with ifdefs?

Does it operate with the debugger in some way?

Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111004/ea275d50/attachment.html>

Reply by email

dmitry boyarintsev
to Vincent Snijders
Vincent Snijders wrote
A writeln would crash a windows GUI application, that is the reason

Unless you link them without "win32 gui application" flag.

WriteLn has irreplaceable functionality of accepting any number of parameters, and most of the types, not supported by any Format() based functions (i.e. sets)

thanks,
Dmitry

Reply by email

Martin
to Frank Church: Is the purpose of DebugLn over write line its ability to write automatically to a debug…
Frank Church wrote 8 lines
Is the purpose of DebugLn over write line its ability to write automatically to a debug log text file? Are there some build settings that will automatically disable DebugLn from executing at runtime, or does it always have to be switch on and off with ifdefs? Does it operate with the debugger in some way?

The debugger has no handling of debugln.

If you use debugln, to see values that the debugger can't display, you just have to keep looking at the console. Though for most cases there a ways to get the debugger accessing the variables/structures you need.

If you debug focus sensitive apps, or apps that must not be stopped for other reasons, then you can use 0.9.31, which allows a none-breaking snapshot to write values to the event log, or to record snapshots of all your watches.

Reply by email

Marc Weustink
to Martin
Martin wrote 11 lines
On 04/10/2011 03:53, Frank Church wrote: > Is the purpose of DebugLn over write line its ability to write > automatically to a debug log text file? > > Are there some build settings that will automatically disable DebugLn > from executing at runtime, or does it always have to be switch on and > off with ifdefs? > > Does it operate with the debugger in some way? The debugger has no handling of debugln.

Thinking of it.... we could add a internal break and capture the output and show it in some dialog

Marc

Reply by email

Martin
to Marc Weustink
Marc Weustink wrote 10 lines
Martin wrote: > On 04/10/2011 03:53, Frank Church wrote: >> Is the purpose of DebugLn over write line its ability to write >> >> Does it operate with the debugger in some way? > > The debugger has no handling of debugln. Thinking of it.... we could add a internal break and capture the output and show it in some dialog

If the LCL has debug info, the user can set a breakpoint. Afaik it is only one location (max 2) where the actual write to output/file takes place. And then log the taxt that is passed as param to the event log.

Reply by email

Bernd
to Vincent Snijders: 2011/10/4 Frank Church : See FAQ: http://wiki.lazarus.freepascal.org/Lazarus_Faq#How_can_I…

2011/10/4 Vincent Snijders :

A writeln would crash a windows GUI application, that is the reason why debugln was invented.

How about making a unit (and make it part of the official LCL) that would automatically redirect stdout (so one could simply use writeln everywhere) and redirect it to debugln and optionally to the debugserver (the one that comes with Lazarus) and to OutputDebugMessage() if it is compiled on windows? Then one would just have to put this unit into the uses section and from then on writeln() would always do the correct (most useful) thing on every platform.

Reply by email