Recent

Author Topic: Poll: Watches and DisplayFormat => How do you think data should be displayed  (Read 10231 times)

440bx

  • Hero Member
  • *****
  • Posts: 4045
Short reply for now... will get into more details when I'm not so "squeezed" for time.

Quote
For instance the trick about "@textvar[0]" to not have every character individually enclosed in single quotes is quite useful
While it might be worth advertising, I wouldn't name it a "trick".

It is normal pascal syntax. You simply watch an expression that returns a "pchar" => so you get to see a pchar. (which is displayed as string)
I agree, "trick" isn't really a good description but, I can't think of a good one at this time.  "options" maybe ?

Maybe you can open a new topic on that (and moderate the topic), and see what others think.
I intend to do that.  Hopefully today or tomorrow.

In general, the debugger has tons of features that are probably seldom used.
I think the real challenge is in figuring out which features are seldom used because they are seldom needed compared to which features are seldom used because they are not common knowledge, e.g, the construct "Ptr[a..b]" is logical but, I didn't know about it and I wouldn't have thought of using it because it's not a valid Pascal statement.  Constructions like that are debugging pearls, extremely useful.

A related but slightly different note, I think that there is a natural fork occurring. By that I mean, FpDebug is really a different debugger than GDB and it will work differently, as a result, I believe that some features are forcefully going to be FpDebug only or GDB only and I think that's natural.   Honestly, at this point, I care very little about GDB.  I realize that's because on Windows FpDebug has gotten quite capable making GDB unnecessary but, that may not be the case on other platforms I don't use.  The point here is, at least on Windows, I think GDB is, in the majority of cases,  legacy stuff.

There are a couple of other things you said I should address, I intend to get to them as soon as reasonably convenient.  There are too many things in my head and some are leaking ;)

I like the new layout of the formatting options... I have about $0.02 worth of comments to mention... next post!

(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: 9881
  • Debugger - SynEdit - and more
    • wiki
Btw, it be a nice place to list all the intrinsics https://wiki.freepascal.org/FpDebug-Watches-Intrinsic-Functions
And the backends can have functions to list them.
But then it be nice, to also have some of those from gdb, if only to make use of the button.

On using features: If you need a field from an object, then you can open the object in the inspector => that has a filter (filters field names and data), so you can type "auto" to find any field (and data) containing "auto" => double click the desired one, and add it back as watch.
IMHO useful.
(filter in watches, whenever I find the time....)

Or, work a lot with variants? Configure the "variant backend convertor" https://wiki.freepascal.org/IDE_Window:_Ide_Options_-_Backend_Value_Converter#.22Convert_variant_to_value_type.22

It's documented...

440bx

  • Hero Member
  • *****
  • Posts: 4045
part of the problem is that I've only been using FpDebug since I learned that it supported DebugBreak() (which I only learned very recently.)  Since without that feature I couldn't use it, I didn't read the FpDebug documentation, consequently my knowledge of FpDebug is rather deficient and I need to correct that. 

The links you provided will most definitely be very helpful.

As far as the "Watch Properties" window, I tend to favor minimal designs.  In this case that means no dividers, just whitespace.  To my taste the dividers give a cluttered look.  The whitespace is usually enough (IMO) to create a visual separation among options.

I've attached a partially edited "Watch Properties" window.  I've left some of the dividers to show the contrast.  Personally, I'd get rid of all the dividers with the exception of the one that separates the "Memory dump" from the other options above.

I'd probably keep the small "dash" on the left hand side.

$0.02 :)
(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: 9881
  • Debugger - SynEdit - and more
    • wiki
I currently prefer the version where the radios are (starting on) the same line as the checkbox.

The lines can be fine tuned, 1 pixel, darker or lighter grey. But in general, the separation between groups is needed. (when there are several groups).

I currently have to rewrite some of the unlaying code...
And then incorporate the option of showing/hiding leading zeros.

I thought of various other ways....

1) Take a away the "signed-ness" and have global settings where the user can define "MyHex as hex-signed-no_lead_zero" and then that would be in the list...
2) Have the minimal preconfigured num-formats, and an edit, similar to "format", allowing to specify in text form, signed-ness, base, lead_zero, ....

But then gave up on them again (at least for the moment, until I see where I can get without them).
One thing is, that at least Decimal should be easily available in the following forms: "signed as the type of data", "always signed/cast to signed", "always unsigned" (that is one more that even existed in the old dialog. And so the minimal preset becomes a lot already.

Anyway, lets see where my current idea takes me.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9881
  • Debugger - SynEdit - and more
    • wiki
I am getting somewhere.... At least I think.

"Number(2nd)" will unfold, if selected. Outside the "all" tab, it will be always unfolded.

Despite the space being less, it still shows a lot....
I am reflecting if
- Enum,...: can/should be folded (only "all" tab). That is, if "Name/Letter" is selected, then the number settings are collapsed
  - Alternatively, on the "all" tab, enum does *not* show "signed-ness" at all (only number base) / or at least folds that line
  - The number setting for enums, previously an the "all" tab, where merged with the normal number settings. That could be restored...
- "Address" needs to be on the all page... Or could be folded, until the checkbox is checked.
- All Signedness could alternatively (on the "all" tab) be made a dropdown, at the end of the number-base line.


Yes, the horizontal lines are a bit heavy. Probably going to test them as dotted.


But first of all, I have to fix the entire handling of the display formats (which I broke, as I changed some settings).


Btw, the "digits" count (a minimum digit count), will if set (e.g. to 1) stop hex numbers from displaying leading zeros.

Hex and bin, will have the ability of spacing between bytes/words/dwords. (instead of separator)
« Last Edit: March 30, 2024, 12:29:03 am by Martin_fr »

440bx

  • Hero Member
  • *****
  • Posts: 4045
My $0.02 on the above pic are...

I'd have lines only between the main groups but no separating lines in the same group.

I'd put a little more white  space between main groups.  It would make the window a little bit taller but, I think it would look less cluttered (actually, I should say not as dense... I don't think it's cluttered).

ETA:

added the comment in parentheses.

« Last Edit: March 30, 2024, 01:12:20 am by 440bx »
(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: 9881
  • Debugger - SynEdit - and more
    • wiki
So, I gave different amount of dividers a try...

You are right, on the first glance it looks better without the dotted lines inside each section (Image 2).
But, then for something like "Structure", it becomes hard to tell, that there are 2 groups of radios.

Right now, all radio groups are single lined... But what if that can't be kept that way?

I tried little "grip handles" as indicators for each group. But...

440bx

  • Hero Member
  • *****
  • Posts: 4045
But, then for something like "Structure", it becomes hard to tell, that there are 2 groups of radios.
That's also true for the "pointer" group and is a valid concern.  OTH, I think that most, if not all, programmers would quickly realize that they are dealing with independent option groups.

Right now, all radio groups are single lined... But what if that can't be kept that way?
That could become a real problem because my comment above in a way depends on that.  At this stage, it's a potential problem I'd keep in mind but, as they say, I'd cross that bridge if and when I get there.

As far as dividers, I think you're right that some sort of visual divider between the groups is needed.  Figure 3 (without the dividers) feels, at first sight, a bit like an alphabet soup.  The presence of dividers really give a welcome structure to all the information present.

ETA:

I like the second one best.  I see the use of the "size grips" but, I can't manage to like them.  To me, they don't feel like they belong there.  That said, I don't have an alternative to offer at this time.
« Last Edit: March 31, 2024, 04:39:33 pm by 440bx »
(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: 9881
  • Debugger - SynEdit - and more
    • wiki
I committed a new attempt.

Also new settings. If you made global defaults, then some of them have to be redone.


Currently in the Watches window, when a record is being watched, the address of the record is included in the output - which is very nice for those who are doing low level debugging.

It would also be very nice if the address did _not_ include all the leading zeroes. 

I did include that option for normal numbers, but did not thought of pointers.

For normal numbers it is now possible to give a min-digit count.  E.g. for an array of byte, it may be nice to have them all showing 3 digits with leading zeros. And if the min-digit is set to 1, then no extra zeros will be shown. For a value of 0 min-digits, hex numbers show the full widths of the type of the data (which has always been that way, and now is made the default).

Pointers don't really need "min-digits". So I still need to add a simple checkbox for "short".

440bx

  • Hero Member
  • *****
  • Posts: 4045
I committed a new attempt.
There are still a number of things I have to test in the trunk version but... here are a few comments.  The attachment is mostly for convenience.  IOW, it doesn't show any problems.

First, I think the Watch Properties really looks much cleaner than it did in the recent past.  Definitely an improvement.

In the attachment, I don't understand why "Address" is there.  I tried changing the settings but I didn't see any changes in how the information was displayed.  Did I miss something ? I also tried changing the settings "Hide Pointer", "Show Pointer", "Only Pointer" and didn't see any side effect.   Basically, if those options don't do anything then maybe they shouldn't be there.

The new set of buttons is also a definite improvement. 

The button that shows the "data address" didn't show anything for the record I was watching.  Was the column supposed to remain empty in that case ?

The icon with the little red x is a very noticeable improvement over the previous icon :) and the dialog box asking for confirmation is most welcome :)

Another very welcome improvement is the assembly window. It looks a lot better than it used to.

One thing the screenshot does not show is that when debugging a 32bit executable, pressing F9 causes the assembly window to show up and execution is stopped "somewhere".  I say somewhere because the assembly window shows someplace in ntdll but, it definitely isn't stopped where it is showing because single stepping a few times causes jumps that don't make any sense, for instance, after executing a non-jump/non-call instruction, the instruction pointer is not on the next instruction but in a completely unrelated function/area.  It's not tracking its location correctly.

NOTE: I'm using v3.2 most of the time.  I'll try to use v3.99 more.

ETA:

Added the attachment that shows the Assembly window when first attempting to debug a 32bit executable.  It shows execution stopped in ntdll but, that's very unlikely to be correct because single stepping about 5 instructions causes the executable to run.

« Last Edit: April 10, 2024, 04:48:37 pm by 440bx »
(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: 9881
  • Debugger - SynEdit - and more
    • wiki
In the attachment, I don't understand why "Address" is there.  I tried changing the settings but I didn't see any changes in how the information was displayed.  Did I miss something ? I also tried changing the settings "Hide Pointer", "Show Pointer", "Only Pointer" and didn't see any side effect.   Basically, if those options don't do anything then maybe they shouldn't be there.

Right that is for "classes" (object instances) only. (And interfaces). Those have a hidden pointer that can be shown.
And, in that case, it would affect the display of that address within the "value" column (not the "address" column).

For top level object values, that is a duplication, because you can view it in the address column. But for nested object instances, it has meaning. (The idea is, to offer control to set this independently for top level and nested)

That needs to be fixed.

Quote
The button that shows the "data address" didn't show anything for the record I was watching.  Was the column supposed to remain empty in that case ?
object(class instance), interface, ansistring, dyn-array, ...

Quote
Another very welcome improvement is the assembly window. It looks a lot better than it used to.
Use the force... Aeh, I mean CTRL key. And it shows you jump targets (and - on click - jumps (display) there too). Provided you use FpDebug.

The editor options offer color config for the asm too.

Quote
One thing the screenshot does not show is that when debugging a 32bit executable, pressing F9 causes the assembly window to show up and execution is stopped "somewhere".  I say somewhere because the assembly window shows someplace in ntdll but, it definitely isn't stopped where it is showing because single stepping a few times causes jumps that don't make any sense, for instance, after executing a non-jump/non-call instruction, the instruction pointer is not on the next instruction but in a completely unrelated function/area.  It's not tracking its location correctly.

ETA:
Added the attachment that shows the Assembly window when first attempting to debug a 32bit executable.  It shows execution stopped in ntdll but, that's very unlikely to be correct because single stepping about 5 instructions causes the executable to run.

I need a lot more info on that. And ideally a new thread or a bug report, since this will likely add a bit of an exchange and is unrelated to this topic here.

For starters: register window (showing EIP), Callstack, Threads. Possibly at some time some logs.

Could "SetRedEnd" somehow end up in image loading? (Not that it necessarily is, it could be unlabeled kernel code *after* the routine of the displayed name). It would stop there for the "int3" (which I believe you have enabled).

Single stepping should ideally step asm instructions, and eventually step out. Or get into a finally/except block.

440bx

  • Hero Member
  • *****
  • Posts: 4045
I need a lot more info on that. And ideally a new thread or a bug report, since this will likely add a bit of an exchange and is unrelated to this topic here.
Before I address the above, thank you for all the very useful information you provided in the post above.

About the bug report and "ideally a new thread", I will create a new thread and attach the problem program's source code.

ETA:

New thread: https://forum.lazarus.freepascal.org/index.php/topic,66927.msg513960/topicseen.html#new

« Last Edit: April 10, 2024, 06:39:27 pm by 440bx »
(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: 9881
  • Debugger - SynEdit - and more
    • wiki
Please let me have a checkbox "display in dateformat".

Often I have data in the format double, e.g. 45122.

That should now be fully possible in 3.99. See image.

In the image, it has been set to show both, the human readable date, and the float. That can be configured. (red box)

You can also configure the format for the date (see https://www.freepascal.org/docs-html/rtl/sysutils/formatchars.html ). (green box)
Different formats can be given for each type (TDate, TTime, TDateTime). So you can decide what happens if a TDate has a time different from 0.

You can add other types (yellow box), if you have your own
Code: Pascal  [Select][+][-]
  1. type TMyTime = double;


You can also repeat the config, and add different setting for different nest levels. That is values shown in the array could be shown shorter.
If the array gets expanded (and each element listed in its own line) then those expanded values are at nestlevel = 0 (top level).
But in the single line display, where all array entries are coma separated, they are at level=1 (or in the case where the array is in a record, they are at level 2)

You can also set the formatter for each watch. (blue box / watch properties)
- You can disable the formatter
- You can choose a specific one (if you have set up formatters with different format-string yyddmm...)
- You can set up formatters inactive (Not checking the checkbox in the options list), and those will not be applied unless specifically selected in the watch properties)

There is a topic on "value formatters" https://forum.lazarus.freepascal.org/index.php/topic,66186.0.html


From the thread https://forum.lazarus.freepascal.org/index.php/topic,66398.msg508570.html#msg508570

It would be nice if the characters in a null terminated array of characters were displayed without single quotes and without commas separating them.

I added a value formatter, that will show an array of char as string.

You can add the value converter (global or per project).
- To add a new formatter, first select the type-of-formatter in the drop down, then press add.
- "match type by name" (brown box) you would probably want an "*", so it acts on any typename. (It will only act if it is an array of char).
- There is a checkbox (brown box), to select if it should stop at the last char before the first #0  encountered.
- You do want "Replace/Hide original value", or the array data is shown on the same line before/after the string.

It only changes the displayed value (and what gets copied to clipboard). At current it does not prevent the watches window from showing a [ + ] symbol to expand the array.

Please test.
« Last Edit: April 18, 2024, 09:23:45 pm by Martin_fr »

440bx

  • Hero Member
  • *****
  • Posts: 4045
Very nice.  Thank you Martin.

I have to download the new trunk version and give it a workout.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

440bx

  • Hero Member
  • *****
  • Posts: 4045
I tried updating my copy of Lazarus trunk using FPCUPDELUXE (which is what I normally do) and got an error when compiling Lazarus which seems to be related to FpDebug.

Please, refer to the screenshots.

The first screenshot (...A) shows that an error occurred when compiling "...arrayofchartostring.pas"

The second screenshot shows the compiler was expecting a resource file (and its name) it was unable to find.

HTH.

ETA:

added "(and its name)"
« Last Edit: April 18, 2024, 10:39:29 pm by 440bx »
(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