Forum > Designer
FPDebug: Evaluate/Modify variable of type Currency
(1/1)
bpranoto:
When debugging with fpDebug, Evalue/Modify and watch, variables of type currency is displayed multiplied by 10000, for example Val1 value is actually 10, but displayed in Evaluate/Watched windows as 10000. See the screenshot attached.
I think, it will be better if it represented the value as it is?
Martin_fr:
This does work (kinda) in 3.99.
It only affects the display in the watches Window (and locals, inspect, ...).
The problem is that FPC encodes "currency" as plain integer in the debug info. So the debugger (fpdebug, gdb, lldb) itself does not know.
However, in 3.99 "debug visualizers" (aka "value formatters") exist: https://forum.lazarus.freepascal.org/index.php/topic,66186.0.html
And they amend at least how it is displayed.
Downside, if you add a watch like:
--- Code: Text [+][-]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";}};} ---MyCurrencyVar + 1MyCurrencyVar + MyIntVarThen the result is calculate in the debugger, and the Integer value will add 0.0001 to the currency var.
But to fix this, fpc needs to provide the correct info to the debugger...
Well, maybe FpDebug can get an option to override that info. But that is problematic too, because all it has to detect currency is the typename (though that is the same for the "dbg visualizer"), and you can have code 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";}};} ---type currency = byte;And then translating this into fixed point, would be wrong (and will be incorrectly displayed if the dbg-visualizer is active).
bpranoto:
Thank you for the Insight Martin, actually it's not really a problem, it just gives me an itch whenever I inspect the variable in the debugger :)
Navigation
[0] Message Index