1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

139 Commits

Author SHA1 Message Date
Pavel Labath
d9d89d6390 [DebugInfo/AccelTable] Fix inconsistency in getDIEOffset implementations
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
2018-03-09 11:58:59 +00:00
Pavel Labath
2d03f8789b Fix build breakage from r326003
- 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
2018-02-24 00:54:31 +00:00
Pavel Labath
396e9fac82 Implement equal_range for the DWARF v5 accelerator table
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-24 00:35:21 +00:00
Jonas Devlieghere
bce345d61d [dwarfdump] Normalize input path.
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-02-08 16:31:01 +00:00
Pavel Labath
4e33537215 [DebugInfo] Basic .debug_names dumping support
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-29 11:08:32 +00:00
Pavel Labath
1dd5338ab2 Rename DwarfAcceleratorTable to AppleAcceleratorTable. NFC
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
2018-01-22 13:17:23 +00:00
Jonas Devlieghere
c562c1f132 [dwarfdump] Lookup needs to be an unsigned long long parameter.
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-19 09:45:26 +00:00
Michael Zolotukhin
66a95d7c09 Remove redundant includes from tools.
llvm-svn: 320631
2017-12-13 21:31:10 +00:00
Adrian Prantl
5ca2084996 dwarfdump: Add support for the --diff option.
--diff      Emit the output in a diff-friendly way by omitting offsets and
            addresses.

<rdar://problem/34502625>

llvm-svn: 320214
2017-12-08 23:32:47 +00:00
Adrian Prantl
404a2c9dce llvm-dwarfdump: honor the --show-children option when dumping a specific DIE.
llvm-svn: 319271
2017-11-29 01:12:22 +00:00
Jonas Devlieghere
e7361cd27e Re-land "[dwarfdump] Add -lookup option"
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-25 21:56:41 +00:00
Adrian Prantl
72cc88bd96 Unify spelling.
llvm-svn: 315102
2017-10-06 20:24:35 +00:00
Adrian Prantl
d11782d299 llvm-dwarfdump: Add an option to collect debug info quality metrics.
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-06 20:24:34 +00:00
Adrian Prantl
7d0f59fbef llvm-dwarfdump: implement the --regex option in combination with --name.
llvm-svn: 314855
2017-10-03 22:08:22 +00:00
Hans Wennborg
059c2fadb1 Revert r314817 "[dwarfdump] Add -lookup option"
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 18:39:13 +00:00
Jonas Devlieghere
cce4ff485e [dwarfdump] Add -lookup option
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-03 17:10:21 +00:00
Adrian Prantl
86532b53d7 llvm-dwarfdump: support the --ignore-case option.
llvm-svn: 314723
2017-10-02 21:21:09 +00:00
Jonas Devlieghere
6f21edf7e9 [dwarfdump] Add -show-form
This enables printing of DWARF form types after the DWARF attribute
types.

Differential revision: https://reviews.llvm.org/D38459

llvm-svn: 314685
2017-10-02 16:02:04 +00:00
Adrian Prantl
7815bab680 typos
llvm-svn: 314577
2017-09-30 00:31:15 +00:00
Adrian Prantl
5f4a1a5ebf llvm-dwarfdump: implement the --name lookup option.
llvm-svn: 314576
2017-09-30 00:22:25 +00:00
Adrian Prantl
b7d8613119 Add comments
llvm-svn: 314574
2017-09-30 00:22:21 +00:00
Adrian Prantl
19d0a6e426 llvm-dwarfdump: support .apple-namespaces in --find
llvm-svn: 314481
2017-09-29 00:52:33 +00:00
Adrian Prantl
d2beca911e llvm-dwarfdump: add support for .apple_types in --find
llvm-svn: 314479
2017-09-29 00:33:22 +00:00
Adrian Prantl
9d2ec27ba8 try and appease gcc
llvm-svn: 314442
2017-09-28 18:27:00 +00:00
Adrian Prantl
9a78f28e7e llvm-dwarfdump: implement --find for .apple_names
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-28 18:10:52 +00:00
Reid Kleckner
7f2317ba9c Commit missing fixes for tool_file_rename
llvm-svn: 314051
2017-09-23 01:04:42 +00:00
Jonas Devlieghere
004d6f480d [dwarfdump] Fix ambiguous call to make_unique
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 09:38:52 +00:00
Jonas Devlieghere
25e539c814 [dwarfdump] Add support for redirecting output to a file
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-22 09:20:57 +00:00
Adrian Prantl
4055863a09 llvm-dwarfdump: Add support for the --arch command line option.
llvm-svn: 313888
2017-09-21 16:26:18 +00:00
Adrian Prantl
fe878dc115 llvm-dwarfdump: move -eh-frame into the right section in the help output.
llvm-svn: 313836
2017-09-20 23:29:31 +00:00
Adrian Prantl
25bdef70ce llvm-dwarfdump: implement --recurse-depth=<N>
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-20 17:44:00 +00:00
Adrian Prantl
b684d26c09 llvm-dwarfdump: un-hide more command line options
llvm-svn: 313673
2017-09-19 20:58:57 +00:00
Adrian Prantl
47b91a913c Replace for_each with a range-based for. NFC.
llvm-svn: 313578
2017-09-18 22:11:33 +00:00
Adrian Prantl
87821c19b9 llvm-dwarfdump: add a --show-parents options when selectively dumping DIEs.
llvm-svn: 313567
2017-09-18 21:27:44 +00:00
Jonas Devlieghere
158da0d39f [dwarfdump] Make .eh_frame an alias for .debug_frame
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-18 14:15:57 +00:00
Adrian Prantl
5aebf77e70 llvm-dwarfdump: support a --show-children option
This will print all children of a DIE when selectively printing only
one DIE at a given offset.

llvm-svn: 313464
2017-09-16 17:28:00 +00:00
Adrian Prantl
978de38747 llvm-dwarfdump: Add support for -debug-info=<offset>.
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-15 23:04:04 +00:00
Adrian Prantl
fb4efe8f9b Revert "llvm-dwarfdump: Add support for -debug-info=<offset>."
This reverts commit r313412 because of a g++ incompatibility.

llvm-svn: 313413
2017-09-15 22:47:16 +00:00
Adrian Prantl
8da0c20511 llvm-dwarfdump: Add support for -debug-info=<offset>.
This is the first of many commits that enable selectively dumping just
one record from the debug info.

llvm-svn: 313412
2017-09-15 22:37:56 +00:00
Adrian Prantl
180de22eaf llvm-dwarfdump: support dumping static archives.
llvm-svn: 313272
2017-09-14 17:01:53 +00:00
Adrian Prantl
ee497cc888 Use MemoryBufferRef. (NFC)
llvm-svn: 313212
2017-09-13 23:16:13 +00:00
Adrian Prantl
dd8dd15319 Factor out duplicate code from llvm-dwarfdump (NFC)
llvm-svn: 313211
2017-09-13 23:07:24 +00:00
Adrian Prantl
93fed884cc llvm-dwarfdump: automatically dump both regular and .dwo variant of sections
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-13 22:09:01 +00:00
Adrian Prantl
030a76d32a llvm-dwarfdump: support dumping UUIDs of Mach-O binaries.
This is a feature supported by Darwin dwarfdump. UUIDs are used to
associate executables with their .dSYM bundles.

llvm-svn: 313165
2017-09-13 18:22:59 +00:00
Jonas Devlieghere
599ad8ebac [dwarfdump] Rename Brief to Verbose in DIDumpOptions
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-13 09:43:05 +00:00
Adrian Prantl
807f7a961f Clean up the --help output of llvm-dwarfdump by hiding irrelevant options.
llvm-svn: 313085
2017-09-12 22:32:53 +00:00
Adrian Prantl
6927831e30 llvm-dwarfdump: Make -brief the default and add a -verbose option instead.
Differential Revision: https://reviews.llvm.org/D37717

llvm-svn: 312972
2017-09-11 23:05:20 +00:00
Adrian Prantl
37ec73c718 llvm-dwarfdump: Replace -debug-dump=sect option with individual options.
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-09-11 22:59:45 +00:00
Jonas Devlieghere
1cf0785760 [llvm-dwarfdump] Brief mode only dumps debug_info by default
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-31 16:44:47 +00:00
Justin Bogner
1f7d4b581a cmake: Invent add_llvm_fuzzer to set up fuzzer targets
This moves the cmake configuration for fuzzers in LLVM to a new macro,
add_llvm_fuzzer. This will make it easier to keep things consistent
while implementing llvm.org/pr34314.

I've also made a couple of minor functional changes here:

- the fuzzers now use add_llvm_executable rather than add_llvm_tool.
  This means they won't create install targets and stuff like that,
  because those made little sense for these fuzzers.
- I've grouped these under "Fuzzers" rather than in with "Tools" for
  people who build with IDEs.

llvm-svn: 312200
2017-08-31 00:36:33 +00:00