[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 23 14:58:52 PDT 2023
clayborg wrote:
> Making sure I'm following along properly. For context, this is the debug experience I'm most used to: ![Capture](https://user-images.githubusercontent.com/4587626/277433029-e45937dc-9b78-4a3d-9321-1fa99a35daa8.PNG)
>
> It sounds like you're saying we shouldn't change the enum formatter to display `Enum (1)`, it should continue to display just `Enum`. But the summary could be changed for enumerations so it says `(1)`, so that both pieces of information would appear in the debugger by default?
The summary should just display "1" (no parens).
If we have the following code in C/C++:
```
enum Foo {
Bar = 1,
Baz,
Ding
};
Foo f = Bar;
```
And we stop after the last line, we can do:
```
>>> v = lldb.frame.FindVariable('f')
>>> v.GetValue()
'Bar'
>>> v.GetFormat()
0
>>> lldb.eFormatDefault
0
>>> v.SetFormat(lldb.eFormatHex)
>>> v.GetValue()
'0x00000001'
>>> v.SetFormat(lldb.eFormatDecimal)
>>> v.GetValue()
'1'
```
And if you set the summary to be the signed unsigned value then we would have this:
```
>>> v.GetSummary()
'1'
```
Where right now it returns `None`
If the user changes the format and we did the patch the way it was currently coded we would get:
```
>>> v.SetFormat(lldb.eFormatDecimal)
>>> v.GetValue()
`1(1)`
```
Since the normal value would listen to the format value (which defaults to `lldb.eFormatDefault` which is zero), but is now set to `lldb.eFormatDecimal`.
https://github.com/llvm/llvm-project/pull/69815
More information about the lldb-commits
mailing list