summaryrefslogtreecommitdiffstats
path: root/llvm/tools/dsymutil
Commit message (Collapse)AuthorAgeFilesLines
...
* [Object] Change object::SectionRef::getContents() to return Expected<StringRef>Fangrui Song2019-05-162-7/+13
| | | | | | | | Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. Follow-up of D61781. llvm-svn: 360876
* [dsymutil] Put Swift interface files into a per-arch subdirectory.Adrian Prantl2019-04-231-1/+1
| | | | | | | | | This was meant to be part of the original commit r358921, but somehow got lost. <rdar://problem/49751748> llvm-svn: 359010
* [dsymutil] Fix use-after-free when sys::path::append grows the buffer.Adrian Prantl2019-04-231-2/+2
| | | | | | <rdar://problem/50117620> llvm-svn: 359003
* Revert "[dsymutil] Fix use-after-free when sys::path::append grows the buffer."Adrian Prantl2019-04-231-1/+1
| | | | llvm-svn: 359002
* [dsymutil] Fix use-after-free when sys::path::append grows the buffer.Adrian Prantl2019-04-231-1/+1
| | | | | | <rdar://problem/50117620> llvm-svn: 359001
* Fully qualify llvm::Optional, some compilers complain otherwise.Adrian Prantl2019-04-221-3/+4
| | | | llvm-svn: 358933
* Try to work around compile errors with older versions of GCC.Adrian Prantl2019-04-221-6/+10
| | | | llvm-svn: 358927
* [dsymutil] Collect parseable Swift interfaces in the .dSYM bundle.Adrian Prantl2019-04-226-49/+175
| | | | | | | | | | | | | | | | | | When a Swift module built with debug info imports a library without debug info from a textual interface, the textual interface is necessary to reconstruct types defined in the library's interface. By recording the Swift interface files in DWARF dsymutil can collect them and LLDB can find them. This patch teaches dsymutil to look for DW_TAG_imported_modules and records all references to parseable Swift ingterfrace files and copies them to a.out.dSYM/Contents/Resources/<Arch>/<ModuleName>.swiftinterface <rdar://problem/49751748> llvm-svn: 358921
* [dsymutil] DwarfLinker: delete unused parameterFangrui Song2019-04-191-7/+6
| | | | llvm-svn: 358762
* Revert "[DWARFFormValue] Cleanup DWARFFormValue interface. (2/2) (NFC)"Vlad Tsyrklevich2019-03-021-6/+4
| | | | | | This reverts commit r355233, it was causing UBSan failures. llvm-svn: 355255
* [DWARFFormValue] Cleanup DWARFFormValue interface. (2/2) (NFC)Jonas Devlieghere2019-03-011-4/+6
| | | | | | | Continues the work started in r354941. Changes (all but one) uses of the extractValue to static createFromData. llvm-svn: 355233
* dsymutil support for DW_OP_convertAdrian Prantl2019-02-284-48/+160
| | | | | | | | | | | Add support for cloning DWARF expressions that contain base type DIE references in dsymutil. <rdar://problem/48167812> Differential Revision: https://reviews.llvm.org/D58534 llvm-svn: 355148
* [dsymutil] Use rfind for paths with parenthesesJonas Devlieghere2019-02-281-1/+1
| | | | | | | | Dsymutil gets library member information is through the ambiguous /path/to/archive.a(member.o). The current logic we use would get confused by additional parentheses. Using rfind mitigates this issue. llvm-svn: 355114
* [DebugInfo] add SectionedAddress to DebugInfo interfaces.Alexey Lapshin2019-02-272-14/+14
| | | | | | | | | | | | | | | | | That patch is the fix for https://bugs.llvm.org/show_bug.cgi?id=40703 "wrong line number info for obj file compiled with -ffunction-sections" bug. The problem happened with only .o files. If object file contains several .text sections then line number information showed incorrectly. The reason for this is that DwarfLineTable could not detect section which corresponds to specified address(because address is the local to the section). And as the result it could not select proper sequence in the line table. The fix is to pass SectionIndex with the address. So that it would be possible to differentiate addresses from various sections. With this fix llvm-objdump shows correct line numbers for disassembled code. Differential review: https://reviews.llvm.org/D58194 llvm-svn: 354972
* [dsymutil] Improve readability of cloneAllCompileUnits (NFC)Jonas Devlieghere2019-02-131-5/+13
| | | | | | Add some newlines and improve consistency between the two loops. llvm-svn: 353904
* [dsymutil] Don't clone empty CUsJonas Devlieghere2019-02-132-9/+8
| | | | | | | | | | | | | | | The DWARF standard says that an empty compile unit is not valid: > Each such contribution consists of a compilation unit header (see > Section 7.5.1.1 on page 200) followed by a single DW_TAG_compile_unit or > DW_TAG_partial_unit debugging information entry, together with its > children. Therefore we shouldn't clone them in dsymutil. Differential revision: https://reviews.llvm.org/D57979 llvm-svn: 353903
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1925-100/+75
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [dsymutil] Fix assertion triggered by empty address range.Jonas Devlieghere2019-01-081-1/+5
| | | | | | | | | An assertion was hit when running dsymutil on a gcc generated binary that contained an empty address range. Address ranges are stored in an interval map of half open intervals. Since the interval is empty and therefore meaningless, we simply don't add it to the map. llvm-svn: 350591
* [dsymutil] Upstream unobfuscation logic.Jonas Devlieghere2019-01-0714-28/+388
| | | | | | | | | | The unobufscation support for BCSymbolMaps was the last piece of code that hasn't been upstreamed yet. This patch contains a reworked version of the existing code and relevant tests. Differential revision: https://reviews.llvm.org/D56346 llvm-svn: 350580
* [dsymutil] Ensure we're comparing time stamps with the same precision.Jonas Devlieghere2018-12-041-9/+14
| | | | | | | | | After TimePoint's precision was increased in LLVM we started seeing failures because the modification times didn't match. This adds a time cast to ensure that we're comparing TimePoints with the same amount of precision. llvm-svn: 348283
* [dsymutil] Gather global and local symbol addresses in the main executable.Jonas Devlieghere2018-11-301-7/+13
| | | | | | | | | | | | | | | | | | | | | | Usually local symbols will have their address described in the debug map. Global symbols have to have their address looked up in the symbol table of the main executable. By playing with 'ld -r' and export lists, you can get a symbol described as global by the debug map while actually being a local symbol as far as the link in concerned. By gathering the address of local symbols, we fix this issue. Also, we prefer a global symbol in case of a name collision to preserve the previous behavior. Note that using the 'ld -r' tricks, people can actually cause symbol names collisions that dsymutil has no way to figure out. This fixes the simple case where there is only one symbol of a given name. rdar://problem/32826621 Differential revision: https://reviews.llvm.org/D54922 llvm-svn: 348021
* Make dsymutil more robust when parsing load commands.Adrian Prantl2018-11-131-14/+19
| | | | | | rdar://problem/45883463 llvm-svn: 346815
* [dsymutil] Copy the LC_BUILD_VERSION load command into the companion binary.Adrian Prantl2018-11-081-14/+29
| | | | | | | | | | | | | LC_BUILD_VERSION contains platform information that is useful for LLDB to match up dSYM bundles with binaries. This patch copies the load command over into the dSYM. rdar://problem/44145175 rdar://problem/45883463 Differential Revision: https://reviews.llvm.org/D54233 llvm-svn: 346412
* [DWARF] Revert r345546: Refactor range list extraction and dumpingWolfgang Pieb2018-10-313-23/+23
| | | | | | This patch caused some internal tests to break which are being investigated. llvm-svn: 345687
* [DWARF][NFC] Refactor range list extraction and dumpingWolfgang Pieb2018-10-293-23/+23
| | | | | | | | | | | | | | | | | The purpose of this patch is twofold: - Fold pre-DWARF v5 functionality into v5 to eliminate the need for 2 different versions of range list handling. We get rid of DWARFDebugRangelist{.cpp,.h}. - Templatize the handling of range list tables so that location list handling can take advantage of it as well. Location list and range list tables have the same basic layout. A non-NFC version of this patch was previously submitted with r342218, but it caused errors with some TSan tests. This patch has no functional changes. The difference to the non-NFC patch is that there are no changes to rangelist dumping in this patch. Differential Revision: https://reviews.llvm.org/D53545 llvm-svn: 345546
* [dsymutil] Improve error reporting when we cannot create output file.Jonas Devlieghere2018-10-231-31/+42
| | | | | | | | | Before this patch we were returning an empty string in case we couldn't create the output file. Now we return an expected string so we can return and print the proper issue. We now return errors instead of bools and defer printing to the call site. llvm-svn: 344983
* Use the container form llvm::sort(C, ...)Fangrui Song2018-09-302-8/+7
| | | | | | | There are a few leftovers in rL343163 which span two lines. This commit changes these llvm::sort(C.begin(), C.end, ...) to llvm::sort(C, ...) llvm-svn: 343426
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-272-2/+2
| | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: dblaikie, javed.absar, JDevlieghere, andreadb Subscribers: MatzeB, sanjoy, arsenm, dschuff, mehdi_amini, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, javed.absar, gbedwell, jrtc27, mgrang, atanasyan, steven_wu, george.burgess.iv, dexonsmith, kristina, jsji, llvm-commits Differential Revision: https://reviews.llvm.org/D52573 llvm-svn: 343163
* Revert "[DWARF] reposting r342048, which was reverted in r342056 due to ↵Alexander Kornienko2018-09-173-23/+23
| | | | | | | | | buildbot errors. Adjusted 2 test cases for ARM and darwin and fixed a bug with the original change in dsymutil." This reverts commit r342218. Due to a number of failures under TSAN. An isolated test case is being worked on. llvm-svn: 342399
* [DWARF] reposting r342048, which was reverted in r342056 due to buildbot Wolfgang Pieb2018-09-143-23/+23
| | | | | | | | errors. Adjusted 2 test cases for ARM and darwin and fixed a bug with the original change in dsymutil. llvm-svn: 342218
* Reverting r342048, which caused UBSan failures in dsymutil.Wolfgang Pieb2018-09-123-20/+20
| | | | llvm-svn: 342056
* [DWARF] Refactoring range list dumping to fold DWARF v4 functionality into ↵Wolfgang Pieb2018-09-123-20/+20
| | | | | | | | | | | | | v5 handling Eliminating some duplication of rangelist dumping code at the expense of some version-dependent code in dump and extract routines. Reviewer: dblaikie, JDevlieghere, vleschuk Differential revision: https://reviews.llvm.org/D51081 llvm-svn: 342048
* [dsymutil] Prevent non-determinism due to threading.Jonas Devlieghere2018-09-072-20/+37
| | | | | | | | | | | | | | | | | | Before this patch, analyzeContext called getCanonicalDIEOffset(), for which the result depends on the timings of the setCanonicalDIEOffset() calls in the cloneLambda. This can lead to slightly different output between runs due to threading. To prevent this from happening, we now record the output debug info size after importing the modules (before any concurrent processing takes place). This value, named the ModulesEndOffset is used to compare the canonical DIE offset against. If the value is greater than this offset, the canonical DIE offset has been updated during cloning, and should therefore not be considered for pruning. Differential revision: https://reviews.llvm.org/D51443 llvm-svn: 341649
* [dsymutil] Reduce peak memory usage for the single threaded execution.Jonas Devlieghere2018-09-061-95/+105
| | | | | | | | | | | | | | | | | | | Keeping the compile units in memory is expensive. For the single threaded case we allocate them in the analyze part and deallocate them again once we've finished cloning. This poses a problem in the single threaded case where we did all the analysis first followed by all the cloning. This meant we had all the link context in memory right after analyzing finished. This patch changes the way we order work in the single threaded case. Instead of doing all the analysis and cloning in serial, we now interleave the two so we can deallocate the memory as soon as a file is processed. The result is binary identical and peak memory usage went down from 13.43GB to 5.73GB for a debug build of trunk clang. Differential revision: https://reviews.llvm.org/D51618 llvm-svn: 341568
* Add header guards to some headers that are missing themArgyrios Kyrtzidis2018-09-034-9/+14
| | | | | | | Also adjust some of dsymutil's headers to put the header guards at the top, otherwise the compiler will not recognize them as header guards. llvm-svn: 341323
* dsymutil: Avoid pruning non-type forward declarations inside DW_TAG_moduleAdrian Prantl2018-08-301-35/+36
| | | | | | | | | | | | | | | | forward declarations. Especially with template instantiations, there are legitimate reasons why for declarations might be emitted into a DW_TAG_module skeleton / forward-declaration sub-tree, that are not forward declarations in the sense of that there is a more complete definition over in a .pcm file. The example in the testcase is a constant DW_TAG_member of a DW_TAG_class template instatiation. rdar://problem/43623196 llvm-svn: 341123
* Reduce the memory footprint of dsymutil. (NFC)Adrian Prantl2018-08-242-29/+43
| | | | | | | | | | | | | | | | | | This (partially) fixes a regression introduced by https://reviews.llvm.org/D43945 / r327399, which parallelized DwarfLinker. This patch avoids parsing and allocating the memory for all input DIEs up front and instead only allocates them in the concurrent loop in the AnalyzeLambda. At the end of the loop the memory from the LinkContext is cleared again. This reduces the peak memory needed to link the debug info of a non-modular build of the Swift compiler by >3GB. rdar://problem/43444464 Differential Revision: https://reviews.llvm.org/D51078 llvm-svn: 340650
* [DWARF] Unify warning callbacks. NFC.Victor Leschuk2018-08-231-2/+2
| | | | | | | | | | | | | | | | | Both DWARFDebugLine and DWARFDebugAddr used the same callback mechanism for handling recoverable errors. They both implemented similar warn() function to be used as such callbacks. In this revision we get rid of code duplication and move this warn() function to DWARFContext as DWARFContext::dumpWarning(). Reviewers: lhames, jhenderson, aprantl, probinson, dblaikie, JDevlieghere Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D51033 llvm-svn: 340528
* [DebugInfo] Reduce debug_str_offsets section sizePavel Labath2018-08-074-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The accelerator tables use the debug_str section to store their strings. However, they do not support the indirect method of access that is available for the debug_info section (DW_FORM_strx et al.). Currently our code is assuming that all strings can/will be referenced indirectly, and puts all of them into the debug_str_offsets section. This is generally true for regular (unsplit) dwarf, but in the DWO case, most of the strings in the debug_str section will only be used from the accelerator tables. Therefore the contents of the debug_str_offsets section will be largely unused and bloating the main executable. This patch rectifies this by teaching the DwarfStringPool to differentiate between strings accessed directly and indirectly. When a user inserts a string into the pool it has to declare whether that string will be referenced directly or not. If at least one user requsts indirect access, that string will be assigned an index ID and put into debug_str_offsets table. Otherwise, the offset table is skipped. This approach reduces the overall binary size (when compiled with -gdwarf-5 -gsplit-dwarf) in my tests by about 2% (debug_str_offsets is shrunk by 99%). Reviewers: probinson, dblaikie, JDevlieghere Subscribers: aprantl, mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D49493 llvm-svn: 339122
* [dsymutil] Convert recursion in lookForDIEsToKeep into worklist.Jonas Devlieghere2018-08-012-48/+114
| | | | | | | | | | | | | | | | | | | | The functions `lookForDIEsToKeep` and `keepDIEAndDependencies` can have some very deep recursion. This tackles part of this problem by removing the recursion from `lookForDIEsToKeep` by turning it into a worklist. The difficulty in doing so is the computation of incompleteness, which depends on the incompleteness of its children. To compute this, we insert "continuation markers" into the worklist. This informs the work loop to (re)compute the incompleteness property of the DIE associated with it (i.e. the parent of the previously processed DIE). This patch should generate byte-identical output. Unfortunately it also has some impact of performance, regressing by about 4% when processing clang on my machine. Differential revision: https://reviews.llvm.org/D48899 llvm-svn: 338536
* [dsymutil] Simplify temporary file handling.Jonas Devlieghere2018-07-293-46/+53
| | | | | | | | | | | Dsymutil's update functionality was broken on Windows because we tried to rename a file while we're holding open handles to that file. TempFile provides a solution for this through its keep(Twine) method. This patch changes dsymutil to make use of that functionality. Differential revision: https://reviews.llvm.org/D49860 llvm-svn: 338216
* [dsymutil] Add support for generating DWARF5 accelerator tables.Jonas Devlieghere2018-07-256-23/+165
| | | | | | | | | | | | | | | | | | This patch add support for emitting DWARF5 accelerator tables (.debug_names) from dsymutil. Just as with the Apple style accelerator tables, it's possible to update existing dSYMs. This patch includes a test that show how you can convert back and forth between the two types. If no kind of table is specified, dsymutil will default to generating Apple-style accelerator tables whenever it finds those in its input. The same is true when there are no accelerator tables at all. Finally, in the remaining case, where there's at least one DWARF v5 table and no Apple ones, the output will contains a DWARF accelerator tables (.debug_names). Differential revision: https://reviews.llvm.org/D49137 llvm-svn: 337980
* [MC] Add interface to finish pending labels.Jonas Devlieghere2018-07-101-1/+3
| | | | | | | | | | | When manually finishing the object writer in dsymutil, it's possible that there are pending labels that haven't been resolved. This results in an assertion when the assembler tries to fixup a label that doesn't have an address yet. Differential revision: https://reviews.llvm.org/D49131 llvm-svn: 336688
* [dsymutil] Add support for outputting assemblyJonas Devlieghere2018-07-095-17/+51
| | | | | | | | | | | | | When implementing the DWARF accelerator tables in dsymutil I ran into an assertion in the assembler. Debugging these kind of issues is a lot easier when looking at the assembly instead of debugging the assembler itself. Since it's only a matter of creating an AsmStreamer instead of a MCObjectStreamer it made sense to turn this into a (hidden) dsymutil feature. Differential revision: https://reviews.llvm.org/D49079 llvm-svn: 336561
* [dsymutil] Emit label at the begin of a CUJonas Devlieghere2018-07-062-0/+9
| | | | | | | | When emitting a CU, store the MCSymbol pointing to the beginning of the CU. We'll need this information later when emitting the .debug_names section (DWARF5 accelerator table). llvm-svn: 336433
* [dsymutil] Rename conflicting declarationJonas Devlieghere2018-06-292-9/+9
| | | | | | | Using MemoryBuffer as member name clashed with the llvm::MemoryBuffer class. llvm-svn: 335995
* [dsymutil] Make the CachedBinaryHolder the defaultJonas Devlieghere2018-06-299-377/+120
| | | | | | | | Replaces all uses of the old binary holder with its cached variant. Differential revision: https://reviews.llvm.org/D48770 llvm-svn: 335991
* [dsymutil] Introduce a new CachedBinaryHolderJonas Devlieghere2018-06-296-32/+409
| | | | | | | | | | | | | | | | | | | | | | | | The original binary holder has an optimization where it caches a static library (archive) between consecutive calls to GetObjects. However, the actual memory buffer wasn't cached between calls. This made sense when dsymutil was processing objects one after each other, but when processing them in parallel, several binaries have to be in memory at the same time. For this reason, every link context contained a binary holder. Having one binary holder per context is problematic, because the same static archive was cached for every object file. Luckily, when the file is mmap'ed, this was only costing us virtual memory. This patch introduces a new BinaryHolder variant that is fully cached, for all the object files it load, as well as the static archives. This way, we don't have to give up on this optimization of bypassing the file system. Differential revision: https://reviews.llvm.org/D48501 llvm-svn: 335990
* [dsymutil] Use UnitListTy consistently (NFC)Jonas Devlieghere2018-06-282-18/+15
| | | | | | | Use the UnitListTy typedef consistently throughout the Dwarf linker and pass it by const reference where possible. llvm-svn: 335860
* [dsymutil] Move abstractions into separate files (NFC)Jonas Devlieghere2018-06-2717-2020/+2225
| | | | | | | | | | | This patch splits off some abstractions used by dsymutil's dwarf linker and moves them into separate header and implementation files. This almost halves the number of LOC in DwarfLinker.cpp and makes it a lot easier to understand what functionality lives where. Differential revision: https://reviews.llvm.org/D48647 llvm-svn: 335749
OpenPOWER on IntegriCloud