summaryrefslogtreecommitdiffstats
path: root/llvm/tools/dsymutil
Commit message (Collapse)AuthorAgeFilesLines
...
* [dsymutil] Force mmap'ing of binariesJonas Devlieghere2018-06-211-2/+2
| | | | | | | | | | | | | | | | | | | | | After the recent refactoring that introduced parallel handling of different object, the binary holder became unique per object file. This defeats its optimization of caching archives, leading to an archive being opened for every binary it contains. This is obviously unfortunate and will need to be refactored soon. Luckily in practice, the impact of this is limited as most files are mmap'ed instead of memcopy'd. There's a caveat however: when the memory buffer requires a null terminator and it's a multiple of the page size, we allocate instead of mmap'ing. If this happens for a static archive, we end up with N copies of it in memory, where N is the number of objects in the archive, leading to exuberant memory usage. This provided a stopgap solution to ensure that all the files it loads are mmap in memory by removing the requirement for a terminating null byte. Differential revision: https://reviews.llvm.org/D48397 llvm-svn: 335293
* [DWARF] Improved error reporting for range lists. Wolfgang Pieb2018-06-201-1/+5
| | | | | | | | | | | Errors found processing the DW_AT_ranges attribute are propagated by lower level routines and reported by their callers. Reviewer: JDevlieghere Differential Revision: https://reviews.llvm.org/D48344 llvm-svn: 335188
* Refactor ExecuteAndWait to take StringRefs.Zachary Turner2018-06-121-8/+7
| | | | | | | | | | | | | | | | | | | This simplifies some code which had StringRefs to begin with, and makes other code more complicated which had const char* to begin with. In the end, I think this makes for a more idiomatic and platform agnostic API. Not all platforms launch process with null terminated c-string arrays for the environment pointer and argv, but the api was designed that way because it allowed easy pass-through for posix-based platforms. There's a little additional overhead now since on posix based platforms we'll be takign StringRefs which were constructed from null terminated strings and then copying them to null terminate them again, but from a readability and usability standpoint of the API user, I think this API signature is strictly better. llvm-svn: 334518
* [ADT] Make escaping fn conform to coding guidelinesJonas Devlieghere2018-05-311-3/+3
| | | | | | | | As noted by Adrian on llvm-commits, PrintHTMLEscaped and PrintEscaped in StringExtras did not conform to the LLVM coding guidelines. This commit rectifies that. llvm-svn: 333669
* [dsymutil] Escape HTML special characters in plist.Jonas Devlieghere2018-05-301-8/+17
| | | | | | | | | | When printing string in the Plist, we weren't escaping the characters which lead to invalid XML. This patch adds the escape logic to StringExtras. rdar://39785334 llvm-svn: 333565
* [Support] Add color cl category.Jonas Devlieghere2018-05-241-1/+1
| | | | | | | | | This commit adds a color category so tools can document this option and enables it for dwarfdump and dsymuttil. rdar://problem/40498996 llvm-svn: 333176
* MC: Change object writers to use endian::Writer. NFCI.Peter Collingbourne2018-05-211-16/+13
| | | | | | | | Part of PR37466. Differential Revision: https://reviews.llvm.org/D47040 llvm-svn: 332861
* MC: Change MCAssembler::writeSectionData and writeFragmentPadding to take a ↵Peter Collingbourne2018-05-211-1/+1
| | | | | | | | | | | | | | raw_ostream. NFCI. Also clean up a couple of hacks where we were writing the section contents to another stream by setting the object writer's stream, writing and setting it back. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47038 llvm-svn: 332858
* [DWARF] Refactor callback usage for .debug_line error handlingJames Henderson2018-05-211-1/+1
| | | | | | | | | | | Change the "recoverable" error callback to take an Error instaed of a string. Reviewed by: JDevlieghere Differential Revision: https://reviews.llvm.org/D46831 llvm-svn: 332845
* MC: Change the streamer ctors to take an object writer instead of a stream. ↵Peter Collingbourne2018-05-181-3/+4
| | | | | | | | | | | | | | NFCI. The idea is that a client that wants split dwarf would create a specific kind of object writer that creates two files, and use it to create the streamer. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47050 llvm-svn: 332749
* [DWARF] Rework debug line parsing to use llvm::Error and callbacksJames Henderson2018-05-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed by: dblaikie, JDevlieghere, espindola Differential Revision: https://reviews.llvm.org/D44560 Summary: The .debug_line parser previously reported errors by printing to stderr and return false. This is not particularly helpful for clients of the library code, as it prevents them from handling the errors in a manner based on the calling context. This change switches to using llvm::Error and callbacks to indicate what problems were detected during parsing, and has updated clients to handle the errors in a location-specific manner. In general, this means that they continue to do the same thing to external users. Below, I have outlined what the known behaviour changes are, relating to this change. There are two levels of "errors" in the new error mechanism, to broadly distinguish between different fail states of the parser, since not every failure will prevent parsing of the unit, or of subsequent unit. Malformed table errors that prevent reading the remainder of the table (reported by returning them) and other minor issues representing problems with parsing that do not prevent attempting to continue reading the table (reported by calling a specified callback funciton). The only example of this currently is when the last sequence of a unit is unterminated. However, I think it would be good to change the handling of unrecognised opcodes to report as minor issues as well, rather than just printing to the stream if --verbose is used (this would be a subsequent change however). I have substantially extended the DwarfGenerator to be able to handle custom-crafted .debug_line sections, allowing for comprehensive unit-testing of the parser code. For now, I am just adding unit tests to cover the basic error reporting, and positive cases, and do not currently intend to test every part of the parser, although the framework should be sufficient to do so at a later point. Known behaviour changes: - The dump function in DWARFContext now does not attempt to read subsequent tables when searching for a specific offset, if the unit length field of a table before the specified offset is a reserved value. - getOrParseLineTable now returns a useful Error if an invalid offset is encountered, rather than simply a nullptr. - The parse functions no longer use `WithColor::warning` directly to report errors, allowing LLD to call its own warning function. - The existing parse error messages have been updated to not specifically include "warning" in their message, allowing consumers to determine what severity the problem is. - If the line table version field appears to have a value less than 2, an informative error is returned, instead of just false. - If the line table unit length field uses a reserved value, an informative error is returned, instead of just false. - Dumping of .debug_line.dwo sections is now implemented the same as regular .debug_line sections. - Verbose dumping of .debug_line[.dwo] sections now prints the prologue, if there is a prologue error, just like non-verbose dumping. As a helper for the generator code, I have re-added emitInt64 to the AsmPrinter code. This previously existed, but was removed way back in r100296, presumably because it was dead at the time. This change also requires a change to LLD, which will be committed separately. llvm-svn: 331971
* Remove LLVM_INSTALL_CCTOOLS_SYMLINKSNico Weber2018-04-241-5/+0
| | | | | | | | | | | | | It used to symlink dsymutil to llvm-dsymutil, but after r327790 llvm's dsymutil binary is now called dsymutil without prefix. r327792 then reversed the direction of the symlink if LLVM_INSTALL_CCTOOLS_SYMLINKS was set, but that looks like a buildfix and not like something anyone should need. https://reviews.llvm.org/D45966 llvm-svn: 330727
* [Support] Add convenience functions to WithColor. NFC.Jonas Devlieghere2018-04-146-88/+57
| | | | | | | | | Create convenience functions for printing error, warning and note to stdout. Previously we had similar functions being used in dsymutil, but given that this pattern is so common it makes sense to make it available globally. llvm-svn: 330091
* Define InitLLVM to do common initialization all at once.Rui Ueyama2018-04-131-5/+3
| | | | | | | | | | | We have a few functions that virtually all command wants to run on process startup/shutdown. This patch adds InitLLVM class to do that all at once, so that we don't need to copy-n-paste boilerplate code to each llvm command's main() function. Differential Revision: https://reviews.llvm.org/D45602 llvm-svn: 330046
* Rename *CommandFlags.def to *CommandFlags.incDavid Blaikie2018-04-111-1/+1
| | | | | | | | These aren't the .def style files used in LLVM that require a macro defined before their inclusion - they're just basic non-modular includes to stamp out command line flag variables. llvm-svn: 329840
* [dsymutil] Remove trailing colon. NFCJonas Devlieghere2018-04-091-2/+2
| | | | llvm-svn: 329554
* [dsymutil] Don't try to load Swift ASTs as objects.Jonas Devlieghere2018-04-091-0/+5
| | | | | | | | | | | | | | | | With the threading refactoring, loading of object files happens before checking whether we're dealing with a swift AST. While that's not an issue per se, it causes a warning to be printed: warning: /path/to/a.swiftmodule: The file was not recognized as a valid object file note: while processing /path/to/a.swiftmodule This suppresses the warning by checking for a Swift AST before attempting to load is as an object file. rdar://39240444 llvm-svn: 329553
* [dsymutil] Don't crash on empty CUJonas Devlieghere2018-04-081-1/+15
| | | | | | Add some additional checks so we don't crash on empty compile units. llvm-svn: 329537
* [dsymutil] Apply recursion workaround for threadingJonas Devlieghere2018-04-033-13/+26
| | | | | | | | | | | | The DwarfLinker can have some very deep recursion that can max out the (significantly smaller) stack when using threads. We don't want this limitation when we only have a single thread. We already have this workaround for the architecture-related threading. This patch applies the same workaround to the parallel analysis and cloning. Differential revision: https://reviews.llvm.org/D45172 llvm-svn: 329093
* [dsymutil] Upstream emitting of papertrail warnings.Jonas Devlieghere2018-04-025-13/+113
| | | | | | | | | | When running dsymutil as part of your build system, it can be desirable for warnings to be part of the end product, rather than just being emitted to the output stream. This patch upstreams that functionality. Differential revision: https://reviews.llvm.org/D44639 llvm-svn: 328965
* [tools] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-04-013-6/+7
| | | | | | | | | | | | | | | | | | | | | | Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer the comments section in D44363 for a list of all the required patches. Reviewers: JDevlieghere, zturner, echristo, dberris, friss Reviewed By: echristo Subscribers: gbedwell, llvm-commits Differential Revision: https://reviews.llvm.org/D45141 llvm-svn: 328943
* Style update. NFC.Rafael Espindola2018-03-291-15/+15
| | | | | | | Rename 3 functions to start with lowercase letters. Don't repeat the name in the comments. llvm-svn: 328848
* typoAdrian Prantl2018-03-211-1/+1
| | | | llvm-svn: 328141
* [dsymutil] Fix add_llvm_tool_symlinkJonas Devlieghere2018-03-181-1/+1
| | | | | | | Update the arguments to add_llvm_tool_symlink to symlink llvm-dsymutil to dsymutil. llvm-svn: 327792
* [dsymutil] Rename llvm-dsymutil -> dsymutilJonas Devlieghere2018-03-183-9/+8
| | | | | | | | | | | Now that almost all functionality of Apple's dsymutil has been upstreamed, the open source variant can be used as a drop in replacement. Hence we feel it's no longer necessary to have the llvm prefix. Differential revision: https://reviews.llvm.org/D44527 llvm-svn: 327790
* [dsymutil] Print architecture in warningJonas Devlieghere2018-03-141-11/+17
| | | | | | | Make the architecture part of the warning in the DebugMapParser. This makes things consistent with the Apple's internal version of dsymutil. llvm-svn: 327485
* [dsymutil] Unify error handling outside DwarfLinker.Jonas Devlieghere2018-03-136-47/+74
| | | | | | | | This is a follow-up to r327137 where we unified error handling for the DwarfLinker. This replaces calls to errs() and outs() with the appropriate ostream wrapper everywhere in dsymutil. llvm-svn: 327411
* [dsymutil] Remove old error/warn functions. NFC.Jonas Devlieghere2018-03-131-11/+0
| | | | | | | This removes the old error and warn functions that were still present in the dwarf linker. llvm-svn: 327400
* [dsymutil] Perform analyzeContextInfo and CloneDIEs in parallelJonas Devlieghere2018-03-131-51/+117
| | | | | | | | | | | | | | | | | | This patch makes dsymutil perform analyzeContextInfo and CloneDIEs in parallel. For the same object file, there is a dependency between the two. However, we can do analyzeContextInfo for the next object file while cloning DIEs for the current. This is exactly the approach taken in this patch. For WebCore, this leads to a performance improvement of 29% and for clang we see similar results with at 32% improvement. A big thanks to Pete Cooper who came up with the original idea and the PoC. Differential revision: https://reviews.llvm.org/D43945 llvm-svn: 327399
* [dsymutil] Unbreak non-Darwin bots.Jonas Devlieghere2018-03-131-3/+3
| | | | | | BinaryHolder -> BinHolder llvm-svn: 327384
* [dsymutil] Introduce LinkContext. NFC.Jonas Devlieghere2018-03-132-219/+338
| | | | | | | | This patch introduces the LinkContext which is necessary to have dsymutil perform analysis and cloning of DIEs in parallel. As requested in D43945, I'm landing this as two separate commits. llvm-svn: 327382
* [dsymutil] Unify error handling and add colorJonas Devlieghere2018-03-092-17/+44
| | | | | | | | | We improved the handling of errors and warnings in dwarfdump's verifier in rL314498. This patch does the same thing for dsymutil. Differential revision: https://reviews.llvm.org/D44052 llvm-svn: 327137
* [dsymutil] Embed toolchain in dSYM bundleJonas Devlieghere2018-03-081-2/+11
| | | | | | | | | Allow us to embed the (Xcode) toolchain in the dSYM bundle's property list. Differential revision: https://reviews.llvm.org/D44151 llvm-svn: 326994
* [dsymutil] Move string pool into its own implementatino file. NFC.Jonas Devlieghere2018-03-014-46/+57
| | | | | | | | The DwarfLinker implementation is already relatively large with over 4k LOC. This commit moves the implementation of NonRelocatableStringpool into a separate cpp file. llvm-svn: 326425
* build: add the ability to create a symlink for dsymutilSaleem Abdulrasool2018-02-281-2/+7
| | | | | | | | | Add a `LLVM_INSTALL_CCTOOLS_SYMLINKS` to mirror `LLVM_INSTALL_BINUTILS_SYMLINKS`. For now, this allows us to create symlinks for `dsymutil` to `llvm-dsymutil`. This option is off by default, but the user can enable it. llvm-svn: 326381
* [dsymutil] Skip DW_AT_sibling attributes.Jonas Devlieghere2018-02-271-2/+3
| | | | | | | | | | Following DW_AT_sibling attributes completely defeats the pruning pass. Although clang doesn't generate the DW_AT_sibling attribute we should still handle it correctly. Differential revision: https://reviews.llvm.org/D43439 llvm-svn: 326231
* [dsymutil] Remove \brief from comments. NFCJonas Devlieghere2018-02-224-29/+23
| | | | | | | With autobrief enabled, these server no purpose anymore. Most of them were already removed but this makes everything consistent. llvm-svn: 325769
* [dsymutil] Fix typos and formatting. NFC.Jonas Devlieghere2018-02-2210-254/+238
| | | | | | | Some over-due gardening: this fixes a bunch of typos and makes the formatting consistent with LLVM's style guide. llvm-svn: 325768
* [dsymutil] Replace PATH_MAX in SmallString with fixed value.Jonas Devlieghere2018-02-221-3/+3
| | | | | | | | | | | Apparently the Windows bots don't know this define, so just going with a sensible default. Failing builds: http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc2015/builds/19179 http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/19263 llvm-svn: 325762
* [dsymutil] Be smarter in caching calls to realpathJonas Devlieghere2018-02-221-17/+44
| | | | | | | | | | | | | | | | | | | Calling realpath is expensive but necessary to perform the uniqueing in dsymutil. Although we already cached the results for every individual file in the line table, we had reports of it taking 40 seconds of a 3.5 minute link. This patch adds a second level of caching. When we do have to call realpath, we cache its result for its parents path. We didn't replace the existing caching, because it's fast (indexed) and saves us from reading the line table for entries we've already seen. For WebkitCore this results in a decrease of 11% in linking time: from 85.79 to 76.11 seconds (average over 3 runs). Differential revision: https://reviews.llvm.org/D43511 llvm-svn: 325757
* [dsymutil] Correctly handle DW_TAG_labelJonas Devlieghere2018-02-201-1/+28
| | | | | | | | | This patch contains logic for handling DW_TAG_label that's present in darwin's dsymutil implementation, but not yet upstream. Differential revision: https://reviews.llvm.org/D43438 llvm-svn: 325600
* [CodeGen] Refactor AppleAccelTablePavel Labath2018-02-191-21/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit separates the abstract accelerator table data structure from the code for writing out an on-disk representation of a specific accelerator table format. The idea is that former (now called AccelTable<T>) can be reused for the DWARF v5 accelerator tables as-is, without any further customizations. Some bits of the emission code (now living in the EmissionContext class) can be reused for DWARF v5 as well, but the subtle differences in the layout of various subtables mean the sharing is not always possible. (Also, the individual emit*** functions are fairly simple so there's a tradeoff between making a bigger general-purpose function, and two smaller targeted functions.) Another advantage of this setup is that more of the serialization logic can be hidden in the .cpp file -- I have moved declarations of the header and all the emission functions there. Reviewers: JDevlieghere, aprantl, probinson, dblaikie Subscribers: echristo, clayborg, vleschuk, llvm-commits Differential Revision: https://reviews.llvm.org/D43285 llvm-svn: 325516
* [dsymutil] Use llvm::sys::path to join bundle path.Jonas Devlieghere2018-02-081-3/+4
| | | | | | | | When processing a dSYM bundle, use llvm::sys::path to join the different path components instead of using a string with hard coded forward slashes as separators. llvm-svn: 324622
* Re-land [dsymutil] Upstream update featureJonas Devlieghere2018-02-084-44/+281
| | | | | | | | | | This commit attempts to re-land the r324480 which was reverted in r324493 because it broke the Windows bots. For now I disabled the two update tests on Windows until I'm able to debug this. Differential revision: https://reviews.llvm.org/D42880 llvm-svn: 324592
* Revert dsymutil -update commitsJonas Devlieghere2018-02-074-281/+44
| | | | | | | Revert "[dsymutil][test] Check the updated dSYM instead of companion file." Revert "[dsymutil] Upstream update feature." llvm-svn: 324493
* [dsymutil] Upstream update feature.Jonas Devlieghere2018-02-074-44/+281
| | | | | | | | | | | Now that dsymutil can generate accelerator tables, we can upstream the update logic that, as the name implies, updates the accelerator tables in an existing dSYM bundle. In combination with `-minimize` this can be used to remove redundant .debug_(inlines|pubtypes|pubnames). Differential revision: https://reviews.llvm.org/D42880 llvm-svn: 324480
* [NFC] 'DWARFv5' -> 'DWARF v5'Jonas Devlieghere2018-02-011-1/+1
| | | | llvm-svn: 323950
* [dsymutil] Enable -minimize feature.Jonas Devlieghere2018-01-301-0/+10
| | | | | | | | | | | | | Passing -minimize to dsymutil prevents the emission of .debug_inlines, .debug_pubnames, and .debug_pubtypes in favor of the Apple accelerator tables. The actual check in the DWARF linker was added in r323655. This patch simply enables it. Differential revision: https://reviews.llvm.org/D42688 llvm-svn: 323812
* [DWARFv5] Re-enable dumping a line table with no CU.Paul Robinson2018-01-291-1/+1
| | | | | | | | | | | r323476 added support for DW_FORM_line_strp, and incorrectly made that depend on having a DWARFUnit available. We shouldn't be tracking .debug_line_str in DWARFUnit after all. After this patch, I can do an NFC follow up and undo a bunch of the "plumbing" part of r323476. Differential Revision: https://reviews.llvm.org/D42609 llvm-svn: 323691
* [dsymutil] Generate Apple accelerator tablesJonas Devlieghere2018-01-292-48/+321
| | | | | | | | | | | This patch adds support for generating accelerator tables in dsymutil. This feature was already present in our internal repository but not yet upstreamed because it requires changes to the Apple accelerator table implementation. Differential revision: https://reviews.llvm.org/D42501 llvm-svn: 323655
OpenPOWER on IntegriCloud