FpDebug Enum question lazarus / 12-Debugger ---------------------------------------------------------------------- 440bx · 2024-04-26 02:55 Lazarus v3.99 (trunk) In the attachment, the value of the variable "HighValues" is shown in both, decimal and hex.  Great feature!. The Enum variable is supposedly displayed in "Hex", I expected the value to be $FFFFFFFF not -$1 which is basically a decimal value (an interpretation of the hex value $FFFFFFFF).  Another thing I may not be understanding correctly is, when the "Name" radio button is selected then only the variable name is displayed, its value is no longer displayed.  I don't see how just seeing the variable name without an associated value is useful.  Am I missing something there ? I may be missing something again but, in the snapshot, the presence of the "=" sign seems of little use. Code used:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$APPTYPE CONSOLE} {$define USE_ABSOLUTE} program _Enumerations; type  TENUM = (e1, e2, e3); var  {$ifndef USE_ABSOLUTE}    Enum       : TENUM = TENUM(-1);       { it won't accept this }  {$endif}   {$ifdef USE_ABSOLUTE}    HighValues : DWORD = DWORD(-1);    Enum       : TENUM absolute HighValues;  {$endif}    Enum2      : TENUM; begin  Enum2 := TENUM(-1);     { but it accepts this    }   {$ifdef USE_ABSOLUTE}    inc(HighValues);      { needs to be referenced }  {$endif}   readln;end. ---------------------------------------------------------------------- Martin_fr · 2024-04-26 09:44 Quote from: 440bx on April 26, 2024, 04:55:34 amThe Enum variable is supposedly displayed in "Hex", I expected the value to be $FFFFFFFF not -$1 which is basically a decimal value (an interpretation of the hex value $FFFFFFFF).  There is a checkbox (at the end of the radio row) "Unsigned". I couldn't find docs, but looking through compiler sources it seems that enum are treated as signed. For numbers there is signedness=auto, which does 2 things: check the type of the variable, and if it is signed, then decide based on dec vs hex. I didn't add an "auto" for enum, as I considered it less important. So you have to explicitly change it for hex. I did consider having the full auto/signed/unsigned choice if you switch to the "enum tab" => but then again, I considered it low value, and adding confusion by having another meaning of the "unsigned CHECKBOX" being greyed. It can currently already be greyed for 2 reason (well one implemented, one planed) - You select enum and bool, and they have different settings - You edit settings for several watches at the same time (planed) // You can already edit defaults for locals and watches at the same time Quote Another thing I may not be understanding correctly is, when the "Name" radio button is selected then only the variable name is displayed, its value is no longer displayed.  I don't see how just seeing the variable name without an associated value is useful.  Am I missing something there ? I think it is useful in many cases. Usually if I look at "Form1.align" and it says clClient => that is all I need. I don't need to know the ordinal value of  alClient. I did just check, and it is however broken => if the value is out of range (and has no name) then it ought to still give a number. (using the default format), something like TAlign(123). That it currently gives empty => bug. --- EDIT: fixed That also leaves the question, if in case of "both" it should then say  "TAlign(123) = $7B" or just "$7B". I think the first. A short off topic: Such out of range values only should happen as a result of bugs in code. Otherwise the resulting behaviour is undefined (and can change with new versions of fpc). You setting it explicitly to -1 should never be coded... Currently at least "case of {all enum} else" may not enter that "else" block). And lastly there is a difference between watching an enum-variable and an enum-identifier. If you watch "e1" => then just name indeed makes no sense. => But  I did not add a separate setting for enum-ident in the watch properties => so the option is still shown. And because it is shown there, it is shown everywhere. In the global presets you can give different presets for "enum identifier". I also still have to check some details when using this with boolean. That is, if the debug info provides enough info... There is - bytebool, longbool... - boolean8, boolean32... And one of those only has True=1 and False=0 and all others are not true, nor false. The other has True= anything but 0. QuoteI may be missing something again but, in the snapshot, the presence of the "=" sign seems of little use. Its just a separator between the 2 forms of the value. How else to separate them? Note this is also used in other places, e.g. when you have colors displayed as name: clRed = $....... Just got the idea that "set of enum" may need a "bitmap" mode. Instead of displaying the list of enum (name or number), show the bitmap as hex or bin. ---------------------------------------------------------------------- 440bx · 2024-04-26 12:03 Thank you Martin.  That helps understanding how it all hangs together. Quote from: Martin_fr on April 26, 2024, 11:44:20 amIts just a separator between the 2 forms of the value. How else to separate them? That makes sense but, the "=" sign also seems to sometimes be there when there is only one value.  In that case, I don't see what it separates, e.g, the Enum in the screenshot above. ---------------------------------------------------------------------- Martin_fr · 2024-04-26 15:49 Quote from: 440bx on April 26, 2024, 02:03:56 pmThat makes sense but, the "=" sign also seems to sometimes be there when there is only one value.  In that case, I don't see what it separates, e.g, the Enum in the screenshot above. That was because (due to the bug I mentioned), the first part wasn't printed as there was no name. It will now print TEnum(-1) = -$1 Which is a bit of duplication... But, then not completely => the first bit tells you that it is an unnamed enum (out of range). The 2nd is the hex value, because you want a hex value. They could be combined. But given that this should be rare (enums should not be out of range, unless the code being debugger has a bug which makes it so...) ---------------------------------------------------------------------- 440bx · 2024-04-26 16:09 Makes sense now. Thanks Martin.