summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* DebugInfoDWARFTests: Add missing deps, AsmPrinter and Object.NAKAMURA Takumi2016-12-081-0/+2
| | | | llvm-svn: 289052
* DebugInfoDWARFTests: Reorder LLVM_LINK_COMPONENTS.NAKAMURA Takumi2016-12-081-1/+1
| | | | llvm-svn: 289051
* Move DwarfGenerator.cpp to unittestsDaniel Jasper2016-12-084-1/+495
| | | | | | | | | So far it creates a test helper and so it should be moved there. It also create a layering cycle between CodeGen and CodeGen/AsmPrinter, which should be avoided. Review: https://reviews.llvm.org/D27570 llvm-svn: 289044
* Unbreak buildbots where the debug info test was crashing due to unchecked error.Greg Clayton2016-12-081-4/+5
| | | | llvm-svn: 289017
* Make a DWARF generator so we can unit test DWARF APIs with gtest.Greg Clayton2016-12-082-0/+798
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only tests we have for the DWARF parser are the tests that use llvm-dwarfdump and expect output from textual dumps. More DWARF parser modification are coming in the next few weeks and I wanted to add tests that can verify that we can encode and decode all form types, as well as test some other basic DWARF APIs where we ask DIE objects for their children and siblings. DwarfGenerator.cpp was added in the lib/CodeGen directory. This file contains the code necessary to easily create DWARF for tests: dwarfgen::Generator DG; Triple Triple("x86_64--"); bool success = DG.init(Triple, Version); if (!success) return; dwarfgen::CompileUnit &CU = DG.addCompileUnit(); dwarfgen::DIE CUDie = CU.getUnitDIE(); CUDie.addAttribute(DW_AT_name, DW_FORM_strp, "/tmp/main.c"); CUDie.addAttribute(DW_AT_language, DW_FORM_data2, DW_LANG_C); dwarfgen::DIE SubprogramDie = CUDie.addChild(DW_TAG_subprogram); SubprogramDie.addAttribute(DW_AT_name, DW_FORM_strp, "main"); SubprogramDie.addAttribute(DW_AT_low_pc, DW_FORM_addr, 0x1000U); SubprogramDie.addAttribute(DW_AT_high_pc, DW_FORM_addr, 0x2000U); dwarfgen::DIE IntDie = CUDie.addChild(DW_TAG_base_type); IntDie.addAttribute(DW_AT_name, DW_FORM_strp, "int"); IntDie.addAttribute(DW_AT_encoding, DW_FORM_data1, DW_ATE_signed); IntDie.addAttribute(DW_AT_byte_size, DW_FORM_data1, 4); dwarfgen::DIE ArgcDie = SubprogramDie.addChild(DW_TAG_formal_parameter); ArgcDie.addAttribute(DW_AT_name, DW_FORM_strp, "argc"); // ArgcDie.addAttribute(DW_AT_type, DW_FORM_ref4, IntDie); ArgcDie.addAttribute(DW_AT_type, DW_FORM_ref_addr, IntDie); StringRef FileBytes = DG.generate(); MemoryBufferRef FileBuffer(FileBytes, "dwarf"); auto Obj = object::ObjectFile::createObjectFile(FileBuffer); EXPECT_TRUE((bool)Obj); DWARFContextInMemory DwarfContext(*Obj.get()); This code is backed by the AsmPrinter code that emits DWARF for the actual compiler. While adding unit tests it was discovered that DIEValue that used DIEEntry as their values had bugs where DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref8, and DW_FORM_ref_udata forms were not supported. These are all now supported. Added support for DW_FORM_string so we can emit inlined C strings. Centralized the code to unique abbreviations into a new DIEAbbrevSet class and made both the dwarfgen::Generator and the llvm::DwarfFile classes use the new class. Fixed comments in the llvm::DIE class so that the Offset is known to be the compile/type unit offset. DIEInteger now supports more DW_FORM values. There are also unit tests that cover: Encoding and decoding all form types and values Encoding and decoding all reference types (DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, DW_FORM_ref_udata, DW_FORM_ref_addr) including cross compile unit references with that go forward one compile unit and backward on compile unit. Differential Revision: https://reviews.llvm.org/D27326 llvm-svn: 289010
* Clean up DWARFFormValue by reducing duplicated code and removing ↵Greg Clayton2016-11-111-10/+41
| | | | | | | | | | | | | | | | | | | | | DWARFFormValue::getFixedFormSizes() In preparation for a follow on patch that improves DWARF parsing speed, clean up DWARFFormValue so that we have can get the fixed byte size of a form value given a DWARFUnit or given the version, address byte size and dwarf32/64. This patch cleans up code so that everyone is using one of the new DWARFFormValue functions: static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, const DWARFUnit *U = nullptr); static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, uint16_t Version, uint8_t AddrSize, bool Dwarf32); This patch changes DWARFFormValue::skipValue() to rely on the output of DWARFFormValue::getFixedByteSize(...) instead of duplicating the code in each function. This will reduce the number of changes we need to make to DWARF to fewer places in DWARFFormValue when we add support for new form. This patch also starts to support DWARF64 so that we can get correct byte sizes for forms that vary according the DWARF 32/64. To reduce the code duplication a new FormSizeHelper pure virtual class was created that can be created as a FormSizeHelperDWARFUnit when you have a DWARFUnit, or FormSizeHelperManual where you manually specify the DWARF version, address byte size and DWARF32/DWARF64. There is now a single implementation of a function that gets the fixed byte size (instead of two where one took a DWARFUnit and one took the DWARF version, address byte size and DWARFFormat enum) and one function to skip the form values. https://reviews.llvm.org/D26526 llvm-svn: 286597
* Switch all DWARF variables for tags, attributes and forms over to use the ↵Greg Clayton2016-10-271-2/+2
| | | | | | | | llvm::dwarf enumerations instead of using raw uint16_t values. This allows easier debugging as users can see the values of the enumerations in the variables view that will show the enumeration string instead of just a number. https://reviews.llvm.org/D26013 llvm-svn: 285309
* [pdb] Fix unit test compilation.Zachary Turner2016-09-142-15/+23
| | | | llvm-svn: 281560
* [msf] Resubmit "Rename Msf -> MSF".Zachary Turner2016-07-293-57/+57
| | | | | | | | | | | | | Previously this change was submitted from a Windows machine, so changes made to the case of filenames and directory names did not survive the commit, and as a result the CMake source file names and the on-disk file names did not match on case-sensitive file systems. I'm resubmitting this patch from a Linux system, which hopefully allows the case changes to make it through unfettered. llvm-svn: 277213
* Revert "[msf] Rename Msf to MSF."Zachary Turner2016-07-293-57/+57
| | | | | | This reverts commit 4d1557ffac41e079bcb1abbcf04f512474dcd6fe. llvm-svn: 277194
* [msf] Rename Msf to MSF.Zachary Turner2016-07-293-57/+57
| | | | | | | | In a previous patch, it was suggested to use all caps instead of rolling caps for initialisms, so this patch changes everything to do this. llvm-svn: 277190
* [pdb] Fix another narrowing conversion on x64 builds.Zachary Turner2016-07-281-1/+1
| | | | llvm-svn: 277026
* [pdb] Refactor library to more clearly separate reading/writingZachary Turner2016-07-282-104/+94
| | | | | | | Reviewed By: amccarth, ruiu Differential Revision: https://reviews.llvm.org/D22693 llvm-svn: 277019
* Get rid of IMsfStreamData class.Zachary Turner2016-07-281-75/+99
| | | | | | | | | | | | | | | | | | | | This was a pure virtual base class whose purpose was to abstract away the notion of how you retrieve the layout of a discontiguous stream of blocks in an Msf file. This led to too many layers of abstraction making it difficult to figure out what was going on and extend things. Ultimately, a stream's layout is decided by its length and the array of block numbers that it lives on. So rather than have an abstract base class which can return this in any number of ways, it's more straightforward to simply store them as fields of a trivial struct, and also to give a more appropriate name. This patch does that. It renames IMsfStreamData to MsfStreamLayout, and deletes the 2 concrete implementations, DirectoryStreamData and IndexedStreamData. MsfStreamLayout is a trivial struct with the necessary data. llvm-svn: 277018
* Fix dangling reference to temporary in use of ArrayRefReid Kleckner2016-07-281-1/+3
| | | | | | Fixes tests locally for me with MSVC 2015. llvm-svn: 277015
* Make DebugInfoMsf a dependency of DebugInfoPDBTests.Zachary Turner2016-07-221-0/+1
| | | | | | | For some reason this doesn't cause linker errors with MSVC or clang-cl, but the bots seem to be failing with other compilers. llvm-svn: 276463
* [msf] Create LLVMDebugInfoMsfZachary Turner2016-07-222-19/+17
| | | | | | | | | | | | | | This provides a better layering of responsibilities among different aspects of PDB writing code. Some of the MSF related code was contained in CodeView, and some was in PDB prior to this. Further, we were often saying PDB when we meant MSF, and the two are actually independent of each other since in theory you can have other types of data besides PDB data in an MSF. So, this patch separates the MSF specific code into its own library, with no dependencies on anything else, and DebugInfoCodeView and DebugInfoPDB take dependencies on DebugInfoMsf. llvm-svn: 276458
* [pdb] Teach MsfBuilder and other classes about the Free Page Map.Zachary Turner2016-07-151-20/+26
| | | | | | | | | | | | | | Block 1 and 2 of an MSF file are bit vectors that represent the list of blocks allocated and free in the file. We had been using these blocks to write stream data and other data, so we mark them as the free page map now. We don't yet serialize these pages to the disk, but at least we make a note of what it is, and avoid writing random data to them. Doing this also necessitated cleaning up some of the tests to be more general and hardcode fewer values, which is nice. llvm-svn: 275629
* [pdb] Use MsfBuilder to handle the writing PDBs.Zachary Turner2016-07-151-2/+56
| | | | | | | | | | | | | | | Previously we would read a PDB, then write some of it back out, but write the directory, super block, and other pertinent metadata back out unchanged. This generates incorrect PDBs since the amount of data written was not always the same as the amount of data read. This patch changes things to use the newly introduced `MsfBuilder` class to write out a correct and accurate set of Msf metadata for the data *actually* written, which opens up the door for adding and removing type records, symbol records, and other types of data to an existing PDB. llvm-svn: 275627
* [pdb] Introduce MsfBuilder for laying out PDB files.Zachary Turner2016-07-154-17/+345
| | | | | | | Reviewed by: ruiu Differential Revision: https://reviews.llvm.org/D22308 llvm-svn: 275611
* [llvm-pdbdump] Propagate errors a little more consistentlyDavid Majnemer2016-07-101-2/+2
| | | | | | | PDBFile::getBlockData didn't really return any indication that it failed. It merely returned an empty buffer. llvm-svn: 275009
* Try to fix compilation error in DebugInfoPDBTests.Zachary Turner2016-07-081-1/+3
| | | | llvm-svn: 274881
* DebugInfoPDBTests:MappedBlockStreamTest.TestWriteThenRead: Avoid assigning ↵NAKAMURA Takumi2016-06-111-1/+3
| | | | | | temporary object to ArrayRef. llvm-svn: 272457
* Try again to fix this endianness issue.Zachary Turner2016-06-101-17/+15
| | | | llvm-svn: 272440
* [pdb] Fix issues with pdb writing.Zachary Turner2016-06-101-1/+4
| | | | | | | | | This fixes an alignment issue by forcing all cached allocations to be 8 byte aligned, and also fixes an issue arising on big endian systems by writing ulittle32_t's instead of uint32_t's in the test. llvm-svn: 272437
* Add support for writing through StreamInterface.Zachary Turner2016-06-101-22/+285
| | | | | | | | | | | This adds method and tests for writing to a PDB stream. With this, even a PDB stream which is discontiguous can be treated as a sequential stream of bytes for the purposes of writing. Reviewed By: ruiu Differential Revision: http://reviews.llvm.org/D21157 llvm-svn: 272369
* [pdb] Fix build errors in PDB unit tests.Zachary Turner2016-06-081-8/+15
| | | | llvm-svn: 272174
* [pdb] Fix broken unit test compilation.Zachary Turner2016-06-071-4/+4
| | | | llvm-svn: 272059
* [pdb] Fix broken unit tests after r271982.Zachary Turner2016-06-071-11/+13
| | | | llvm-svn: 271983
* [CodeView] Take the StreamRef::readBytes offset into account when validatingDavid Majnemer2016-06-021-0/+2
| | | | | | | | We only considered the length of the operation and the length of the StreamRef without considered what it meant for the offset to be at a non-zero position. llvm-svn: 271496
* Rework r271439. I forgot to save the buffer for editing.NAKAMURA Takumi2016-06-011-1/+1
| | | | llvm-svn: 271441
* MappedBlockStreamTest.cpp: Simplify array initializers.NAKAMURA Takumi2016-06-011-2/+2
| | | | llvm-svn: 271439
* [pdb] silence warnings about moving from a temporary.Zachary Turner2016-06-011-2/+2
| | | | llvm-svn: 271420
* [CodeView] Make sure StreamRef::readBytes doesn't read too muchDavid Majnemer2016-06-011-5/+17
| | | | llvm-svn: 271418
* [PDB] Silence sign comparison warnings in MappedBlockStreamTestDavid Majnemer2016-06-011-8/+8
| | | | llvm-svn: 271416
* MappedBlockStreamTest.cpp: Appease msc18 to avoid initializer for std::vector.NAKAMURA Takumi2016-06-011-2/+6
| | | | llvm-svn: 271397
* DebugInfoPDBTests: Update libdeps for r271346.NAKAMURA Takumi2016-06-011-0/+1
| | | | llvm-svn: 271355
* [pdb] Add unit tests for PDB MappedBlockStream and zero copyZachary Turner2016-05-312-0/+162
| | | | | | | Differential Revision: http://reviews.llvm.org/D20837 Reviewed By: ruiu llvm-svn: 271346
* Fix build of DebugInfoPDBTests.Zachary Turner2016-05-041-0/+1
| | | | | | Missing a using statement. llvm-svn: 268552
* [NFC] Header cleanupMehdi Amini2016-04-181-0/+1
| | | | | | | | | | | | | | Removed some unused headers, replaced some headers with forward class declarations. Found using simple scripts like this one: clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap' Patch by Eugene Kosov <claprix@yandex.ru> Differential Revision: http://reviews.llvm.org/D19219 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266595
* [DebugInfoPDB] Add source / line number accessors for PDB.Zachary Turner2016-02-181-0/+26
| | | | | | | This patch adds a variety of different methods to query source and line number information from PDB files. llvm-svn: 261239
* Remove autoconf supportChris Bieneman2016-01-263-47/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* Fix compilation of PDBApiTest.Zachary Turner2015-05-011-1/+1
| | | | llvm-svn: 236345
* [PDB] Support executables and source/line info.Zachary Turner2015-04-171-0/+10
| | | | | | | | | | | | Previously DebugInfoPDB could only load data for a PDB given a path to the PDB. It could not open an EXE and find the matching PDB and verify it matched, etc. This patch adds support for that so that we can simply load debug information for a PDB directly. Additionally, this patch extends DebugInfoPDB to support getting source and line information for symbols. llvm-svn: 235237
* Purge unused includes throughout libSupport.Benjamin Kramer2015-03-231-1/+2
| | | | | | NFC. llvm-svn: 232976
* Fix -Woverflow warning in unittest.Frederic Riss2015-03-051-1/+1
| | | | llvm-svn: 231368
* DWARFFormValue: Add getAsSignedConstant method.Frederic Riss2015-03-041-0/+74
| | | | | | | The implementation accepts explicitely signed forms (DW_FORM_sdata), but also unsigned forms as long as they fit in an int64_t. llvm-svn: 231299
* [llvm-pdbdump] Very minor code cleanup.Zachary Turner2015-02-231-1/+1
| | | | | | | This just removes some dead enums as well as some debug flushes of stdout. llvm-svn: 230204
* Fix the build, I forgot to check that UnitTests still built.Zachary Turner2015-02-131-0/+3
| | | | llvm-svn: 229021
* Fix warning due to unused private member variable.Zachary Turner2015-02-111-4/+3
| | | | llvm-svn: 228774
OpenPOWER on IntegriCloud