Commit Graph

81 Commits

Author SHA1 Message Date
Zachary Turner
4ad658d8f1 [llvm-pdbdump] Very minor code cleanup.
This just removes some dead enums as well as some debug flushes
of stdout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230204 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 05:59:14 +00:00
Zachary Turner
92d755ea65 [llvm-pdbdump] Add an option to dump full class definitions.
This adds the --class-definitions flag.  If specified, when dumping
types, instead of "class Foo" you will see the full class definition,
with member functions, constructors, access specifiers.

NOTE: Using this option can be very slow, as generating a full class
definition requires accessing many different parts of the PDB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230203 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 05:58:34 +00:00
Zachary Turner
395adf9f89 [llvm-pdbdump] Rewrite dumper using visitor pattern.
This increases the flexibility of how to dump different
symbol types -- necessary for context-sensitive formatting of
symbol types -- and also improves the modularity by allowing
the dumping to be implemented in the actual dumper, as opposed
to in the PDB library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230184 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-22 22:03:38 +00:00
Aaron Ballman
66981fe208 Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229340 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-15 22:54:22 +00:00
Zachary Turner
7f6d93f718 llvm-pdbdump: Add flags controlling the type of values to dump.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229330 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-15 20:27:53 +00:00
Zachary Turner
73a1e454d7 llvm-pdbdump: Only dump whitelisted global symbols.
Dumping the global scope contains a lot of very uninteresting
things and is generally polluted with a lot of random junk.
Furthermore, it dumps values unsorted, making it hard to read.
This patch dumps known interesting types only, and as a side
effect sorts the list by symbol type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229232 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-14 03:54:28 +00:00
Frederic Riss
ae0c4604d4 DWARFUnit: Add a couple of helpers to access the DIE array.
To be used in dsymutil (or any other client that wants to take
advantage of the fact that DIEs are stored in a vector).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229179 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 23:18:24 +00:00
Zachary Turner
4c0a8b3025 llvm-pdbdump: Improve printing of functions and signatures.
This correctly prints the function pointers, and also prints
function signatures for symbols as opposed to just types.  So
actual functions in your program will now be printed with full
name and signature, as opposed to just name as before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229129 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 17:57:09 +00:00
Chandler Carruth
02d6288667 Re-sort #include lines using my handy dandy ./utils/sort_includes.py
script. This is in preparation for changes to lots of include lines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229088 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 09:09:03 +00:00
Zachary Turner
60f22886e3 Fix the windows build *again*. Grrr, MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229081 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 07:55:29 +00:00
Zachary Turner
2614564769 Fix non-windows builds unhappy about a missing header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229079 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 07:45:49 +00:00
Zachary Turner
eb95a535aa llvm-pdbdump: Add more comprehensive dumping of symbol types.
In particular this patch adds the ability to dump complete
function signature information including argument types as
correctly formatted strings.  A side effect of this is that
almost all symbol and meta types are now formatted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229076 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 07:40:03 +00:00
Zachary Turner
bcaafc81ab Improve llvm-pdbdump output display.
This patch adds a number of improvements to llvm-pdbdump.

1) Dumping of the entire global scope, and not only those
   symbols that live in individual compilands.
2) Prepend class name to member functions and data
3) Improved display of bitfields.
4) Support for dumping more kinds of data symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229012 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 01:23:51 +00:00
David Blaikie
122ea21abf Add missing override.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228974 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-12 22:58:53 +00:00
Zachary Turner
3231937293 Attempt to fix the build again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228964 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-12 21:25:58 +00:00
Zachary Turner
232308cfa9 Attempt to fix Linux builds after r228960.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228962 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-12 21:17:07 +00:00
Zachary Turner
13a819cbad Add concrete type overloads to PDBSymbol::findChildren().
Frequently you only want to iterate over children of a specific
type (e.g. functions).  Previously you would get back a generic
interface that allowed iteration over the base symbol type,
which you would have to dyn_cast<> each one of.  With this patch,
we allow the user to specify the concrete type as a template
parameter, and it will return an iterator which returns instances
of the concrete type directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228960 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-12 21:09:24 +00:00
Zachary Turner
1e70854148 Rewrite llvm-pdbdump in terms of LLVMDebugInfoPDB.
This makes llvm-pdbdump available on all platforms, although it
will currently fail to create a dumper if there is no PDB reader
implementation for the current platform.

It implements dumping of compilands and children, which is less
information than was previously available, but it has to be
rewritten from scratch using the new set of interfaces, so the
rest of the functionality will be added back in subsequent commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228755 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 22:43:25 +00:00
Zachary Turner
8ffa03cd98 Provide DIA implementation of DebugInfoPDB.
This implements DebugInfoPDB when the DIA SDK is present on the system.
Specifically, this means that the following conditions are met:
  1) You are building on Windows.
  2) You are building with MSVC.
  3) Visual Studio did not corrupt the installation of DIA due to a
     known issue with side-by-side installations of VS2012 and VS2013.
If all of these conditions are true, you will be able to pass a value
of PDB_Reader::DIA to PDB::createPdbReader().

There are no tests for this yet, as any test will be in the form of a
lit test which tests the llvm-pdbdump.exe, which still needs to be
rewritten in terms of this library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228747 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 21:17:52 +00:00
Zachary Turner
4bb5abb075 Make PDBSymbol's IPDBSymbol reference const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228553 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 22:53:53 +00:00
Zachary Turner
926749af90 DebugInfoPDB: Make the symbol base case hold an IPDBSession ref.
Dumping a symbol often requires access to data that isn't inside
the symbol hierarchy, but which is only accessible through the
top-level session.  This patch is a pure interface change to give
symbols a reference to the session.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228542 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 20:58:09 +00:00
Zachary Turner
e642985be9 Some cleanup for libpdb.
This patch implements a few of the optional suggestions from the
initial patch comitting libpdb.  In particular, it implements a
virtual function out of line for each of the concrete classes.

A few other minor cleanups exist as well, such as using override
instead of virtual, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228516 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 00:29:29 +00:00
Zachary Turner
6a03769d1c Change RHS-style decltype to LHS-style decltype<declval()>.
Seems some compilers don't like the RHS-style decltype specifier.

This should fix the buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228484 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-07 02:02:23 +00:00
Zachary Turner
44797c5a09 Resubmit "Create lib/DebugInfo/PDB" (r228428)
This change resubmits the patch that broke the build, this time
without unittests.  The unittests will be submitted separately
after the problem has been addressed:

--Original Commit Message--

Create lib/DebugInfo/PDB.

This patch creates a platform-independent interface to a PDB reader.
There is currently no implementation of this interface, which will
be provided in future patches.  This defines the basic object model
which any implementation must conform to.

Reviewed by: David Blaikie
Differential Revision: http://reviews.llvm.org/D7356

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228435 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-06 20:30:52 +00:00
Zachary Turner
9c505a5d38 Revert "Create lib/DebugInfo/PDB."
This reverts commit 21028, as it is causing failures in LLVMConfig.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-06 20:00:18 +00:00
Zachary Turner
1a05c567d6 Create lib/DebugInfo/PDB.
This patch creates a platform-independent interface to a PDB reader.
There is currently no implementation of this interface, which will
be provided in future patches.  This defines the basic object model
which any implementation must conform to.

Reviewed by: David Blaikie
Differential Revision: http://reviews.llvm.org/D7356

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228428 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-06 19:44:09 +00:00
Zachary Turner
50418a0ac4 Move DebugInfo to DebugInfo/DWARF.
In preparation for adding PDB support to LLVM, this moves the
DWARF parsing code to its own subdirectory under DebugInfo, and
renames LLVMDebugInfo to LLVMDebugInfoDWARF.

This is purely a mechanical / build system change.

Differential Revision: http://reviews.llvm.org/D7269
Reviewed by: Eric Christopher

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227586 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-30 18:07:45 +00:00
Frederic Riss
33c9f17f2c Add DWARFUnit::getNumDIEs() and getDIEIndex()
Parsed DIEs are stored in a vector and that makes it easy to get their
indices. Having easy access to a DIE's index makes it possible to use
arrays or vectors to efficiently store/access DIE related information.

There's no test for that new functionality (I don't see how to test
it standalone), but it'll be used in a subsequent dsymutil commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227381 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-28 22:15:07 +00:00
Chandler Carruth
1b279144ec [cleanup] Re-sort all the #include lines in LLVM using
utils/sort_includes.py.

I clearly haven't done this in a while, so more changed than usual. This
even uncovered a missing include from the InstrProf library that I've
added. No functionality changed here, just mechanical cleanup of the
include order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225974 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 11:23:27 +00:00
Frederic Riss
7e5492d27d [DebugInfo] Move all DWARF headers to the public include directory.
dsymutil needs access to DWARF specific inforamtion, the small DIContext
wrapper isn't sufficient. Other DWARF consumers might want to use it too
(I'm looking at you lldb).

Differential Revision: http://reviews.llvm.org/D6694

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224594 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19 18:26:33 +00:00
Frederic Riss
e26d79386b Reapply "[dwarfdump] Add support for dumping accelerator tables."
This reverts commit r221842 which was a revert of r221836 and of the
test parts of r221837.

This new version fixes an UB bug pointed out by David (along with
addressing some other review comments), makes some dumping more
resilient to broken input data and forces the accelerator tables
to be dumped in the tests where we use them (this decision is
platform specific otherwise).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222003 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 16:15:53 +00:00
Frederic Riss
8839439547 Revert "[dwarfdump] Add support for dumping accelerator tables."
This reverts commit r221836.

The tests are asserting on some buildbots. This also reverts the
test part of r221837 as it relies on dwarfdump dumping the
accelerator tables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221842 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 00:15:15 +00:00
Frederic Riss
931e22fd7c [dwarfdump] Add support for dumping accelerator tables.
The class used for the dump only allows to dump for the moment, but
it can (and will) be easily extended to support search also.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221836 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 23:48:10 +00:00
Frederic Riss
0275be3a97 Allow DWARFFormValue::extractValue to be called with a null CU.
Currently FormValues are only used for attributes of DIEs and thus
uers always have a CU lying around when calling into the FormValue
API.
Accelerator tables encode their information using the same Forms
as the attributes, thus it is natural to use DWARFFormValue to
extract/dump them. There is no CU in that case though. Allow the
API to be called with a null CU arguemnt by making the RelocMap
lookup conditional on the CU pointer validity. And document this
new behvior in the header. (Test coverage for this use of the API
comes in the DwarfAccelTable support patch)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221835 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 23:48:04 +00:00
Alexey Samsonov
10051f0f62 Constify input argument of RelocVisitor and DWARFContext constructors. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220228 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-20 20:28:51 +00:00
Frederic Riss
dd2cb9cae7 [dwarfdump] Resolve also variable specifications/abstract_origins.
DW_AT_specification and DW_AT_abstract_origin resolving was only performed
on subroutine DIEs because it used the getSubroutineName method. Introduce
a more generic getName() and use it to dump the reference attributes.

Testcases have been updated to check the printed names instead of the offsets
except when the name could be ambiguous.

Reviewers: dblaikie, samsonov

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5625

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219506 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 15:51:02 +00:00
Frederic Riss
a41fd4f9c2 Fix build faliure introduced by r217129.
Looks like one can't put 'const uint8_t' as ArrayRef contained type. It fails to build with libstdc++.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217132 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04 06:35:09 +00:00
Frederic Riss
b81715aca8 Add DWARFFormValue::getAsBlock() and add FC_Flag as an acceptable class for an unsigned constant.
To be used in further patches that improve the dumpers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217129 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04 06:14:35 +00:00
Rafael Espindola
81becb73ab Use a reference instead of a pointer.
This makes using a std::unique_ptr in the caller more convenient.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214433 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-31 20:19:36 +00:00
Alexey Samsonov
bf6e3f9257 [DWARF parser] Teach DIContext to fetch short (non-linkage) function names for a given address.
Change --functions option in llvm-symbolizer tool to accept
values "none", "short" or "linkage". Update the tests and docs
accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209050 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-17 00:07:48 +00:00
Alexey Samsonov
b043c3d94a [DWARF parser] Use enums instead of bitfields in DILineInfoSpecifier.
It is more appropriate than the current situation, when one flag
(AbsoluteFilePath) is relevant only if another flag is set.

This refactoring would also simplify fetching the short function name
(stored in DW_AT_name) instead of a linkage name returned currently.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208921 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-15 21:24:32 +00:00
Alexey Samsonov
08ef0202ce [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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206654 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-18 21:36:39 +00:00
Craig Topper
0b6cb7104b [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206252 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 06:32:26 +00:00
David Blaikie
b13d54f588 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204697 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 01:44:02 +00:00
David Blaikie
3e07f8a03d Revert "Clean up SmallString a bit"
This reverts commit r203374.

Ambiguities in assign... oh well. I'm just going to revert this and
probably not try to recommit it as it's not terribly important.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203375 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 06:22:58 +00:00
David Blaikie
ed8ba2e58e Clean up SmallString a bit
Move a common utility (assign(iter, iter)) into SmallVector (some of the
others could be moved there too, but this one seemed particularly
generic) and replace repetitions overrides with using directives.

And simplify SmallVector::assign(num, element) while I'm here rather
than thrashing these files (that cause everyone to rebuild) again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203374 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 06:17:01 +00:00
David Blaikie
2a213a4532 llvm-dwarfdump: Support for debug_line.dwo section for file names for type units under fission.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202091 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-24 23:58:54 +00:00
David Blaikie
a34ec4a961 llvm-dwarfdump: type unit dwo support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198850 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-09 05:08:24 +00:00
Alexey Samsonov
6faff4886a DWARF parser: Use ArrayRef to represent form sizes and simplify DWARFDIE::extractFast() interface. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193560 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-28 23:41:49 +00:00
Alexey Samsonov
c5253237f8 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193553 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-28 23:01:48 +00:00