diff options
author | Kostya Serebryany <kcc@google.com> | 2017-08-04 23:49:53 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2017-08-04 23:49:53 +0000 |
commit | a84a6c1e484e40a2b37c0f95cc9c88a466c078d7 (patch) | |
tree | b23a864a7c8bd676ced13a4515de10e253df9866 /llvm/lib/Fuzzer/FuzzerLoop.cpp | |
parent | 4a8a0a2a88df617e002d62034849db8b432092c6 (diff) | |
download | llvm-a84a6c1e484e40a2b37c0f95cc9c88a466c078d7.zip llvm-a84a6c1e484e40a2b37c0f95cc9c88a466c078d7.tar.gz llvm-a84a6c1e484e40a2b37c0f95cc9c88a466c078d7.tar.bz2 |
[libFuzzer] use the in-binary pc table (instead of PCs captured at run-time) to implement -exit_on_src_pos
llvm-svn: 310151
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerLoop.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp index 41fd213..2064783 100644 --- a/llvm/lib/Fuzzer/FuzzerLoop.cpp +++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp @@ -328,17 +328,16 @@ void Fuzzer::SetMaxMutationLen(size_t MaxMutationLen) { void Fuzzer::CheckExitOnSrcPosOrItem() { if (!Options.ExitOnSrcPos.empty()) { static auto *PCsSet = new std::set<uintptr_t>; - for (size_t i = 1, N = TPC.GetNumPCs(); i < N; i++) { - uintptr_t PC = TPC.GetPC(i); - if (!PC) continue; - if (!PCsSet->insert(PC).second) continue; - std::string Descr = DescribePC("%L", PC); + auto HandlePC = [&](uintptr_t PC) { + if (!PCsSet->insert(PC).second) return; + std::string Descr = DescribePC("%F %L", PC + 1); if (Descr.find(Options.ExitOnSrcPos) != std::string::npos) { Printf("INFO: found line matching '%s', exiting.\n", Options.ExitOnSrcPos.c_str()); _Exit(0); } - } + }; + TPC.ForEachObservedPC(HandlePC); } if (!Options.ExitOnItem.empty()) { if (Corpus.HasUnit(Options.ExitOnItem)) { |