summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* [PDB] Remove use of std error codes.Zachary Turner2017-03-011-7/+6
| | | | | | | | | | I already created a BinaryStreamError class for this purpose, so update the code to use that on the remaining occurrences of errc values. This should also address the issue which led to r296583. llvm-svn: 296640
* (Rewroking r296581) PDB/BinaryStreamTest.cpp: Appease mingw to avoid ↵NAKAMURA Takumi2017-03-011-3/+4
| | | | | | | | | | | | std::errc::no_buffer_space. Unfortunately, mingw's libstdc++ doesn't provide winsock2 errors. That said, we should avoid raising OS-oriented error code in our code. For now, I suggest to define custom error from std::error_category. See also; https://reviews.llvm.org/D20592 llvm-svn: 296583
* Revert r296581, "PDB/BinaryStreamTest.cpp: Appease mingw to avoid ↵NAKAMURA Takumi2017-03-011-3/+3
| | | | | | | | std::errc::no_buffer_space." Wrong commit -- I have unstaged changes. llvm-svn: 296582
* PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffer_space.NAKAMURA Takumi2017-03-011-3/+3
| | | | | | | | | | Unfortunately, mingw's libstdc++ doesn't provide winsock2 errors. That said, we should avoid raising OS-oriented error code in our code. For now, I suggest to define custom error from std::error_category. See also; https://reviews.llvm.org/D20592 llvm-svn: 296581
* Move constexpr arrays out of class definition.Zachary Turner2017-03-011-3/+4
| | | | | | GCC Linker doesn't seem to like this. llvm-svn: 296560
* Fix signed / unsigned comparison warning.Zachary Turner2017-03-011-1/+1
| | | | llvm-svn: 296557
* [PDB] Add an additional test for BinaryStreamRef.Zachary Turner2017-03-011-2/+58
| | | | | | | | | | | A bug was uncovered where if you have a StreamRef whose ViewOffset is > 0, then when you call readLongestContiguousChunk it will succeed even when it shouldn't, and it always return you a buffer that was taken as if the ViewOffset was 0. Fixed this bug and added a test for it. llvm-svn: 296556
* [PDB] Add tests for BinaryStream.Zachary Turner2017-03-012-0/+644
| | | | llvm-svn: 296555
* [DWARFv5] Emit new unit header format.Paul Robinson2017-02-281-2/+8
| | | | | | | | | Requesting DWARF v5 will now get you the new compile-unit and type-unit headers. llvm-dwarfdump will also recognize them. Differential Revision: http://reviews.llvm.org/D30206 llvm-svn: 296514
* [PDB] Add BinaryStreamError.Zachary Turner2017-02-281-6/+6
| | | | | | | This migrates the stream code away from MSFError to using its own custom Error class. llvm-svn: 296494
* [PDB] Make streams carry their own endianness.Zachary Turner2017-02-283-10/+15
| | | | | | | | | | | | | Before the endianness was specified on each call to read or write of the StreamReader / StreamWriter, but in practice it's extremely rare for streams to have data encoded in multiple different endiannesses, so we should optimize for the 99% use case. This makes the code cleaner and more general, but otherwise has NFC. llvm-svn: 296415
* [PDB] Partial resubmit of r296215, which improved PDB Stream Library.Zachary Turner2017-02-273-39/+40
| | | | | | | | | | | | | | | | | This was reverted because it was breaking some builds, and because of incorrect error code usage. Since the CL was large and contained many different things, I'm resubmitting it in pieces. This portion is NFC, and consists of: 1) Renaming classes to follow a consistent naming convention. 2) Fixing the const-ness of the interface methods. 3) Adding detailed doxygen comments. 4) Fixing a few instances of passing `const BinaryStream& X`. These are now passed as `BinaryStreamRef X`. llvm-svn: 296394
* Revert r296215, "[PDB] General improvements to Stream library." and followings.NAKAMURA Takumi2017-02-255-812/+48
| | | | | | | | | | | | | | | | | r296215, "[PDB] General improvements to Stream library." r296217, "Disable BinaryStreamTest.StreamReaderObject temporarily." r296220, "Re-enable BinaryStreamTest.StreamReaderObject." r296244, "[PDB] Disable some tests that are breaking bots." r296249, "Add static_cast to silence -Wc++11-narrowing." std::errc::no_buffer_space should be used for OS-oriented errors for socket transmission. (Seek discussions around llvm/xray.) I could substitute s/no_buffer_space/others/g, but I revert whole them ATM. Could we define and use LLVM errors there? llvm-svn: 296258
* Add static_cast to silence -Wc++11-narrowing.Daniel Jasper2017-02-251-1/+1
| | | | llvm-svn: 296249
* [PDB] Disable some tests that are breaking bots.Zachary Turner2017-02-251-3/+3
| | | | | | | | This has to do with big endian, but I can't fix it until Monday. The code itself is fine, just the tests are wrong. Disabling 3 tests for now. llvm-svn: 296244
* Re-enable BinaryStreamTest.StreamReaderObject.Zachary Turner2017-02-252-34/+28
| | | | | | | I had an invalid pointer / size calculation that was causing a stack smash. Should be fixed now. llvm-svn: 296220
* Disable BinaryStreamTest.StreamReaderObject temporarily.Zachary Turner2017-02-251-33/+33
| | | | | | This is crashing on some bots, so I need some time to investigate. llvm-svn: 296217
* [PDB] General improvements to Stream library.Zachary Turner2017-02-255-48/+818
| | | | | | | | | | | | | | | This adds various new functionality and cleanup surrounding the use of the Stream library. Major changes include: * Renaming of all classes for more consistency / meaningfulness * Addition of some new methods for reading multiple values at once. * Full suite of unit tests for reader / writer functionality. * Full set of doxygen comments for all classes. * Streams now store their own endianness. * Fixed some bugs in a few of the classes that were discovered by the unit tests. llvm-svn: 296215
* [PDB] Rename Stream related source files.Zachary Turner2017-02-253-11/+11
| | | | | | | | | | | | | | This is part of a larger effort to get the Stream code moved up to Support. I don't want to do it in one large patch, in part because the changes are so big that it will treat everything as file deletions and add, losing history in the process. Aside from that though, it's just a good idea in general to make small changes. So this change only changes the names of the Stream related source files, and applies necessary source fix ups. llvm-svn: 296211
* Fix unit tests after r296049.Adrian McCarthy2017-02-241-1/+1
| | | | llvm-svn: 296055
* Don't assume little endian in StreamReader / StreamWriter.Zachary Turner2017-02-181-6/+6
| | | | | | | In an effort to generalize this so it can be used by more than just PDB code, we shouldn't assume little endian. llvm-svn: 295525
* [pdb] Add the ability to resolve TypeServer PDBs.Zachary Turner2017-02-162-0/+176
| | | | | | | | | | | | | | Some PDBs or object files can contain references to other PDBs where the real type information lives. When this happens, all type indices in the original PDB are meaningless because their records are not there. With this patch we add the ability to pull type info from those secondary PDBs. Differential Revision: https://reviews.llvm.org/D29973 llvm-svn: 295382
* [MC] Fix some Clang-tidy modernize and Include What You Use warnings in ↵Eugene Zelenko2017-02-091-10/+14
| | | | | | | | SubtargetFeature; other minor fixes (NFC). Same changes in files affected by reduced SubtargetFeature.h dependencies. llvm-svn: 294548
* Fix for r293104, which renamed a directory.Adrian McCarthy2017-01-252-3/+3
| | | | llvm-svn: 293105
* Post-commit review feedback from dblaikieChris Bieneman2017-01-231-1/+1
| | | | | | Use ASSERT_* instead of EXPECT_* for error condition. llvm-svn: 292798
* [pdb] Write the Named Stream mapping to Yaml and binary.Zachary Turner2017-01-201-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D28919 llvm-svn: 292665
* [PDB] Rename some files to be more intuitive.Zachary Turner2017-01-202-8/+8
| | | | llvm-svn: 292663
* [DWARF] [ObjectYAML] Adding APIs for unittestingChris Bieneman2017-01-202-30/+27
| | | | | | | | | | | | Summary: This patch adds some new APIs to enable using the YAML DWARF representation in unit tests. The most basic new API is DWARFYAML::EmitDebugSections which converts a YAML string into a series of owned MemoryBuffer objects stored in a StringMap. The string map can then be used to construct a DWARFContext for parsing in place of an ObjectFile. Reviewers: dblaikie, clayborg Subscribers: mgorny, fhahn, jgosnell, aprantl, llvm-commits Differential Revision: https://reviews.llvm.org/D28828 llvm-svn: 292634
* [pdb] Add HashTable data structure.Zachary Turner2017-01-192-0/+168
| | | | | | | | | | | | | | | | This was being parsed / serialized ad-hoc inside the code for a specific PDB stream. But this data structure is used in multiple ways / places within the PDB format. To be able to re-use it we need to raise this code out and make it more generic. In doing so, a number of bugs are fixed in the original implementation, and support is added for growing the hash table and deleting items from the hash table, which had either been omitted or incorrect implemented in the initial version. Differential Revision: https://reviews.llvm.org/D28715 llvm-svn: 292535
* DWARFDebugInfoTest.cpp: Don't use ArrayRef with initializer. It was ↵NAKAMURA Takumi2017-01-161-3/+3
| | | | | | allocated locally. llvm-svn: 292127
* PDB: Add a class to create the /names stream contents.Rui Ueyama2017-01-152-0/+55
| | | | | | | | | | This patch adds a new class NameHashTableBuilder which creates /names streams. This patch contains a test to confirm that a stream created by NameHashTableBuilder can be read by NameHashTable reader class. Differential Revision: https://reviews.llvm.org/D28707 llvm-svn: 292040
* Add a variant of DWARFDie::find() and DWARFDie::findRecursively() that takes ↵Greg Clayton2017-01-131-0/+67
| | | | | | | | | | a llvm::ArrayRef<dwarf::Attribute>. This allows us efficiently look for more than one attribute, something that is quite common in DWARF consumption. Differential Revision: https://reviews.llvm.org/D28704 llvm-svn: 291967
* Cleanup how DWARFDie attributes are accessed and decoded.Greg Clayton2017-01-131-123/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removed all DWARFDie::getAttributeValueAs*() calls. Renamed: Optional<DWARFFormValue> DWARFDie::getAttributeValue(dwarf::Attribute); To: Optional<DWARFFormValue> DWARFDie::find(dwarf::Attribute); Added: Optional<DWARFFormValue> DWARFDie::findRecursively(dwarf::Attribute); All decoding of Optional<DWARFFormValue> values are now done using the dwarf::to*() functions from DWARFFormValue.h: Old code: auto DeclLine = DWARFDie.getAttributeValueAsSignedConstant(DW_AT_decl_line).getValueOr(0); New code: auto DeclLine = toUnsigned(DWARFDie.find(DW_AT_decl_line), 0); This composition helps us since we can now easily do: auto DeclLine = toUnsigned(DWARFDie.findRecursively(DW_AT_decl_line), 0); This allows us to easily find attribute values in the current DIE only (the first new code above) or in any DW_AT_abstract_origin or DW_AT_specification Dies using the line above. Note that the code line length is shorter and more concise. Differential Revision: https://reviews.llvm.org/D28581 llvm-svn: 291959
* Fix buildbots.Greg Clayton2017-01-131-2/+2
| | | | llvm-svn: 291864
* Add the ability to iterate across all attributes in a DIE.Greg Clayton2017-01-131-7/+62
| | | | | | Differential Revision: https://reviews.llvm.org/D28386 llvm-svn: 291861
* Remove all variants of DWARFDie::getAttributeValueAs...() that had ↵Greg Clayton2017-01-111-75/+90
| | | | | | | | | | parameters that specified default values. Now we only support returning Optional<> values and have changed all clients over to use Optional::getValueOr(). Differential Revision: https://reviews.llvm.org/D28569 llvm-svn: 291686
* DebugInfo: support for DW_FORM_implicit_constVictor Leschuk2017-01-101-2/+28
| | | | | | | | | | | | Support for DW_FORM_implicit_const DWARFv5 feature. When this form is used attribute value goes to .debug_abbrev section (as SLEB). As this form would break any debug tool which doesn't support DWARFv5 it is guarded by dwarf version check. Attempt to use this form with dwarf version <= 4 is considered a fatal error. Differential Revision: https://reviews.llvm.org/D28456 llvm-svn: 291599
* Add iterator support to DWARFDie to allow child DIE iteration.Greg Clayton2017-01-053-0/+128
| | | | | | Differential Revision: https://reviews.llvm.org/D28303 llvm-svn: 291194
* Correct the parent testing to avoid the special case where a DIE has a depth ↵Greg Clayton2017-01-041-29/+46
| | | | | | | | | | of 1 This test was testing that we could correctly find the parent of a DIE, but it was actually just testing the special case where a DIE's depth was 1. This corrects that error by adding an extra level into the the DWARF to ensure that we correctly get the parent by looking for the parent with a depth that is 1 less than the current depth. Differential Revision: https://reviews.llvm.org/D28261 llvm-svn: 290918
* DebugInfo: add explicit casts for -Wqual-castSaleem Abdulrasool2016-12-271-2/+4
| | | | | | | Fix a warning detected by gcc 6: warning: cast from type 'const void*' to type 'uint8_t* {aka unsigned char*}' casts away qualifiers [-Wcast-qual] llvm-svn: 290618
* Add the ability for DWARFDie objects to get the parent DWARFDie.Greg Clayton2016-12-211-0/+116
| | | | | | | | | | | | In order for the llvm DWARF parser to be used in LLDB we will need to be able to get the parent of a DIE. This patch adds that functionality by changing the DWARFDebugInfoEntry class to store a depth field instead of a sibling index. Using a depth field allows us to easily calculate the sibling and the parent without increasing the size of DWARFDebugInfoEntry. I tested llvm-dsymutil on a debug version of clang where this fully parses DWARF in over 1200 .o files to verify there was no serious regression in performance. Added a full suite of unit tests to test this functionality. Differential Revision: https://reviews.llvm.org/D27995 llvm-svn: 290274
* Make a function to correctly extract the DW_AT_high_pc given the low pc value.Greg Clayton2016-12-191-0/+176
| | | | | | | | DWARF 4 and later supports encoding the PC as an address or as as offset from the low PC. Clients using DWARFDie should be insulated from how to extract the high PC value. This function takes care of extracting the form value and looking for the correct form. Differential Revision: https://reviews.llvm.org/D27885 llvm-svn: 290131
* [PDB] Validate superblock addressesDavid Majnemer2016-12-181-0/+1
| | | | | | | - Validate the address of the block map. - Validate the address of the free block map. llvm-svn: 290053
* Switch functions that returned bool and filled in a DWARFFormValue arg with ↵Greg Clayton2016-12-131-9/+13
| | | | | | | | ones that return Optional<DWARFFormValue> Differential Revision: https://reviews.llvm.org/D27737 llvm-svn: 289611
* Make a DWARFDIE class that can help avoid using the wrong DWARFUnit when ↵Greg Clayton2016-12-132-131/+130
| | | | | | | | | | | | extracting attributes Many places pass around a DWARFDebugInfoEntryMinimal and a DWARFUnit. It is easy to get things wrong by using the wrong DWARFUnit with a DWARFDebugInfoEntryMinimal. This patch creates a DWARFDie class that contains the DWARFUnit and DWARFDebugInfoEntryMinimal objects so that they can't get out of sync. All attribute extraction has been moved out of DWARFDebugInfoEntryMinimal and into DWARFDie. DWARFDebugInfoEntryMinimal was also renamed to DWARFDebugInfoEntry. DWARFDie objects are temporary objects that are used by clients and contain 2 pointers that you always need to have anyway. Keeping them grouped will avoid errors and simplify many of the attribute extracting APIs by not having to pass in a DWARFUnit. Differential Revision: https://reviews.llvm.org/D27634 llvm-svn: 289565
* Plug another leak in the DWARF unittests, DIEInlineStrings are never destroyed.Benjamin Kramer2016-12-091-1/+2
| | | | llvm-svn: 289208
* Fix memory leak in unit test.Benjamin Kramer2016-12-092-3/+3
| | | | | | | The StringPool entries are destroyed with the allocator, the string pool itself is not. llvm-svn: 289207
* Fix ASAN buildbots by fixing a double free crash.Greg Clayton2016-12-082-3/+5
| | | | | | The dwarfgen::Generator::StringPool was in a unique_ptr but it was owned by the Allocator member variable so it was being free twice. llvm-svn: 289070
* DIE::addAttribute(): Prune a redundant \param. [-Wdocumentation]NAKAMURA Takumi2016-12-081-1/+1
| | | | llvm-svn: 289056
* DebugInfoDWARFTests: Prune unused libdeps.NAKAMURA Takumi2016-12-081-4/+0
| | | | llvm-svn: 289053
OpenPOWER on IntegriCloud