Forum > Lazarus

Testers needed: FpDebug and ModeSwitch AutoDeref


Under Tools > Debugger > Debugger Backend: When FpDebug is selected, there is now an option "AutoDeref" (in the properties grid).
The option is OFF by default.

If checked, FpDebug will evaluate expressions like

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  PointerToMyObject.Foo // without the ^  PointerToMyArray[i] // without the ^
That is, if a (typed) pointer is followed by either "." or "[" then the debugger performs exactly one ^ deref.

The debugger has no knowledge if a unit was compiled with or without that ModeSwitch. The debugger applies the setting globally.

As I don't use that ModeSwitch in any of my code, I have no experience when or where it will affect operations (all the nitty gritty details).
And also, I will not use the feature in may daily work, reducing the amount of testing it gets from me.

So, I relay on those who use the modeswitch (and want the debugger to behave accordingly) to test it.
And to find out any place were the debugger behaves different from what the compiler does. (except for applying the flag globally).

If you find differences, then please create an issue report on the bugtracker. Please include a small example prog that show what the compiler does.

Thank you, this is very useful.
I suggest that {$mode delphi} users enable this debug-mode option,
because the compile mode already includes AutoDeref ON by default.

My test for AutoDeref was successful:
Expression type was pointer-type PRecord, PStaticObject, PStaticArray.
I also tested some exotic expressions (above pointer-types are result-types):
PPPStaticArray^^[0] resolves to PPPStaticArray^^^[0] under AutoDeref ON.
All this was successful.

I know one combination where the AutoDeref debug-option should be disabled:
1) {$PointerMath on} type PStaticArray = ^TStaticArray;
2) compiler mode is AutoDeref OFF  (or even ON in case of ideal compiler (see note)).
By pointermath, the compiler views PStaticArray[0] as one TStaticArray in a line of arrays.
With debugger-AutoDeref, the debugger would see only first element in TStaticArray: PStaticArray^[0].

(Note about the compiler: PStaticArray[0] is a pointermath index expression,
but due to a known compiler bug (also in Delphi) the pointermath meaning is overridden (lost) under AutoDeref ON.
This compiler bug violates the rule that AutoDeref should be applied to expressions
only if the same expressions under AutoDeref OFF are non-compilable (caret missing).)


[0] Message Index

Go to full version