192 Commits

Author SHA1 Message Date
Kai Nacke
c7712cd897 [Tools] Mark output of tools as text if it is text
Several LLVM tools write text files/streams without using OF_Text.
This can cause problems on platforms which distinguish between
text and binary output. This PR adds the OF_Text flag for the
following tools:

- llvm-dis
- llvm-dwarfdump
- llvm-mca
- llvm-mc (assembler files only)
- opt (assembler files only)
- RemarkStreamer (used e.g. by opt)

Reviewers: rnk, vivekvpandya, Bigcheese, andreadb

Differential Revision: https://reviews.llvm.org/D67696

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374024 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-08 08:21:20 +00:00
Djordje Todorovic
a98779d25c [llvm-dwarfdump] Fix dumping of wrong locstats map
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373469 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-02 13:24:45 +00:00
Djordje Todorovic
e6e74eaf95 [llvm-dwarfdump] Adjust Windows path to be acceptable by JSON
Backslash is a special character according to JSON specification,
so we should avoid that when printing a file path with the
--statistics option.

Differential Revision: https://reviews.llvm.org/D67699

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372378 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 09:25:11 +00:00
Djordje Todorovic
1b050aba65 [llvm-dwarfdump] Add additional stats fields
The additional fields will be parsed by the llvm-locstats tool in order to
produce more human readable output of the DWARF debug location quality
generated.

Differential Revision: https://reviews.llvm.org/D66525

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371506 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-10 10:37:28 +00:00
Djordje Todorovic
6e914add2f [llvm-dwarfdump] Fix spelling in the comments. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370861 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-04 09:44:09 +00:00
David Blaikie
209c4e345a llvm-dwarfdump: Cache CU low_pc when computing statistics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370559 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-31 01:05:46 +00:00
Djordje Todorovic
a782d2cb2d Reland "[DwarfDebug] Dump call site debug info"
The build failure found after the rL365467 has been
resolved.

Differential Revision: https://reviews.llvm.org/D60716

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367446 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-31 16:51:28 +00:00
Djordje Todorovic
24d43bb78f Revert "[DwarfDebug] Dump call site debug info"
A build failure was found on the SystemZ platform.

This reverts commit 9e7e73578e54cd22b3c7af4b54274d743b6607cc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365886 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 09:45:12 +00:00
Djordje Todorovic
9e7e73578e [DwarfDebug] Dump call site debug info
Dump the DWARF information about call sites and call site parameters into
debug info sections.

The patch also provides an interface for the interpretation of instructions
that could load values of a call site parameters in order to generate DWARF
about the call site parameters.

([13/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>

Differential Revision: https://reviews.llvm.org/D60716

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365467 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 11:33:56 +00:00
James Henderson
b7bdff997f [binutils] Add response file option to help and docs
Many LLVM-based tools already support response files (i.e. files
containing a list of options, specified with '@'). This change simply
updates the documentation and help text for some of these tools to
include it. I haven't attempted to fix all tools, just a selection that
I am interested in.

I've taken the opportunity to add some tests for --help behaviour, where
they were missing. We could expand these tests, but I don't think that's
within scope of this patch.

This fixes https://bugs.llvm.org/show_bug.cgi?id=42233 and
https://bugs.llvm.org/show_bug.cgi?id=42236.

Reviewed by: grimar, MaskRay, jkorous

Differential Revision: https://reviews.llvm.org/D63597

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364036 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-21 11:49:20 +00:00
James Henderson
9cce93fd45 [llvm-dwarfdump] Remove unnecessary explicit -h behaviour
--help and -h are automatically supported by the command-line parser,
unless overridden by the tool. The behaviour of the PrintHelpMessage
being used for -h prior to this patch is subtly different to that
provided by --help automatically (it omits certain elements of help text
and options, such as --help-list), so overriding the default is not
desirable, without good reason. This patch removes the explicit
specification of -h and its behaviour, so that the default behaviour is
used.

Reviewed by: hintonda

Differential Revision: https://reviews.llvm.org/D63565

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364029 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-21 11:22:20 +00:00
James Henderson
5900b63bf6 [docs][llvm-dwarfdump] Make the --show-parents and --show-children help text and docs more consistent and correct
The docs and help text for --show-parents and --show-children were a bit
inconsistent. The help text claimed they had an effect when "=<offset>"
was used, whereas the doc said it had an effect when "--find" or
"--name" were used. This change changes the doc to mention "=<offset>"
and removes this reference from the help text, to avoid having a very
long description in the help text (it still says "when selectively
printing entries").

Reviewed by: JDevlieghere, aprantl

Differential Revision: https://reviews.llvm.org/D63275

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363380 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-14 13:00:09 +00:00
James Henderson
592639ad22 [llvm-dwarfdump] Simplify --ignore-case help text and documentation
There was a typo in the --ignore-case help text that was copied into the
llvm-dwarfdump command-guide. Additionally, this patch simplifies the
wording, since it was unnecessarily verbose: the switch applies for
searching in general and doesn't need explicitly stating different
search modes (which might go out-of-date as options are added or
removed).

Reviwed by: JDevlieghere

Differential Revision: https://reviews.llvm.org/D63133


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363066 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-11 13:51:18 +00:00
James Henderson
45c7c099f0 [llvm-dwarfdump] Add -o to help text and remove --out-file from doc
-o is in the documentation, but not in the llvm-dwarfdump help text.
This patch adds it by inverting the -o and --out-file aliasing. It also
removes --out-file from the documentation, since we don't really want
people to be using this switch in practice.

Reviewed by: aprantl, JDevlieghere, dblaikie

Differential Revision: https://reviews.llvm.org/D63013


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363044 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-11 10:20:07 +00:00
Jonas Devlieghere
1a23ac011d [dwarfdump] Add flag to limit the number of parents DIEs
This adds `-parent-recurse-depth` which limits the number of parent DIEs
being dumped.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361671 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-24 21:11:28 +00:00
Caroline Tice
fdb7e915f2 llvm-dwarfdump: Add dwo parsing to --statistics.
Add check for, and parsing of, .dwo files to Statistics.cpp; create a new getNon
SkeletonUnitDie function for DWARFUnit.h

Reviewers: dblaikie

Differential Revision: https://review.llvm.org/D61755




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360380 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 21:53:33 +00:00
Fangrui Song
8b0afcf334 [CommandLine] Provide parser<unsigned long> instantiation to allow cl::opt<uint64_t> on LP64 platforms
Summary:
And migrate opt<unsigned long long> to opt<uint64_t>

Fixes PR19665

Differential Revision: https://reviews.llvm.org/D60933

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359068 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-24 02:40:20 +00:00
Adrian Prantl
fcf59db0a6 llvm-dwarfdump: Support alternative architecture names in the -arch filter
<rdar://problem/47918606>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357706 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-04 15:48:40 +00:00
Fangrui Song
add25ee371 [llvm-dwarfdump] Simplify -o handling
ToolOutputFile handles '-' so no need to specialize here.
Also, we neither reassign the variable nor pass it around, thus no need
to use std::unique_ptr<ToolOutputFile>.

exit(1) -> return 1;  to call the destructor of raw_fd_stream

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357051 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-27 08:19:36 +00:00
Caroline Tice
4cdcb8055d llvm-dwarfdump: Add new variable, parameter and inlining statistics; also function source location statistics.
Add statistics for abstract origins, function, variable and parameter
locations; break the 'variable' counts down into variables and
parameters. Also update call site counting to check for
DW_AT_call_{file,line} in addition to DW_TAG_call_site.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355243 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 23:51:54 +00:00
Alexey Lapshin
a15cff122c [DebugInfo] add SectionedAddress to DebugInfo interfaces.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354972 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 13:17:36 +00:00
Caroline Tice
14911bb497 lvm-dwarfdump: Stop counting out-of-line subprogram in the "inlined functions" statistic.
DW_TAG_subprogram DIEs should not be counted in the inlined function statistic. This also addresses the source variables count, as that uses the inlined function count in its calculations.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353491 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-08 00:51:33 +00:00
Chandler Carruth
6b547686c5 Update the file headers across all of the LLVM projects in the monorepo
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 08:50:56 +00:00
Luke Cheeseman
c8ecb42041 Revert r347490 as it breaks address sanitizer builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347499 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-23 17:13:06 +00:00
Luke Cheeseman
7ef46a70af Revert r343341
- Cannot reproduce the build failure locally and the build logs have
  been deleted.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347490 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-23 11:01:47 +00:00
Greg Clayton
6517c35cb7 Add total function byte size and inline function byte size to "llvm-dwarfdump --statistics"
Differential Revision: https://reviews.llvm.org/D54217



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346531 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-09 18:10:02 +00:00
Paul Robinson
d51aaa8a3f Make llvm-dwarfdump -name work on type units.
Differential Revision: https://reviews.llvm.org/D53672

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345203 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 21:51:55 +00:00
Jonas Devlieghere
ed9fa1afb6 [dwarfdump] Make incompatibility between -diff and -verbose explicit.
Using -diff and -verbose together doesn't work today. We should audit
where these two options interact and fix them. In the meantime we error
out when the user try to specify both.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345084 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 21:51:44 +00:00
Fangrui Song
7d3ea70f00 Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344774 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-19 06:12:02 +00:00
Adrian Prantl
0f4106775e llvm-dwarfdump: Extend --name to also search DW_AT_linkage_name.
rdar://problem/45132695

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344079 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-09 20:51:33 +00:00
Adrian Prantl
0a3d7dbe84 Add missing space
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344064 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-09 18:12:04 +00:00
Vedant Kumar
78b8f9db17 [DebugInfo] Add support for DWARF5 call site-related attributes
DWARF v5 introduces DW_AT_call_all_calls, a subprogram attribute which
indicates that all calls (both regular and tail) within the subprogram
have call site entries. The information within these call site entries
can be used by a debugger to populate backtraces with synthetic tail
call frames.

Tail calling frames go missing in backtraces because the frame of the
caller is reused by the callee. Call site entries allow a debugger to
reconstruct a sequence of (tail) calls which led from one function to
another. This improves backtrace quality. There are limitations: tail
recursion isn't handled, variables within synthetic frames may not
survive to be inspected, etc. This approach is not novel, see:

  https://gcc.gnu.org/wiki/summit2010?action=AttachFile&do=get&target=jelinek.pdf

This patch adds an IR-level flag (DIFlagAllCallsDescribed) which lowers
to DW_AT_call_all_calls. It adds the minimal amount of DWARF generation
support needed to emit standards-compliant call site entries. For easier
deployment, when the debugger tuning is LLDB, the DWARF requirement is
adjusted to v4.

Testing: Apart from check-{llvm, clang}, I built a stage2 RelWithDebInfo
clang binary. Its dSYM passed verification and grew by 1.4% compared to
the baseline. 151,879 call site entries were added.

rdar://42001377

Differential Revision: https://reviews.llvm.org/D49887

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343883 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-05 20:37:17 +00:00
Adrian Prantl
24a3723b3a Format the dwarfdump --statistics version as an integer instead of a string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343864 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-05 17:41:30 +00:00
Luke Cheeseman
4c6cb9f427 Revert r343317
- asan buildbots are breaking and I need to investigate the issue



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343341 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 17:01:50 +00:00
Luke Cheeseman
96f82d5c18 Reapply changes reverted by r343235
- Add fix so that all code paths that create DWARFContext
  with an ObjectFile initialise the target architecture in the context
- Add an assert that the Arch is known in the Dwarf CallFrameString method



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343317 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 13:37:27 +00:00
Luke Cheeseman
4d42c19cd1 Revert r343192 as an ubsan build is currently failing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343235 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 16:47:30 +00:00
Luke Cheeseman
a26da93994 Reapply changes reverted in r343114, lldb patch to follow shortly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343192 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 10:39:20 +00:00
Fangrui Song
3b35e17b21 llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343163 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 02:13:45 +00:00
Luke Cheeseman
9f0b248da5 Revert r343112 as CallFrameString API change has broken lldb builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343114 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 14:48:03 +00:00
Luke Cheeseman
538d8c7d85 [AArch64] - Return address signing dwarf support
- Reapply r343089 with a fix for DebugInfo/Sparc/gnu-window-save.ll



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343112 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 14:30:29 +00:00
Hans Wennborg
21491992cf Revert r343089 "[AArch64] - Return address signing dwarf support"
This caused the DebugInfo/Sparc/gnu-window-save.ll test to fail.

> Functions that have signed return addresses need additional dwarf support:
> - After signing the LR, and before authenticating it, the LR register is in a
>   state the is unusable by a debugger or unwinder
> - To account for this a new directive, .cfi_negate_ra_state, is added
> - This directive says the signed state of the LR register has now changed,
>   i.e. unsigned -> signed or signed -> unsigned
> - This directive has the same CFA code as the SPARC directive GNU_window_save
>   (0x2d), adding a macro to account for multiply defined codes
> - This patch matches the gcc implementation of this support:
>   https://patchwork.ozlabs.org/patch/800271/
>
> Differential Revision: https://reviews.llvm.org/D50136

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343103 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 12:57:45 +00:00
Luke Cheeseman
e99f0eb61e [AArch64] - Return address signing dwarf support
Functions that have signed return addresses need additional dwarf support:
- After signing the LR, and before authenticating it, the LR register is in a
  state the is unusable by a debugger or unwinder
- To account for this a new directive, .cfi_negate_ra_state, is added
- This directive says the signed state of the LR register has now changed,
  i.e. unsigned -> signed or signed -> unsigned
- This directive has the same CFA code as the SPARC directive GNU_window_save
  (0x2d), adding a macro to account for multiply defined codes
- This patch matches the gcc implementation of this support:
  https://patchwork.ozlabs.org/patch/800271/

Differential Revision: https://reviews.llvm.org/D50136



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343089 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 10:14:15 +00:00
Adrian Prantl
bb1f2f9d39 llvm-dwarfdump --statistics: Unique abstract origins across multiple CUs.
Instead of indexing local variables by DIE offset, use the variable
name + the path through the lexical block tree. This makes the lookup
key consistent across duplicate abstract origins in different CUs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342776 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-21 21:59:34 +00:00
Paul Robinson
ddedb75c1d [DebugInfo/DWARF] Remove redundant iterator type. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338759 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-02 19:29:38 +00:00
Wolfgang Pieb
5a4174c540 [DWARF] Improved error reporting for range lists.
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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335188 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-20 22:56:37 +00:00
Pavel Labath
de99770375 Fix "Optional" is ambiguous error on some bots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334580 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13 08:29:19 +00:00
Pavel Labath
c271b02f29 [DWARF/AccelTable] Remove getDIESectionOffset for DWARF v5 entries
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334578 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13 08:14:27 +00:00
Pavel Labath
2299c2e836 DWARFAcceleratorTable: fix equal_range iterators
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333635 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31 08:47:00 +00:00
Jonas Devlieghere
2071b7a8b2 [Support] Add color cl category.
This commit adds a color category so tools can document this option and
enables it for dwarfdump and dsymuttil.

rdar://problem/40498996

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333176 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 11:36:57 +00:00
Nicola Zaghen
0818e789cb Rename DEBUG macro to LLVM_DEBUG.
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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332240 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 12:53:11 +00:00