summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* PDB - Instead of hardcoding stream numbers, use an enum.Zachary Turner2016-05-022-12/+17
| | | | llvm-svn: 268270
* Parse PDB Name Hash TableZachary Turner2016-05-024-0/+151
| | | | | | | | | | | | | PDB has a lot of similar data structures. We already have code for parsing a Name Map, but PDB seems to have a different but very similar structure that is a hash table. This is the beginning of code needed in order to parse the name hash table, but it is not yet complete. It parses the basic metadata of the hash table, the bucket array, and the names buffer, but doesn't use any of these fields yet as the data structure requires a non-trivial amount of work to understand. llvm-svn: 268268
* Fix crash in PDB when loading corrupt file.Zachary Turner2016-04-291-0/+7
| | | | | | | | | | There are probably hundreds of crashers we can find by fuzzing more. For now we do the simplest possible validation of the block size. Later, more complicated validations can verify that other fields of the super block such as directory size, number of blocks, agree with the size of the file etc. llvm-svn: 268084
* Put PDB parsing code into a pdb namespace.Zachary Turner2016-04-2911-62/+70
| | | | llvm-svn: 268072
* Refactor the PDB Stream reading interface.Zachary Turner2016-04-297-74/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | The motivation for this change is that PDB has the notion of streams and substreams. Substreams often consist of variable length structures that are convenient to be able to treat as guaranteed, contiguous byte arrays, whereas the streams they are contained in are not necessarily so, as a single stream could be spread across many discontiguous blocks. So, when processing data from a substream, we want to be able to assume that we have a contiguous byte array so that we can cast pointers to variable length arrays and such. This leads to the question of how to be able to read the same data structure from either a stream or a substream using the same interface, which is where this patch comes in. We separate out the stream's read state from the underlying representation, and introduce a `StreamReader` class. Then we change the name of `PDBStream` to `MappedBlockStream`, and introduce a second kind of stream called a `ByteStream` which is simply a sequence of contiguous bytes. Finally, we update all of the std::vectors in `PDBDbiStream` to use `ByteStream` instead as a proof of concept. llvm-svn: 268071
* [llvm-pdbdump] Try to appease the ASan botDavid Majnemer2016-04-291-0/+5
| | | | | | We didn't check that the file was large enough to hold a super block. llvm-svn: 267965
* [llvm-pdbdump] Restore error messages, handle bad block sizesDavid Majnemer2016-04-281-1/+1
| | | | | | | We lost the ability to report errors, bring it back. Also, correctly validate the block size. llvm-svn: 267955
* [llvm-pdbdump] Correctly read data larger than a blockDavid Majnemer2016-04-281-25/+15
| | | | | | | | | A bug was introduced when the code was refactored which resulted in a bad memory access. This fixes PR27565. llvm-svn: 267953
* Read discriminators correctly from object file.Dehao Chen2016-04-281-44/+33
| | | | | | | | | | | | | | | Summary: This is the follow-up patch for http://reviews.llvm.org/D19436 * Update the discriminator reading algorithm to match the assignment algorithm. * Add test to cover the new algorithm. Reviewers: dnovillo, echristo, dblaikie Subscribers: danielcdh, dblaikie, echristo, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D19522 llvm-svn: 267945
* Fix warning in PDB code. NFCAmaury Sechet2016-04-281-1/+1
| | | | llvm-svn: 267938
* Add parentheses to silence -Wparentheses warnings.Zachary Turner2016-04-281-6/+6
| | | | llvm-svn: 267934
* Read the rest of the DBI substreams, and parse source info.Zachary Turner2016-04-281-11/+124
| | | | | | | | | | | | | We now read out the rest of the substreams from the DBI streams. One of these substreams, the FileInfo substream, contains information about which source files contribute to each module (aka compiland). This patch additionally parses out the file information from that substream, and dumps it in llvm-pdbdump. Differential Revision: http://reviews.llvm.org/D19634 Reviewed by: ruiu llvm-svn: 267928
* Parse module information from DBI stream.Zachary Turner2016-04-273-2/+161
| | | | | | | | | | | | This gets more data out of the DBI strema of the PDB. In particular it extracts the metadata for the list of modules (compilands) that this PDB contains info about, and adds support for dumping these fields to llvm-pdbdump. Differential Revision: http://reviews.llvm.org/D19570 Reviewed By: ruiu llvm-svn: 267818
* [PDB] Fix function names for private symbols in PDBsReid Kleckner2016-04-271-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: llvm-symbolizer wants to get linkage names of functions for historical reasons. Linkage names are only recorded in the PDB for public symbols, and the linkage name is apparently stored separately in some "public symbol" record. We had a workaround in PDBContext which would look for such symbols when the user requested linkage names. However, when given an address that was truly in a private function and public funciton, we would accidentally find nearby public symbols and return those function names. The fix is to look for both function symbols and public symbols and only prefer the public symbol name if the addresses of the symbols agree. Fixes PR27492 Reviewers: zturner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19571 llvm-svn: 267732
* Remove more unused variables.Zachary Turner2016-04-261-3/+0
| | | | llvm-svn: 267598
* [llvm-pdbdump] Fix version reading on big endian systems.Zachary Turner2016-04-261-1/+2
| | | | llvm-svn: 267595
* Fix warnings and -Werror build on clang.Zachary Turner2016-04-261-1/+1
| | | | llvm-svn: 267589
* Parse and dump PDB DBI Stream Header InformationZachary Turner2016-04-265-1/+191
| | | | | | | | | | | | | | | | | | The DBI stream contains a lot of bookkeeping information for other streams. In particular it contains information about section contributions and linked modules. This patch is a first attempt at parsing some of the information out of the DBI stream. It currently only parses and dumps the headers of the DBI stream, so none of the module data or section contribution data is pulled out. This is just a proof of concept that we understand the basic properties of the DBI stream's metadata, and followup patches will try to extract more detailed information out. Differential Revision: http://reviews.llvm.org/D19500 Reviewed By: majnemer, ruiu llvm-svn: 267585
* Fix build broken due to order of initialization problem.Zachary Turner2016-04-261-2/+1
| | | | llvm-svn: 267571
* Refactor some more PDB reading code into DebugInfoPDB.Zachary Turner2016-04-263-0/+164
| | | | | | | Differential Revision: http://reviews.llvm.org/D19445 Reviewed By: David Majnemer llvm-svn: 267564
* Resubmit "Refactor raw pdb dumper into library"Zachary Turner2016-04-255-3/+468
| | | | | | | This fixes a number of endianness issues as well as an ODR violation that hopefully causes everything to be happy. llvm-svn: 267431
* llvm-symbolizer: Avoid infinite recursion walking dwos where the dwo ↵David Blaikie2016-04-221-5/+8
| | | | | | | | | | | contains a dwo_name attribute The dwo_name was added to dwo files to improve diagnostics in dwp, but it confuses tools that attempt to load any dwo named by a dwo_name, even ones inside dwos. Avoid this by keeping track of whether a unit is already a dwo unit, and if so, not loading further dwos. llvm-svn: 267241
* llvm-symbolizer: prefer .dwo contents over fission-gmlt-like-data when .dwo ↵David Blaikie2016-04-221-12/+7
| | | | | | | | | | | | | | | | | | | | | file is present Rather than relying on the gmlt-like data emitted into the .o/executable which only contains the simple name of any inlined functions, use the .dwo file if present. Test symbolication with/without a .dwo, and the old test that was testing behavior when no gmlt-like data was present. (I haven't included a test of non-gmlt-like data + no .dwo (that would be akin to symbolication with no debug info) but we could add one for completeness) The test was simplified a bit to be a little clearer (unoptimized, force inline, using a function call as the inlined entity) and regenerated with ToT clang. For the no-gmlt-like-data case, I modified Clang back to its old behavior temporarily & the .dwo file is identical so it is shared between the two executables. llvm-svn: 267227
* Revert r267049, r26706[16789], r267071 - Refactor raw pdb dumper into libraryDaniel Sanders2016-04-225-468/+3
| | | | | | r267049 broke multiple buildbots (e.g. clang-cmake-mips, and clang-x86_64-linux-selfhost-modules) which the follow-ups have not yet resolved and this is preventing subsequent committers from being notified about additional failures on the affected buildbots. llvm-svn: 267148
* Fix PDB warnings and testReid Kleckner2016-04-212-22/+9
| | | | llvm-svn: 267071
* Remove dead code. NFCAmaury Sechet2016-04-211-4/+0
| | | | llvm-svn: 267069
* Fix -Wreturn-type warning with HAVE_DIA_SDK is false.Zachary Turner2016-04-211-0/+2
| | | | llvm-svn: 267068
* Fix for case sensitive filename failure.Zachary Turner2016-04-211-1/+1
| | | | llvm-svn: 267066
* Remove various warnings. NFCAmaury Sechet2016-04-212-5/+4
| | | | llvm-svn: 267061
* Refactor raw pdb dumper into libraryZachary Turner2016-04-215-3/+484
| | | | | | | | | | | | | | | | | | PDB parsing code was hand-rolled into llvm-pdbdump. This patch moves the parsing of this code into DebugInfoPDB and makes the dumper use this. This is achieved by implementing the skeleton of RawPdbSession, the non-DIA counterpart to the existing PDB read interface. None of the type / source file / etc information is accessible yet, so this implementation is not yet close to achieving parity with the DIA counterpart, but the RawSession class simply holds a reference to a PDBFile class which handles parsing the file format. Additionally a PDBStream class is introduced which allows accessing the bytes of a particular stream in a PDB file. Differential Revision: http://reviews.llvm.org/D19343 Reviewed By: majnemer llvm-svn: 267049
* Thread Expected<...> up from libObject’s getName() for symbols to allow ↵Kevin Enderby2016-04-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | llvm-objdump to produce a good error message. Produce another specific error message for a malformed Mach-O file when a symbol’s string index is past the end of the string table. The existing test case in test/Object/macho-invalid.test for macho-invalid-symbol-name-past-eof now reports the error with the message indicating that a symbol at a specific index has a bad sting index and that bad string index value. Again converting interfaces to Expected<> from ErrorOr<> does involve touching a number of places. Where the existing code reported the error with a string message or an error code it was converted to do the same. There is some code for this that could be factored into a routine but I would like to leave that for the code owners post-commit to do as they want for handling an llvm::Error. An example of how this could be done is shown in the diff in lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h which had a Check() routine already for std::error_code so I added one like it for llvm::Error . Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: “// TODO: Actually report errors helpfully” and a call something like consumeError(NameOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. Note there fixes needed to lld that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one. llvm-svn: 266919
* [llvm-pdbdump] Print a better error message when PDB loading fails.Zachary Turner2016-04-192-14/+19
| | | | | | Differential Revision: http://reviews.llvm.org/D19234 llvm-svn: 266772
* Unbreak building llvm-pdbdump on Windows after r266595.Nico Weber2016-04-183-1/+4
| | | | llvm-svn: 266612
* [NFC] Header cleanupMehdi Amini2016-04-183-4/+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
* Update and fix LLVM_ENABLE_MODULES:Richard Smith2016-04-161-1/+0
| | | | | | | | | | | | | | | | 1) We need to add this flag prior to adding any other, in case the user has specified a -fmodule-cache-path= flag in their custom CXXFLAGS. Such a flag causes -Werror builds to fail, and thus all config checks fail, until we add the corresponding -fmodules flag. The modules selfhost bot does this, for instance. 2) Delete module maps that were putting .cpp files into modules. 3) Enable -fmodules-local-submodule-visibility, to get proper module visibility rules applied across submodules of the same module. Disable -fmodules for C builds, since that flag is not available there. llvm-svn: 266502
* Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump ↵Kevin Enderby2016-04-062-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to produce a real error message Produce the first specific error message for a malformed Mach-O file describing the problem instead of the generic message for object_error::parse_failed of "Invalid data was encountered while parsing the file”.  Many more good error messages will follow after this first one. This is built on Lang Hames’ great work of adding the ’Error' class for structured error handling and threading Error through MachOObjectFile construction. And making createMachOObjectFile return Expected<...> . So to to get the error to the llvm-obdump tool, I changed the stack of these methods to also return Expected<...> : object::ObjectFile::createObjectFile() object::SymbolicFile::createSymbolicFile() object::createBinary() Then finally in ParseInputMachO() in MachODump.cpp the error can be reported and the specific error message can be printed in llvm-objdump and can be seen in the existing test case for the existing malformed binary but with the updated error message. Converting these interfaces to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now use of errorToErrorCode() and errorOrToExpected() are used where the callers are yet to be converted. Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values. So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: “// TODO: Actually report errors helpfully” and a call something like consumeError(ObjOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one. llvm-svn: 265606
* Make DIASession work if msdia*.dll isn't registered.Nico Weber2016-04-011-9/+34
| | | | | | | | | This fixes various symbolization test failures for me when I build with a hermetic VS2015 without having run the 2015 installer. http://reviews.llvm.org/D18707 llvm-svn: 265193
* Fix Clang-tidy modernize-deprecated-headers warnings in some files; other ↵Eugene Zelenko2016-03-281-10/+19
| | | | | | | | minor fixes. Differential revision: http://reviews.llvm.org/D18469 llvm-svn: 264598
* Fix a crash in running llvm-objdump -t with an invalid Mach-O file alreadyKevin Enderby2016-03-231-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the test suite. While this is not really an interesting tool and option to run on a Mach-O file to show the symbol table in a generic libObject format it shouldn’t crash. The reason for the crash was in MachOObjectFile::getSymbolType() when it was calling MachOObjectFile::getSymbolSection() without checking its return value for the error case. What makes this fix require a fair bit of diffs is that the method getSymbolType() is in the class ObjectFile defined without an ErrorOr<> so I needed to add that all the sub classes.  And all of the uses needed to be updated and the return value needed to be checked for the error case. The MachOObjectFile version of getSymbolType() “can” get an error in trying to come up with the libObject’s internal SymbolRef::Type when the Mach-O symbol symbol type is an N_SECT type because the code is trying to select from the SymbolRef::ST_Data or SymbolRef::ST_Function values for the SymbolRef::Type. And it needs the Mach-O section to use isData() and isBSS to determine if it will return SymbolRef::ST_Data. One other possible fix I considered is to simply return SymbolRef::ST_Other when MachOObjectFile::getSymbolSection() returned an error. But since in the past when I did such changes that “ate an error in the libObject code” I was asked instead to push the error out of the libObject code I chose not to implement the fix this way. As currently written both the COFF and ELF versions of getSymbolType() can’t get an error. But if isReservedSectionNumber() wanted to check for the two known negative values rather than allowing all negative values or the code wanted to add the same check as in getSymbolAddress() to use getSection() and check for the error then these versions of getSymbolType() could return errors. At the end of the day the error printed now is the generic “Invalid data was encountered while parsing the file” for object_error::parse_failed. In the future when we thread Lang’s new TypedError for recoverable error handling though libObject this will improve. And where the added // Diagnostic(… comment is, it would be changed to produce and error message like “bad section index (42) for symbol at index 8” for this case. llvm-svn: 264187
* [DebugInfo] Dump CIE augmentation data as a list of hex bytesSimon Atanasyan2016-03-011-2/+7
| | | | | | | | | CIE augmentation data might contain non-printable characters. The patch prints the data as a list of hex bytes. Differential Revision: http://reviews.llvm.org/D17759 llvm-svn: 262361
* [DebugInfoPDB] Add source / line number accessors for PDB.Zachary Turner2016-02-183-3/+93
| | | | | | | This patch adds a variety of different methods to query source and line number information from PDB files. llvm-svn: 261239
* [DebugInfoPDB] A few cleanups on PDB Variant class.Zachary Turner2016-02-171-2/+4
| | | | | | | | Also implements the PDBSymbolCompilandEnv::getValue() method, which until now had been unimplemented specifically because variant did not support string values. llvm-svn: 261173
* [DebugInfoPDB] Raise getSymIndexId() up to PDBSymbolZachary Turner2016-02-171-0/+1
| | | | | | | | | | | | | Every symbol, no matter what it's tag is, supports the method getSymIndexId(). However, this was being forwarded on every concrete symbol type, so if someone had a PDBSymbol that they didn't know what type it was (or simply didn't have an instance of the concrete symbol type), they would not be able to get its index id. This patch moves the method up to PDBSymbol, so that no matter what type of object you have, you can always get its id. llvm-svn: 261153
* [DebugInfoPDB] Teach Variant to support string types.Zachary Turner2016-02-172-22/+36
| | | | | | | | | | The IDiaSymbol::getValue() method returns a variant. Until now, I had never encountered a string value, so the Variant wrapper did not support VT_BSTR. Now we have need to support string values, so this patch just adds support for one extra type to Variant. llvm-svn: 261152
* [DebugInfo] Eliminate compilation warning about used variable LSDADmitry Polukhin2016-02-051-2/+1
| | | | | | | The waring was: lib/DebugInfo/DWARF/DWARFDebugFrame.cpp:643:20: warning: variable ‘LSDA’ set but not used llvm-svn: 259877
* [DebugInfo] Support zero-length CIE in the _eh_frame parserIgor Laevsky2016-01-271-30/+27
| | | | | | | | | | | | MCJIT emits zero-length CIE at the end of the _eh_frame section. This change ensures that parser inside DebugInfo will not crash and correctly record such cases. We are now recording DW_EH_PE_omit as a default value for FDE and LSDA encodings. Also Offset != EndAugmentationOffset assertion check will only happen if augmentation string had 'z' letter in it. Differential Revision: http://reviews.llvm.org/D16588 llvm-svn: 258931
* Remove autoconf supportChris Bieneman2016-01-265-72/+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
* Re-submit r256008 "Improve DWARFDebugFrame::parse to also handle __eh_frame."Igor Laevsky2016-01-263-19/+186
| | | | | | | Originally this change was causing failures on windows buildbots. But those problems were fixed in r258806. llvm-svn: 258811
* [DebugInfo] Fix DWARFDebugFrame instruction operand orderingIgor Laevsky2016-01-261-6/+14
| | | | | | | | We can't rely on the evalution order of function arguments. Differential Revision: http://reviews.llvm.org/D16509 llvm-svn: 258806
* Fix instance of -Wcovered-switch-defaultReid Kleckner2016-01-131-2/+0
| | | | llvm-svn: 257665
OpenPOWER on IntegriCloud