Author Topic: Has $Debug been working well for you?  (Read 7172 times)

0 Members and 1 Guest are viewing this topic.

Offline tomxp411

  • Newbie
  • Posts: 28
Re: Has $Debug been working well for you?
« Reply #15 on: March 09, 2022, 02:53:23 pm »
I really like having the debug/watch feature, and it's helped me quite a bit.

However, there are some issues that could make it more useful:

1. If a variable being watched has been removed since the last debugging session, the debugger will crash when you hit a breakpoint.
2. Remove a BP while the program is paused on that BP... and the program will still pause there on the next cycle. I seem to remember this happening frequently.
3. It is not possible to add watch variables defined in include files. We need a way to add those variables - possibly through a different watch dialog that simply asks for the variable name and its scope.
4. With a large program, the list of watch variables can get huge... it would be nice if I could just add a watch by selecting it in the source code or typing its name, rather than having to parse that huge watch list.

In fact, the variable list is the part of the debugger I don't like. While it looks great, it's unwieldly when there are more than a few variables in the program. I'd much rather just be able to type in the scope and/or variable name:


+-------------------------------------+
|             Add Watch               |
| Sub/Function: _____________         |
| Variable:     _____________         |
| Member:       _____________         |
|    [Add Watch]        [Cancel]      |
+-------------------------------------+


Marked as best answer by on Today at 08:06:21 am

Offline mdijkens

  • Newbie
  • Posts: 34
Re: Has $Debug been working well for you?
« Reply #16 on: March 09, 2022, 05:37:31 pm »
  • Undo Best Answer
  • Actually, this would also be solved with an 'Instant Watch' implementation as PDS had:
    You don't have to look for a variable in a list (which could be very long), but you can just select any variable (also when declared in an include-file)

    With 'Instant Watch' not only could you put your cursor on a variable in the source and press Shift-F9 to view it and then Enter to add it to the watchlist (or Esc if you don't need that), but you could also select any (complex) expression in the source and do the same. e.g. select Val(Mid$(Str$(var!), Instr(Mid$(Str$(var!),"."))+1)) as a watch-value.
    ~ 2 million lines of BASIC

    FellippeHeitor

    • Guest
    Re: Has $Debug been working well for you?
    « Reply #17 on: March 09, 2022, 06:37:14 pm »
    @tomxp411 thanks for your feedback - and yes, as @mdijkens put it, the new var lookup feature I intend to add next will help you out with issue #4. Just making sure we're on the same page (especially because I use the debugger to debug QB64 itself sometimes, with a rather large list of 1932 variables only in the main file, since $includes are, ahem, excluded) do you use the filter feature? Maybe I need to document it/exemplify it more deeply, but it does make my life so easy when looking for variables either by name or by scope (or both).

    Thanks for the report about the crashes/misbehaviors - I will have to try to reproduce the scenarios you outlined, since I don't recall getting any of those before.

    @mdijkens don't hold high hopes for watching expressions, don't forget it's compiled code we're dealing with, and that request would require a full-blown interpreter to be integrated, which is not our goal in the end.

    Regarding variables in $includes, I remember having a very good reason to exclude them, I just don't recall exactly what it was. After the 4 months of development of $Debug, I remember I still had that reason in mind - I'll let you all know if I remember what it was.

    Offline Cobalt

    • QB64 Developer
    • Forum Resident
    • Posts: 878
    • At 60 I become highly radioactive!
    Re: Has $Debug been working well for you?
    « Reply #18 on: March 09, 2022, 07:10:57 pm »
    Hate to be a naysayer BUT, It seems to be way too invasive, there are a multitude of buttons associated with it that constantly cause popups if accidentally pressed. Plus clicking too far to the left side trying to get to the beginning of a line.

    Perhaps an option to completely disable it if you don't need it? That way it doesn't get in the way but, can still be turned back on when needed?
    Granted after becoming radioactive I only have a half-life!

    FellippeHeitor

    • Guest
    Re: Has $Debug been working well for you?
    « Reply #19 on: March 09, 2022, 07:13:55 pm »
    @Cobalt suggestion noted.

    Offline mdijkens

    • Newbie
    • Posts: 34
    Re: Has $Debug been working well for you?
    « Reply #20 on: March 09, 2022, 07:27:01 pm »
    @mdijkens don't hold high hopes for watching expressions, don't forget it's compiled code we're dealing with, and that request would require a full-blown interpreter to be integrated, which is not our goal in the end.

    I can totally understand the issue there. PDS ran in some intermediate debug/interpreted mode (also slower then final compiled/linked program. Instant watch variables would already be very valuable.
    ~ 2 million lines of BASIC

    FellippeHeitor

    • Guest
    Re: Has $Debug been working well for you?
    « Reply #21 on: March 09, 2022, 07:37:51 pm »
    @Cobalt you do know you've asked me this before and that I did add it to the Debug menu, right?

      [ You are not allowed to view this attachment ]  

    Took me a hot second to remember.

    FellippeHeitor

    • Guest
    Re: Has $Debug been working well for you?
    « Reply #22 on: March 09, 2022, 11:59:55 pm »
    Latest dev build available now contains the new ability to choose number format, as per @RhoSigma's suggestion (dec/hex/oct/bin) as well as a fix for the issue reported by @tomxp411 regarding occasional crashes due to removing variables between $debug sessions.

    @tomxp411 I could not reproduce the issue regarding breakpoints, so I'd be glad if you could list the exact steps to reproduce it (provide some simple code if you can).

    @mdijkens var lookup might take a tad longer, but hang in there.

    Thank you all for your feedback and for trying the latest dev build. Help me break it, so the next release comes out as stable as it gets.

    Offline tomxp411

    • Newbie
    • Posts: 28
    Re: Has $Debug been working well for you?
    « Reply #23 on: March 10, 2022, 02:52:15 am »
    Latest dev build available now contains the new ability to choose number format, as per @RhoSigma's suggestion (dec/hex/oct/bin) as well as a fix for the issue reported by @tomxp411 regarding occasional crashes due to removing variables between $debug sessions.

    @tomxp411 I could not reproduce the issue regarding breakpoints, so I'd be glad if you could list the exact steps to reproduce it (provide some simple code if you can).

    Thanks.

    I'll see what I can do on the stuck BP issue. I seem to recall it being kind of random, and toggling the BP the second time always fixed it.

    Offline tomxp411

    • Newbie
    • Posts: 28
    Re: Has $Debug been working well for you?
    « Reply #24 on: March 10, 2022, 02:54:14 am »
    @tomxp411 I could not reproduce the issue regarding breakpoints, so I'd be glad if you could list the exact steps to reproduce it (provide some simple code if you can).

    I can't reproduce it on a simple test program, either. I'll try it again the next time I'm working on my Trek program.

    Offline RhoSigma

    • QB64 Developer
    • Forum Resident
    • Posts: 565
    Re: Has $Debug been working well for you?
    « Reply #25 on: March 10, 2022, 05:49:47 am »
    Latest dev build available now contains the new ability to choose number format, as per @RhoSigma's suggestion (dec/hex/oct/bin) as well as a fix for the issue reported by @tomxp411 regarding occasional crashes due to removing variables between $debug sessions.

    Just tested, works perfect for me, even the "remember" feature between debug sessions.

    But what happened to the development builds? - 145MB 7z, with nearly 30000 files each (32/64)?

    Oh, after a closer look, it seems both archives deliver both compiler versions (mingw32/64), one of it is renamed to c_compiler (according to version), but instead deleting the other one, it remains in place. Is this intended or a glitch in the build process?

    I mean I could live with it in the development builds, but later in the release archives it should definitly strip out the unused compiler distibution.

    PS - talking about the windows archives...
    My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
    GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
    Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
    Bonus - Blankers, QB64/Notepad++ setup pack

    FellippeHeitor

    • Guest
    Re: Has $Debug been working well for you?
    « Reply #26 on: March 10, 2022, 06:06:04 am »
    @luke will know.

    Offline OldMoses

    • Seasoned Forum Regular
    • Posts: 469
    Re: Has $Debug been working well for you?
    « Reply #27 on: March 10, 2022, 06:46:41 am »
    I'm not a heavy user of debug features, but the few times I've used it, I've found it helpful. A worthwhile feature in general. I wouldn't characterize it as a particularly intuitive a system, but I could get over that by more use and familiarity.

    If I were to critique a personal negative aspect, it would be the loss of full line highlighting by clicking at the line number bar. I always liked being able to do that. I could easily make multiples of code lines, make small changes in each and then comment toggle among them. It's gone now, which I found an irritation.

    As it is now, I have to be very precise with my mouse dragging from column 1 of the line I want to column 1 of the next line, to highlight a code line for cut/paste ops. My hands are those of an arthritic farmer, not a surgeon, and I have to maneuver very close to the line number bar to do this and If I'm not careful, it's constantly asking if I want to add $DEBUG, which I then have to cancel. If I actually want $DEBUG, I can go do it manually. The auto add part of it, otherwise, interferes with my workflow.

    PS I see from an earlier post how to turn off the auto add feature, which helps. Still I can no longer single click to highlight a line. I suppose I better hang on to 1.5
    « Last Edit: March 10, 2022, 06:58:43 am by OldMoses »

    FellippeHeitor

    • Guest
    Re: Has $Debug been working well for you?
    « Reply #28 on: March 10, 2022, 07:07:32 am »
    Thank you for your feedback, @OldMoses

    Yes, you can disable the "Add $Debug metacommand?" prompt in the Debug menu, as in the screenshot above. That won't give you back line number clicking to select a line, but should solve 50% of your problems. I'll consider re-adding the line selection feature when the prompt is disabled, I'll let you know about it.

    For comment toggling though, you don't need to select a line. Just have the cursor on it and hit Ctrl+T. 75% percent of your problems solved there now 😉

    I hope you also know that you can single click a line, hold shift, then single click another line to select a line range. Hope that helps too.

    Offline OldMoses

    • Seasoned Forum Regular
    • Posts: 469
    Re: Has $Debug been working well for you?
    « Reply #29 on: March 10, 2022, 07:23:43 am »
    Just turning off the auto add feature made it reasonable to use again.