Recent

Author Topic: No break where expected  (Read 2436 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10553
  • Debugger - SynEdit - and more
    • wiki
Re: No break where expected
« Reply #15 on: November 29, 2024, 04:35:01 pm »
Btw, I haven't tried, but if you get the address from a watch, and you then add a watchpoint like

^longint($01234567)^

That might just do.

440bx

  • Hero Member
  • *****
  • Posts: 4738
Re: No break where expected
« Reply #16 on: November 29, 2024, 05:33:38 pm »
Btw, I haven't tried, but if you get the address from a watch, and you then add a watchpoint like

^longint($01234567)^

That might just do.
Just tried it and it works but...

You were right, the address of the variable very often changes from one run to the next even when everything is kept identical between runs.  I believe it may have something to do with ASLR because the delta is always a multiple of 64K.

What works is, as you mentioned previously, set a breakpoint where the target variable is in scope then create the watchpoint there.  On subsequent runs all that is necessary is to disable and re-enable the watchpoint at the breakpoint for it to be valid again.  It would be very useful if fpdebug did this disabling/re-enabling automatically between runs.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10553
  • Debugger - SynEdit - and more
    • wiki
Re: No break where expected
« Reply #17 on: November 29, 2024, 07:25:07 pm »
What works is, as you mentioned previously, set a breakpoint where the target variable is in scope then create the watchpoint there.  On subsequent runs all that is necessary is to disable and re-enable the watchpoint at the breakpoint for it to be valid again.  It would be very useful if fpdebug did this disabling/re-enabling automatically between runs.

You need the breakpoint to define where.

But you should the be able to
- Set a group for the watchpoint. E.g. "g1"
- Set a group for the breakpoint. "g2"
- Open the properties of the breakpoint and edit its action
 - action break: false
 - action enable groups "g1"
 - action disable groups "g2"

The one thing that is missing (and a todo), when the app starts the enabled for breakpoint and watch need to be set correctly.
- breakpoint must be back to enabled
- watchpoint must be disabled.

That is not yet done automagically.

440bx

  • Hero Member
  • *****
  • Posts: 4738
Re: No break where expected
« Reply #18 on: November 29, 2024, 07:48:19 pm »
Thank you Martin.  The entire discussion was very useful.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018