Some tips for Delphi debugger - part 3

by Radek Červinka 11. July 2011 23:44

Next part of Delphi debugger tips. Today about modules, data breakpoints, thread breakpoint and so on.

No 1 - Delphi 2007 tip: Last time I wrote about dragging current stepped line during debugging, but older versions have similar possibility to set which line to be stepped using the command Set Next Statement.

Set Next Statement

Simple move cursor at line, which we want to be executed and select menu item. But Drag&Drop is nice.

No 2 - I think that since Delphi 2006 is the possibility of browse through the component tree - see screenshot.

Hint during debugging

But if we have more complex structure and want to look on source code - there is simple solution. When CTRL key is pressed, tree will be transparent and we can digg look at source.

Hint during debugging

No 3 - debugging more threads? Sometimes can be appropriate that breakpoint is only for specific thread. In breakpoint dialog this can be specified. And use thread names (from previous article) and result is perfect.

Thread breakpoint

No 4 - sometimes can be useful to stop program when some module is loaded (e.g. DLL) - typical can be set breakpoint to function in DLL. This can be simple achieved in module view (BTW this show used modules too) and set breakpoint in this dialog is very simple.

Module breakpoint

In same dialog, there is a list of available imported functions - use double click for breakpoint. For example on CreateFile or MessageBox - but this smell like cracking. Because when program stop here, we can use call stack and look at caller.

In this dialog programmer can associate RSM (remote symbols) for module and this can improve readability of code.

Module breakpoint

No 5 - Data breakpoint - sometimes can be interesting know, who access address - Data breakpoint is good answer.

Data breakpoint

    1var
    2  s: string;
    3
    4begin
    5  writeln('line1');
    6  s := 'xxx';
    7  writeln('line2');
    8  s := '444';
    9  writeln('line3');
   10  writeln(s);
   11end.

After program startup we set data breakpoint by picture and when resume, program stop and call stack show assigment s := '444'.

Data breakpoint

Tags: ,

Practices

Comments

10/26/2010 12:52:55 PM #

Radim

Ako v OpenPictureDialog komponente si sam vykreslim moj uzivatelsky nahlad na obsah suboru /teda mam vlastny typ/. Malo by to fungovat tak ze ako prechadzam po suboroch/vyber mysou, klavesami/ tak sa mi nahlad aktualizuje. Velka vdaka.

Radim |

10/26/2010 3:36:04 PM #

Radim

Nieco som nasiel ale starsieho data - http://bak-o-soft.dk/Delphi/PBPreview.aspx
Demo priklad funguje fajn. Je nieco pre C++Builder 2010/XE?

Radim |

10/26/2010 4:13:20 PM #

radekc

a) tohle neni forum
b) dival ses do JVCL?
c) kdyz to cos nasel funguje tak vetsinou by nemel byt vetsi problem to prekompilovat pod novejsi Delphi
d) pokud neni mail adresa platna (jako ze se mi mail vraci) tak je to problem

radekc |

10/26/2010 5:11:45 PM #

Radim

Email by mal byt uz poriadku. Pouzivam C++Builder 6 Pro + testujem novsie verzie, ale ani v C++Builder 6 komponenta nefunguje, ide bez problemov nainstalovat, vlozit na formular aj zavolat po kliknuti tlacitka no dialog sa neotvori.

Pozriem JVCL. Vdaka

Radim |

10/27/2010 12:07:18 PM #

Radim

Zdravim, presiel som cele JVCL a nic. Nejaky typ ako registrovat vlastny typ suboru v OpenPictureDialog-u ? Viem toto nieje forum, ale ci v C++Builder 2010/XE nieje nejaky *novsi* a jednoduchsi sposob. Vdaka.

Radim |

10/28/2010 1:23:01 PM #

Radim

Vdaka za update pre Delphi XE.

Radim |

Comments are closed