Skip to content

Comments

Elide ALL commands that we are not trying to trace.#1883

Merged
AWoloszyn merged 1 commit intogoogle:masterfrom
AWoloszyn:elide_api
May 25, 2018
Merged

Elide ALL commands that we are not trying to trace.#1883
AWoloszyn merged 1 commit intogoogle:masterfrom
AWoloszyn:elide_api

Conversation

@AWoloszyn
Copy link
Contributor

We were ignoring some of the data, but not all of it. We would
end up adding the commands to the tree, but no observations,
this caused havok with the new memory work, since replaying
those commands would cause OOB memory accesses.

@AWoloszyn AWoloszyn requested a review from ben-clayton May 16, 2018 18:44
}

void CallObserver::exit() {
if (!mSpy->should_trace(mApi)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scares me. If the should_trace return value changes between enter and exit then You're Going To Have A Bad Time.
Are there cases where should_trace should change for the lifetime of a CallObserver? If not, can we fetch it once and store it as a member?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no cases (that I know) that would make this change during a call.
The only place we change ShouldTrace is during MEC start

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can definitely store it off as a member, that will prevent this from accidentally happening.

return should_trace(api) ? mEncoder : mNullEncoder;
}

std::shared_ptr<gapii::PackEncoder> parentEncoder(uint8_t api, CallObserver* parent) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a bit of a clunky method. There's nothing particularly parent-specific about the implementation, and the name has no real indication of what it does.
I wonder if it would be clearer to just expose mNullEncoder and let the caller do this logic. This would also deobfuscate the call to should_trace.

We were ignoring some of the data, but not all of it. We would
end up adding the commands to the tree, but no observations,
this caused havok with the new memory work, since replaying
those commands would cause OOB memory accesses.
@AWoloszyn AWoloszyn merged commit a0d8bf6 into google:master May 25, 2018
@AWoloszyn AWoloszyn deleted the elide_api branch May 25, 2018 13:08
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

Successfully merging this pull request may close these issues.

2 participants