aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
AgeCommit message (Collapse)AuthorFilesLines
2018-02-24Implement equal_range for the DWARF v5 accelerator tablePavel Labath1-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
2018-02-08[dwarfdump] Normalize input path.Jonas Devlieghere1-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
2018-01-29[DebugInfo] Basic .debug_names dumping supportPavel Labath1-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
2018-01-22Rename DwarfAcceleratorTable to AppleAcceleratorTable. NFCPavel Labath1-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
2017-12-19[dwarfdump] Lookup needs to be an unsigned long long parameter.Jonas Devlieghere1-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
2017-12-13Remove redundant includes from tools.Michael Zolotukhin1-5/+0
llvm-svn: 320631
2017-12-08dwarfdump: Add support for the --diff option.Adrian Prantl1-0/+5
--diff Emit the output in a diff-friendly way by omitting offsets and addresses. <rdar://problem/34502625> llvm-svn: 320214
2017-11-29llvm-dwarfdump: honor the --show-children option when dumping a specific DIE.Adrian Prantl1-1/+8
llvm-svn: 319271
2017-10-25Re-land "[dwarfdump] Add -lookup option"Jonas Devlieghere1-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
2017-10-06Unify spelling.Adrian Prantl1-16/+16
llvm-svn: 315102
2017-10-06llvm-dwarfdump: Add an option to collect debug info quality metrics.Adrian Prantl1-1/+11
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
2017-10-03llvm-dwarfdump: implement the --regex option in combination with --name.Adrian Prantl1-8/+30
llvm-svn: 314855
2017-10-03Revert r314817 "[dwarfdump] Add -lookup option"Hans Wennborg1-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
2017-10-03[dwarfdump] Add -lookup optionJonas Devlieghere1-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
2017-10-02llvm-dwarfdump: support the --ignore-case option.Adrian Prantl1-3/+12
llvm-svn: 314723
2017-10-02[dwarfdump] Add -show-formJonas Devlieghere1-3/+10
This enables printing of DWARF form types after the DWARF attribute types. Differential revision: https://reviews.llvm.org/D38459 llvm-svn: 314685
2017-09-30typosAdrian Prantl1-3/+3
llvm-svn: 314577
2017-09-30llvm-dwarfdump: implement the --name lookup option.Adrian Prantl1-9/+39
llvm-svn: 314576
2017-09-30Add commentsAdrian Prantl1-0/+5
llvm-svn: 314574
2017-09-29llvm-dwarfdump: support .apple-namespaces in --findAdrian Prantl1-0/+2
llvm-svn: 314481
2017-09-29llvm-dwarfdump: add support for .apple_types in --findAdrian Prantl1-5/+14
llvm-svn: 314479
2017-09-28try and appease gccAdrian Prantl1-1/+1
llvm-svn: 314442
2017-09-28llvm-dwarfdump: implement --find for .apple_namesAdrian Prantl1-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
2017-09-23Commit missing fixes for tool_file_renameReid Kleckner1-2/+2
llvm-svn: 314051
2017-09-22[dwarfdump] Fix ambiguous call to make_uniqueJonas Devlieghere1-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
2017-09-22[dwarfdump] Add support for redirecting output to a fileJonas Devlieghere1-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
2017-09-21llvm-dwarfdump: Add support for the --arch command line option.Adrian Prantl1-16/+57
llvm-svn: 313888
2017-09-20llvm-dwarfdump: move -eh-frame into the right section in the help output.Adrian Prantl1-1/+1
llvm-svn: 313836
2017-09-20llvm-dwarfdump: implement --recurse-depth=<N>Adrian Prantl1-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
2017-09-19llvm-dwarfdump: un-hide more command line optionsAdrian Prantl1-4/+9
llvm-svn: 313673
2017-09-18Replace for_each with a range-based for. NFC.Adrian Prantl1-4/+2
llvm-svn: 313578
2017-09-18llvm-dwarfdump: add a --show-parents options when selectively dumping DIEs.Adrian Prantl1-1/+8
llvm-svn: 313567
2017-09-18[dwarfdump] Make .eh_frame an alias for .debug_frameJonas Devlieghere1-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
2017-09-16llvm-dwarfdump: support a --show-children optionAdrian Prantl1-0/+7
This will print all children of a DIE when selectively printing only one DIE at a given offset. llvm-svn: 313464
2017-09-15llvm-dwarfdump: Add support for -debug-info=<offset>.Adrian Prantl1-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
2017-09-15Revert "llvm-dwarfdump: Add support for -debug-info=<offset>."Adrian Prantl1-73/+10
This reverts commit r313412 because of a g++ incompatibility. llvm-svn: 313413
2017-09-15llvm-dwarfdump: Add support for -debug-info=<offset>.Adrian Prantl1-10/+73
This is the first of many commits that enable selectively dumping just one record from the debug info. llvm-svn: 313412
2017-09-14llvm-dwarfdump: support dumping static archives.Adrian Prantl1-7/+37
llvm-svn: 313272
2017-09-13Use MemoryBufferRef. (NFC)Adrian Prantl1-3/+2
llvm-svn: 313212
2017-09-13Factor out duplicate code from llvm-dwarfdump (NFC)Adrian Prantl1-38/+27
llvm-svn: 313211
2017-09-13llvm-dwarfdump: automatically dump both regular and .dwo variant of sectionsAdrian Prantl1-3/+2
Since users typically don't really care about the .dwo / non.dwo distinction, this patch makes it so dwarfdump --debug-<info,...> dumps .debug_info and (if available) also .debug_info.dwo. This simplifies the command line interface (I've removed all dwo-specific dump options) and makes the tool friendlier to use. Differential Revision: https://reviews.llvm.org/D37771 llvm-svn: 313207
2017-09-13llvm-dwarfdump: support dumping UUIDs of Mach-O binaries.Adrian Prantl1-4/+9
This is a feature supported by Darwin dwarfdump. UUIDs are used to associate executables with their .dSYM bundles. llvm-svn: 313165
2017-09-13[dwarfdump] Rename Brief to Verbose in DIDumpOptionsJonas Devlieghere1-6/+10
This patches renames "brief" to "verbose" in de DIDumpOptions and inverts the logic to match the new behavior where brief is the default. Changing the default value uncovered some bugs related to the DIDumpOptions not being propagated and have been fixed as well. Differential revision: https://reviews.llvm.org/D37745 llvm-svn: 313139
2017-09-12Clean up the --help output of llvm-dwarfdump by hiding irrelevant options.Adrian Prantl1-19/+41
llvm-svn: 313085
2017-09-11llvm-dwarfdump: Make -brief the default and add a -verbose option instead.Adrian Prantl1-5/+8
Differential Revision: https://reviews.llvm.org/D37717 llvm-svn: 312972
2017-09-11llvm-dwarfdump: Replace -debug-dump=sect option with individual options.Adrian Prantl1-39/+18
As discussed on llvm-dev in http://lists.llvm.org/pipermail/llvm-dev/2017-September/117301.html this changes the command line interface of llvm-dwarfdump to match the one used by the dwarfdump utility shipping on macOS. In addition to being shorter to type this format also has the advantage of allowing more than one section to be specified at the same time. In a nutshell, with this change $ llvm-dwarfdump --debug-dump=info $ llvm-dwarfdump --debug-dump=apple-objc becomes $ dwarfdump --debug-info --apple-objc Differential Revision: https://reviews.llvm.org/D37714 llvm-svn: 312970
2017-08-31[llvm-dwarfdump] Brief mode only dumps debug_info by defaultJonas Devlieghere1-3/+12
This patch changes the default behavior in brief mode to only show the debug_info section. This is undoubtedly the most popular and likely the one you'd want in brief mode. Non-brief mode behavior is not affected and still defaults to all. Differential revision: https://reviews.llvm.org/D37334 llvm-svn: 312252
2017-08-29[dwarfdump] Pretty print location expressions and location listsReid Kleckner1-1/+7
Summary: Based on Fred's patch here: https://reviews.llvm.org/D6771 I can't seem to commandeer the old review, so I'm creating a new one. With that change the locations exrpessions are pretty printed inline in the DIE tree. The output looks like this for debug_loc entries: DW_AT_location [DW_FORM_data4] (0x00000000 0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3 0x000000000000000b - 0x0000000000000012: DW_OP_consts +7 0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4 0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0) And like this for debug_loc.dwo entries: DW_AT_location [DW_FORM_sec_offset] (0x00000000 Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4) Simple locations without ranges are printed inline: DW_AT_location [DW_FORM_block1] (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0) The debug_loc(.dwo) dumping in changed accordingly to factor the code. Reviewers: dblaikie, aprantl, friss Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere Differential Revision: https://reviews.llvm.org/D37123 llvm-svn: 312042
2017-07-19Use delegation instead of inheritance.Rafael Espindola1-3/+3
This changes DwarfContext to delegate to DwarfObject instead of having pure virtual methods. With this DwarfContextInMemory is replaced with an implementation of DwarfObject that is local to a .cpp file. llvm-svn: 308543
2017-06-12[DWARF] Added a blank line in llvm-dwarfdump to test commit access.Spyridoula Gravani1-0/+1
llvm-svn: 305220