[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)

Vlad Serebrennikov via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 24 08:08:57 PDT 2023


Endilll wrote:

@clayborg Thank you for extensive feedback! Can you clarify where do you want me to put the changes?

---
You expected the following:
> v.SetFormat(lldb.eFormatDecimal)
v.GetValue()
`1(1)`

But my patch doesn't seem to alter the behavior of `eFormatDecimal`. The code and LLDB output with this PR applied are below.
```cpp
enum E {
  E1 = 0
};

int main()
{
    E e;
    return 0;
}
```
```
* thread #1, name = 'enum_test', stop reason = breakpoint 1.1
    frame #0: 0x000055555555513b enum_test`main at test.cxx:8:5
   5    int main()
   6    {
   7        E e;
-> 8        return 0;
   9    }
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> lldb.frame.FindVariable("e")
(E) e = E1(0)
>>> e = lldb.frame.FindVariable("e")
>>> e.SetFormat(lldb.eFormatDecimal)
>>> e
(E) e = 0
>>> e.GetValue()
'0'
>>> e.GetSummary()
>>>
```

---

I'm also wondering if refactoring this patch to use summaries is going to affect the way we dump enum *types* (with enumerators included). Apparently, this is covered by `TestRustEnumStructs.py` test that I change in this PR.

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


More information about the lldb-commits mailing list