microsoft / microsoft/vscode-cpptools

Can we reference the expression being evaluated within the natvis rule?

オープン
#561 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

debugger question
主要言語
TypeScript
スター
6.2k
フォーク
1.7k
平均マージ
14時間 46分
マージ済み PR(30日)
61

説明

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?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

この Issue には、ファイル、テスト、エントリポイントがありません。まず、Type、DisplayString、Condition の natvis 処理をリポジトリ内で検索します。完了条件は、self-expression を C と C++ の両方の natvis 評価で公開できるかどうかを判断すること、またはそれができない理由を文書化することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, cpp
領域
devtools
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。