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

403 Commits

Author SHA1 Message Date
Chandler Carruth
15c7b91ac2 [Modules] Make Support/Debug.h modular. This requires it to not change
behavior based on other files defining DEBUG_TYPE, which means it cannot
define DEBUG_TYPE at all. This is actually better IMO as it forces folks
to define relevant DEBUG_TYPEs for their files. However, it requires all
files that currently use DEBUG(...) to define a DEBUG_TYPE if they don't
already. I've updated all such files in LLVM and will do the same for
other upstream projects.

This still leaves one important change in how LLVM uses the DEBUG_TYPE
macro going forward: we need to only define the macro *after* header
files have been #include-ed. Previously, this wasn't possible because
Debug.h required the macro to be pre-defined. This commit removes that.
By defining DEBUG_TYPE after the includes two things are fixed:

- Header files that need to provide a DEBUG_TYPE for some inline code
  can do so by defining the macro before their inline code and undef-ing
  it afterward so the macro does not escape.

- We no longer have rampant ODR violations due to including headers with
  different DEBUG_TYPE definitions. This may be mostly an academic
  violation today, but with modules these types of violations are easy
  to check for and potentially very relevant.

Where necessary to suppor headers with DEBUG_TYPE, I have moved the
definitions below the includes in this commit. I plan to move the rest
of the DEBUG_TYPE macros in LLVM in subsequent commits; this one is big
enough.

The comments in Debug.h, which were hilariously out of date already,
have been updated to reflect the recommended practice going forward.

llvm-svn: 206822
2014-04-21 22:55:11 +00:00
Alexey Samsonov
b94b4557c0 [llvm-symbolizer] Print file/line for a PC even if there is no DIE describing it.
This is important for symbolizing executables with debug info in
unavailable .dwo files. Even if all DIE entries are missing, we can
still symbolize an address: function name can be fetched from symbol table,
and file/line info can be fetched from line table.

llvm-svn: 206665
2014-04-18 22:22:44 +00:00
Alexey Samsonov
5a3863a395 [DWARF parser] Turn DILineInfo into a struct.
Immutable DILineInfo doesn't bring any benefits and complicates
code. Also, use std::string instead of SmallString<16> for file
and function names - their length can vary significantly.

No functionality change.

llvm-svn: 206654
2014-04-18 21:36:39 +00:00
Alexey Samsonov
f021cb1cc1 [DWARF parser] Respect address ranges specified in compile unit DIE.
When address ranges for compile unit are specified in compile unit DIE
itself, there is no need to collect ranges from children subprogram DIEs.

This change speeds up llvm-symbolizer on Clang-produced binaries with
full debug info. For instance, symbolizing a first address in a 1Gb binary
is now 2x faster (1s vs. 2s).

llvm-svn: 206641
2014-04-18 20:30:27 +00:00
Benjamin Kramer
cbe7245a0f DebugInfo: Remove some initializer lists to make MSVC happy again.
llvm-svn: 206632
2014-04-18 19:01:53 +00:00
Alexey Samsonov
ea5a42fe9c [DWARF parser] Refactor fetching DIE address ranges.
Add a helper method to get address ranges specified in a DIE
(either by DW_AT_low_pc/DW_AT_high_pc, or by DW_AT_ranges). Use it
to untangle and simplify the code.

No functionality change.

llvm-svn: 206624
2014-04-18 17:25:46 +00:00
Craig Topper
c2260fc0ab [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
llvm-svn: 206252
2014-04-15 06:32:26 +00:00
David Blaikie
20021670e1 Simplify compression API by decompressing into a SmallVector rather than a MemoryBuffer
This avoids an extra copy during decompression and avoids the use of
MemoryBuffer which is a weirdly esoteric device that includes unrelated
concepts like "file name" (its rather generic name is a bit misleading).

Similar refactoring of zlib::compress coming up.

llvm-svn: 205676
2014-04-05 21:26:44 +00:00
David Blaikie
c5322af8c2 DebugInfo: Support debug_loc under fission
Implement debug_loc.dwo, as well as llvm-dwarfdump support for dumping
this section.

Outlined in the DWARF5 spec and http://gcc.gnu.org/wiki/DebugFission the
debug_loc.dwo section has more variation than the standard debug_loc,
allowing 3 different forms of entry (plus the end of list entry). GCC
seems to, and Clang certainly, only use one form, so I've just
implemented dumping support for that for now.

It wasn't immediately obvious that there was a good refactoring to share
the implementation of dumping support between debug_loc and
debug_loc.dwo, so they're separate for now - ideas welcome or I may come
back to it at some point.

As per a comment in the code, we could choose different forms that may
reduce the number of debug_addr entries we emit, but that will require
further study.

llvm-svn: 204697
2014-03-25 01:44:02 +00:00
Benjamin Kramer
9345ba0e3e Make some assertions on constant expressions static.
llvm-svn: 204011
2014-03-15 18:47:07 +00:00
Alexey Samsonov
c7665b69a6 [C++11] Introduce SectionRef::relocations() to use range-based loops
Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3077

llvm-svn: 203927
2014-03-14 14:22:49 +00:00
Alexey Samsonov
dec574044e Use ctor instead of initializer list to appease Windows buildbots
llvm-svn: 203915
2014-03-14 10:37:36 +00:00
Alexey Samsonov
165e747f63 Use temporary instead of a local variable here
llvm-svn: 203914
2014-03-14 10:20:10 +00:00
Alexey Samsonov
5eeea0b023 [C++11] Introduce ObjectFile::sections().
Summary:
This adds ObjectFile::section_iterator_range, that allows to write
range-based for-loops running over all sections of a given file.
Several files from lib/ are converted to the new interface. Similar fixes
should be applied to a variety of llvm-* tools.

Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3069

llvm-svn: 203799
2014-03-13 13:52:54 +00:00
Alexey Samsonov
168c757de0 [C++11] DWARF parser: use SmallVector<std::unique_ptr> for parsed units in DWARFContext, and delete custom destructors
llvm-svn: 203770
2014-03-13 08:19:59 +00:00
Alexey Samsonov
740617d186 [C++11] Convert DWARF parser to range-based for loops
llvm-svn: 203766
2014-03-13 07:52:54 +00:00
Ahmed Charles
52ce0c101e Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes
overloads to various functions which are used by those projects and llvm
which have OwningPtr's as parameters. This should allow out of tree
projects some time to move. There are also no changes to libs/Target,
which should help out of tree targets have time to move, if necessary.

llvm-svn: 203083
2014-03-06 05:51:42 +00:00
Ahmed Charles
4a96a15754 [C++11] Replace OwningPtr::take() with OwningPtr::release().
llvm-svn: 202957
2014-03-05 10:19:29 +00:00
Craig Topper
7208edb1c2 [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 202946
2014-03-05 07:52:44 +00:00
Craig Topper
b0056a4ca7 Switch all uses of LLVM_OVERRIDE to just use 'override' directly.
llvm-svn: 202621
2014-03-02 09:09:27 +00:00
Chandler Carruth
db906c8499 [C++11] Switch all uses of the llvm_move macro to use std::move
directly, and remove the macro.

llvm-svn: 202612
2014-03-02 04:08:41 +00:00
David Blaikie
5c7418b2ee llvm-dwarfdump: Support for debug_line.dwo section for file names for type units under fission.
llvm-svn: 202091
2014-02-24 23:58:54 +00:00
Diego Novillo
eb4175295c Support DWARF discriminators in object streamer.
Summary:
This adds support for emitting DWARF path discriminator values in
the object streamer. It also changes the DWARF dumper to show
discriminator values in the line table output.

Reviewers: echristo

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2794

llvm-svn: 201427
2014-02-14 19:27:53 +00:00
Adrian Prantl
241b4b0251 make llvm-dwarfdump a little more resilient when parsing .debug_loc
sections. The call to data.getUnsigned(&Offset, AddressSize) only
increments Offset if the read succeeds, which will result in an infinite
loop.

llvm-svn: 201179
2014-02-11 21:22:53 +00:00
Rafael Espindola
4abddc0b33 Change the begin and end methods in ObjectFile to match the style guide.
llvm-svn: 201108
2014-02-10 20:24:04 +00:00
Rafael Espindola
6148a226d5 Simplify the handling of iterators in ObjectFile.
None of the object file formats reported error on iterator increment. In
retrospect, that is not too surprising: no object format stores symbols or
sections in a linked list or other structure that requires chasing pointers.
As a consequence, all error checking can be done on begin() and end().

This reduces the text segment of bin/llvm-readobj in my machine from 521233 to
518526 bytes.

llvm-svn: 200442
2014-01-30 02:49:50 +00:00
Venkatraman Govindaraju
4cbcf2fd77 [Sparc] Add support for parsing DW_CFA_GNU_window_save.
llvm-svn: 200127
2014-01-26 05:13:44 +00:00
NAKAMURA Takumi
5a69751116 DWARFContext: Fix possible memory leak since r198908.
llvm-svn: 200000
2014-01-24 13:40:43 +00:00
Rafael Espindola
a7de95d3e7 Change createObjectFile to return an ErrorOr.
llvm-svn: 199776
2014-01-22 00:14:49 +00:00
David Blaikie
d9fe95178b llvm-dwarfdump: type unit dwo support
llvm-svn: 198850
2014-01-09 05:08:24 +00:00
David Blaikie
a9ddd4efa6 Simplify/collapse/denest a conditions/blocks.
llvm-svn: 198813
2014-01-09 00:13:35 +00:00
David Blaikie
52f79eb8c1 llvm-dwarfdump: reorder dwo sections to immediately proceed their non-dwo equivalents
This makes it easier to write a test that's mostly shared between
fission and non-fission (using FileCheck's multiple prefix support).

llvm-svn: 198806
2014-01-08 23:29:59 +00:00
Chandler Carruth
87f14b4eec Re-sort all of the includes with ./utils/sort_includes.py so that
subsequent changes are easier to review. About to fix some layering
issues, and wanted to separate out the necessary churn.

Also comment and sink the include of "Windows.h" in three .inc files to
match the usage in Memory.inc.

llvm-svn: 198685
2014-01-07 11:48:04 +00:00
David Blaikie
8a09ed5776 DebugInfo: Move type units into the debug_types section with appropriate comdat grouping and type unit headers
This commit does not complete the type units feature - there are issues
around fission support (skeletal type units, pubtypes/pubnames) and
hashing of some types including those containing references to types in
other type units.

Originally committed as r197073 and reverted in r197079.
Recommitted as r197197 to reproduce the failure and reverted as r197199

Turns out there was unstable ordering in the type unit dumping code.
Fixed by using MapVector in DWARFContext to store the debug_types
comdat sections.

Recommitted as r197210 with a fix to dumping and reverted as r197211
because I was a bit gun shy and thought I saw a failure that turned out
to be unrelated.

So here we go - once more with feeling! \o/

llvm-svn: 197275
2013-12-13 21:33:40 +00:00
David Blaikie
d33cff338c Revert "DebugInfo: Move type units into the debug_types section with appropriate comdat grouping and type unit headers"
This reverts commit r197210.

llvm-svn: 197211
2013-12-13 06:43:32 +00:00
David Blaikie
46261ea89d DebugInfo: Move type units into the debug_types section with appropriate comdat grouping and type unit headers
This commit does not complete the type units feature - there are issues
around fission support (skeletal type units, pubtypes/pubnames) and
hashing of some types including those containing references to types in
other type units.

Originally committed as r197073 and reverted in r197079.
Recommitted as r197197 to reproduce the failure and reverted as r197199

Turns out there was unstable ordering in the type unit dumping code.
Fixed by using MapVector in DWARFContext to store the debug_types
comdat sections.

llvm-svn: 197210
2013-12-13 06:27:38 +00:00
David Blaikie
98277f8277 DebugInfo: Avoid emitting pubtype entries for type DIEs that just indirect to a type unit.
llvm-svn: 195698
2013-11-26 00:22:37 +00:00
David Blaikie
263e05531f DebugInfo: Make pubnames header printing similar to unit header printing
In a failed attempt to allow the gnu-public-names.ll test case to not
hardcode the size of the unit that the pubnames section referred to I've
at least managed to have unit headers and pubnames headers print out in
a similar style.

This failed to achieve the desired goal because the header in a unit
specifies the length of the unit without the length element of the
header whereas the length in the pubnames includes this element, so the
numbers are off by 4 bytes. I don't know of any arithmetic powers in
FileCheck so the test case can't simply say "CU_LENGTH + 4".

llvm-svn: 193872
2013-11-01 17:53:30 +00:00
Alexey Samsonov
12785ece03 DWARFDebugArangeSet: remove dead code
llvm-svn: 193785
2013-10-31 18:54:20 +00:00
Alexey Samsonov
d06df25a95 DWARFUnit: kill dead code and make a couple of functions private. No functionality change.
llvm-svn: 193780
2013-10-31 18:05:02 +00:00
Alexey Samsonov
eeda86af06 DWARFAbbreviationDeclaration: remove dead code, refactor parsing code and make it more robust. No functionality change.
llvm-svn: 193770
2013-10-31 17:20:14 +00:00
Alexey Samsonov
29ac66d0fe DWARF parser: propery handle DW_FORM_ref_sig8 and fix Windows build.
Based on D2050 by Timur Iskhodzhanov.

llvm-svn: 193619
2013-10-29 16:32:19 +00:00
Timur Iskhodzhanov
a98623a27d Quick-fix DebugInfo build on Windows
MSVC can't comprehend
  template<typename T, size_t N>
  ArrayRef<T> makeArrayRef(const T (&Arr)[N]) {
    return ArrayRef<T>(Arr);
  }
if Arr is
  static const uint8_t sizes[];
declared in a templated and defined a few lines later.

I'll send a proper fix (i.e. get rid of unnecessary templates) for review soon.

llvm-svn: 193604
2013-10-29 12:13:22 +00:00
Richard Smith
c358358cab Clean up.
llvm-svn: 193576
2013-10-29 01:44:23 +00:00
NAKAMURA Takumi
b5769ec6db DWARFFormValue.cpp: Appease gcc to give explicit constructors.
error: conversion from `const uint8_t*' to non-scalar type `llvm::ArrayRef<unsigned char>' requested

llvm-svn: 193575
2013-10-29 01:43:05 +00:00
Alexey Samsonov
7b56aa1648 Merge DWARFDIE::extractFast and DWARFDIE::extract into one function.
Complicated CU-DIE-specific logic in the latter was never used,
and it makes sense to have safety checks for broken dwarf in the former.

llvm-svn: 193563
2013-10-28 23:58:58 +00:00
Alexey Samsonov
08970d884d DWARF parser: Use ArrayRef to represent form sizes and simplify DWARFDIE::extractFast() interface. No functionality change.
llvm-svn: 193560
2013-10-28 23:41:49 +00:00
Alexey Samsonov
6421cac301 DWARF parser: since DWARF4, DW_AT_high_pc may be a constant representing function size
llvm-svn: 193555
2013-10-28 23:15:15 +00:00
Alexey Samsonov
c8dd7e63e8 DebugInfo: Introduce the notion of "form classes"
Summary:
Use DWARF4 table of form classes to fetch attributes from DIE
in a more consistent way. This shouldn't change the functionality and
serves as a refactoring for upcoming change: DW_AT_high_pc has different
semantics depending on its form class.

Reviewers: dblaikie, echristo

Reviewed By: echristo

CC: echristo, llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1961

llvm-svn: 193553
2013-10-28 23:01:48 +00:00
Ed Maste
f3655708c9 Correct log message typo: ended ad -> ended at
(From LLDB r192897)

llvm-svn: 192968
2013-10-18 13:01:33 +00:00
Alexey Samsonov
4e8af73f01 [DebugInfo] Remove unneeded struct member and hide struct definition. No functionality change.
llvm-svn: 192954
2013-10-18 07:13:32 +00:00
Alexey Samsonov
5ed6e5276b [DebugInfo] Remove dead code.
llvm-svn: 192952
2013-10-18 07:03:16 +00:00
Alexey Samsonov
9568db6ca5 [DebugInfo] Delete dead code, simplify and fix code style for some existing code. No functionality change.
llvm-svn: 192894
2013-10-17 13:28:16 +00:00
Alexey Samsonov
efbb767b5b [DebugInfo] Further simplify DWARFDebugAranges public interface
llvm-svn: 191813
2013-10-02 07:12:47 +00:00
Alexey Samsonov
ada9b94050 [DebugInfo] Simplify and speedup .debug_aranges parsing
Parsing .debug_aranges section now takes O(nlogn) operations instead
of O(n^2), where "n" is the number of address ranges. With this change,
the time required to symbolize an address from a random large
Clang-generated binary drops from 165 seconds to 1.5 seconds.

No functionality change.

llvm-svn: 191781
2013-10-01 16:52:46 +00:00
Alexey Samsonov
1bb7484e09 [DebugInfo] Further simplify DWARFDebugAranges. No functionality change.
llvm-svn: 191779
2013-10-01 16:25:14 +00:00
Alexey Samsonov
18c4e7e84f [DebugInfo] Remove unused functions from DWARFDebugAranges and fix code style.
llvm-svn: 191778
2013-10-01 15:48:10 +00:00
Benjamin Kramer
9a4c18a22b Deallocate type units when destroying a DWARFContext.
llvm-svn: 191637
2013-09-29 11:24:02 +00:00
Eric Christopher
8a7dc17632 Rework conditional for printing out pub sections.
llvm-svn: 191571
2013-09-27 22:10:10 +00:00
Eric Christopher
02158bcbd4 Dump the normal dwarf pubtypes section as well.
llvm-svn: 191408
2013-09-25 23:02:41 +00:00
Eric Christopher
0ef07dbcf5 Unify pubsection/gnu pubsection printing.
llvm-svn: 191407
2013-09-25 23:02:36 +00:00
Eric Christopher
1f11b36bd9 Slight formatting change for pubnames/pubtypes output.
llvm-svn: 191401
2013-09-25 21:17:37 +00:00
David Blaikie
b096f4205c llvm-dwarfdump: add missing opening quotation mark lost in r191330
llvm-svn: 191333
2013-09-24 20:23:36 +00:00
David Blaikie
8a5b23ab1a llvm-dwarfdump: re-add field formatting for the entry kind lost in r191329
CR feedback from Eric Christopher

llvm-svn: 191330
2013-09-24 19:56:27 +00:00
David Blaikie
200977ce99 llvm-dwarfdump support for gnu_pubtypes
llvm-svn: 191329
2013-09-24 19:50:00 +00:00
NAKAMURA Takumi
b5e44fa680 DWARFTypeUnit::dump(): Use PRIx64 to format uint64_t.
llvm-svn: 191266
2013-09-24 03:23:07 +00:00
Eric Christopher
1c2f577ec5 Format the index entry kind string to align.
llvm-svn: 191255
2013-09-24 00:17:49 +00:00
David Blaikie
e6ea892307 Comments for r191234 as suggested by Eric Christopher.
llvm-svn: 191244
2013-09-23 23:39:55 +00:00
David Blaikie
c3cd97ef68 Unbreak the build (from r191233)since we're calling printf.
llvm-svn: 191238
2013-09-23 23:15:57 +00:00
David Blaikie
70660e39e4 llvm-dwarfdump/libDebugInfo support for type units
llvm-svn: 191234
2013-09-23 22:44:47 +00:00
David Blaikie
641c46dab7 Exract most of DWARFCompileUnit into a new DWARFUnit to prepare for the coming DWARFTypeUnit.
llvm-svn: 191233
2013-09-23 22:44:40 +00:00
David Blaikie
5e6273bea3 DebugInfo: Wrap section data and relocs together for dwarf dumping support
This is a small step that may enable some simplifications in producer
(DWARFContext) and consumer (DWARFCompileUnit and other places) by
making a more complete abstraction around the data and relocations for a
section. Small initial steps could include simple changes such as
passing the pair to DWARFCompileUnit's ctor rather than passing the data
and relocs separately. I don't intend to pursue any such changes
immediately, however.

The motivation for doing this now is that type unit dumping will need to
deal with these data+reloc pairs moreso than the existing dumping
support has needed to associate the data as type unit sections are named
the same (debug_types) and comdat group folded. So to implement dumping
and reloc handling we'll need a mapping of section->data+relocs.

llvm-svn: 191209
2013-09-23 17:42:01 +00:00
David Blaikie
60884c0660 Remove dead code
llvm-svn: 191179
2013-09-22 18:25:32 +00:00
David Blaikie
a65dc13dbb StringRef-ize some things
llvm-svn: 191178
2013-09-22 17:01:50 +00:00
Richard Smith
6dfe60433d Revert r191062; the build break was also fixed in a different (incompatible) way in r191060.
llvm-svn: 191065
2013-09-20 01:24:10 +00:00
Richard Smith
255a969b21 Unbreak Clang build after r191050: don't pass a StringRef to snprintf.
llvm-svn: 191062
2013-09-20 00:38:18 +00:00
David Blaikie
954130581b DebugInfo: constrain gnu pubnames test further
Ensures that the pubnames entries actually refer to the intended
entities. This test could be more flexible if there was a way to do
multiline FileCheck matches with captures (in that way the test wouldn't
need to have hardcoded offset values and would thus be resilient to
changes in the layout of the DIEs in this CU).

llvm-svn: 191055
2013-09-19 23:43:46 +00:00
David Blaikie
f60a2aeec3 DebugInfo: llvm-dwarfdump support for gnu_pubnames section
llvm-svn: 191050
2013-09-19 23:01:29 +00:00
Alexey Samsonov
349607af6f Add support for DebugFission to DWARF parser
Summary:
1) Make llvm-symbolizer properly symbolize
files with split debug info (by using stanalone .dwo files).
2) Make DWARFCompileUnit parse and store corresponding .dwo file,
if necessary.
3) Make bits of DWARF parsing more CompileUnit-oriented.

Reviewers: echristo

Reviewed By: echristo

CC: bkramer, llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1164

llvm-svn: 189329
2013-08-27 09:20:22 +00:00
Alexey Samsonov
c9f658cd2a Make DWARFCompileUnit non-copyable
Summary:
This is a part of D1164. DWARFCompileUnit is not that lightweight
to copy it around, and we want it to own corresponding .dwo compile unit
eventually.

Reviewers: echristo

Reviewed By: echristo

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1298

llvm-svn: 189089
2013-08-23 06:56:01 +00:00
David Blaikie
c5c33c4a15 llvm-dwarfdump: Do not include address offsets for attributes, only for tags
This reduces the noise in diffs making it more likely that, at least for
LLVM revision-over-revision, diffs will actually yield usable results.

This is consistent with objdump's DWARF dumping behavior.

llvm-svn: 188650
2013-08-19 03:36:23 +00:00
Alexey Samsonov
72db336586 Store compile unit corresponding to each chain of inlined debug info entries. No functionality change.
llvm-svn: 187792
2013-08-06 10:49:15 +00:00
Alexey Samsonov
c51801370f Add LLVM-style RTTI to DIContext/DWARFContext classes
llvm-svn: 187790
2013-08-06 10:32:39 +00:00
Eric Christopher
c5f9312717 Allow 4 as a valid debug info version.
llvm-svn: 187763
2013-08-06 01:38:27 +00:00
Alexey Samsonov
9e65cbea5d DebugInfo: Factor out parsing compile unit DIEs to a separate function. Improve code style and comments.
No functionality change.

llvm-svn: 186315
2013-07-15 08:43:35 +00:00
David Blaikie
efeec21da2 Spell correct (s/begining/beginning/)
llvm-svn: 184362
2013-06-19 21:42:05 +00:00
David Blaikie
7637c0313e llvm-dwarfdump: Add support for dumping the .debug_loc section
This is a basic implementation - we still don't have any support (that I
know of) for dumping DWARF expressions in a meaningful way, so the
location information itself is just printed as a sequence of bytes as we
do elsewhere.

llvm-svn: 184361
2013-06-19 21:37:13 +00:00
Rafael Espindola
6f41305fd8 Handle relocations that don't point to symbols.
In ELF (as in MachO), not all relocations point to symbols. Represent this
properly by using a symbol_iterator instead of a SymbolRef. Update llvm-readobj
ELF's dumper to handle relocatios without symbols.

llvm-svn: 183284
2013-06-05 01:33:53 +00:00
Rafael Espindola
5b34d5a3c7 Change how we iterate over relocations on ELF.
For COFF and MachO, sections semantically have relocations that apply to them.
That is not the case on ELF.

In relocatable objects (.o), a section with relocations in ELF has offsets to
another section where the relocations should be applied.

In dynamic objects and executables, relocations don't have an offset, they have
a virtual address. The section sh_info may or may not point to another section,
but that is not actually used for resolving the relocations.

This patch exposes that in the ObjectFile API. It has the following advantages:

* Most (all?) clients can handle this more efficiently. They will normally walk
all relocations, so doing an effort to iterate in a particular order doesn't
save time.

* llvm-readobj now prints relocations in the same way the native readelf does.

* probably most important, relocations that don't point to any section are now
visible. This is the case of relocations in the rela.dyn section. See the
updated relocation-executable.test for example.

llvm-svn: 182908
2013-05-30 03:05:14 +00:00
Eric Christopher
7112ce79dc Reformat comments here.
llvm-svn: 182901
2013-05-30 00:43:30 +00:00
Benjamin Kramer
06f11acde8 libDebugInfo depends on libObject nowadays.
llvm-svn: 181510
2013-05-09 13:48:26 +00:00
Eric Christopher
3cc2bddd41 Hoist boundary condition out of loop header.
llvm-svn: 181248
2013-05-06 21:19:44 +00:00
Eric Christopher
eb2243ca76 Untabify.
llvm-svn: 181247
2013-05-06 21:19:41 +00:00
Eric Christopher
4cbb105dfc Don't emit .dwo sections unless they exist.
llvm-svn: 181224
2013-05-06 17:50:42 +00:00
Rafael Espindola
9541db893e Clarify getRelocationAddress x getRelocationOffset a bit.
getRelocationAddress is for dynamic libraries and executables,
getRelocationOffset for relocatable objects.

Mark the getRelocationAddress of COFF and MachO as not implemented yet. Add a
test of ELF's. llvm-readobj -r now prints the same values as readelf -r.

llvm-svn: 180259
2013-04-25 12:28:45 +00:00
Alexey Samsonov
cb820bd0a4 Use zlib to uncompress debug sections in DWARF parser.
This makes llvm-dwarfdump and llvm-symbolizer understand
debug info sections compressed by ld.gold linker.

llvm-svn: 180088
2013-04-23 10:17:34 +00:00
Eric Christopher
65e2f0c4cb Remove variable store that is never read.
llvm-svn: 180013
2013-04-22 13:46:33 +00:00
Alexey Samsonov
7abfd15675 Use StringSwitch instead of long chain of if-else. No functionality change.
llvm-svn: 179682
2013-04-17 14:27:04 +00:00
Alexey Samsonov
542f535116 Create a stub for DWARF parser unittests
Moves one DWARF-specific header to include/llvm/DebugInfo from lib/.
Add a short unittest for r179095.

llvm-svn: 179678
2013-04-17 08:29:02 +00:00
Benjamin Kramer
cf2731d0e0 Rename the C function to create a SLPVectorizerPass to something sane and expose it in the header file.
llvm-svn: 179272
2013-04-11 11:36:36 +00:00
Alexey Samsonov
2d1fae1f75 DWARF parser: Fix DWARF-2/3 incompatibility: size of DW_FORM_ref_addr is the same as DW_FORM_addr in DWARF2, and is 4/8 bytes on 32/64-bit DWARF starting from DWARF3. Adding a test for this is a huge pain - generating and uploading pre-built binary with DWARF3 debug info is way too ugly, and writing fine-grained unittests for DebugInfo is impossible, as it doesn't expose any headers in include/llvm. That said, I'm going to choose the second approach and submit the patch exposing DebugInfo headers for review soon enough.
llvm-svn: 179095
2013-04-09 14:09:42 +00:00
Alexey Samsonov
5a62adc696 DWARF parser: remove duplicated code and fix code style in DIE extractors.
llvm-svn: 179023
2013-04-08 14:37:16 +00:00
Eric Christopher
546e1942f2 DW_FORM_sec_offset should be a relocation on platforms that use
a relocation across sections. Do this for DW_AT_stmt list in the
skeleton CU and check the relocations in the debug_info section.

Add a FIXME for multiple CUs.

llvm-svn: 178969
2013-04-07 03:43:09 +00:00
Matt Arsenault
a80a8422d5 Fix missing std::. Not sure how this compiles for anyone else.
llvm-svn: 177620
2013-03-21 00:57:21 +00:00
Rafael Espindola
c82c27dd5a xlC doesn't like Header being both a type and a member variable. Rename the
member variable.

Patch by Kai <kai@redstar.de>

llvm-svn: 177575
2013-03-20 21:03:41 +00:00
Eli Bendersky
7859287ea6 Code cleanup: pass Offset by pointer to parseInstruction to more explicitly
convey that it's a INOUT argument.
Also, if parsing of entry instructions fails, don't push the entry.

llvm-svn: 175847
2013-02-22 00:50:48 +00:00
Eli Bendersky
1185958e53 Previously, parsing capability of the .debug_frame section was added
to lib/DebugInfo, with dumping in llvm-dwarfdump. This patch adds
initial ability to parse and dump CFA instructions contained in
entries.

To keep it manageable, the patch omits some more advanced capabilities
(accounted in TODOs):

* Parsing of instructions with BLOCK arguments (expression lists)
* Dumping of actual instruction arguments (currently only names are
dumped). This is quite tricky since the dumper has to effectively
"interpret" the instructions.

llvm-svn: 175820
2013-02-21 22:53:19 +00:00
Benjamin Kramer
e11f88e804 Make helpers static. Add missing include so LLVMInitializeObjCARCOpts gets C linkage.
llvm-svn: 175264
2013-02-15 12:30:38 +00:00
Krzysztof Parzyszek
de39fad3d2 Add support for the pubnames section to llvm-dwarfdump.
llvm-svn: 174976
2013-02-12 16:20:28 +00:00
David Tweed
0d0db378f4 The patch to fix some issues in r174543 fixed the lines failing the test, but missed a couple
of lines which weren't being explicitly looked at and were printing incorrect results. These
values clearly must lie within 32 bits, so the casts are definitely safe.

llvm-svn: 174717
2013-02-08 16:35:10 +00:00
NAKAMURA Takumi
2ea96df1f0 FDE::dumpHeader(): Forgot to fix one more formatting, ... take two!
Excuse me, I could not test it locally.

llvm-svn: 174614
2013-02-07 14:54:42 +00:00
NAKAMURA Takumi
d33774373d FDE::dumpHeader(): Forgot to fix one more formatting. It affected bigendian hosts.
llvm-svn: 174602
2013-02-07 10:57:42 +00:00
NAKAMURA Takumi
b493210348 DWARFDebugFrame.cpp: Fix formatting on i686 hosts.
FIXME: Are they really truncated to i32 from i64 unconditionally?
llvm-svn: 174574
2013-02-07 02:02:27 +00:00
Eli Bendersky
31f7dcd2e4 Add some comments to new frame entries
llvm-svn: 174515
2013-02-06 16:20:31 +00:00
Eli Bendersky
935df72ee3 Failing builds because a private class member is not being used after
initialization is one of the reasons I consider -werror to be shoddy.

llvm-svn: 174485
2013-02-06 05:37:46 +00:00
Eli Bendersky
bd977c5c69 Add virtual desctructor to FrameEntry to avoid error on delete-non-virtual-dtor
llvm-svn: 174483
2013-02-06 03:08:02 +00:00
Eli Bendersky
7eeb3473bf Fix some formatting & add comments, following Eric's review
llvm-svn: 174473
2013-02-06 00:20:38 +00:00
Eli Bendersky
b5ee34671c Add missing file to CMake list
llvm-svn: 174465
2013-02-05 23:37:18 +00:00
Eli Bendersky
0802d28eff Initial support for DWARF CFI parsing and dumping in LLVM
llvm-svn: 174463
2013-02-05 23:30:58 +00:00
NAKAMURA Takumi
731f502bbd DWARFDebugLine.cpp: Fix true path. Did you forget "return true" here?
llvm-svn: 173552
2013-01-26 01:45:06 +00:00
Andrew Kaylor
2677c75e5d Add DIContext::getLineInfoForAddressRange() function and test. This function allows a caller to obtain a table of line information for a function using the function's address and size.
llvm-svn: 173537
2013-01-26 00:28:05 +00:00
Nadav Rotem
78ccedd76a Fix a warning in the new DWARFheader. Add a new line at the end of the file.
llvm-svn: 173518
2013-01-25 22:57:05 +00:00
Andrew Kaylor
c9fa0590eb Add support for applying in-memory relocations to the .debug_line section and, in the case of ELF files, using symbol addresses when available for relocations to the .debug_info section. Also extending the llvm-rtdyld tool to add the ability to dump line number information for testing purposes.
llvm-svn: 173517
2013-01-25 22:50:58 +00:00
Eli Bendersky
1b58747212 Add command-line flags for DWARF dumping.
Flags for dumping specific DWARF sections added in lib/DebugInfo and
llvm-dwarfdump.

llvm-svn: 173480
2013-01-25 20:26:43 +00:00
Eric Christopher
bd3c66b31a Fix the assembly and dissassembly of DW_FORM_sec_offset. Found this by
changing both the string of the dwo_name to be correct and the type of
the statement list.

Testcases all around.

llvm-svn: 172699
2013-01-17 03:00:04 +00:00
Eric Christopher
7c06c5fb2b Add the DW_AT_GNU_addr_base for the skeleton cu. Add support for
emitting the dwarf32 version of DW_FORM_sec_offset and correct
disassembler support.

llvm-svn: 172698
2013-01-17 02:59:59 +00:00
Eric Christopher
a159b6c731 Split address information for DWARF5 split dwarf proposal. This involves
using the DW_FORM_GNU_addr_index and a separate .debug_addr section which
stays in the executable and is fully linked.

Sneak in two other small changes:

a) Print out the debug_str_offsets.dwo section.
b) Change form we're expecting the entries in the debug_str_offsets.dwo
   section to take from ULEB128 to U32.

Add tests for all of this in the fission-cu.ll test.

llvm-svn: 172578
2013-01-15 23:56:56 +00:00
NAKAMURA Takumi
3f5b60a9a0 [Object, DebugInfo] Make DWARFContext BE-aware.
test/DebugInfo/member-pointers.ll would not fail in targetting BE any more.

llvm-svn: 171943
2013-01-09 02:45:05 +00:00
Eric Christopher
4b9394acd5 Whitespace and 80-col.
llvm-svn: 171804
2013-01-07 22:40:48 +00:00
Eric Christopher
ba738518f0 Add support for separating strings for the split debug info DWARF5
proposal. This leaves the strings in the skeleton die as strp,
but in all dwo files they're accessed now via DW_FORM_GNU_str_index.

Add support for dumping these sections and modify the fission-cu.ll
testcase to have the correct strings and form. Fix a small bug
in the fixed form sizes routine that involved out of array accesses
for the table and add a FIXME in the extractFast routine to fix
this up.

llvm-svn: 171779
2013-01-07 19:32:41 +00:00
Eric Christopher
e8b74437f7 Update comment.
llvm-svn: 171689
2013-01-07 03:27:58 +00:00
Eric Christopher
d593f65fae Add a space to the end of the line so we don't get "itsbounds" in output.
llvm-svn: 171487
2013-01-04 18:30:36 +00:00
Eric Christopher
03fdb543d9 Extend the dumping infrastructure to deal with additional
sections for debug info. These are some of the dwo sections from the
DWARF5 split debug info proposal. Update the fission-cu.ll testcase
to show what we should be able to dump more of now.

Work in progress: Ultimately the relocations will be gone for the
dwo section and the strings will be a different form (as well as
the rest of the sections will be included).

llvm-svn: 171428
2013-01-02 23:52:13 +00:00
Eric Christopher
c6fa1e95a2 Right now all of the relocations are 32-bit dwarf, and the relocation
information doesn't return an addend for Rel relocations. Go ahead
and use this information to fix relocation handling inside dwarfdump
for 32-bit ELF REL.

llvm-svn: 171126
2012-12-27 01:07:07 +00:00
Rafael Espindola
cb6155ac8d Don't skip __DWARF,
Now that we don't merge section and segment names, we don't need to skip the
segment name to get to the section name.

llvm-svn: 170839
2012-12-21 04:08:03 +00:00
Bill Wendling
56d9c4b832 Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
llvm-svn: 170502
2012-12-19 07:18:57 +00:00
Chandler Carruth
a98c778194 Sort includes for all of the .h files under the 'lib' tree. These were
missed in the first pass because the script didn't yet handle include
guards.

Note that the script is now able to handle all of these headers without
manual edits. =]

llvm-svn: 169224
2012-12-04 07:12:27 +00:00
Eric Christopher
178793931e The section is .debug_line.
llvm-svn: 168666
2012-11-27 01:40:36 +00:00
Eric Christopher
5843894e1e Add some basic support for the fission addr forms to DebugInfo.
llvm-svn: 168223
2012-11-16 23:44:11 +00:00
Alexey Samsonov
3f02d70a5b [DebugInfo] Generate address ranges for compile units even if .debug_aranges is present: it is often the case that .debug_aranges section contains ranges only for a small subset of compile units. Test cases will be added in separate commits.
llvm-svn: 168144
2012-11-16 08:36:25 +00:00
Eric Christopher
9df7c1b185 Rewrite DIContext interface to take an object. Update all callers.
llvm-svn: 167757
2012-11-12 21:40:38 +00:00
Alexey Samsonov
8fee8dc998 Fixup for r167558: Store raw pointer (instead of reference) to RelocMap in DIContext. This is needed to prevent crashes because of dangling reference if the clients don't provide RelocMap to DIContext constructor.
llvm-svn: 167728
2012-11-12 14:25:36 +00:00
Eric Christopher
b34bece6a8 Add a relocation visitor to lib object. This works via caching relocated
values in a map that can be passed to consumers. Add a testcase that
ensures this works for llvm-dwarfdump.

llvm-svn: 167558
2012-11-07 23:22:07 +00:00
Eric Christopher
1dcc1b0cdc Reformat and 80-column this. It's not strictly conforming
yet, but it's better.

llvm-svn: 167053
2012-10-30 21:36:43 +00:00
Eric Christopher
98ed8efd11 Use a typedef to reduce some typing and reformat code accordingly.
llvm-svn: 166077
2012-10-16 23:46:25 +00:00
Eric Christopher
e411070efb Variable name cleanup.
llvm-svn: 166076
2012-10-16 23:46:23 +00:00
Craig Topper
5a3d1cefa5 Mark unimplemented copy constructors and copy assignment operators as LLVM_DELETED_FUNCTION.
llvm-svn: 164090
2012-09-18 02:01:41 +00:00
Roman Divacky
85348270cd Stop casting away const qualifier needlessly.
llvm-svn: 163258
2012-09-05 22:26:57 +00:00
Roman Divacky
4c161d6fab Remove unused typedefs gcc4.8 warns about.
llvm-svn: 163225
2012-09-05 17:55:46 +00:00
Alexey Samsonov
0dd3d6f49e Add support for fetching inlining context (stack of source code locations)
by instruction address from DWARF.

Add --inlining flag to llvm-dwarfdump to demonstrate and test this functionality,
so that "llvm-dwarfdump --inlining --address=0x..." now works much like
"addr2line -i 0x...", provided that the binary has debug info
(Clang's -gline-tables-only *is* enough).

llvm-svn: 163128
2012-09-04 08:12:33 +00:00
Alexey Samsonov
ac2e149b2d Refactor fetching file/line info from DWARFContext to simplify the
code and allow better code reuse. Make the code a bit more conforming
to LLVM code style.
No functionality change.

llvm-svn: 162895
2012-08-30 07:49:50 +00:00
Marshall Clow
7c9fea2579 Fix compile error when building with C++11 - clang thinks that PRIx64 is a user-defined suffix or something
llvm-svn: 162704
2012-08-27 22:53:35 +00:00
NAKAMURA Takumi
940981753b DWARFDebugRangeList.cpp: Use PRIx64 for uint64_t as format string.
llvm-svn: 162665
2012-08-27 10:10:10 +00:00
Alexey Samsonov
57736afed2 [DebugInfo] fixup for r162657: update CMakeLists.txt
llvm-svn: 162659
2012-08-27 07:24:43 +00:00
Alexey Samsonov
e39e62d8e5 Add basic support for .debug_ranges section to LLVM's DebugInfo library.
This section (introduced in DWARF-3) is used to define instruction address
ranges for functions that are not contiguous and can't be described
by low_pc/high_pc attributes (this is the usual case for inlined subroutines).
The patch is the first step to support fetching complete inlining info from DWARF.

Reviewed by Benjamin Kramer.

llvm-svn: 162657
2012-08-27 07:17:47 +00:00
Eric Christopher
742a44014e Add support for some missing DW_FORM_*.
TODO: Fix code duplication and coding style.
llvm-svn: 162525
2012-08-24 01:14:23 +00:00
Eric Christopher
2ab028ca0f Formatting.
llvm-svn: 162524
2012-08-24 01:14:21 +00:00
Eric Christopher
1b1c2a9f48 Formatting cleanup.
llvm-svn: 162499
2012-08-23 23:26:57 +00:00
Eric Christopher
becf1e9673 Add an assert here in case parsing gave us a NULL compile unit.
llvm-svn: 162498
2012-08-23 23:21:11 +00:00
Eric Christopher
524510c805 80-col.
llvm-svn: 162422
2012-08-23 00:52:51 +00:00
Eric Christopher
73e02367e0 Tidy.
llvm-svn: 162421
2012-08-23 00:52:49 +00:00
Alexey Samsonov
fa8f91a368 Fix the representation of debug line table in DebugInfo LLVM library,
and "instruction address -> file/line" lookup.

Instead of plain collection of rows, debug line table for compilation unit is now
treated as the number of row ranges, describing sequences (series of contiguous machine
instructions). The sequences are not always listed in the order of increasing
address, so previously used std::lower_bound() sometimes produced wrong results.
Now the instruction address lookup consists of two stages: finding the correct
sequence, and searching for address in range of rows for this sequence.

llvm-svn: 161414
2012-08-07 11:46:57 +00:00
Alexey Samsonov
8832a9374f DebugInfo library: add support for fetching absolute paths to source files
(instead of basenames) from DWARF. Use this behavior in llvm-dwarfdump tool.

Reviewed by Benjamin Kramer.

llvm-svn: 160496
2012-07-19 07:03:58 +00:00
Alexey Samsonov
5204605486 Improve behavior of DebugInfoEntryMinimal::getSubprogramName() introduced in r159512.
To fetch a subprogram name we should not only inspect the DIE for this subprogram, but optionally inspect
its specification, or its abstract origin (even if there is no inlining), or even specification of an abstract origin.

Reviewed by Benjamin Kramer.

llvm-svn: 160365
2012-07-17 15:28:35 +00:00
Alexey Samsonov
a887f63924 Fix a bug in DebugInfo lib, extend a comment for one of the methods
llvm-svn: 159707
2012-07-04 09:42:54 +00:00
Alexey Samsonov
2e5d156c11 This patch extends the libLLVMDebugInfo which contains a minimalistic DWARF parser:
1) DIContext is now able to return function name for a given instruction address (besides file/line info).
2) llvm-dwarfdump accepts flag --functions that prints the function name (if address is specified by --address flag).
3) test case that checks the basic functionality of llvm-dwarfdump added

llvm-svn: 159512
2012-07-02 05:54:45 +00:00
Benjamin Kramer
270e886395 Fix a C++11 UDL conflict.
Still not fixed in the standard ;)

llvm-svn: 154044
2012-04-04 20:33:56 +00:00
David Blaikie
06ecc99a56 More dead code removal (using -Wunreachable-code)
llvm-svn: 148578
2012-01-20 21:51:11 +00:00
David Blaikie
576aba04f1 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146960
2011-12-20 02:50:00 +00:00
Daniel Dunbar
30d6a45140 LLVMBuild: Remove trailing newline, which irked me.
llvm-svn: 146409
2011-12-12 19:48:00 +00:00
Daniel Dunbar
4e00f5f8fd build/CMake: Finish removal of add_llvm_library_dependencies.
llvm-svn: 145420
2011-11-29 19:25:30 +00:00
Benjamin Kramer
da83e60daf Audited all the format strings in libDebugInfo and fixed those that didn't match the types.
llvm-svn: 143814
2011-11-05 16:01:13 +00:00
Benjamin Kramer
638df7f8c4 Reduce the offsets in DwarfDebugInfoEntry to 32 bit, they're printed with %x and
that breaks on big-endian machines.

I have to clean up the 32/64 bit confusion in libDebugInfo some day.

llvm-svn: 143812
2011-11-05 15:35:00 +00:00
Benjamin Kramer
3c2ba1a51a Add more PRI.64 macros for MSVC and use them throughout the codebase.
llvm-svn: 143799
2011-11-05 08:57:40 +00:00
Daniel Dunbar
3760ebeebb build: Add initial cut at LLVMBuild.txt files.
llvm-svn: 143634
2011-11-03 18:53:17 +00:00
NAKAMURA Takumi
cc0706b36c lib/DebugInfo/DWARFDebugLine.cpp: De-Unicode-ify.
llvm-svn: 141484
2011-10-08 11:22:47 +00:00
NAKAMURA Takumi
fe47764929 Whitespace
llvm-svn: 141483
2011-10-08 11:22:41 +00:00
Benjamin Kramer
ff31737153 DWARF: avoid unnecessary map lookups.
llvm-svn: 140260
2011-09-21 17:31:42 +00:00
Benjamin Kramer
5938cf29d2 Namespacify.
llvm-svn: 139892
2011-09-16 00:35:06 +00:00
Benjamin Kramer
e98b6ec93c DWARF: Reset the state after parsing a line table prologue and remove an unnecessary lookup.
llvm-svn: 139859
2011-09-15 21:59:13 +00:00
Benjamin Kramer
912beeec25 DWARF: Don't crash when looking up an invalid address.
llvm-svn: 139846
2011-09-15 21:08:54 +00:00
Benjamin Kramer
a2833ff7e0 DWARF: Put all the pieces we have together and provide a single accessor to DIContext that provides line information when given an address.
llvm-svn: 139836
2011-09-15 20:43:22 +00:00
Benjamin Kramer
5307d9c91a DWARF: Remove accessors that parse the whole line table section in one go, this can't possibly work.
The address size is specified by the compile unit associated with a line table, there is no global address size.

llvm-svn: 139835
2011-09-15 20:43:18 +00:00
Benjamin Kramer
1adbd30351 DWARF: Print line tables per compile unit, so they get the right address size.
llvm-svn: 139808
2011-09-15 18:02:20 +00:00
Benjamin Kramer
900209189c DWARF: wire up .debug_str dumping.
llvm-svn: 139799
2011-09-15 16:57:13 +00:00
Benjamin Kramer
346abfde05 DWARF: Make DIE printing more bulletproof.
llvm-svn: 139786
2011-09-15 05:43:00 +00:00
Benjamin Kramer
2b93dac69c DWARF: Print the number for unknown abbrev fields.
Thanks Nick!

llvm-svn: 139778
2011-09-15 04:15:59 +00:00
Benjamin Kramer
2dd05a53d3 DWARF: Fail gracefully when encountering unknown values in an abbrev.
llvm-svn: 139777
2011-09-15 04:00:58 +00:00
Nick Lewycky
4b85977895 Give structs with virtual methods a virtual destructor.
llvm-svn: 139776
2011-09-15 03:41:51 +00:00
Benjamin Kramer
8f332f8767 DWARF: Silence GCC -Wsign-compare warning.
llvm-svn: 139775
2011-09-15 03:20:04 +00:00
Benjamin Kramer
551244d899 DWARF: Fix indentation.
llvm-svn: 139774
2011-09-15 03:11:09 +00:00
Benjamin Kramer
8013b8f7e0 DWARF: Include <algorithm> explicitly.
llvm-svn: 139773
2011-09-15 02:19:33 +00:00
Benjamin Kramer
ceca872d69 DWARF: Add basic support for line tables.
The llvm-dwarfdump output isn't very verbose yet.

llvm-svn: 139771
2011-09-15 02:12:05 +00:00
Benjamin Kramer
00648a5c53 DWARF: Generate the address lookup table from the DIE tree if .debug_aranges is not available.
Ported from LLDB.

llvm-svn: 139732
2011-09-14 20:52:27 +00:00
Benjamin Kramer
3f753c2372 DWARF: Reorder fields to reduce padding.
llvm-svn: 139712
2011-09-14 18:34:47 +00:00
Benjamin Kramer
fd97743d22 DWARF: Improve indentation of DIE dumping so it's easier to see the structure.
llvm-svn: 139705
2011-09-14 17:54:56 +00:00
Benjamin Kramer
b08f6dc724 llvm-dwarfdump: Make the "is debug info section" heuristic stricter so it doesn't accidentaly picks up the wrong section.
Also add some validation code to the aranges section parser.

Fixes PR10926.

llvm-svn: 139701
2011-09-14 17:28:13 +00:00
Benjamin Kramer
a7b727b0bf Don't rely in <algorithm> being pulled in transitively.
llvm-svn: 139684
2011-09-14 01:27:48 +00:00
Benjamin Kramer
6b456ffb42 DWARF: Port support for parsing .debug_aranges section from LLDB and wire it up to llvm-dwarfdump.
This is only one half of it, the part that caches address ranges from the DIEs when .debug_aranges is
not available will be ported soon.

llvm-svn: 139680
2011-09-14 01:09:52 +00:00
Benjamin Kramer
62f1c110f1 DebugInfo: Don't print DIEs multiple times.
llvm-svn: 139671
2011-09-14 00:15:32 +00:00
Benjamin Kramer
c592744658 Style & indentation tweaks.
llvm-svn: 139646
2011-09-13 21:47:32 +00:00
Benjamin Kramer
fdfaae6a8f I know copy&paste!
llvm-svn: 139628
2011-09-13 19:49:53 +00:00
Benjamin Kramer
c4e7a56915 Sketch out a DWARF parser.
This introduces a new library to LLVM: libDebugInfo. It will provide debug information
parsing to LLVM. Much of the design and some of the code is taken from the LLDB project.

It also contains an llvm-dwarfdump tool that can dump the abbrevs and DIEs from an
object file. It can be used to write tests for DWARF input and output easily.

llvm-svn: 139627
2011-09-13 19:42:23 +00:00