summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Change llvm-objdump, llvm-nm and llvm-size when reporting an object file errorKevin Enderby2016-05-311-1/+1
| | | | | | | | | | | | | | | | | | | when the object is from a slice of a Mach-O Universal Binary use something like "foo.o (for architecture i386)" as part of the error message when expected. Also fixed places in these tools that were ignoring object file errors from MachOUniversalBinary::getAsObjectFile() when the code moved on to see if the slice was an archive. To do this MachOUniversalBinary::getAsObjectFile() and MachOUniversalBinary::getObjectForArch() were changed from returning ErrorOr<...> to Expected<...> then that was threaded up to its users. Converting these interfaces to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now the use of errorToErrorCode() is still used in two places yet to be fully converted. llvm-svn: 271332
* Avoid some copies by using const references.Benjamin Kramer2016-05-271-1/+1
| | | | | | | clang-tidy's performance-unnecessary-copy-initialization with some manual fixes. No functional changes intended. llvm-svn: 270988
* [NFC] Header cleanupMehdi Amini2016-04-181-1/+0
| | | | | | | | | | | | | | 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
* Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump ↵Kevin Enderby2016-04-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* llvm-dwarfdump: Add support for dumping .dSYM bundles.Adrian Prantl2015-12-231-2/+43
| | | | | | | | This replicates the logic of Darwin dwarfdump for manually opening up .dSYM bundles without introducing any new dependencies. <rdar://problem/20491670> llvm-svn: 256350
* dwarfdump: Added macro support to llvm-dwarfdump tool.Amjad Aboud2015-11-121-0/+1
| | | | | | | | Added "macro" option to "-debug-dump" flag, which trigger parsing and dumping of the ".debug_macinfo" section. Differential Revision: http://reviews.llvm.org/D14294 llvm-svn: 252866
* dwarfdump: Use the right enum for the tu_index sectionDavid Blaikie2015-11-121-1/+1
| | | | llvm-svn: 252835
* dwarfdump: add command line support for dumping the tu_index sectionDavid Blaikie2015-11-121-1/+2
| | | | llvm-svn: 252830
* Format my previous commitDavid Blaikie2015-11-111-8/+8
| | | | llvm-svn: 252782
* dwarfdump: First piece of support for DWP dumpingDavid Blaikie2015-11-111-0/+1
| | | | | | Just a tiny piece of index dumping - the header in this instance. llvm-svn: 252781
* [dwarfdump] Add support for dumping mach-o universal objectfilesFrederic Riss2015-08-031-8/+16
| | | | llvm-svn: 243862
* [dwarfdump] Move dumping to a helper function NFCFrederic Riss2015-08-031-6/+10
| | | | llvm-svn: 243861
* [llvm-dwarfump] Don't rely on global state, part 3.Davide Italiano2015-07-261-11/+6
| | | | | | | | | Some tools used to rely on a global static variable to keep track of the return value for main(). I changed llvm-cxxdump to use exit(1) and Rafael shortly after did the same with llvm-readobj. This is (yet) another step towards the goal. llvm-svn: 243240
* Make llvm-dwarfdump exit with non-zero exit code if error was occured.Alexey Samsonov2015-06-251-8/+13
| | | | llvm-svn: 240729
* Move DIContext.h to common DebugInfo location.Zachary Turner2015-04-231-2/+3
| | | | | | | | | | This will enable us to create a PDBContext so as to expose some amount of debug info functionality through a common interace. Differential Revision: http://reviews.llvm.org/D9205 Reviewed by: Alexey Samsonov llvm-svn: 235612
* Move DebugInfo to DebugInfo/DWARF.Zachary Turner2015-01-301-1/+1
| | | | | | | | | | | | | In preparation for adding PDB support to LLVM, this moves the DWARF parsing code to its own subdirectory under DebugInfo, and renames LLVMDebugInfo to LLVMDebugInfoDWARF. This is purely a mechanical / build system change. Differential Revision: http://reviews.llvm.org/D7269 Reviewed by: Eric Christopher llvm-svn: 227586
* Remove unused includes and out of date comment. NFC.Rafael Espindola2014-12-171-1/+0
| | | | llvm-svn: 224413
* Reapply "[dwarfdump] Add support for dumping accelerator tables."Frederic Riss2014-11-141-0/+4
| | | | | | | | | | | | | This reverts commit r221842 which was a revert of r221836 and of the test parts of r221837. This new version fixes an UB bug pointed out by David (along with addressing some other review comments), makes some dumping more resilient to broken input data and forces the accelerator tables to be dumped in the tests where we use them (this decision is platform specific otherwise). llvm-svn: 222003
* Revert "[dwarfdump] Add support for dumping accelerator tables."Frederic Riss2014-11-131-4/+0
| | | | | | | | | | This reverts commit r221836. The tests are asserting on some buildbots. This also reverts the test part of r221837 as it relies on dwarfdump dumping the accelerator tables. llvm-svn: 221842
* [dwarfdump] Add support for dumping accelerator tables.Frederic Riss2014-11-121-0/+4
| | | | | | | The class used for the dump only allows to dump for the moment, but it can (and will) be easily extended to support search also. llvm-svn: 221836
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-301-1/+1
| | | | | | const from some other StringRefs since its implicitly const already. llvm-svn: 216820
* Don't own the buffer in object::Binary.Rafael Espindola2014-08-191-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries (like Archive) and we had to create dummy buffers just to handle that. It is also a bad fit for IRObjectFile where the Module wants to own the buffer too. Keeping this ownership would make supporting IR inside native objects particularly painful. This patch focuses in lib/Object. If something elsewhere used to own an Binary, now it also owns a MemoryBuffer. This patch introduces a few new types. * MemoryBufferRef. This is just a pair of StringRefs for the data and name. This is to MemoryBuffer as StringRef is to std::string. * OwningBinary. A combination of Binary and a MemoryBuffer. This is needed for convenience functions that take a filename and return both the buffer and the Binary using that buffer. The C api now uses OwningBinary to avoid any change in semantics. I will start a new thread to see if we want to change it and how. llvm-svn: 216002
* Remove some calls to std::move.Rafael Espindola2014-08-011-3/+3
| | | | | | | | | Instead of moving out the data in a ErrorOr<std::unique_ptr<Foo>>, get a reference to it. Thanks to David Blaikie for the suggestion. llvm-svn: 214516
* Use a reference instead of a pointer.Rafael Espindola2014-07-311-1/+1
| | | | | | This makes using a std::unique_ptr in the caller more convenient. llvm-svn: 214433
* Use std::unique_ptr to make the ownership explicit.Rafael Espindola2014-07-311-2/+3
| | | | llvm-svn: 214377
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-4/+5
| | | | llvm-svn: 212405
* Pass a std::unique_ptr& to the create??? methods is lib/Object.Rafael Espindola2014-06-231-1/+1
| | | | | | | | This makes the buffer ownership on error conditions very natural. The buffer is only moved out of the argument if an object is constructed that now owns the buffer. llvm-svn: 211546
* Remove 'using std::error_code' from tools.Rafael Espindola2014-06-131-3/+2
| | | | llvm-svn: 210876
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* Remove system_error.h.Rafael Espindola2014-06-121-1/+1
| | | | | | | This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch. llvm-svn: 210803
* Kill symbolization functionality in llvm-dwarfdump. We have llvm-symbolizer ↵Alexey Samsonov2014-05-191-48/+4
| | | | | | for that. llvm-svn: 209152
* [DWARF parser] Use enums instead of bitfields in DILineInfoSpecifier.Alexey Samsonov2014-05-151-6/+6
| | | | | | | | | | | | It is more appropriate than the current situation, when one flag (AbsoluteFilePath) is relevant only if another flag is set. This refactoring would also simplify fetching the short function name (stored in DW_AT_name) instead of a linkage name returned currently. No functionality change. llvm-svn: 208921
* [DWARF parser] Turn DILineInfo into a struct.Alexey Samsonov2014-04-181-4/+2
| | | | | | | | | | Immutable DILineInfo doesn't bring any benefits and complicates code. Also, use std::string instead of SmallString<16> for file and function names - their length can vary significantly. No functionality change. llvm-svn: 206654
* DebugInfo: Support debug_loc under fissionDavid Blaikie2014-03-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | Implement debug_loc.dwo, as well as llvm-dwarfdump support for dumping this section. Outlined in the DWARF5 spec and http://gcc.gnu.org/wiki/DebugFission the debug_loc.dwo section has more variation than the standard debug_loc, allowing 3 different forms of entry (plus the end of list entry). GCC seems to, and Clang certainly, only use one form, so I've just implemented dumping support for that for now. It wasn't immediately obvious that there was a good refactoring to share the implementation of dumping support between debug_loc and debug_loc.dwo, so they're separate for now - ideas welcome or I may come back to it at some point. As per a comment in the code, we could choose different forms that may reduce the number of debug_addr entries we emit, but that will require further study. llvm-svn: 204697
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-4/+3
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* [C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles2014-03-051-1/+1
| | | | llvm-svn: 202957
* llvm-dwarfdump: Support for debug_line.dwo section for file names for type ↵David Blaikie2014-02-241-0/+1
| | | | | | units under fission. llvm-svn: 202091
* Change createObjectFile to return an ErrorOr.Rafael Espindola2014-01-221-3/+4
| | | | llvm-svn: 199776
* llvm-dwarfdump: type unit dwo supportDavid Blaikie2014-01-091-0/+1
| | | | llvm-svn: 198850
* llvm-dwarfdump: support for emitting only the debug_types section using ↵David Blaikie2013-11-191-0/+1
| | | | | | -debug-dump llvm-svn: 195063
* Add gnu pubsections as options to llvm-dwarfdump.Eric Christopher2013-09-251-0/+2
| | | | | | Argument spelling feedback welcome. llvm-svn: 191409
* Dump the normal dwarf pubtypes section as well.Eric Christopher2013-09-251-0/+1
| | | | llvm-svn: 191408
* llvm-dwarfdump: Add support for dumping the .debug_loc sectionDavid Blaikie2013-06-191-0/+1
| | | | | | | | | This is a basic implementation - we still don't have any support (that I know of) for dumping DWARF expressions in a meaningful way, so the location information itself is just printed as a sequence of bytes as we do elsewhere. llvm-svn: 184361
* Add support for the pubnames section to llvm-dwarfdump.Krzysztof Parzyszek2013-02-121-0/+1
| | | | llvm-svn: 174976
* Initial support for DWARF CFI parsing and dumping in LLVMEli Bendersky2013-02-051-0/+1
| | | | llvm-svn: 174463
* When encountering an unknown file format, ObjectFile::createObjectFile shouldEli Bendersky2013-01-251-0/+5
| | | | | | | | | politely report it instead of running into llvm_unreachable. Also patch llvm-dwarfdump to actually check whether the file it's attempting to dump is a valid object file. llvm-svn: 173489
* Add command-line flags for DWARF dumping.Eli Bendersky2013-01-251-1/+18
| | | | | | | Flags for dumping specific DWARF sections added in lib/DebugInfo and llvm-dwarfdump. llvm-svn: 173480
* Rename variable to be more comprehensible and follow naming conventionEli Bendersky2013-01-251-4/+4
| | | | llvm-svn: 173460
* Sort the #include lines for tools/...Chandler Carruth2012-12-041-2/+2
| | | | | | | | Again, tools are trickier to pick the main module header for than library source files. I've started to follow the pattern of using LLVMContext.h when it is included as a stub for program source files. llvm-svn: 169252
* Rewrite DIContext interface to take an object. Update all callers.Eric Christopher2012-11-121-93/+1
| | | | llvm-svn: 167757
OpenPOWER on IntegriCloud