summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/llvm-objdump.h
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-objdump] Add dynamic section printing to private-headers optionPaul Semel2018-07-251-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D49016 llvm-svn: 337902
* [llvm-objdump] Add -demangle (-C) optionPaul Semel2018-07-181-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D49043 llvm-svn: 337401
* Revert "[llvm-objdump] Add -demangle (-C) option"Paul Semel2018-07-111-2/+0
| | | | | | | This reverts commit 3a44ccd156e0edd2e89226f8ed63928e227900bb. This reverts commit d5cfc836bb5552e20507d3612d13ff66ff9e36a0. llvm-svn: 336829
* [llvm-objdump] Add -demangle (-C) optionPaul Semel2018-07-111-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D49043 llvm-svn: 336816
* [llvm-objdump] Add --file-headers (-f) optionPaul Semel2018-07-041-0/+1
| | | | llvm-svn: 336284
* [llvm-objdump] Add -x --all-headers optionsFangrui Song2018-06-271-0/+1
| | | | | | | | | | Reviewers: paulsemel, echristo Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48622 llvm-svn: 335785
* [llvm-objdump] Add -R optionPaul Semel2018-06-071-0/+2
| | | | | | | | This option prints dynamic relocation entries of the given file Differential Revision: https://reviews.llvm.org/D47493 llvm-svn: 334196
* Add the rest of the error checking for Mach-O dyld compact bind entry errorsKevin Enderby2017-03-201-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | and test cases for each of the error checks. To do this more plumbing was needed so that the segment indexes and segment offsets can be checked. Basically what was done was the SegInfo from llvm-objdump’s MachODump.cpp was moved into libObject for Mach-O objects as BindRebaseSegInfo and it is only created when an iterator for bind or rebase entries are created. This commit really only adds the error checking and test cases for the bind table entires and the checking for the lazy bind and weak bind entries are still to be fully done as well as the rebase entires. Though some of the plumbing for those are added with this commit. Those other error checks and test cases will be added in follow on commits. Note, the two llvm_unreachable() calls should now actually be unreachable with the error checks in place and would take a logic bug in the error checking code to be reached if the segment indexes and segment offsets are used from a checked bind entry. Comments have been added to the methods that require the arguments to have been checked prior to calling. llvm-svn: 298292
* llvm-objdump: make NoLeadingAddr work on more than just MachOSaleem Abdulrasool2017-02-081-0/+1
| | | | | | | | | Support printing the disassembly without the address on all formats rather than making it MachO specific. Patch by Jeff Muizelaar! llvm-svn: 294495
* [WebAssembly] Add llvm-objdump support for wasm file formatDerek Schuff2016-11-301-0/+1
| | | | | | | | | | | This is the first part of an effort to add wasm binary support across all llvm tools. Patch by Sam Clegg Differential Revision: https://reviews.llvm.org/D26172 llvm-svn: 288251
* General clean up of error handling in llvm-objdump to remove its use of ↵Kevin Enderby2016-11-161-0/+1
| | | | | | | | | | | | | | | | | | report_fatal_error(). No real functional change with this commit. The problem with report_fatal_error() is it does not include the tool name and the file name the for which the error message was generated. Uses of report_fatal_error() were change to report_error() or error() to get a better error and to make the code smaller and cleaner. Also changed things like error(errorToErrorCode(SOrErr.takeError())) to use report_error() with a file name and the llvm::Error (as well as the ArchitectureName if available) so the error message is printed. llvm-svn: 287163
* llvm-objdump: add coff import library symbol listing supportSaleem Abdulrasool2016-08-181-0/+2
| | | | | | | | | | This adds behaviour similar to binutils' objdump which can show symbols in an import library. Differences from that stem around the fact that we do not create section symbols nor the all import import descriptor symbol reference. However, this does mean that the tool can serve as a possible replacement for the existing tool. llvm-svn: 279088
* Finish cleaning up most of the error handling in libObject’s ↵Kevin Enderby2016-06-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MachOUniversalBinary and its clients to use the new llvm::Error model for error handling. Changed getAsArchive() from ErrorOr<...> to Expected<...> so now all interfaces there use the new llvm::Error model for return values. In the two places it had if (!Parent) this is actually a program error so changed from returning errorCodeToError(object_error::parse_failed) to calling report_fatal_error() with a message. In getObjectForArch() added error messages to its two llvm::Error return values instead of returning errorCodeToError(object_error::arch_not_found) with no error message. For the llvm-obdump, llvm-nm and llvm-size clients since the only binary files in Mach-O Universal Binaries that are supported are Mach-O files or archives with Mach-O objects, updated their logic to generate an error when a slice contains something like an ELF binary instead of ignoring it. And added a test case for that. The last error stuff to be cleaned up for libObject’s MachOUniversalBinary is the use of errorOrToExpected(Archive::create(ObjBuffer)) which needs Archive::create() to be changed from ErrorOr<...> to Expected<...> first, which I’ll work on next. llvm-svn: 274079
* Change llvm-objdump, llvm-nm and llvm-size when reporting an object file errorKevin Enderby2016-05-311-3/+8
| | | | | | | | | | | | | | | | | | | 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
* Change llvm-objdump, llvm-nm and llvm-size when reporting an object file errorKevin Enderby2016-05-171-1/+9
| | | | | | | | | | | | | | | | | | | | | when the object is in an archive to use something like libx.a(foo.o) as part of the error message. Also changed llvm-objdump and llvm-size to be like llvm-nm and ignore non-object files in archives and not produce any error message. To do this Archive::Child::getAsBinary() was changed from ErrorOr<...> to Expected<...> then that was threaded up to its users. Converting this interface 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 one place yet to be fully converted. Again 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 comments for those. llvm-svn: 269784
* [NFC] Header cleanupMehdi Amini2016-04-181-1/+2
| | | | | | | | | | | | | | 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-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Re-submit r256008 "Improve DWARFDebugFrame::parse to also handle __eh_frame."Igor Laevsky2016-01-261-0/+2
| | | | | | | Originally this change was causing failures on windows buildbots. But those problems were fixed in r258806. llvm-svn: 258811
* For llvm-objdump, add the option -private-header (without the trailing ’s’)Kevin Enderby2016-01-131-0/+2
| | | | | | | | | | | | | | | to only print the first private header. Which for Mach-O files only prints the Mach header and not the subsequent load commands. Which is used by scripts to match what the darwin otool(1) with the -h flag does without the -l flag. For non-Mach-O files it has the same functionality as -private-headers (with the trailing ’s’). rdar://24158331 llvm-svn: 257548
* [llvm-objdump] Mark noreturn function as such.Davide Italiano2015-12-291-1/+2
| | | | | | Match attribute in the header to make MSVC happy. llvm-svn: 256560
* [llvm-objdump] Move COFF function to where it belongs.Davide Italiano2015-12-201-0/+1
| | | | | | | Ideally much more stuff should be moved out of llvm-objdump.cpp, but that will happen later. llvm-svn: 256118
* Revert "Improve DWARFDebugFrame::parse to also handle __eh_frame."Pete Cooper2015-12-181-2/+0
| | | | | | | | This reverts commit r256008. Its breaking multiple buildbots, although works for me locally. llvm-svn: 256013
* Improve DWARFDebugFrame::parse to also handle __eh_frame.Pete Cooper2015-12-181-0/+2
| | | | | | | | | | | | | | | LLVM MC has single methods which can handle the output of EH frame and DWARF CIE's and FDE's. This code improves DWARFDebugFrame::parse to do the same for parsing. This also allows llvm-objdump to support the --dwarf=frames option which objdump supports. This option dumps the .eh_frame section using the new code in DWARFDebugFrame::parse. http://reviews.llvm.org/D15535 Reviewed by Rafael Espindola. llvm-svn: 256008
* [llvm-objdump/MachO] Don't cut'n'paste the same code over and over.Davide Italiano2015-12-081-0/+1
| | | | | | Use the appropriate helper instead. llvm-svn: 254990
* [llvm-objdump] Call exit(1) on error, i.e. fail early.Davide Italiano2015-08-051-1/+1
| | | | | | | | | | | | | Previously we kept going on partly corrupted input, which might result in garbage being printed, or even worse, random crashes. Rafael mentioned that this is the GNU behavior as well, but after some discussion we both agreed it's probably better to emit a reasonable error message and exit. As a side-effect of this commit, now we don't rely on global state for error codes anymore. objdump was the last tool in the toolchain which needed to be converted. Hopefully the old behavior won't sneak into the tree again. llvm-svn: 244019
* [llvm-objdump] Merging MachO DumpSections in to FilterSections. Simplifying ↵Colin LeMahieu2015-07-291-2/+1
| | | | | | some predicate logic. llvm-svn: 243556
* [llvm-objdump] Added -j flag to filter sections that are operated on.Colin LeMahieu2015-07-291-1/+2
| | | | llvm-svn: 243526
* [llvm-objdump] Add -D and --disassemble-all flags that attempt disassembly ↵Colin LeMahieu2015-07-231-1/+2
| | | | | | on all sections instead of just text sections. llvm-svn: 243041
* llvm-objdump: Replace the -macho -raw option with a generic -raw-clang-astAdrian Prantl2015-07-081-1/+2
| | | | | | | | | | | | | | | option that works with all object container formats. Now that clang modules/PCH are object containers this option is useful to to construct pipes like llvm-objdump -raw-clang-ast foo.pcm | llvm-bcanalyzer - to inspect the AST contents in a PCH container. Will be tested via clang. Belatedly addresses review feedback for r233390. llvm-svn: 241659
* [objdump] Moving PrintImmHex out of MachODump and in to llvm-objdump and ↵Colin LeMahieu2015-06-071-0/+1
| | | | | | setting instprinter appropriately. llvm-svn: 239265
* [llvm] Parameterizing the output stream for dumpbytes and outputting ↵Colin LeMahieu2015-05-281-1/+0
| | | | | | directly to stream. llvm-svn: 238453
* Add the option -objc-meta-data to llvm-objdump used with -macho toKevin Enderby2015-04-011-1/+1
| | | | | | | | | | print the Objective-C runtime meta data for Mach-O files. There are three types of Objective-C runtime meta data, Objc2 64-bit, Objc2 32-bit and Objc1 32-bit. This prints the first of these types. The changes to print the others will follow next. llvm-svn: 233840
* Add a -raw option to the -section mode of llvm-objdump.Adrian Prantl2015-03-271-0/+1
| | | | llvm-svn: 233390
* [Objdump] DumpBytes of uint8_t from ArrayRef<uint8_t> instead of char from ↵Colin LeMahieu2015-03-181-1/+1
| | | | | | StringRef. Removing reinterpret_casts. llvm-svn: 232659
* Add the option, -dis-symname to llvm-objdump used with -macho andKevin Enderby2015-03-171-0/+1
| | | | | | -disassemble to disassemble just one symbol’s instructions. llvm-svn: 232503
* Add the options, -dylibs-used and -dylib-id to llvm-objdump used with -machoKevin Enderby2015-03-161-0/+2
| | | | | | | to print the Mach-O dynamic shared libraries used by a linked image or the library id of a shared library. llvm-svn: 232406
* Add the option, -non-verbose to llvm-objdump used with -macho to print thingsKevin Enderby2015-03-131-0/+1
| | | | | | | | | | using numeric values and not their symbolic constant names. The routines that print Mach-O stuff already had a verbose parameter and this change is just changing the passing true to passing !NonVerbose. With just a couple of fixes and a bunch of test case updates. llvm-svn: 232182
* Add the option, -info-plist to llvm-objdump used with -macho to print theKevin Enderby2015-03-111-0/+1
| | | | | | Mach-O info plist section as strings. llvm-svn: 231974
* Add the -section option to llvm-objdump used with -macho that takes the argumentKevin Enderby2015-01-311-0/+1
| | | | | | | | | | segname,sectname to specify a Mach-O section to print. The printing is based on the section type or section attributes. The printing of the module initialization and termination section types is printed with this change. Printing of other section types will be added next. llvm-svn: 227649
* dd the option, -link-opt-hints to llvm-objdump used with -macho to print theKevin Enderby2015-01-271-0/+1
| | | | | | Mach-O AArch64 linker optimization hints for ADRP code optimization. llvm-svn: 227246
* Add the option, -data-in-code, to llvm-objdump used with -macho to print the ↵Kevin Enderby2015-01-231-0/+1
| | | | | | Mach-O data in code table. llvm-svn: 226921
* Add the option, -indirect-symbols, used with -macho to print the Mach-O ↵Kevin Enderby2015-01-221-0/+1
| | | | | | indirect symbol table to llvm-objdump. llvm-svn: 226848
* For llvm-objdump, hook up existing options to work when using -macho (the ↵Kevin Enderby2015-01-201-0/+9
| | | | | | Mach-O parser). llvm-svn: 226612
* Add the option, -archive-headers, used with -macho to print the Mach-O ↵Kevin Enderby2015-01-151-0/+1
| | | | | | archive headers to llvm-objdump. llvm-svn: 226228
* Add the option, -universal-headers, used with -macho to print the Mach-O ↵Kevin Enderby2015-01-091-0/+1
| | | | | | universal headers to llvm-objdump. llvm-svn: 225537
* Slightly refactor things for llvm-objdump and the -macho option so it can be ↵Kevin Enderby2015-01-071-1/+13
| | | | | | | | | | | | used with options other than just -disassemble so that universal files can be used with other options combined with -arch options. No functional change to existing options and use. One test case added for the additional functionality with a universal file an a -arch option. llvm-svn: 225383
* Remove the now unused StringRefMemoryObject.h.Rafael Espindola2014-11-121-1/+0
| | | | llvm-svn: 221755
* Flush out enough of llvm-objdump’s SymbolizerSymbolLookUp() for Mach-O ↵Kevin Enderby2014-09-241-0/+1
| | | | | | | | | | | | | | | | | | | | | files to get the literal string “Hello world” printed as a comment on the instruction that loads the pointer to it. For now this is just for x86_64. So for object files with relocation entries it produces things like: leaq L_.str(%rip), %rax ## literal pool for: "Hello world\n" and similar for fully linked images like executables: leaq 0x4f(%rip), %rax ## literal pool for: "Hello world\n" Also to allow testing against darwin’s otool(1), I hooked up the existing -no-show-raw-insn option to the Mach-O parser code, added the new Mach-O only -full-leading-addr option to match otool(1)'s printing of addresses and also added the new -print-imm-hex option. llvm-svn: 218423
* [llvm-objdump] for mach-o add -bind, -lazy-bind, and -weak-bind optionsNick Kledzik2014-09-161-0/+3
| | | | | | | | | | | | | | | | This finishes the ability of llvm-objdump to print out all information from the LC_DYLD_INFO load command. The -bind option prints out symbolic references that dyld must resolve immediately. The -lazy-bind option prints out symbolc reference that are lazily resolved on first use. The -weak-bind option prints out information about symbols which dyld must try to coalesce across images. llvm-svn: 217853
* [llvm-objdump] support -rebase option for mach-o to dump rebasing infoNick Kledzik2014-09-121-0/+1
| | | | | | | | | | Similar to my previous -exports-trie option, the -rebase option dumps info from the LC_DYLD_INFO load command. The rebasing info is a list of the the locations that dyld needs to adjust if a mach-o image is not loaded at its preferred address. Since ASLR is now the default, images almost never load at their preferred address, and thus need to be rebased by dyld. llvm-svn: 217709
OpenPOWER on IntegriCloud