microsoft / microsoft/vscode-cpptools
Can we reference the expression being evaluated within the natvis rule?
Personne n'a encore pris cette issue.
- Langage dominant
- TypeScript
- Étoiles
- 6.2k
- Forks
- 1.7k
- Merge moyen
- 14 h 46 min
- PR mergées (30 j)
- 61
Description
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?
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
L’issue ne fournit aucun fichier, test ni point d’entrée. Commencez par rechercher dans le dépôt la gestion natvis de Type, DisplayString et Condition ; le travail est terminé lorsqu’il a été déterminé si une self-expression peut être exposée à la fois dans l’évaluation natvis de C et de C++, ou lorsque la raison pour laquelle cela est impossible a été documentée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- c, cpp
- Domaine
- devtools
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 25/100