Yes, that could/should be seen as a bug.
is your being aware of the bug sufficient or would you like me to file a bug report for it ?
Added to the list of items in this thread (in my original opening post).
Also, you were the one who pointed out that nested values are "jumpled":
https://forum.lazarus.freepascal.org/index.php/topic,66143.msg511387.html#msg511387And internally, this falls in the same category.
PPInstruction($1234)^^: $2345^: (...)
The 2nd address of the intermediate pointer
It would be a good feature because that allows the user to verify the pointer is pointing into the expected block of memory and not some random block that happens to yield reasonable values.
Ok. In that case
1) the first pointer should have only one "^"
2) How to display in the main watches area when expanding?
I mean expand should probably still show the final deref value....
I have thought about allowing to expand pointers (even to non struct/array). E.g. expanding ^double would just show the double number (in the expanded row). A quick way to see it without address (if you don't want to change display format) in case of narrow columns.
But even then, if you had ^^^record => you would likely want to see the fields of the record.
And it's fine, but one minor detail.
- if you have a display format that shows the address(es) in the value column => then the top-level line shows all the addresses anyway => so all info is present.
- if your display format does exclude the address, and you use the "address column" => then that only shows the first deref address
So in the 2nd case, some addresses wont be shown...
In the case of FpDebug, I think that having a button that doesn't even need to be clicked, just hovered upon, to present some "formatting trick" reminders would be useful.
Maybe...
Would depend on getting feedback on which "tricks" other people would find useful. And yes, a bit of a catch22: Many of those who would find them useful wont know them, and therefore can't give feedback.
But those who do, might have ideas what they think others would....
Also, it isn't as straight forward. Some of those rely on the backend. The ".." only exists in FpDebug (as do all of those
https://wiki.freepascal.org/FpDebug-Watches-Intrinsic-Functions )
Which means, not only does the list have to know the backend... There is also the case that a user learns about ".." and then need to remote debug with gdb, and suddenly it stops working.
Then again, gdb has intrinsics too. But - within the IDE - that has not been tested (and may depend on gdb version).
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)
FpDebug does casting and converting. And hopefully the same way as FPC. (Gdb does not always do it the same way...)
That includes
type TFoo = packed record a,b: byte; end;
var foo: TFoo;
bar: word;
begin
foo.a := 1; foo.b := 2;
bar := word(Foo);
You can enter "word(Foo)" as watch.
Of course, as previously mentioned, this isn't really about formatting, it's really a feature request: a little cheat sheet window with useful formatting tricks. Also, initially it would only have a few, non-obvious, tricks which could be added on as new ones are thought of. IOW, initially having just 3 or 4 tricks (or even less) in the little window would be fine.
Maybe you can open a new topic on that (and moderate the topic), and see what others think.
In general, the debugger has tons of features that are probably seldom used.
* E.g. using the breakpoint hitcount.
If some code (testcase, that always runs the same behaviour) which is deeply nested in a loop, and fails after a certain amount (> 100) of calls, then just setting a breakpoint wont do it. You would have to single step more than a 100 times over the problematic line.
- set a non-breaking breakpoint, run the app, when it fails read the "pass count" of the breakpoint. Note that it passed (e.g.) 123 times.
- restart the code, this time with a breakpoint that has its hitcount set to 123 (so when it is about to be passed for the 123 time, it will stop).
* The history window
- if you debug focus sensitive code
- export the stack and watches of a crash, to be reviewed by a colleague.
* even watchpoints => I suspect are not as well known as they deserve
* pausing other threads (beta-ish)
* enable/disable breakpoints as other breakpoints are passed (with conditions on the other breakpoints)
But all that needs to go into another thread (if of interest)
Btw: Blaise Pascal Magazine has some Articles on the Debugger (starting most basic, IIRC in issue 105 with stepping)...
They offer a free subscription. I don't know if you can download the old one though (the German/Brasil subscription seem to allow that, by their description)