Recent

Author Topic: Pointer range in watches  (Read 692 times)

440bx

  • Hero Member
  • *****
  • Posts: 4212
Pointer range in watches
« on: May 27, 2024, 10:44:37 pm »
Hello,

I'm unclear as to what the behavior should be when setting the bounds between the "+" and "-" in the watch properties.

Please refer to the screenshot. 

I started watching the first 21st elements of an array by setting the "Expression" to:
Code: Pascal  [Select][+][-]
  1. ProgramData.PD_PE_DATA.PED_RUNTIME_FUNCTIONS.RT_FUNCTIONS_TABLE[0..20]
then I wanted to see more elements and simply changed the upper bound to "30" in the properties window but, that seems to be ignored.

My question is: should the new value be ignored because it is outside the bounds of the original boundaries or should the new value in the properties window have replaced the upper bound in the expression ?

It would be nice if it automatically replaced the upper bound in the expression. That would save having to set it manually.

PS: Lazarus v3.99 (trunk) downloaded today (5/27/2024)
(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: 10001
  • Debugger - SynEdit - and more
    • wiki
Re: Pointer range in watches
« Reply #1 on: May 28, 2024, 08:57:32 am »
It seems it isn't currently documented... https://wiki.lazarus.freepascal.org/IDE_Window:_Watch_list#Viewing/Expanding_Arrays

The embedded toolbar by default works inside the range of the returned watch (in your case 0..20).

That is, so that the last page ends at the end of the array. If your 21 entries were paginated on pages with 10 elements, then the last page would only show 1 element. Sparing you the random data after your array. (for the toolbar, this is not distinguishable from a real array, and even if it was it would not know if you had chosen the maximum value for the index)

However, if the start point is forcefully set outside the bounds, then it will give up enforcing those bounds.
So in your case, if you set the start or -1 or 21 then the paging will show more values.
The arrows will not set those values. You have to type them directly into the edit fields.

Since the default for pagination size can be bigger than the array (e.g. an array with 5 elements, but pagination starts at 10 per page), the page size is not used to determine if bounds should be ignored.

440bx

  • Hero Member
  • *****
  • Posts: 4212
Re: Pointer range in watches
« Reply #2 on: May 28, 2024, 11:19:04 am »
Now I understand.  In one case, it's boundary control in the other it's pagination, which is a different thing.

Thank you Martin. :)
(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