summaryrefslogtreecommitdiffstats
path: root/llvm/tools/sancov
Commit message (Collapse)AuthorAgeFilesLines
* Python compat - print statementSerge Guelton2019-01-031-0/+2
| | | | | | | | | Make sure all print statements are compatible with Python 2 and Python3 using the `from __future__ import print_function` statement. Differential Revision: https://reviews.llvm.org/D56249 llvm-svn: 350307
* [sancov] Generalize the code to get the previous instruction to multiple ↵George Karpenkov2018-10-101-1/+14
| | | | | | | | | | | | | architectures sancov subtracts one from the address to get the previous instruction, which makes sense on x86_64, but not on other platforms. This change ensures that the offset is correct for different platforms. The logic for computing the offset is copied from sanitizer_common. Differential Revision: https://reviews.llvm.org/D53039 llvm-svn: 344103
* Rename sancov.cc to sancov.cppNico Weber2018-04-252-3/+2
| | | | | | | LLVM uses cpp as its C++ file ending. https://reviews.llvm.org/D46068 llvm-svn: 330853
* Remove redundant includes from tools.Michael Zolotukhin2017-12-131-8/+0
| | | | llvm-svn: 320631
* Add section headers to SpecialCaseListsVlad Tsyrklevich2017-09-251-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Sanitizer blacklist entries currently apply to all sanitizers--there is no way to specify that an entry should only apply to a specific sanitizer. This is important for Control Flow Integrity since there are several different CFI modes that can be enabled at once. For maximum security, CFI blacklist entries should be scoped to only the specific CFI mode(s) that entry applies to. Adding section headers to SpecialCaseLists allows users to specify more information about list entries, like sanitizer names or other metadata, like so: [section1] fun:*fun1* [section2|section3] fun:*fun23* The section headers are regular expressions. For backwards compatbility, blacklist entries entered before a section header are put into the '[*]' section so that blacklists without sections retain the same behavior. SpecialCaseList has been modified to also accept a section name when matching against the blacklist. It has also been modified so the follow-up change to clang can define a derived class that allows matching sections by SectionMask instead of by string. Reviewers: pcc, kcc, eugenis, vsk Reviewed By: eugenis, vsk Subscribers: vitalybuka, llvm-commits Differential Revision: https://reviews.llvm.org/D37924 llvm-svn: 314170
* [sancov] coverage-report-server.py: ServerHandler(): open file as UTF8Roman Lebedev2017-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is nessesary in Python3. Everywhere else we assume that encoding is UTF8. If we don't specify it here, the defaults from the environment will be used, which may result in ASCII decoder being used. And if the file is non-ASCII, then it will crash: ``` File "/usr/local/bin/coverage-report-server.py", line 168, in do_GET for line_no, line in enumerate(f, start=1)]) File "/usr/local/bin/coverage-report-server.py", line 165, in <listcomp> ["<span class='{cls}'>{line}&nbsp;</span>".format( File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 106: ordinal not in range(128) ``` Fixes https://bugs.llvm.org/show_bug.cgi?id=33548 Now, how would i add a testcase here? Reviewers: m.ostapenko, kcc Reviewed By: kcc Subscribers: kcc, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D37661 llvm-svn: 313063
* [sancov] Fix broken links and displaced coloring in coverage-report-server.pyMaxim Ostapenko2017-03-201-2/+2
| | | | | | | | | | | | | | This patch fixes two issues: * Fixed relative links to source files * Enumeration of lines in source files starts from 1 instead of 0 to align with .symcov files generated by sancov -symbolize Patch by Dmitiriy Nikiforov. Differential Revision: https://reviews.llvm.org/D31038 llvm-svn: 298250
* [sancov] better input parameters validationMike Aizatsky2017-03-031-4/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D30370 llvm-svn: 296900
* [sancov] extending sancov --help documentationMike Aizatsky2017-02-241-2/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D30361 llvm-svn: 296205
* [sancov] applying blacklist to covered points tooMike Aizatsky2017-01-191-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D28872 llvm-svn: 292468
* [sancov] skip duplicated pointsMike Aizatsky2016-12-211-0/+5
| | | | llvm-svn: 290278
* [sancov] hash prefix results in huge merge files, use shorter prefixMike Aizatsky2016-12-211-2/+1
| | | | llvm-svn: 290277
* [sancov] skip dead files from computationsMike Aizatsky2016-12-171-18/+38
| | | | | | Differential Revision: https://reviews.llvm.org/D27863 llvm-svn: 290017
* Make the Error class constructor protectedMehdi Amini2016-11-111-1/+1
| | | | | | | | | This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 llvm-svn: 286561
* [sancov] add __sanitizer_cov_trace_pc_guard to the supported coverage pointsKostya Serebryany2016-10-181-1/+3
| | | | llvm-svn: 284509
* Turn cl::values() (for enum) from a vararg function to using C++ variadic ↵Mehdi Amini2016-10-081-1/+1
| | | | | | | | | | | | | | | template The core of the change is supposed to be NFC, however it also fixes what I believe was an undefined behavior when calling: va_start(ValueArgs, Desc); with Desc being a StringRef. Differential Revision: https://reviews.llvm.org/D25342 llvm-svn: 283671
* [sancov] renamed symcov-report-server to coverage-report-serverMike Aizatsky2016-10-042-2/+2
| | | | llvm-svn: 283241
* [sancov] using env for better portabilityMike Aizatsky2016-10-031-1/+1
| | | | llvm-svn: 283136
* [sancov] introducing symbolized coverage files (.symcov)Mike Aizatsky2016-09-281-740/+626
| | | | | | | | | | | | | | | | | | | | | Summary: Answering any meaningful questions about .sancov files requires accessing symbol information from the corresponding binary. This change introduces a separate intermediate data structure and format: symbolized coverage. It contains all symbol information that is required to answer common queries: - merging - coverd/uncovered files and functions - line status. Also removing the html report functionality from sancov: generated HTML files are too huge, and a different approach is required. Maintaining this half-working approach in the C++ is painful. Differential Revision: https://reviews.llvm.org/D24947 llvm-svn: 282639
* [sancov] a simple .symcov coverage report serverMike Aizatsky2016-09-281-0/+203
| | | | | | | | | | Coverage reports for gigabyte-sized binaries are huge. There's no practical reason to generate them statically. Implementing an experiment http coverage report server. The server loads .symcov file and serves interactive coverage pages. llvm-svn: 282637
* [sancov] MachO indirect symbols support.Mike Aizatsky2016-08-121-8/+56
| | | | | | Differential Revision: https://reviews.llvm.org/D23338 llvm-svn: 278551
* [sancov] Port sancov -print-coverage-pcs to COFFReid Kleckner2016-08-101-5/+26
| | | | | | | | | | | The export table is not considered part of the object file symbol table, so we have to look through it separately. Reviewers: kcc Differential Revision: https://reviews.llvm.org/D23321 llvm-svn: 278284
* [Object] Re-apply r275316 now that I have the corresponding LLD patch ready.Lang Hames2016-07-141-6/+11
| | | | llvm-svn: 275361
* [Object] Revert r275316, Archive::child_iterator changes, while I update lld.Lang Hames2016-07-141-11/+6
| | | | | | Should fix the bots broken by r275316. llvm-svn: 275353
* [Object] Change Archive::child_iterator for better interop with Error/Expected.Lang Hames2016-07-131-6/+11
| | | | | | | | | | | | | | | | | | | | | | | See http://reviews.llvm.org/D22079 Changes the Archive::child_begin and Archive::children to require a reference to an Error. If iterator increment fails (because the archive header is damaged) the iterator will be set to 'end()', and the error stored in the given Error&. The Error value should be checked by the user immediately after the loop. E.g.: Error Err; for (auto &C : A->children(Err)) { // Do something with archive child C. } // Check the error immediately after the loop. if (Err) return Err; Failure to check the Error will result in an abort() when the Error goes out of scope (as guaranteed by the Error class). llvm-svn: 275316
* Thread Expected<...> up from libObject’s getSymbolAddress() for symbols to ↵Kevin Enderby2016-06-241-2/+2
| | | | | | | | | | | | | | | | | | | | | allow a good error message to be produced. This is nearly the last libObject interface that used ErrorOr and the last one that appears in llvm/include/llvm/Object/MachO.h . For Mach-O objects this is just a clean up because it’s version of getSymbolAddress() can’t return an error. I will leave it to the experts on COFF and ELF to actually add meaning full error messages in their tests if they wish. And also leave it to these experts to change the last two ErrorOr interfaces in llvm/include/llvm/Object/ObjectFile.h for createCOFFObjectFile() and createELFObjectFile() if they wish. Since there are no test cases for COFF and ELF error cases with respect to getSymbolAddress() in the test suite this is no functional change (NFC). llvm-svn: 273701
* Apply another batch of fixes from clang-tidy's ↵Benjamin Kramer2016-06-171-12/+13
| | | | | | | | performance-unnecessary-value-param. Contains some manual fixes. No functionality change intended. llvm-svn: 273047
* Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith2016-06-091-1/+1
| | | | | | | looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
* [Symbolize] Check if the PE file has a PDB and emit an error if we can't load itReid Kleckner2016-06-031-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: Previously we would try to load PDBs for every PE executable we tried to symbolize. If that failed, we would fall back to DWARF. If there wasn't any DWARF, we'd print mostly useless symbol information using the export table. With this change, we only try to load PDBs for executables that claim to have them. If that fails, we can now print an error rather than falling back silently. This should make it a lot easier to diagnose and fix common symbolization issues, such as not having DIA or not having a PDB. Reviewers: zturner, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20982 llvm-svn: 271725
* Avoid some copies by using const references.Benjamin Kramer2016-05-271-7/+7
| | | | | | | clang-tidy's performance-unnecessary-copy-initialization with some manual fixes. No functional changes intended. llvm-svn: 270988
* Change llvm-objdump, llvm-nm and llvm-size when reporting an object file errorKevin Enderby2016-05-171-2/+2
| | | | | | | | | | | | | | | | | | | | | when the object is in an archive to use something like libx.a(foo.o) as part of the error message. Also changed llvm-objdump and llvm-size to be like llvm-nm and ignore non-object files in archives and not produce any error message. To do this Archive::Child::getAsBinary() was changed from ErrorOr<...> to Expected<...> then that was threaded up to its users. Converting this interface to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now the use of errorToErrorCode() is still used in one place yet to be fully converted. Again there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comments for those. llvm-svn: 269784
* [sancov] using normalized filenames for blacklist checks.Mike Aizatsky2016-04-211-9/+13
| | | | | | Differential Revision: http://reviews.llvm.org/D19395 llvm-svn: 267078
* Thread Expected<...> up from libObject’s getName() for symbols to allow ↵Kevin Enderby2016-04-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | llvm-objdump to produce a good error message. Produce another specific error message for a malformed Mach-O file when a symbol’s string index is past the end of the string table. The existing test case in test/Object/macho-invalid.test for macho-invalid-symbol-name-past-eof now reports the error with the message indicating that a symbol at a specific index has a bad sting index and that bad string index value. Again converting interfaces to Expected<> from ErrorOr<> does involve touching a number of places. Where the existing code reported the error with a string message or an error code it was converted to do the same. There is some code for this that could be factored into a routine but I would like to leave that for the code owners post-commit to do as they want for handling an llvm::Error. An example of how this could be done is shown in the diff in lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h which had a Check() routine already for std::error_code so I added one like it for llvm::Error . Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: “// TODO: Actually report errors helpfully” and a call something like consumeError(NameOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. Note there fixes needed to lld that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one. llvm-svn: 266919
* Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump ↵Kevin Enderby2016-04-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to produce a real error message Produce the first specific error message for a malformed Mach-O file describing the problem instead of the generic message for object_error::parse_failed of "Invalid data was encountered while parsing the file”.  Many more good error messages will follow after this first one. This is built on Lang Hames’ great work of adding the ’Error' class for structured error handling and threading Error through MachOObjectFile construction. And making createMachOObjectFile return Expected<...> . So to to get the error to the llvm-obdump tool, I changed the stack of these methods to also return Expected<...> : object::ObjectFile::createObjectFile() object::SymbolicFile::createSymbolicFile() object::createBinary() Then finally in ParseInputMachO() in MachODump.cpp the error can be reported and the specific error message can be printed in llvm-objdump and can be seen in the existing test case for the existing malformed binary but with the updated error message. Converting these interfaces to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now use of errorToErrorCode() and errorOrToExpected() are used where the callers are yet to be converted. Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values. So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: “// TODO: Actually report errors helpfully” and a call something like consumeError(ObjOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one. llvm-svn: 265606
* Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining ↵Duncan P. N. Exon Smith2016-04-051-50/+41
| | | | | | | | | | files; other minor fixes." This reverts commit r265454 since it broke the build. E.g.: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/ llvm-svn: 265459
* Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; ↵Eugene Zelenko2016-04-051-41/+50
| | | | | | | | | | | | other minor fixes. Some Include What You Use suggestions were used too. Use anonymous namespaces in source files. Differential revision: http://reviews.llvm.org/D18778 llvm-svn: 265454
* [sancov] renaming statistics fields.Mike Aizatsky2016-03-241-4/+4
| | | | llvm-svn: 264349
* [sancov] adding leading zeros to coverage pct.Mike Aizatsky2016-03-241-2/+18
| | | | | | | | | | Summary: Using leading zeroes allows you to search for "000%" to find non-covered items. Differential Revision: http://reviews.llvm.org/D18420 llvm-svn: 264336
* [sancov] -print-coverage-stats option to print various coverage statistics.Mike Aizatsky2016-03-241-4/+50
| | | | | | Differential Revision: http://reviews.llvm.org/D18418 llvm-svn: 264222
* [sancov] typo fixMike Aizatsky2016-03-181-2/+2
| | | | llvm-svn: 263849
* [sancov] reformat & 1 clang-tidy warning.Mike Aizatsky2016-03-181-40/+40
| | | | llvm-svn: 263846
* [sancov] html report: replacing uncovered functions with function coverage % ↵Mike Aizatsky2016-03-181-44/+69
| | | | | | | | table. Differential Revision: http://reviews.llvm.org/D18256 llvm-svn: 263767
* [sancov] using md5 for anchors in attempt to reduce file size.Mike Aizatsky2016-03-111-6/+18
| | | | | | Differential Revision: http://reviews.llvm.org/D18102 llvm-svn: 263308
* Don't crash sancov if file is unreadable.Mike Aizatsky2016-03-111-6/+10
| | | | | | | | | | | | | | | Summary: Caller can provides the list of .so files where some files are unreadable (e.g linux-vdso.so.1). It's more convenient to handler this in sancov with warning then making all callers to check files. Reviewers: aizatsky Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18103 llvm-svn: 263307
* [sancov] print_coverage_points command.Mike Aizatsky2016-02-271-0/+18
| | | | | | Differential Revision: http://reviews.llvm.org/D17670 llvm-svn: 262104
* Fix some abuse of auto flagged by clang's -Wrange-loop-analysis.Benjamin Kramer2016-02-221-1/+1
| | | | llvm-svn: 261524
* fixing msvc warning.Mike Aizatsky2016-02-201-1/+2
| | | | llvm-svn: 261396
* [sancov] sanitizer html report cosmetic improvements.Mike Aizatsky2016-02-191-15/+25
| | | | llvm-svn: 261375
* [sancov] widening default blacklist.Mike Aizatsky2016-02-191-1/+4
| | | | | | Differential Revision: http://reviews.llvm.org/D17426 llvm-svn: 261291
* [sancov] Adding covered/uncovered tables to coverage report.Mike Aizatsky2016-02-191-204/+462
| | | | | | | | | | | | | | | Summary: This change adds 3 tables to html report: - list of covered files with number of functions covered. - list of not covered files - list of not covered functions. I tried to put most coverage-calculating functionality into SourceCoverageData. Differential Revision: http://reviews.llvm.org/D17421 llvm-svn: 261287
OpenPOWER on IntegriCloud