fix: mergeParser is registered twice #407
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.
Hi,
I'm reading your source code recently. It's beautiful work that providing a unified platform for binary instrumentation. But I found a bug, which may significantly reduces the efficiency.
The
mergeParser
will register itself toreporter
while being initialized inmerge-file-parser.cc:66
However, it's registered manually in
main.cc
, which is deleted in this commit. This can be easily reproduced by addingINFO_MSG
tog_kcov_debug_mask
inutil.cc:27
, every REPORT line from themergeParser
will be duplicated, which means themergePaser
's callback functiononLineReporter
is called twice.This will cause redundant callback when each line of source code is parsed by the parser. According to my test report, this will add about 30% overhead on parsing stage.
Thank you for your reading. I'm looking forward to your further feedback.
(ps: Sorry for my English, I'm not a native speaker.)