i#2157 re-attach: add best-effort re-attach support #2182
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While there are many globals that are not reset, we take a best-effort
approach here and reset the ones that matter, allowing us to re-attach with
a memtrace client and static DR.
Portions of this were initially based on
https://codereview.appspot.com/13314047/ from Peter Goodman.
For DO_ONCE, an incremented counter is used.
For numerous other globals, at exit time if doing_detach is set we reset
them to NULL.
For locks, we simply reset count_times_acquired but leave the deleted field
as it does not matter much (part of the whole theme here: this may never be
rock-solid for unusual option combinations but our goal is supporting the
common case).
For drreg, with the new multi-init feature we have to zero the options at
exit time.
Adds several tests by adding loops around existing start/stop tests, but
stops short on burst_threads until i#2175 is fixed.
Review-URL: https://codereview.appspot.com/318520043