[Lazarus] Maybe using CodeTools to modify source code

Martin lazarus at mfriebe.de
Wed May 8 13:59:21 CEST 2013


On 08/05/2013 12:38, Graeme Geldenhuys wrote:
> Hi,
>
> I want to ease my debugging by implementing a stand-alone tool that
> inserts trace calls (modified dbugintf calls) via a checkbox style
> treeview interface of my selected unit. Checking a method inserts a
> begin/end trace call pair, unchecking a method removes the trace calls.
>
> This way I don't have to leave {$IFDEF DEBUG} code blocks in some units
> to debug a call stack etc. Checking and unchecking methods must be quick
> and fully reversible - using the same tool.
>

Just an alternative proposal:

Do something like lazlogger does.

Have a 2nd unit "TraceToolsDummy", that defines
    procedure SendMethodEnter(Atext: string); inline;
   begin end;

empty.

fpc should not generate any code for that (unless you use open array as 
param)

Then you can toggle by changing the unit.

You can also tell the Lavarus IDE (1.1) to display " SendMethodEnter" in 
a diff color (just the name, not the whole call)




More information about the Lazarus mailing list