1358 Commits

Author SHA1 Message Date
Mandeep Singh Grang
bffcc487e3 [llvm] Change 2 instances of std::sort to llvm::sort
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337192 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-16 17:26:37 +00:00
Jonas Devlieghere
6ab694dd51 [dwarfdump] Add pretty printer for accelerator table based on Atom.
For instance, When dumping .apple_types, the second atom represents the
DW_TAG. In addition to printing the raw value, we now also pretty print
the value if the ATOM tells us how.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337026 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-13 17:21:51 +00:00
Fangrui Song
adfcff45ee [DebugInfo] Fix getPreviousSibling after r336823
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336837 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 19:09:37 +00:00
Jonas Devlieghere
f8497881d6 [DebugInfo] Make children iterator bidirectional
Make the DIE iterator bidirectional so we can move to the previous
sibling of a DIE.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336823 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 17:11:11 +00:00
Rui Ueyama
1897a62c2e Use StringRef instead of const char *.
I don't think there's a need to use `const char *`. In most (probably all?)
cases, we need a length of a name later, so discarding a length will
lead to a wasted effort.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336612 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-09 22:26:49 +00:00
Maksim Panchenko
5e8a352aa6 [DebugInfo] Change default value of FDEPointerEncoding
Summary:
If the encoding is not specified in CIE augmentation string, then it
should be DW_EH_PE_absptr instead of DW_EH_PE_omit.

Reviewers: ruiu, MaskRay, plotfi, rafauler

Reviewed By: MaskRay

Subscribers: rafauler, JDevlieghere, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336577 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-09 18:45:38 +00:00
Benjamin Kramer
ec4a235223 [PDB] memicmp only exists on Windows, use StringRef::compare_lower instead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336469 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06 21:56:57 +00:00
Zachary Turner
c779b36d25 [PDB] One more fix for hasing GSI records.
The reference implementation uses a case-insensitive string
comparison for strings of equal length.  This will cause the
string "tEo" to compare less than "VUo".  However we were using
a case sensitive comparison, which would generate the opposite
outcome.  Switch to a case insensitive comparison.  Also, when
one of the strings contains non-ascii characters, fallback to
a straight memcmp.

The only way to really test this is with a DIA test.  Before this
patch, the test will fail (but succeed if link.exe is used instead
of lld-link).  After the patch, it succeeds even with lld-link.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336464 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06 21:01:42 +00:00
Zachary Turner
1ba3969024 [PDB] Sort globals symbols by name in GSI hash buckets.
It seems like the debugger first computes a symbol's bucket,
and then does a binary search of entries in the bucket using the
symbol's name in order to find it.  If the bucket entries are not
in sorted order, this obviously won't work.  After this patch a
couple of simple test cases show that we generate an exactly
identical GSI hash stream, which is very nice.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336405 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06 02:33:58 +00:00
Zachary Turner
7ce035b534 [CodeView] Correctly compute the name of S_PROCREF symbols.
We have a function which switches on the type of a symbol record
to return a hardcoded offset into the record that contains the
symbol name.  Not all symbols have names to begin with, and for
those records we return -1 for the offset.

Names are used for various things.  Importantly for this particular
bug, a hash of the record name is used as a key for certain hash
tables which are serialied into the PDB file.  One of these hash
tables is for the global symbol stream, which is basically a
collection of S_PROCREF symbols which contain the name of the
symbol, a module, and an address offset.

However, for S_PROCREF symbols, the function to return the offset
of the name was returning -1: basically it wasn't implemented.
As a result of this, all global symbols were hashing to the same
value, essentially it was as if every single global symbol's name
was the empty string.

This manifests in the VS debugger when you try to call a function
(global or member, doesn't matter) through the immediate window
and the debugger simply reports an error because it can't find the
function.  This makes perfect sense, because it is hashing the name
for real, looking in the global symbol hash table, and there is only
1 entry there which corresponds to a symbol whose name is the empty
string.

Fixing this fixes the MSVC debugger in this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336024 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-29 22:19:02 +00:00
Paul Robinson
459351c705 Pass DWARFUnit to verifier by reference not by value. I am moderately
sure this should not cause a memory leak.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336007 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-29 19:17:44 +00:00
Zachary Turner
6a89efb6b2 Move some code from PDBFileBuilder to MSFBuilder.
The code to emit the pieces of the MSF file were actually in
PDBFileBuilder.  Move this to MSFBuilder so that we can
theoretically emit an MSF without having a PDB file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335789 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27 21:18:15 +00:00
Kamil Rytarowski
993ef0ca96 Handle NetBSD specific path in findDebugBinary()
Summary:
The NetBSD Operating System installs debuginfo
files into /usr/libdata/debug, rather than other path
like in some other popular distribution.

This change makes llvm-symbolizer functional with
the basesystem executables.

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: JDevlieghere, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335511 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 18:49:13 +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
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
787adc7006 DWARFAcceleratorTable: Add an iterator-based api for accessing names in the index
Summary:
Back when we were introducing the DWARF v5 name index, there was a
short discussion whether we shouldn't have a nicer api for iterating
over the index. At that time, I did not find it necessary since the
iteration over names was done only from within the index itself (and I
figured the internal implementation can deal with a slightly rough
interface).

However, now I ran into a use for this kind of API in LLDB (for finding
all names matching a regular expression), so it looked like a nice
opportunity to introduce one. To make the API more useful, I've made the
NameTableEntry class a bit smarter: it now stores the string section
reference (so it can return its name) and its position in the name index
(mainly useful for dumping/logging).

I also convert the internal users to use the new API, which also gives
test coverage for the added code.

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333738 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 10:33:11 +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
5f28b9c36c [CodeView] Add prefix to CodeView registers.
Adds CVReg to CodeView register names to prevent a duplicate symbol with
CR3 defined in termios.h, as suggested by Zachary on the mailing list.

http://lists.llvm.org/pipermail/llvm-dev/2018-May/123372.html

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

rdar://39863705

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333421 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 14:35:34 +00:00
Jonas Devlieghere
98ac263943 [dwarfdump] Make -c and -p work together
When requesting to dump both the parent chain and children, we used to
print the DIE more than once because we propagated the dump options to
the parent without clearing the respective flags. This commit fixes this
oversight and adds a test.

rdar://39415292

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333350 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-26 19:39:56 +00:00
Jonas Devlieghere
eda7c167ce [DebugInfo] Invert DIE order for range errors.
When printing an error for an invalid address range in a DIE, we used to
print the child above the parent, which is counter intuitive. This patch
reverses the order and indents the child to mimic the way we print the
debug info section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333006 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 17:38:03 +00:00
Jonas Devlieghere
2c6a6699c3 [DebugInfo] Fix location list check in the verifier
We weren't properly verifying location lists because we tried obtaining
the offset as a constant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333005 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 17:37:27 +00:00
Paul Robinson
04a387aa0f [DWARFv5] Put the DWO ID in its place.
In DWARF v5, the DWO ID is in the (split/skeleton) CU header, not an
attribute on the CU DIE.

This changes the size of those headers, so use the parsed size whenever
we have one, for simplicitly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333004 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 17:27:31 +00:00
Jonas Devlieghere
74157fc710 [DebugInfo] Use absolute addresses in location lists
Rather than relying on the user to do the address calculating in
DW_AT_location we should just dump the absolute address.

rdar://problem/38513870

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332873 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 19:36:54 +00:00
James Henderson
8b03f4d6d2 [DWARF] Refactor callback usage for .debug_line error handling
Change the "recoverable" error callback to take an Error instaed of a
string.

Reviewed by: JDevlieghere

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332845 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 15:30:54 +00:00
Wolfgang Pieb
c1a566a493 Fixing buildbot error introduced with r332759.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332772 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 21:44:28 +00:00
Wolfgang Pieb
02babe8338 Addressing a couple of compiler warnings introduced with r332759.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332766 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 20:51:16 +00:00
Wolfgang Pieb
a576ca1044 Fixing build error introduced with r332759.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332762 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 20:35:13 +00:00
Wolfgang Pieb
eab311b661 [DWARF v5] Improved support for .debug_rnglists (consumer). Enables any consumer to
extract DWARF v5 encoded rangelists.

Reviewer: JDevlieghere

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332759 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 20:12:54 +00:00
Zachary Turner
b26b734118 Resubmit [pdb] Change /DEBUG:GHASH to emit 8 byte hashes."
This fixes the remaining failing tests, so resubmitting with no
functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332676 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 22:55:15 +00:00
Zachary Turner
761b193f29 Revert "[pdb] Change /DEBUG:GHASH to emit 8 byte hashes."
A few tests haven't been properly updated, so reverting while
I have time to investigate proper fixes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332672 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 21:49:25 +00:00
Zachary Turner
d0e6e5a36e [pdb] Change /DEBUG:GHASH to emit 8 byte hashes.
Previously we emitted 20-byte SHA1 hashes.  This is overkill
for identifying debug info records, and has the negative side
effect of making object files bigger and links slower.  By
using only the last 8 bytes of a SHA1, we get smaller object
files and ~10% faster links.

This modifies the format of the .debug$H section by adding a new
value for the hash algorithm field, so that the linker will still
work when its object files have an old format.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332669 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 21:22:48 +00:00
Reid Kleckner
0d0bfa9754 [codeview] Include record prefix in global type hashing
The prefix includes type kind, which is important to preserve. Two
different type leafs can easily have the same interior record contents
as another type.

We ran into this issue in PR37492 where a bitfield type record collided
with a const modifier record. Their contents were bitwise identical, but
their kinds were different.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332664 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 20:47:22 +00:00
Pavel Labath
d3664eaf52 Reapply "DWARFVerifier: Check "completeness" of .debug_names section"
This is a resubmit of r331868 (D46583), which was reverted due to
failures on the PS4 bot.

These have been resolved with r332246/D46748.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332349 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 13:24:10 +00:00
Paul Robinson
989920616f [DWARF] Factor out a DWARFUnitHeader class. NFC
Extract information related to a "unit header" from DWARFUnit into a
new DWARFUnitHeader class, and add a DWARFUnit member for the header.
This is one step in the direction of allowing type units in the
.debug_info section for DWARF v5.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332289 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 20:32:31 +00:00
Pavel Labath
3f8354c90e [CodeGen/AccelTable]: Handle -dwarf-linkage-names=Abstract correctly
Summary:
If we are not emitting a linkage name in the .debug_info sections, we
should not add it into the index either. This makes sure our index is
consistent with the actual debug info.

I am also explicitly setting the --dwarf-linkage-names=All in the
name-collsions test as that one would now fail on targets where this
defaults to "Abstract" (in fact, it would have failed already if there
wasn't a bug in the DWARF verifier, which I fix as well).

Reviewers: probinson, aprantl, JDevlieghere

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332246 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 14:13:20 +00:00
Wolfgang Pieb
3dc44a9d48 [DWARF] Fixing a bug in DWARF v5 string offsets tables where the length encoded the contribution
length excluding the table header. Instead it must encode the contribution length minus the length
field itself.

Reviewer: JDevliegehere

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332030 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10 20:02:34 +00:00
James Henderson
290ef8aa41 Fix signed/unsigned comparison warning and print format
The print format was causing at least 2 unit-test failures from r331971.

The signed/unsigned comparison warnings only appeared to affect two lines but
it was unclear whether it might just pop up on other lines, so I have been
explicit in all the literals in the tests.

There were other bot unit-test failures that I am still investigating.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331978 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10 12:15:43 +00:00
James Henderson
b82663119e [DWARF] Rework debug line parsing to use llvm::Error and callbacks
Reviewed by: dblaikie, JDevlieghere, espindola

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

Summary:
The .debug_line parser previously reported errors by printing to stderr and
return false. This is not particularly helpful for clients of the library code,
as it prevents them from handling the errors in a manner based on the calling
context. This change switches to using llvm::Error and callbacks to indicate
what problems were detected during parsing, and has updated clients to handle
the errors in a location-specific manner. In general, this means that they
continue to do the same thing to external users. Below, I have outlined what
the known behaviour changes are, relating to this change.

There are two levels of "errors" in the new error mechanism, to broadly
distinguish between different fail states of the parser, since not every
failure will prevent parsing of the unit, or of subsequent unit. Malformed
table errors that prevent reading the remainder of the table (reported by
returning them) and other minor issues representing problems with parsing that
do not prevent attempting to continue reading the table (reported by calling a
specified callback funciton). The only example of this currently is when the
last sequence of a unit is unterminated. However, I think it would be good to
change the handling of unrecognised opcodes to report as minor issues as well,
rather than just printing to the stream if --verbose is used (this would be a
subsequent change however).

I have substantially extended the DwarfGenerator to be able to handle
custom-crafted .debug_line sections, allowing for comprehensive unit-testing
of the parser code. For now, I am just adding unit tests to cover the basic
error reporting, and positive cases, and do not currently intend to test every
part of the parser, although the framework should be sufficient to do so at a
later point.

Known behaviour changes:
  - The dump function in DWARFContext now does not attempt to read subsequent
  tables when searching for a specific offset, if the unit length field of a
  table before the specified offset is a reserved value.
  - getOrParseLineTable now returns a useful Error if an invalid offset is
  encountered, rather than simply a nullptr.
  - The parse functions no longer use `WithColor::warning` directly to report
  errors, allowing LLD to call its own warning function.
  - The existing parse error messages have been updated to not specifically
  include "warning" in their message, allowing consumers to determine what
  severity the problem is.
  - If the line table version field appears to have a value less than 2, an
  informative error is returned, instead of just false.
  - If the line table unit length field uses a reserved value, an informative
  error is returned, instead of just false.
  - Dumping of .debug_line.dwo sections is now implemented the same as regular
  .debug_line sections.
  - Verbose dumping of .debug_line[.dwo] sections now prints the prologue, if
  there is a prologue error, just like non-verbose dumping.

As a helper for the generator code, I have re-added emitInt64 to the
AsmPrinter code. This previously existed, but was removed way back in r100296,
presumably because it was dead at the time.

This change also requires a change to LLD, which will be committed separately.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331971 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10 10:51:33 +00:00
Pavel Labath
2a79fdd944 Revert "DWARFVerifier: Check "completeness" of .debug_names section"
The new verifier check has found an error in the
debug-names-name-collisions.ll test on the PS4 bot:

error: Name Index @ 0x0: Entry @ 0xdc: mismatched Name of DIE @ 0x23: index - _ZN3foo3fooE; debug_info - foo.

Reverting while I investigate whether this is a bug in the verifier or
the generator.

This reverts commit r331868.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331869 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09 12:26:19 +00:00
Pavel Labath
1ed49633b3 DWARFVerifier: Check "completeness" of .debug_names section
Summary:
This patch implements a check which makes sure all entries required by
the DWARF v5 specification are present in the Name Index. The algorithm
tries to follow the wording of Section 6.1.1.1 of the spec as closely as
possible.

The main deviation from it is that instead of a whitelist-based approach
in the spec "The name index must contain an entry for each debugging
information entry that defines a named subprogram, label, variable,
type, or namespace" I chose a blacklist-based one, where I consider
everything to be "in" and then remove the entries that don't make sense.
I did this because it has more potential for catching interesting cases
and the above is a bit vague (it uses plain words like "variable" and
"subprogram", but the rest of the section speaks about specific TAGs).

This approach has raised some interesting questions, the main one being
whether enumerator values should be indexed. The consensus seems to be
that they should, although it does not follow from section 6.1.1.1.
For the time being I made the verifier ignore these, as LLVM does not do
this yet, and I wanted to get a clean run when verifying generated debug
info.

Another interesting case was the DW_TAG_imported_declaration. It was not
immediately clear to me whether this should go in or not, but currently
it is not indexed, and (unlike the enumerators) in does not seem to cause
problems for LLDB, so I've also ignored it.

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331868 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09 12:06:17 +00:00
Fangrui Song
ea4e592233 [DebugInfo] Accept S in augmentation strings in CIE.
glibc libc.a(sigaction.o) compiled from sysdeps/unix/sysv/linux/x86_64/sigaction.c uses "zRS".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331738 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-08 06:21:12 +00:00
David Blaikie
df69f1ffbe llvm-symbolizer: Handle function definitions nested within other functions
LLVM always puts function definition DIEs at the top level, but under
some circumstances GCC does not (at least in this case with member
functions of a function-local type).

To ensure that doesn't appear as though the local type's member function
is unduly inlined within the outer function - ensure the inline
discovery DIE parent walk stops at the first DW_TAG_subprogram.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331291 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-01 18:08:45 +00:00
Jonas Devlieghere
8cde9622c0 [DebugInfo] Prevent infinite recursion for malformed DWARF
This prevents infinite recursion in DWARFDie::findRecursively for
malformed DWARF where a DIE references itself.

This fixes PR36257.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331200 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-30 17:02:41 +00:00
Zachary Turner
ce352b75bc [LLD/PDB] Emit first section contribution for DBI Module Descriptor.
Part of the DBI stream is a list of variable length structures
describing each module that contributes to the final executable.

One member of this structure is a section contribution entry that
describes the first section contribution in the output file for
the given module.

We have been leaving this structure unpopulated until now, so with
this patch it is now filled out correctly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330457 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 18:00:46 +00:00
Andrew Ng
3ebc072a79 [DebugInfo] Use WithColor for more debug line warnings
Updated two more debug line related warnings to use WithColor. This was
necessary to ensure consistent output order of the warnings on Windows
for debug line tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330440 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 15:29:47 +00:00
Zachary Turner
8995c860d6 [llvm-pdbutil] Dump first section contribution for each module.
The DBI stream contains a list of module descriptors.  At the
beginning of each descriptor is a structure representing the first
section contribution in the output file for that module.  LLD
currently doesn't fill out this structure at all, but link.exe
does.  So as a precursor to emitting this data in LLD, we first
need a way to dump it so that it can be checked.

This patch adds support for the dumping, and verifies via a test
that LLD emits bogus information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330208 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-17 20:06:43 +00:00
Zachary Turner
e9f782a21b [PDB] Correctly use the target machine when writing DBI stream.
Using Config->is64() will treat ARM64 as Amd64, which is incorrect.
Furthermore, there are more esoteric architectures that could
theoretically be encountered.  Just set it directly to the machine
type, which we already know anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330157 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16 20:42:06 +00:00
Zachary Turner
9a56b66b35 Resubmit "Fix some incorrect fields in our generated PDBs."
This fixes the failing tests.  They simply hadn't been updated
to match the new output resulting from this patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330145 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16 18:17:13 +00:00
Zachary Turner
84d38622bd Revert "Fix some incorrect fields in our generated PDBs."
There are a couple of failing tests which slipped under my radar
so I'm reverting this while I attempt to fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330133 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16 16:55:41 +00:00
Brock Wyma
8af1bad853 [CodeView] Initial support for emitting S_THUNK32 symbols for compiler...
When emitting CodeView debug information, compiler-generated thunk routines
should be emitted using S_THUNK32 symbols instead of S_GPROC32_ID symbols so
Visual Studio can properly step into the user code.  This initial support only
handles standard thunk ordinals.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330132 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16 16:53:57 +00:00