[Lldb-commits] [lldb] [lldb] Add format eFormatEnumWithValues to ensure raw enum value is always shown (PR #90059)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 26 09:52:51 PDT 2024


clayborg wrote:

Sorry for the delay, I am still wondering if we just want to have the value objects for enums return the text name as the value, and have the summary show the value as an appropriate integer if the format is eFormatEnum. When you display registers bitfields do you have a ValueObject? If so we can modify the `ValueObject::GetSummary()` to return the integer value, but only if we have the format set to `eFormatEnum`. The output for variables would be similar to what your tests expect, but we would just modify the summary string that we return and then we don't need the new format. 

One reason I like this way of doing things is if you call "valobj.GetValue()", and the format is set the enum with value, we will get "foo (1)" as the value back from the value object. I would rather call `valobj.GetValue()` and get `"foo"` and then call `valojb.GetSummary()` and get `"1"`, or of course you can always just call `valobj.GetValueAsUnsigned(...)` or `valobj.GetValueAsSigned(...)`. If we have special display code for the register bitfields, they can call these APIs when displaying register by default?

https://github.com/llvm/llvm-project/pull/90059


More information about the lldb-commits mailing list