summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj/COFFDumper.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [codeview] Add a type visitor to help abstract away type stream handlingReid Kleckner2016-05-041-485/+448
| | | | | | | | | | | | | | | | | | Summary: Port the dumper in llvm-readobj over to it. I'm planning to use this visitor to power type stream merging. While we're at it, try to switch from StringRef to ArrayRef<uint8_t> in some places. Reviewers: zturner, amccarth Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19899 llvm-svn: 268535
* Move CodeViewTypeStream to DebugInfo/CodeViewZachary Turner2016-05-031-137/+14
| | | | | | | | | | | | | Ability to parse codeview type streams is also needed by DebugInfoPDB for parsing PDBs, so moving this into a library gives us this option. Since DebugInfoPDB had already hand rolled some code to do this, that code is now convereted over to using this common abstraction. Differential Revision: http://reviews.llvm.org/D19887 Reviewed By: dblaikie, amccarth llvm-svn: 268454
* [codeview] Maintain the type enum-to-classname mapping in the .def fileReid Kleckner2016-05-031-23/+5
| | | | | | This way it will be easy to stamp out something like a type visitor. llvm-svn: 268347
* Move llvm-readobj/StreamWriter to Support.Zachary Turner2016-05-031-7/+7
| | | | | | | | | We wish to re-use this from llvm-pdbdump, and it provides a nice way to print structured data in scoped format that could prove useful for many other dumping tools as well. Moving to support and changing name to ScopedPrinter to better reflect its purpose. llvm-svn: 268342
* NFC: An iterator for stepping through CodeView type stream in llvm-readobjAdrian McCarthy2016-05-021-39/+125
| | | | | | | | | | | | This is a small refactoring step toward moving CodeView type stream logic from llvm-readobj to a library. It abstracts the logic of stepping through the stream into an iterator class and updates llvm-readobj to use that iterator. This has no functional change; llvm-readobj produces identical output. The next step is to abstract the parsing of the different leaf types and then move that and the iterator into a library. Since this is my first contrib outside LLDB, please let me know if I'm messing up on any of the LLVM style guidelines, idioms, or patterns. Differential Revision: http://reviews.llvm.org/D19746 llvm-svn: 268334
* [codeview] Isolate type dumping from object file stateReid Kleckner2016-05-021-18/+38
| | | | | | | | | | | | | | This isolates the state we use for type dumping from the knowledge of object files. We can use CVTypeDumper to dump types from anywhere in memory now. NFC Reviewers: zturner Differential Revision: http://reviews.llvm.org/D19824 llvm-svn: 268300
* [codeview] Don't dump type stream bytes unless asked toReid Kleckner2016-05-021-1/+2
| | | | llvm-svn: 268271
* Thread Expected<...> up from libObject’s getName() for symbols to allow ↵Kevin Enderby2016-04-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [codeview] Dump char16_t and char32_t simple typesReid Kleckner2016-04-151-0/+2
| | | | llvm-svn: 266465
* Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining ↵Duncan P. N. Exon Smith2016-04-051-87/+51
| | | | | | | | | | files; other minor fixes." This reverts commit r265454 since it broke the build. E.g.: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/ llvm-svn: 265459
* Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; ↵Eugene Zelenko2016-04-051-51/+87
| | | | | | | | | | | | other minor fixes. Some Include What You Use suggestions were used too. Use anonymous namespaces in source files. Differential revision: http://reviews.llvm.org/D18778 llvm-svn: 265454
* [codeview] Dump def range lengths in hexReid Kleckner2016-02-111-3/+3
| | | | | | | It makes it easier to correlate with assembly dumps, which are typically given with hex offsets. llvm-svn: 260619
* [codeview] Dump a missing field and change its signednessReid Kleckner2016-02-051-0/+2
| | | | llvm-svn: 259904
* Correctly handle {Always,Never}StepIntoLineDavid Majnemer2016-02-041-8/+9
| | | | llvm-svn: 259806
* Add support for S_DEFRANGE and S_DEFRANGE_SUBFIELDDavid Majnemer2016-02-041-2/+27
| | | | llvm-svn: 259805
* Make the dumper's output for variable ranges easier to readDavid Majnemer2016-02-041-24/+14
| | | | llvm-svn: 259804
* Print the OffsetStart field's relocationDavid Majnemer2016-02-031-8/+15
| | | | llvm-svn: 259723
* [llvm-readobj] Add support for dumping S_DEFRANGE symbolsDavid Majnemer2016-02-031-1/+84
| | | | llvm-svn: 259719
* [codeview] Wire up the .cv_inline_linetable directiveReid Kleckner2016-02-021-1/+1
| | | | | | | | This directive emits the binary annotations that describe line and code deltas in inlined call sites. Single-stepping through inlined frames in windbg now works. llvm-svn: 259535
* [CodeView] Fix dumping the is_stmt bit from the line tableReid Kleckner2016-01-291-1/+1
| | | | | | Bug pointed out by George Rimar. llvm-svn: 259205
* Reland "[CodeView] Use assembler directives for line tables"Reid Kleckner2016-01-291-6/+5
| | | | | | | | This reverts commit r259126 and relands r259117. This time with updated library dependencies. llvm-svn: 259130
* Revert "[CodeView] Use assembler directives for line tables"Reid Kleckner2016-01-291-5/+6
| | | | | | | | | This reverts commit r259117. The LineInfo constructor is defined in the codeview library and we have to link against it now. Doing that isn't trivial, so reverting for now. llvm-svn: 259126
* [CodeView] Use assembler directives for line tablesReid Kleckner2016-01-281-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a new family of .cv_* directives to LLVM's variant of GAS syntax: - .cv_file: Similar to DWARF .file directives - .cv_loc: Similar to the DWARF .loc directive, but starts with a function id. CodeView line tables are emitted by function instead of by compilation unit, so we needed an extra field to communicate this. Rather than overloading the .loc direction further, we decided it was better to have our own directive. - .cv_stringtable: Emits the codeview string table at the current position. Currently this just contains the filenames as null-terminated strings. - .cv_filechecksums: Emits the file checksum table for all files used with .cv_file so far. There is currently no support for emitting actual checksums, just filenames. This moves the line table emission code down into the assembler. This is in preparation for implementing the inlined call site line table format. The inline line table format encoding algorithm requires knowing the absolute code offsets, so it must run after the assembler has laid out the code. David Majnemer collaborated on this patch. llvm-svn: 259117
* [readobj] Print CodeOffset first, it's easier to readReid Kleckner2016-01-201-5/+5
| | | | llvm-svn: 258368
* Use new function name. NFC.Rafael Espindola2016-01-181-3/+2
| | | | llvm-svn: 258079
* [codeview] Handle multiple frame descriptions in readobjReid Kleckner2016-01-151-35/+29
| | | | llvm-svn: 257943
* [codeview] Dump the file checksum substreamReid Kleckner2016-01-151-0/+38
| | | | llvm-svn: 257910
* [codeview] Translate file table offsets to filenames and print themReid Kleckner2016-01-151-48/+63
| | | | llvm-svn: 257846
* [codeview] Dump function callees and add more labels to inlinee infoReid Kleckner2016-01-141-8/+26
| | | | | | | I kept forgetting which number is the line delta and which is the code delta. llvm-svn: 257813
* Update to use new name alignTo().Rui Ueyama2016-01-141-1/+1
| | | | llvm-svn: 257804
* [codeview] Dump CodeView inlinee lines subsectionReid Kleckner2016-01-141-0/+36
| | | | llvm-svn: 257790
* Use std::map::insert instead of emplace for libstdc++ 4.7Reid Kleckner2016-01-141-1/+1
| | | | llvm-svn: 257780
* Print function names when they are referenced via TypeIndexReid Kleckner2016-01-141-1/+1
| | | | llvm-svn: 257778
* [readobj] Add functionality to dump relocations inside of binary blobsReid Kleckner2016-01-141-6/+38
| | | | llvm-svn: 257777
* [codeview] Print relocations against code and data offset fieldsReid Kleckner2016-01-141-76/+62
| | | | | | | | These fields are almost always zero. However, there are relocations against them, and we should print the relocation symbol with it as SYM+0xNN. llvm-svn: 257776
* [CodeView] Add support for dumping binary annotationsDavid Majnemer2016-01-141-1/+100
| | | | | | | | | | | | Binary annotations are encoded along the lines of UTF-8 and ECI but with a few minor differences. The algorithm specified in "ECMA-335 CLI Section II.3.2 - Blobs and Signatures" is used to compress binary annotations. Signed binary annotations are encoded like unsigned annotations except the sign bit is rotated left to reduce the number of bits needed to be encoded. llvm-svn: 257742
* [codeview] Share more enums across the writer and the dumperReid Kleckner2016-01-131-12/+17
| | | | | | | | | Moves some .def files into include/DebugInfo/CodeView. Aslo remove a 'using namespace' directive from a header in readobj and update the uses of the endian helper types to compensate. llvm-svn: 257712
* [readobj] Expand CodeView dumping functionalityReid Kleckner2016-01-131-140/+1568
| | | | | | | | | | | | | | | | This rewrites and expands the existing codeview dumping functionality in llvm-readobj using techniques similar to those in lib/Object. This defines a number of new records and enums useful for reading memory mapped codeview sections in COFF objects. The dumper is intended as a testing tool for LLVM as it grows more codeview output capabilities. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D16104 llvm-svn: 257658
* [CodeView] Improve the line table dumperDavid Majnemer2016-01-131-14/+28
| | | | | | | | This change has us print out fields we didn't previously understand. To improve readability, we now group column information with it's respective line. llvm-svn: 257552
* Reland "[llvm-readobj] Simplify usage of -codeview flag"Reid Kleckner2015-12-161-7/+13
| | | | | | Relands r255790 with fixed tests. llvm-svn: 255793
* Revert "[llvm-readobj] Simplify usage of -codeview flag"Reid Kleckner2015-12-161-13/+7
| | | | | | This reverts commit r255790. llvm-svn: 255791
* [llvm-readobj] Simplify usage of -codeview flagReid Kleckner2015-12-161-7/+13
| | | | llvm-svn: 255790
* [llvm-readobj] s/FunctionName/LinkageName/ for codeview dumpingReid Kleckner2015-12-151-7/+7
| | | | | | | The symbol being printed in this field comes from the main symbol table, not 0xF1 subsection. Use LinkageName to make that a lot clearer. llvm-svn: 255596
* [COFF] Add IMAGE_SCN_TYPE_NOLOAD to SectionCharacteristicsDavid Majnemer2015-07-301-0/+1
| | | | llvm-svn: 243658
* llvm-readobj: call exit(1) on error.Rafael Espindola2015-07-201-54/+33
| | | | | | | | | llvm-readobj exists for testing llvm. We can safely stop the program the first time we know the input in corrupted. This is in preparation for making it handle a few more broken files. llvm-svn: 242656
* [llvm-readobj] Re-add sanity checking which was accidentally removed in r241764David Majnemer2015-07-091-2/+9
| | | | llvm-svn: 241831
* llvm-readobj: Fix an unused variable after r241764Justin Bogner2015-07-091-2/+3
| | | | llvm-svn: 241783
* [CodeView] Add support for emitting column informationDavid Majnemer2015-07-091-6/+14
| | | | | | | | | | Column information is present in CodeView when the line table subsection has bit 0 set to 1 in it's flags field. The column information is represented as a pair of 16-bit quantities: a starting and ending column. This information is present at the end of the chunk, after all the line-PC pairs. llvm-svn: 241764
* Check that COFF .obj files have sections with zero virtual address spaces.Rafael Espindola2015-07-061-1/+6
| | | | | | | | | | | | | When talking about the virtual address of sections the coff spec says: ... for simplicity, compilers should set this to zero. Otherwise, it is an arbitrary value that is subtracted from offsets during relocation. We don't currently subtract it, so check that it is zero. If some producer does create such files, we can change getRelocationOffset instead. llvm-svn: 241447
* Return ErrorOr from SymbolRef::getName.Rafael Espindola2015-07-021-3/+9
| | | | | | | | | | | | This function can really fail since the string table offset can be out of bounds. Using ErrorOr makes sure the error is checked. Hopefully a lot of the boilerplate code in tools/* can go away once we have a diagnostic manager in Object. llvm-svn: 241297
OpenPOWER on IntegriCloud