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

Raw profiler hook fails because of a null ref #371

Open
robertpi opened this issue Feb 17, 2021 · 1 comment
Open

Raw profiler hook fails because of a null ref #371

robertpi opened this issue Feb 17, 2021 · 1 comment

Comments

@robertpi
Copy link
Contributor

This is somewhat relate to #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: robertpi@22b96b5#diff-9025cfc4efbe6666f69f6103e8d4aca595e5107e7c0ec46d644b3f34345717c9R1314

There maybe other better ways to fix this.

@delmyers
Copy link
Contributor

I think that this might be the same issue as discussed in #370, and it has to do with usage of IMethodMalloc. Let's discuss over there first to see if that is the problem.

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