Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluation of enums/constants seems to have stopped working? #293

Open
TurkeyMan opened this issue Mar 7, 2025 · 6 comments
Open

Evaluation of enums/constants seems to have stopped working? #293

TurkeyMan opened this issue Mar 7, 2025 · 6 comments

Comments

@TurkeyMan
Copy link

Once upon a time, debugger evaluation of enums/constants was working well, but since I returned from my hiatus, I've noticed that they don't seem to work at all.
Is this a known issue, or is there any reason for this?

Image

@rainers
Copy link
Member

rainers commented Mar 8, 2025

There is no debug information for enumerators, so there is no debug information to display the value from. With older versions of VS, the data tooltip is intercepted to replace it with intellisense information, but that seems to have broken with VS2022. I can workaround that by adding some text to trigger the "Quick Info", but that pollutes it a bit.

BTW: C++ has the same issue when hovering over a type. It does have debug information for enums, though.

@TurkeyMan
Copy link
Author

So debuginfo for enums is possible? Is there a reason we don't copy that?

@rainers
Copy link
Member

rainers commented Mar 8, 2025

So debuginfo for enums is possible? Is there a reason we don't copy that?

It is possible to emit "constant" symbol records. Not sure if it is easy to decide which symbols to emit without polluting the object file. If an enumerator type is used to declare a variable that might be a possible indicator to also emit the values.

@TurkeyMan
Copy link
Author

You said that C++ has debuginfo for enums though, is that what it does?

@rainers
Copy link
Member

rainers commented Mar 9, 2025

You said that C++ has debuginfo for enums though, is that what it does?

It seems msvc emits all the enumerator values of a declaration if any of its identifiers is referenced. This information might not be available anymore when dmd generates the debug information.

I just noticed that named enumerator types are already emitted with their identifiers and values by dmd/ldc, and the debugger displays identifiers for a variable of this type, but it doesn't understand it as part of an expression. This might have to do with needing the fully qualified name, which also fails for variable names :-/

@rainers
Copy link
Member

rainers commented Mar 14, 2025

The tooltip from semantic analysis is back in https://github.com/dlang/visuald/releases/tag/v1.4.0 and the expression evaluator knows about named enums, e.g. Type.Name can be used in watch expressions. What's missing is debug information about constants without an explicit type name, e.g. enum { Name = 1 } or enum Name = 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants