diff options
| author | Marcos Pividori <mpividori@google.com> | 2017-01-22 01:58:26 +0000 |
|---|---|---|
| committer | Marcos Pividori <mpividori@google.com> | 2017-01-22 01:58:26 +0000 |
| commit | 62c8fc571a345f8f2e462aa8451849d4d2dd48d8 (patch) | |
| tree | ec86e96b77858135d7bfdc489787e7be16badc82 /llvm/lib/Fuzzer/FuzzerUtilWindows.cpp | |
| parent | 60cc2fbba11aa2f856049cd81bc4c7275ba94da5 (diff) | |
| download | bcm5719-llvm-62c8fc571a345f8f2e462aa8451849d4d2dd48d8.tar.gz bcm5719-llvm-62c8fc571a345f8f2e462aa8451849d4d2dd48d8.zip | |
[libFuzzer] Portably disassemble and find calls to sanitizer_cov_trace_pc_guard.
Instead of directly using objdump, which is not present on Windows, we consider
different tools depending on the platform.
For Windows, we consider dumpbin and llvm-objdump.
Differential Revision: https://reviews.llvm.org/D28635
llvm-svn: 292739
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerUtilWindows.cpp')
| -rw-r--r-- | llvm/lib/Fuzzer/FuzzerUtilWindows.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerUtilWindows.cpp b/llvm/lib/Fuzzer/FuzzerUtilWindows.cpp index 3ca1f2c8f56..b9e039f81e5 100644 --- a/llvm/lib/Fuzzer/FuzzerUtilWindows.cpp +++ b/llvm/lib/Fuzzer/FuzzerUtilWindows.cpp @@ -178,6 +178,20 @@ const void *SearchMemory(const void *Data, size_t DataLen, const void *Patt, return NULL; } +std::string DisassembleCmd(const std::string &FileName) { + if (ExecuteCommand("dumpbin > nul") == 0) + return "dumpbin /disasm " + FileName; + if (ExecuteCommand("llvm-objdump > nul") == 0) + return "llvm-objdump -d " + FileName; + Printf("libFuzzer: couldn't find tool to disassemble (dumpbin, " + "llvm-objdump)\n"); + exit(1); +} + +std::string SearchRegexCmd(const std::string &Regex) { + return "findstr /r \"" + Regex + "\""; +} + } // namespace fuzzer #endif // LIBFUZZER_WINDOWS |

