Commit Graph

415 Commits

Author SHA1 Message Date
Mike Aizatsky
a53c3a5236 fixing type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257238 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-09 00:31:56 +00:00
NAKAMURA Takumi
bac757414b llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp: Fix build in -m32. 1L is incompatible to int64_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257237 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-09 00:28:50 +00:00
Mike Aizatsky
d9750d38e1 [llvm-symbolizer] -print-source-context-lines option to print source code around the line.
Differential Revision: http://reviews.llvm.org/D15909

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257236 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-09 00:14:35 +00:00
Dimitry Andric
ac6a87b06e Fix several accidental DOS line endings in source files
Summary:
There are a number of files in the tree which have been accidentally checked in with DOS line endings.  Convert these to native line endings.

There are also a few files which have DOS line endings on purpose, and I have set the svn:eol-style property to 'CRLF' on those.

Reviewers: joerg, aaron.ballman

Subscribers: aaron.ballman, sanjoy, dsanders, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256707 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-03 17:22:03 +00:00
Dave Bartolomeo
341c84c440 Remove unused constants from TypeTableBuilder.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256389 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-24 19:15:56 +00:00
Bill Seurer
4c2011be7d Fix case of path name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256388 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-24 18:54:35 +00:00
Dave Bartolomeo
23d49e466a Fix CodeView library name and non-CMake builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256387 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-24 18:51:35 +00:00
Dave Bartolomeo
994a189088 LLVM CodeView library
Summary: This diff is the initial implementation of the LLVM CodeView library. There is much more work to be done, namely a CodeView dumper and tests. This patch should help others make progress on the LLVM->CodeView debug info emission while I continue with the implementation of the dumper and tests.

This library implements support for emitting debug info in the CodeView format. This phase of the implementation only includes support for CodeView type records. Clients that need to emit type records will use a class derived from TypeTableBuilder. TypeTableBuilder provides member functions for writing each kind of type record; each of these functions eventually calls the writeRecord virtual function to emit the actual bits of the record. Derived classes override writeRecord to implement the folding of duplicate records and the actual emission to the appropriate destination. LLVMCodeView provides MemoryTypeTableBuilder, which creates the table in memory. In the future, other classes derived from TypeTableBuilder will write to other destinations, such as the type stream in a PDB.

The rest of the types in LLVMCodeView define the actual CodeView type records and all of the supporting enums and other types used in the type records. The TypeIndex class is of particular interest, because it is used by clients as a handle to a type in the type table.

The library provides a relatively low-level interface based on the actual on-disk format of CodeView. For example, type records refer to other type records by TypeIndex, rather than by an actual pointer to the referent record. This allows clients to emit type records one at a time, rather than having to keep the entire transitive closure of type records in memory until everything has been emitted. At some point, having a higher-level interface layered on top of this one may be useful for debuggers and other tools that want a more holistic view of the debug info. The lower-level interface should be sufficient for compilers and linkers to do the debug info manipulation that they need to do efficiently.

Reviewers: rnk, majnemer

Subscribers: silvas, rnk, jevinskie, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256385 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-24 18:12:38 +00:00
Alexey Samsonov
9dcc66e06e [Symbolize] Improve the ownership of parsed objects.
This code changes the way Symbolize handles parsed binaries: now
parsed OwningBinary<Binary> is not broken into (binary, memory buffer)
pair, and is just stored as-is in a cache. ObjectFile components
of Mach-O universal binaries are also stored explicitly in a
separate cache.

Additionally, this change:
* simplifies the code that parses/caches binaries: it's now done
  in a single place, not three different functions.
* makes flush() method behave as expected, and actually clear
  the cached parsed binaries and objects.
* fixes a dangling pointer issue described in
  http://reviews.llvm.org/D15638

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256041 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 22:02:14 +00:00
Pete Cooper
11fd7a2269 Revert "Improve DWARFDebugFrame::parse to also handle __eh_frame."
This reverts commit r256008.

Its breaking multiple buildbots, although works for me locally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256013 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 19:45:38 +00:00
Pete Cooper
3c9c3bf291 Improve DWARFDebugFrame::parse to also handle __eh_frame.
LLVM MC has single methods which can handle the output of EH frame and DWARF CIE's and FDE's.

This code improves DWARFDebugFrame::parse to do the same for parsing.

This also allows llvm-objdump to support the --dwarf=frames option which objdump supports.  This
option dumps the .eh_frame section using the new code in DWARFDebugFrame::parse.

http://reviews.llvm.org/D15535

Reviewed by Rafael Espindola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256008 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 18:51:08 +00:00
Dave Bartolomeo
8cf8b10a59 Test commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255926 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-17 20:54:16 +00:00
David Blaikie
2a3cc32f71 [llvm-dwp] Retrieve the DWOID from the CU for the cu_index entry
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254731 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 17:20:04 +00:00
David Blaikie
d61481245d dwarfdump: Correctly indentify the indicies for DWP records
The indicies are one-based, not zero-based, per the spec.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254626 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 18:41:59 +00:00
David Blaikie
cf0403d373 [llvm-dwp] Don't rely on implicit move assignment operator (MSVC won't synthesize one)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 07:09:26 +00:00
David Blaikie
5001b2a939 [llvm-dwp] Emit a rather fictional debug_cu_index
This is very rudimentary support for debug_cu_index, but it is enough to
allow llvm-dwarfdump to find the offsets for  contributions and
correctly dump debug_info.

It will need to actually find the real signature of the unit and build
the real hash table with the right number of buckets, as per the DWP
specification.

It will also need to be expanded to cover the tu_index as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254489 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 06:21:34 +00:00
Craig Topper
766278ea84 Replace dyn_cast with isa in places that weren't using the returned value for more than a boolean check. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253441 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 07:07:59 +00:00
David Blaikie
2fa6f196d6 Fix null dereference committed in r253277
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253393 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 22:39:26 +00:00
David Blaikie
6715b1eee1 dwarfdump: support indexed string dumping in dwp based on the STR_OFFSETS component of the index
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253392 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 22:39:23 +00:00
David Blaikie
e6878ebe82 dwarfdump: Reference the appropriate line table segment when dumping dwp files
Also improves .dwo type unit dumping which didn't handle this either.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253377 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 21:08:05 +00:00
David Blaikie
0f6bba93de Fix indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253278 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 00:41:02 +00:00
David Blaikie
7cd8652959 dwarfdump: Use the index to find the right abbrev offset in DWP files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253277 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 00:39:55 +00:00
David Blaikie
6c420832f3 dwarfdump: Add support for dumping the table contents of DWP indexes
This is a recommit of 252842 which was reverted in 252859. The issue was
using %s format specifier for a StringRef - used Format's
left_justify(StringRef, int) instead.

It'd be nice to have __attribute__((format(..))) on llvm::format, but
apparently it's only implemented for c-style variadics, not C++ variadic
templates. Perhaps we could fix that & conditionalize the attribute on
such...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253065 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 19:18:49 +00:00
Reid Kleckner
84831cda66 [Symbolizer] Don't use PE symbol tables to override PDB symbols
Summary:
PE files are stripped by default, and only contain the names of exported
symbols.

The actual reason that we bother to do this override by default is
actually due to a quirk of the way -gline-tables-only is implemented, so
I phrased the check as "if we are symbolizing from dwarf, do the symtab
override".

This fixes lots of Windows ASan tests that I broke in r250582.

Reviewers: samsonov

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253051 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 17:00:36 +00:00
Amjad Aboud
65d7d51529 dwarfdump: Added macro support to llvm-dwarfdump tool.
Added "macro" option to "-debug-dump" flag, which trigger parsing and dumping of the ".debug_macinfo" section.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252866 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 09:38:54 +00:00
David Blaikie
c65ca6797f Mostly revert 252842 due to failures on some buildbots.
I imagine there's some UB in here somewhere, though Valgrind doesn't
seem to have picked it up (not sure if I have a working asan build right
now to test there).

GDB bot seems to be crashing:
http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/26267/steps/check-all/logs/FAIL%3A%20LLVM%3A%3Adwarfdump-dwp.test

Hexagon ELF bot is, presumably, just getting different output:
http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/32927/steps/check-all/logs/FAIL%3A%20LLVM%3A%3Adwarfdump-dwp.test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252859 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 06:33:14 +00:00
David Blaikie
704f2137a4 dwarfdump: Add error checking to fix the buildbots/correctness
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252845 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 01:57:33 +00:00
David Blaikie
c2e7b3e495 dwarfdump: Add some error handling for DWP index sections of the wrong size
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252843 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 01:41:59 +00:00
David Blaikie
ab8c64ccda dwarfdump: Dump the contents of DWP indexes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252842 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 01:41:52 +00:00
Hemant Kulkarni
a07496f56a [Symbolizer]: Add -pretty-print option
Differential Revision: http://reviews.llvm.org/D13671



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252798 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 20:41:43 +00:00
David Blaikie
8ad0ca8af4 dwarfdump: DWP type unit index dumping skeleton
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 19:40:49 +00:00
David Blaikie
4e295d05a5 Format my previous commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252782 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 19:30:47 +00:00
David Blaikie
1040f990fc dwarfdump: First piece of support for DWP dumping
Just a tiny piece of index dumping - the header in this instance.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252781 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 19:28:21 +00:00
Colin LeMahieu
55b72798ae Reverting r252760
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252770 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 18:11:06 +00:00
Hemant Kulkarni
5776ed04ce [Symbolizer]: Add -pretty-print option
Differential Revision: http://reviews.llvm.org/D13671


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252760 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 17:47:54 +00:00
Alexey Samsonov
3cdfe0ea1c [LLVMSymbolize] Reduce indentation by using helper function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252022 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 00:30:26 +00:00
Alexey Samsonov
d2c42d439a [LLVMSymbolize] Properly propagate object parsing errors from the library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252021 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 00:30:24 +00:00
Alexey Samsonov
55e87bbf66 [LLVMSymbolize] Factor out the logic for printing structs from DIContext. NFC.
Introduce DIPrinter which takes care of rendering DILineInfo and
friends. This allows LLVMSymbolizer class to return a structured data
instead of plain std::strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251989 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-03 22:20:52 +00:00
Alexey Samsonov
3c6ecc0e22 [LLVMSymbolize] Move demangling away from printing routines. NFC.
Make printDILineInfo and friends responsible for just rendering the
contents of the structures, demangling should actually be performed
earlier, when we have the information about the originating
SymbolizableModule at hand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251981 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-03 21:36:13 +00:00
Alexey Samsonov
b977d3a4f4 Let the users of LLVMSymbolizer decide whether they want to symbolize inlined frames.
Introduce LLVMSymbolizer::symbolizeInlinedCode() instead of switching
on PrintInlining option passed to the constructor. This will be needed
once we retrun structured data (instead of std::string) from
LLVMSymbolizer and move printing logic out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251675 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 00:40:20 +00:00
Alexey Samsonov
9452d6e487 [LLVMSymbolize] Simplify SymbolizableObjectFile::symbolizeInlinedCode(). NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251672 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 00:02:55 +00:00
Alexey Samsonov
ff7c978f81 [LLVMSymbolize] Move printing the description of a global into a separate function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251669 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 23:49:19 +00:00
Alexey Samsonov
32e078b09c [LLVMSymbolize] Move ModuleInfo into a separate class (SymbolizableModule).
Summary:
This is mostly NFC. It is a first step in cleaning up LLVMSymbolize
library. It removes "ModuleInfo" class which bundles together ObjectFile
and its debug info context in favor of:
  * abstract SymbolizableModule in public headers;
  * SymbolizableObjectFile subclass in implementation.

Additionally, SymbolizableObjectFile is now created via factory, so we
can properly detect object parsing error at this stage instead of keeping
the broken half-parsed object. As a next step, we would be able to
propagate the error all the way back to the library user.

Further improvements might include:
  * factoring out the logic of finding appropriate file with debug info
    for a given object file, and caching all parsed object files into a
    separate class [A].
  * factoring out DILineInfo rendering [B].
This would make what is now a heavyweight "LLVMSymbolizer" a relatively
straightforward class, that calls into [A] to turn filepath into a
SymbolizableModule, delegates actual symbolization to concrete SymbolizableModule
implementation, and lets [C] render the result.

Reviewers: dblaikie, echristo, rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251662 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 22:21:37 +00:00
Alexey Samsonov
4a86a8b614 [LLVMSymbolize] Don't use LLVMSymbolizer::Options in ModuleInfo. NFC.
LLVMSymbolizer::Options is mostly used in LLVMSymbolizer class anyway.
Let's keep their usage restricted to that class, especially given that
it's worth to move ModuleInfo to a different header, independent from
the symbolizer class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251363 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 22:34:56 +00:00
Alexey Samsonov
b522682945 Fix build failure on GCC 4.7 (old libstdc++ doesn't have std::map::emplace).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251347 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 21:20:37 +00:00
David Blaikie
561b5b7865 Remove use of std::map<>::emplace which is not supported on some older versions of libstdc++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251346 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 21:10:36 +00:00
Alexey Samsonov
43a759de81 [LLVMSymbolize] Use symbol table only if function linkage name was requested.
Now it's enough to just specify -functions=short without additionally
providing -use-symbol-table=false.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251339 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 20:12:29 +00:00
Alexey Samsonov
5f1d03dae6 Fix build error by fully qualifying llvm::make_unique.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251338 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 20:12:27 +00:00
Alexey Samsonov
c2df33628a [LLVMSymbolize] Use std::unique_ptr more extensively to clarify ownership.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251336 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 19:41:23 +00:00
Alexey Samsonov
0cd635f750 Move parts of llvm-symbolizer tool into LLVMSymbolize library.
Summary: See http://lists.llvm.org/pipermail/llvm-dev/2015-October/091624.html

Reviewers: echristo

Subscribers: llvm-commits, aizatsky

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251316 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 17:56:12 +00:00