microsoft / microsoft/vscode-cpptools
Can we reference the expression being evaluated within the natvis rule?
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.2k
- Forks
- 1.7k
- Merge medio
- 14 h 46 min
- PR fusionados (30 d)
- 61
Descripción
Are there any way to reference the expression being evaluated from the natvis rule?
Here are some examples what I am talking about.
Consider we have color_t type defined as typedef uint32_t color_t;, also let's suppose we have a special variable $_self which references current expression. Now we can write natvis rule:
<Type Name="color_t">
<DisplayString>A:{$_self >> 24} R:{($_self>>16) & 0xFF} G:{($_self>>8) & 0xFF} B: {$_self & 0xFF}</DisplayString>
</Type>
So we can see color information in a human readable format.
Another example. Consider we have some struct in C:
typedef struct
{
int state;
//other fields follow
}TCB;
Also there is global variable:
TCB* Running;
I want to make natvis rules that will show the state of the object based on the `state` field and `Running` global variable. If we would have a special variable `$_self` (as above). We could write:
<Type Name="TCB">
<DisplayString Condition="state==0">Empty</DisplayString>
<DisplayString Condition="state==0x80 && Running!=&$_self">Ready</DisplayString>
<DisplayString Condition="state==0x80 && Running==&$_self">Running</DisplayString>
</Type>
The last example could be realized for C++ language using this keyword, but not for C (or I just do not know how).
So are there any way to make such natvis rules? A there any possibility to add some special variable?
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
El issue no proporciona ningún archivo, prueba ni punto de entrada. Empieza buscando en el repositorio el manejo de natvis de Type, DisplayString y Condition; se considera terminado cuando se haya determinado si una self-expression puede exponerse tanto en la evaluación de natvis de C como en la de C++, o se haya documentado por qué no puede hacerse.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- c, cpp
- Área
- devtools
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 25/100