Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Raw profiler hook fails because of a null ref

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cpp
領域
devtools

調査の方向性

CCorProfilerInfoWrapper::GetILFunctionBody から開始し、SetFinalRenderedFunctionBody 後の CMethodInfo の状態を追跡します。特に、m_bIsInstrumented、m_pIntermediateRenderedMethod、m_pFinalRenderedMethod の関係を確認します。SetFinalRenderedFunctionBody に対して提案されている変更を issue 370 および参照されている commit と比較します。raw-profiler による書き換えで null 参照や失敗 HRESULT が発生せず、有効なメソッド本体を取得できれば完了です。

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

説明

This is somewhat relate to https://github.com/microsoft/CLRInstrumentationEngine/issues/370, as it seems impossible to test them separately, but I believe it a separate issue.

It seems if a raw profiler chooses to rewrite a method but it hasn't been rewritten by an instrumentation method then an null ref will occur, or rather the functions will start to return fail HRESULTs because of a null ref.

For an existing method that has been instrumented by the raw profiler but not an instrumentation method CCorProfilerInfoWrapper::GetILFunctionBody will call pMethodInfo->GetIntermediateRenderedFunctionBody. This because pMethodInfo->IsInstrumented() has been set when CMethodInfo::SetFinalRenderedFunctionBody was called.

This means that we're in a state where m_bIsInstrumented is true, m_pIntermediateRenderedMethod is null and m_pFinalRenderedMethod is set to a valid method body.

So, our CMethodInfo has a valid method body, but I'm not sure what the correct way to retrieve it.

One possible fix is to update CMethodInfo::SetFinalRenderedFunctionBody so that it sets m_pIntermediateRenderedMethod if it is not already set. I believe this works, but can't test it properly because of the other issue: https://github.com/robertpi/CLRInstrumentationEngine/commit/22b96b56ec69b1cdb74e9d0d5f3a73169385a923#diff-9025cfc4efbe6666f69f6103e8d4aca595e5107e7c0ec46d644b3f34345717c9R1314

There maybe other better ways to fix this.

主要言語
C++
スター
105
フォーク
53
平均マージ
3日 14時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

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

microsoft/CLRInstrumentationEngine のほかの issue

microsoft/CLRInstrumentationEngine の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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