summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwarfdump
Commit message (Collapse)AuthorAgeFilesLines
...
* [DWARF] Improved error reporting for range lists. Wolfgang Pieb2018-06-201-3/+15
| | | | | | | | | | | 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
* Fix "Optional" is ambiguous error on some botsPavel Labath2018-06-131-1/+1
| | | | llvm-svn: 334580
* [DWARF/AccelTable] Remove getDIESectionOffset for DWARF v5 entriesPavel Labath2018-06-131-16/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This method was not correct for entries in DWO files as it assumed it could just add up the CU and DIE offsets to get the absolute DIE offset. This is not correct for the DWO files, as here the CU offset will reference the skeleton unit, whereas the DIE offset will be the offset in the full unit in the DWO file. Unfortunately, this means that we are not able to determine the absolute DIE offset using the information in the .debug_names section alone, which means we have to offload some of this work to the users of this class. To demonstrate how this can be done, I've added/fixed the ability to lookup entries using accelerator tables in DWO files in llvm-dwarfdump. To make this happen, I've needed to make two extra changes in other classes: - made the DWARFContext method to lookup a CU based on the section offset public. I've needed this functionality to lookup a CU, and this seems like a useful thing in general. - made DWARFUnit::getDWOId call extractDIEsIfNeeded. Before this, the DWOId was filled in only if the root DIE happened to be parsed before we called the accessor. Since the lazy parsing is supposed to happen under the hood, calling extractDIEsIfNeeded seems appropriate. Reviewers: JDevlieghere, aprantl, dblaikie Subscribers: mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D48009 llvm-svn: 334578
* DWARFAcceleratorTable: fix equal_range iteratorsPavel Labath2018-05-311-25/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Both (Apple and DWARF5) implementations of the iterators had bugs which resulted in crashes if one attempted to iterate through the accelerator tables all the way. For the Apple tables, the issue was that we did not clear the DataOffset field when we reached the end, which made our iterator compare unequal to the "end" iterator. For the Dwarf5 tables, the problem was that we incremented the CurrentIndex pointer and then used the incremented (possibly invalid) pointer to check whether we have reached the end of the index list. The reason these bugs went undetected is because their only user (dwarfdump) only ever searched for the first match. Besides allowing us to test this fix, changing llvm-dwarfdump --find to display all matches seems like a good improvement (it makes the behavior consistent with the --name option), so I change llvm-dwarfdump to do that. The existing tests would be sufficient to test this fix with the new llvm-dwarfdump behavior, but I add a special test that demonstrates that the tool indeed displays multiple results. The find.test test needed to be tweaked a bit as the tool now does not print the ".debug_info contents" header (also consistent with how --name works). Reviewers: JDevlieghere, aprantl, dblaikie Subscribers: mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D47543 llvm-svn: 333635
* [Support] Add color cl category.Jonas Devlieghere2018-05-241-1/+2
| | | | | | | | | 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
* Rename DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-141-7/+8
| | | | | | | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM - Manual change to APInt - Manually chage DOCS as regex doesn't match it. In the transition period the DEBUG() macro is still present and aliased to the LLVM_DEBUG() one. Differential Revision: https://reviews.llvm.org/D43624 llvm-svn: 332240
* [DebugInfo] Accept `S` in augmentation strings in CIE.Fangrui Song2018-05-081-1/+1
| | | | | | glibc libc.a(sigaction.o) compiled from sysdeps/unix/sysv/linux/x86_64/sigaction.c uses "zRS". llvm-svn: 331738
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-011-1/+1
| | | | | | | | | | | | | | | | We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
* Define InitLLVM to do common initialization all at once.Rui Ueyama2018-04-131-7/+2
| | | | | | | | | | | 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
* [DebugInfo/AccelTable] Fix inconsistency in getDIEOffset implementationsPavel Labath2018-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Even though the getDIEOffset offset function was common for the two accelerator table implementations, it was doing two different things: for the Apple tables, it was returning the die offset relative to the start of the section, whereas for DWARF v5 tables, it was relative to the start of the CU. I resolve this by renaming the function to getDIESectionOffset to make it obvious what the function returns, and change the DWARF implementation to return the section offset. I also keep the CU-relative accessor, but only in the DWARF implementation (there is no way to get this information for the Apple tables). This was not caught by existing tests because the hand-written inputs also erroneously used section offsets instead of CU-relative ones. While looking at this, I noticed that the Apple implementation was not fully correct either -- the header contains a DIEOffsetBase field, which should be added to offsets encoded with the DW_FORM_ref*** family, but this was not being used. This went unnoticed because all current writers set this field to zero anyway. I fix this as well and add a hand-written test which demonstrates the issue. Reviewers: JDevlieghere, dblaikie Subscribers: aprantl, llvm-commits Differential Revision: https://reviews.llvm.org/D44202 llvm-svn: 327116
* Fix build breakage from r326003Pavel Labath2018-02-241-2/+2
| | | | | | | | | | - an ambiguous reference to Optional<T> in llvm-dwarfdump.cpp (fixed with an explicit prefix). - a missing base class initialization in Entry copy constructor (fixed by using the implicitly default constructor, which is possible after some changes which were done during review). llvm-svn: 326006
* Implement equal_range for the DWARF v5 accelerator tablePavel Labath2018-02-241-12/+14
| | | | | | | | | | | | | | | | | | | Summary: This patch implements the name lookup functionality of the .debug_names accelerator table and hooks it up to "llvm-dwarfdump -find". To make the interface of the two kinds of accelerator tables more consistent, I've created an abstract "DWARFAcceleratorTable::Entry" class, which provides a consistent interface to access the common functionality of the table entries (such as getting the die offset, die tag, etc.). I've also modified the apple table to vend entries conforming to this interface. Reviewers: JDevlieghere, aprantl, probinson, dblaikie Subscribers: vleschuk, clayborg, echristo, llvm-commits Differential Revision: https://reviews.llvm.org/D43067 llvm-svn: 326003
* [dwarfdump] Normalize input path.Jonas Devlieghere2018-02-081-0/+2
| | | | | | | | | Before this patch, llvm-dwarfdump would reject `bundel.dSYM/` as input, while `bundel.dSYM` was accepted. The reason is that `path::extension()` returns an empty string for the former, leading to the argument not being recognized as a dSYM bundle. llvm-svn: 324621
* [DebugInfo] Basic .debug_names dumping supportPavel Labath2018-01-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit renames DWARFAcceleratorTable to AppleAcceleratorTable to free up the first name as an interface for the different accelerator tables. Then I add a DWARFDebugNames class for the dwarf5 table. Presently, the only common functionality of the two classes is the dump() method, because this is the only method that was necessary to implement dwarfdump -debug-names; and because the rest of the AppleAcceleratorTable interface does not directly transfer to the dwarf5 tables (the main reason for that is that the present interface assumes the tables are homogeneous, but the dwarf5 tables can have different keys associated with each entry). I expect to make the common interface richer as I add more functionality to the new class (and invent a way to represent it in generic way). In terms of sharing the implementation, I found the format of the two tables sufficiently different to frustrate any attempts to have common parsing or dumping code, so presently the implementations share just low level code for formatting dwarf constants. Reviewers: vleschuk, JDevlieghere, clayborg, aprantl, probinson, echristo, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42297 llvm-svn: 323638
* Rename DwarfAcceleratorTable to AppleAcceleratorTable. NFCPavel Labath2018-01-221-1/+1
| | | | | | | | | This frees up the first name to be used as an base class for the apple table and the dwarf5 .debug_names accel table. The rename was split off from D42297 (adding of debug_names support), which is still under review. llvm-svn: 323113
* [dwarfdump] Lookup needs to be an unsigned long long parameter.Jonas Devlieghere2017-12-191-2/+1
| | | | | | | | | | | Before this patch, dwarfdump's lookup parameter only accepts unsigned. Given that for many current platforms the load address already exceeds unsigned (e.g. arm64 w/ 0x100000000), dwarfdump needs an unsigned long long parameter. Patch by: Dr. Michael 'Mickey' Lauer <mickey@vanille-media.de> llvm-svn: 321064
* Remove redundant includes from tools.Michael Zolotukhin2017-12-131-5/+0
| | | | llvm-svn: 320631
* dwarfdump: Add support for the --diff option.Adrian Prantl2017-12-081-0/+5
| | | | | | | | | --diff Emit the output in a diff-friendly way by omitting offsets and addresses. <rdar://problem/34502625> llvm-svn: 320214
* llvm-dwarfdump: honor the --show-children option when dumping a specific DIE.Adrian Prantl2017-11-291-1/+8
| | | | llvm-svn: 319271
* Re-land "[dwarfdump] Add -lookup option"Jonas Devlieghere2017-10-251-1/+33
| | | | | | | | | Add the option to lookup an address in the debug information and print out the file, function, block and line table details. Differential revision: https://reviews.llvm.org/D38409 llvm-svn: 316619
* Unify spelling.Adrian Prantl2017-10-061-16/+16
| | | | llvm-svn: 315102
* llvm-dwarfdump: Add an option to collect debug info quality metrics.Adrian Prantl2017-10-063-1/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the last LLVM dev meeting we had a debug info for optimized code BoF session. In that session I presented some graphs that showed how the quality of the debug info produced by LLVM changed over the last couple of years. This is a cleaned up version of the patch I used to collect the this data. It is implemented as an extension of llvm-dwarfdump, adding a new --statistics option. The intended use-case is to automatically run this on the debug info produced by, e.g., our bots, to identify eyebrow-raising changes or regressions introduced by new transformations that we could act on. In the current form, two kinds of data are being collected: - The number of variables that have a debug location versus the number of variables in total (this takes into account inlined instances of the same function, so if a variable is completely missing form only one instance it will be found). - The PC range covered by variable location descriptions versus the PC range of all variables' containing lexical scopes. The output format is versioned and extensible, so I'm looking forward to both bug fixes and ideas for other data that would be interesting to track. Differential Revision: https://reviews.llvm.org/D36627 llvm-svn: 315101
* llvm-dwarfdump: implement the --regex option in combination with --name.Adrian Prantl2017-10-031-8/+30
| | | | llvm-svn: 314855
* Revert r314817 "[dwarfdump] Add -lookup option"Hans Wennborg2017-10-031-36/+5
| | | | | | | | | | | | | | | | | The test fails on Linux; see follow-up email on the llvm-commits list. > Add the option to lookup an address in the debug information and print > out the file, function, block and line table details. > > Differential revision: https://reviews.llvm.org/D38409 This also reverts the follow-up r314818: > [test] Fix llvm-dwarfdump/cmdline.test > > Fixes test/tools/llvm-dwarfdump/cmdline.test llvm-svn: 314825
* [dwarfdump] Add -lookup optionJonas Devlieghere2017-10-031-5/+36
| | | | | | | | | Add the option to lookup an address in the debug information and print out the file, function, block and line table details. Differential revision: https://reviews.llvm.org/D38409 llvm-svn: 314817
* llvm-dwarfdump: support the --ignore-case option.Adrian Prantl2017-10-021-3/+12
| | | | llvm-svn: 314723
* [dwarfdump] Add -show-formJonas Devlieghere2017-10-021-3/+10
| | | | | | | | | This enables printing of DWARF form types after the DWARF attribute types. Differential revision: https://reviews.llvm.org/D38459 llvm-svn: 314685
* typosAdrian Prantl2017-09-301-3/+3
| | | | llvm-svn: 314577
* llvm-dwarfdump: implement the --name lookup option.Adrian Prantl2017-09-301-9/+39
| | | | llvm-svn: 314576
* Add commentsAdrian Prantl2017-09-301-0/+5
| | | | llvm-svn: 314574
* llvm-dwarfdump: support .apple-namespaces in --findAdrian Prantl2017-09-291-0/+2
| | | | llvm-svn: 314481
* llvm-dwarfdump: add support for .apple_types in --findAdrian Prantl2017-09-291-5/+14
| | | | llvm-svn: 314479
* try and appease gccAdrian Prantl2017-09-281-1/+1
| | | | llvm-svn: 314442
* llvm-dwarfdump: implement --find for .apple_namesAdrian Prantl2017-09-281-1/+24
| | | | | | | | | | | | This patch implements the dwarfdump option --find=<name>. This option looks for a DIE in the accelerator tables and dumps it if found. This initial patch only adds support for .apple_names to keep the review small, adding the other sections and pubnames support should be trivial though. Differential Revision: https://reviews.llvm.org/D38282 llvm-svn: 314439
* Commit missing fixes for tool_file_renameReid Kleckner2017-09-231-2/+2
| | | | llvm-svn: 314051
* [dwarfdump] Fix ambiguous call to make_uniqueJonas Devlieghere2017-09-221-2/+2
| | | | | | | | Fix buildbot failures: - http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc2015/builds/13153 - http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/13566 llvm-svn: 313971
* [dwarfdump] Add support for redirecting output to a fileJonas Devlieghere2017-09-221-24/+44
| | | | | | | | | This patch adds the -o and --out-file options for compatibility with Darwin's dwarfdump. Differential revision: https://reviews.llvm.org/D38125 llvm-svn: 313969
* llvm-dwarfdump: Add support for the --arch command line option.Adrian Prantl2017-09-211-16/+57
| | | | llvm-svn: 313888
* llvm-dwarfdump: move -eh-frame into the right section in the help output.Adrian Prantl2017-09-201-1/+1
| | | | llvm-svn: 313836
* llvm-dwarfdump: implement --recurse-depth=<N>Adrian Prantl2017-09-201-0/+11
| | | | | | | | | | This patch implements the Darwin dwarfdump option --recurse-depth=<N>, which limits the recursion depth when selectively printing DIEs at an offset. Differential Revision: https://reviews.llvm.org/D38064 llvm-svn: 313778
* llvm-dwarfdump: un-hide more command line optionsAdrian Prantl2017-09-191-4/+9
| | | | llvm-svn: 313673
* Replace for_each with a range-based for. NFC.Adrian Prantl2017-09-181-4/+2
| | | | llvm-svn: 313578
* llvm-dwarfdump: add a --show-parents options when selectively dumping DIEs.Adrian Prantl2017-09-181-1/+8
| | | | llvm-svn: 313567
* [dwarfdump] Make .eh_frame an alias for .debug_frameJonas Devlieghere2017-09-181-1/+3
| | | | | | | | | | | | | | | | | | | | This patch makes the `.eh_frame` extension an alias for `.debug_frame`. Up till now it was only possible to dump the section using objdump, but not with dwarfdump. Since the two are essentially interchangeable, we dump whichever of the two is present. As a workaround, this patch also adds parsing for 3 currently unimplemented CFA instructions: `DW_CFA_def_cfa_expression`, `DW_CFA_expression`, and `DW_CFA_val_expression`. Because I lack the required knowledge, I just parse the fields without actually creating the instructions. Finally, this also fixes the typo in the `.debug_frame` section name which incorrectly contained a trailing `s`. Differential revision: https://reviews.llvm.org/D37852 llvm-svn: 313530
* llvm-dwarfdump: support a --show-children optionAdrian Prantl2017-09-161-0/+7
| | | | | | | This will print all children of a DIE when selectively printing only one DIE at a given offset. llvm-svn: 313464
* llvm-dwarfdump: Add support for -debug-info=<offset>.Adrian Prantl2017-09-151-10/+77
| | | | | | | | | This is the first of many commits that enable selectively dumping just one record from the debug info. This reapplies r313412 with some extra qualification to appease GCC and MSVC. llvm-svn: 313419
* Revert "llvm-dwarfdump: Add support for -debug-info=<offset>."Adrian Prantl2017-09-151-73/+10
| | | | | | This reverts commit r313412 because of a g++ incompatibility. llvm-svn: 313413
* llvm-dwarfdump: Add support for -debug-info=<offset>.Adrian Prantl2017-09-151-10/+73
| | | | | | | This is the first of many commits that enable selectively dumping just one record from the debug info. llvm-svn: 313412
* llvm-dwarfdump: support dumping static archives.Adrian Prantl2017-09-141-7/+37
| | | | llvm-svn: 313272
* Use MemoryBufferRef. (NFC)Adrian Prantl2017-09-131-3/+2
| | | | llvm-svn: 313212
OpenPOWER on IntegriCloud