Recent

Author Topic: Debug - Inspect array values  (Read 3374 times)

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Debug - Inspect array values
« on: July 29, 2018, 11:50:20 am »
hi,
i am setting an array to watch.
please advise when inspecting this array while debugging how many values i should be able to inspect.
is it all values?
thank you
Lazarus 2.0.2 64b on Debian LXDE 10

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Debug - Inspect array values
« Reply #1 on: July 29, 2018, 02:34:18 pm »
I think by default gdb tries to evaluate every array item.
If it is a huge array gdb may have problems, or become very slow, or both.
For arrays it is best to specify the number of elements to watch. If you right-click on a watch in the Watches window (or click the spanner-screwdriver toolbutton) you can set the "Repeat Count".
There is little point in setting this much above 50 since otherwise the line of array values in the watch window will in any case be cropped at the right window border (unless you have an unusually large screen).

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Debug - Inspect array values
« Reply #2 on: July 29, 2018, 07:42:10 pm »
Depends....

Static arrays: you should see all values. There may be some limits at 2000 or 3000.
In Lazarus 1.9 you can set some of those limits. And the default different for locals/stack and watches.

Dynamic array:
Gdb does not know much about them (maybe if you try dwarf3, but that may cause other issues, even gdb crashes).
For dynamic arrays the IDE has to fetch each value one by one. This is slow, so it defaults to (IIRC around) 5. If you create a watch, you can set the repeat count in the watches property. (Set it to 1000, and the IDE will be busy for a LONG time / assuming the array is that big)

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Debug - Inspect array values
« Reply #3 on: July 29, 2018, 08:33:50 pm »
Dynamic array:
Gdb does not know much about them (maybe if you try dwarf3, but that may cause other issues, even gdb crashes).

Related but, not exactly on topic.  I am under the impression that the developers are working on an alternative debugger for FPC/Lazarus.  If this is correct, is there a list of goals/specifications published somewhere for that debugger that one can look at ?

Thanks.
(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: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Debug - Inspect array values
« Reply #4 on: July 29, 2018, 08:40:13 pm »
Actually several others.

For Mac users: An lldb based debugger is in progress. (including fpdebug via lldb)

For other platforms: Search the forum for "fpdebug" and "lazdebuggerfp" (one and the same).
Also search for "duby" (Not by the core team)

---------------------------
All of those are backend engines for the debugger.
Better tools for displaying available value, will have to be done on top of that.

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Debug - Inspect array values
« Reply #5 on: July 29, 2018, 08:52:36 pm »
For other platforms: Search the forum for "fpdebug" and "lazdebuggerfp" (one and the same).
Also search for "duby" (Not by the core team)

Will do.  Thank you.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Debug - Inspect array values
« Reply #6 on: July 29, 2018, 09:39:45 pm »
For Mac users: An lldb based debugger is in progress. (including fpdebug via lldb)

The LLDB one works fine on Windows as well as long as you have a copy of the LLDB executable, by the way. It's much faster than the GDB backend already too (although it of course doesn't have all the features yet.) I'm sure it would also work on Linux.
« Last Edit: July 29, 2018, 09:43:56 pm by Akira1364 »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Debug - Inspect array values
« Reply #7 on: July 29, 2018, 09:52:59 pm »
Depends on the lldb build. I tested a build that came with fedora, and lldb crashes.

About the speed: If gdb data would be displayed "raw" (without the IDE fixing pascal rules as far as possible), then gdb would be faster too.

Anyway, if you want speed, use LazDebuggerFp (install the package), and choose fpdebug. (Lazarus 1.9)

There are many details, that the gdb based debugger currently has. E.g.
- stepping over an ignored exception (and still stopping after the step)
- stepping out of an exception, into the finally/except handler

 

TinyPortal © 2005-2018