Sign in Join

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

Mailing lists / lazarus / 2016-07

Conditional Breakpoints - again

13 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Graeme Geldenhuys

Hi,

Just over a year ago I asked about Conditional Breakpoints and using an expression. The result was it was broken, unnoticed by other developers and eventually a [work-around] fix applied.

Now I'm revisiting Conditional Breakpoints, but this time referring to the HintCount property. Is that implemented at all? See attached screenshot and items (1) and (2). From my testing it seems it isn't breakpoint is always triggered on every iteration.

My work-around is again the same as it was a year ago - item (3) in the screenshot. Defined a temporary variable, set or change it's value, then have a IF statement and assign a breakpoint inside the IF statement.

[Apologies Martin Fr for this rant - it is no reflection on you or your fantastic contributions in this area]

I don't get it - how do anybody else debug using Lazarus? It seems all that actually works is setting standard breakpoints and stepping through code one line at a time. Everything else is buggy or not I think everything related to debugging that doesn't work should be disabled permanently until it is actually implemented or functioning. eg: The Conditional Breakpoints dialog. I think pretty much everything in there doesn't work! So having those controls enabled just gives a false sense of functionality.

[ end of rant ]

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot.png Type: image/png Size: 56118 bytes Desc: not available URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160707/7fa0d0dc/attachment-0001.png>

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys
Graeme Geldenhuys wrote
See attached screenshot and items (1) and (2). From my testing it seems it isn't breakpoint is always triggered on every iteration.

Oops, attached the wrong screenshot. Here is the correct (annotated) one.

Regards,
Graeme

-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot01.png
Type: image/png
Size: 21296 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160707/d7963b90/attachment-0001.png>

Reply by email

Martok
to Graeme Geldenhuys: Just over a year ago I asked about Conditional Breakpoints and using an expression. The…

Hi,

Just over a year ago I asked about Conditional Breakpoints and using an expression. The result was it was broken, unnoticed by other developers and eventually a [work-around] fix applied.

Apologies for sidetracking, but could you give a pointer to the old discussion/fix? I've recently spent far too long on getting a breakpoint set up (activation by groups appears to be not quite right as well), but ended up doing...

My work-around is again the same as it was a year ago - item (3) in the screenshot. Defined a temporary variable, set or change it's value, then have a IF statement and assign a breakpoint inside the IF statement.

... exactly that.

Regards,

Martok

Reply by email

Martin Frb
to Graeme Geldenhuys: Just over a year ago I asked about Conditional Breakpoints and using an expression. The…
Graeme Geldenhuys wrote 5 lines
Hi, Just over a year ago I asked about Conditional Breakpoints and using an expression. The result was it was broken, unnoticed by other developers and eventually a [work-around] fix applied.

iirc it works for certain datatypes only. And while it was improved, that is still true.

Now I'm revisiting Conditional Breakpoints, but this time referring to the HintCount property. Is that implemented at all? See attached screenshot and items (1) and (2). From my testing it seems it isn't breakpoint is always triggered on every iteration.

It works for me.
But it seems that the hit counter starts at 0 when the debug process is started, and then is not reset. (well delete, the breakpoint should reset it)

So If you have hit the breakpoint before setting the hitcount, those hits do count.
And once you reached the count, it will stop each time (so it is a >= condition)

This obviously could be improved by showing the current count, and have a reset button. Or change the value into a count down, (but then it is show initial and current value, and reset to initial)

Reply by email

Graeme Geldenhuys
to Martin Frb
Martin Frb wrote
But it seems that the hit counter starts at 0 when the debug process is started, and then is not reset. (well delete, the breakpoint should reset it)

Ah, it must have been the reset issue I had. I can now confirm both of those behaviours. Indeed, the counter starts at 0, and does not reset.

I've updated the wiki page to reflect these comments.

http://wiki.lazarus.freepascal.org/IDE_Window:Breakpoints#Breakpoint_properties

Thanks for the information, and apologies for the rant. I'm having a bad debugging day today. :-/

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Martok
to Martin Frb: iirc it works for certain datatypes only. And while it was improved, that is still true.…

Hi,

@Graeme: thanks.

My original issues appear to be working now, at least in a test case - although I'm using a custom patched (unrelated bug that upstream refused to fix) gdb 7.11 now, so maybe they changed something in the versions between as well.

But it seems that the hit counter starts at 0 when the debug process is started, and then is not reset. (well delete, the breakpoint should reset it)

Just checked with Delphi: they reset the counter every time the breakpoint is hit, so it effectively means "every Nth hit". Hits before the one that gets handled are logged as "Iteration 1 of N" etc.
Changing the value in Breakpoint Properties window also resets the counter.

Makes more sense than a manual button I'd say?

Regards,

Martok

Reply by email

Martin Frb
to Martok: @Graeme: thanks. My original issues appear to be working now, at least in a test case -…
Martok wrote 9 lines
Just checked with Delphi: they reset the counter every time the breakpoint is hit, so it effectively means "every Nth hit". Hits before the one that gets handled are logged as "Iteration 1 of N" etc. Changing the value in Breakpoint Properties window also resets the counter. Makes more sense than a manual button I'd say?

Please create a feature request on Mantis

Reply by email

Martin Schreiber
to Martin Frb: iirc it works for certain datatypes only. And while it was improved, that is still true.…
Martin Frb wrote
This obviously could be improved by showing the current count, and have a reset button. Or change the value into a count down, (but then it is show initial and current value, and reset to initial)

MSEide shows the breakpoint count and has an editfield 'Ignore', see attachment.
The program stops the first time after 'Ignore' times. Entering a value in 'Ignore' again skips 'Ignore' breakpoint events.

'Ignore' is especially useful if there is a crash in a function after many calls of the function. Set a breakpoint in code before the crash, set 'Ignore' to a big value so the program does not stop before the crash, run the program. When the crash happens check the 'Count' field, set 'Ignore' to 'Count'-1, run the program again, now the program stops at the breakpoint in the run which will crash and it is possible to check how the crash happens.

Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: breakpoints.png
Type: image/png
Size: 15083 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160707/5cc19798/attachment-0001.png>

Reply by email

Graeme Geldenhuys
to Martin Schreiber
Martin Schreiber wrote
'Ignore' is especially useful if there is a crash in a function after many calls of the function.

That is exactly why I wanted to use the HitCount property in Lazarus. Lazarus HitCount is equivalent to MSEide's 'Ignore'.

What is missing from Lazarus IDE, is to show a read-only Count. That would be useful. I'll add a feature request to mantis.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email