Making proof_trace_parser
and llvm_rewrite_trace_iterator
use a shared_ptr of kore_header
#1156
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.
The Math Proof Team has had an issue with
llvm_rewrite_trace_iterator
where they start iteration in one function, and finish in another function, passing the iterator as an argument to this second function. This second function also generates an Iterable object that is then returned in the first function.This complex workflow was raising a
Python Segmentation Fault
on the call ofget_next_event
inside ourclass LLVMRewriteTraceIterator
. After many hours of debugging, I reached a point where I discovered that thearities_
of thekore_header
object were corrupted, and then the parser threw a Segmentation Fault when trying to executeget_arity
.I believe the Pybind deleted the
kore_header
object when the function finishes, as it was the only const ref on the function, and then when we tried to access it lazily using the Iterable object created by the MPG team, the memory where kore_header lived was already freed.By making it a
shared_ptr
, we ensure it's only deleted when the whole object is deleted, sharing the ownership of it with the C++ code.