summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-objdump] Use the new MinVersion API introduced in r245938. NFC.Davide Italiano2015-08-261-8/+12
| | | | llvm-svn: 246031
* Remove and forbid raw_svector_ostream::flush() calls.Yaron Keren2015-08-131-2/+0
| | | | | | | | | | After r244870 flush() will only compare two null pointers and return, doing nothing but wasting run time. The call is not required any more as the stream and its SmallString are always in sync. Thanks to David Blaikie for reviewing. llvm-svn: 244928
* Remove raw_svector_ostream::resync and users. It's no-op after r244870.Yaron Keren2015-08-131-1/+0
| | | | llvm-svn: 244888
* Use higher level functions in llvm-objdump.Rafael Espindola2015-08-101-17/+12
| | | | | | | This matches the rest of llvm-objdump better and isolates it from upcoming changes to ELFFile. llvm-svn: 244500
* Convert getSymbolSection to return an ErrorOr.Rafael Espindola2015-08-073-9/+8
| | | | | | | This function can actually fail since the symbol contains an index to the section and that can be invalid. llvm-svn: 244375
* [llvm-objdump] Add missing call to exit(1).Davide Italiano2015-08-061-0/+1
| | | | | | Reported by: Rafael Espindola. llvm-svn: 244184
* [llvm-objdump] Call exit(1) on error, i.e. fail early.Davide Italiano2015-08-054-89/+42
| | | | | | | | | | | | | 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] Range-loopify. NFC intended.Davide Italiano2015-08-031-3/+2
| | | | llvm-svn: 243905
* [llvm-objdump] Inverting logic to match the word "predicate". Returning ↵Colin LeMahieu2015-07-291-4/+4
| | | | | | true when we want it rather than when we want to discard it. llvm-svn: 243558
* [llvm-objdump] Merging MachO DumpSections in to FilterSections. Simplifying ↵Colin LeMahieu2015-07-293-26/+21
| | | | | | some predicate logic. llvm-svn: 243556
* [llvm-objdump] Added -j flag to filter sections that are operated on.Colin LeMahieu2015-07-292-16/+88
| | | | llvm-svn: 243526
* [llvm-objdump] Add -D and --disassemble-all flags that attempt disassembly ↵Colin LeMahieu2015-07-232-3/+13
| | | | | | on all sections instead of just text sections. llvm-svn: 243041
* Simplify iterating over program headers and detect corrupt ones.Rafael Espindola2015-07-201-20/+12
| | | | | | We now use a simple pointer and have range loops. llvm-svn: 242669
* Add missing 'const'. I don't think this is strictly required, but someDaniel Jasper2015-07-101-1/+1
| | | | | | | compiler configuration is giving me an error and it seems to be recommended anyway. llvm-svn: 241892
* [llvm-objdump] Require that jump targets shown in -d are functionsDavid Majnemer2015-07-091-6/+17
| | | | | | | Don't let the disassembler pick call <.text> if a function happens to live at the start of the section by only using function symbols. llvm-svn: 241830
* llvm-objdump: Replace the -macho -raw option with a generic -raw-clang-astAdrian Prantl2015-07-083-14/+53
| | | | | | | | | | | | | | | 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
* [llvm-objdump] Print the call target next to the instructionDavid Majnemer2015-07-071-0/+36
| | | | | | | GNU binutils provides this behavior. objdump -r doesn't really help when you aren't dealing with relocation object files. llvm-svn: 241631
* Delete UnknownAddress. It is a perfectly valid symbol value.Rafael Espindola2015-07-072-12/+2
| | | | | | | | | | | getSymbolValue now returns a value that in convenient for most callers: * 0 for undefined * symbol size for common symbols * offset/address for symbols the rest Code that needs something more specific can check getSymbolFlags. llvm-svn: 241605
* Simplify. NFC.Rafael Espindola2015-07-061-3/+1
| | | | llvm-svn: 241456
* Return ErrorOr from getSymbolAddress.Rafael Espindola2015-07-032-11/+14
| | | | | | | It can fail trying to get the section on ELF and COFF. This makes sure the error is handled. llvm-svn: 241366
* Use getValue instead of getAddress in a few MachO only cases.Rafael Espindola2015-07-031-23/+9
| | | | | | | In MachO the value of the symbol is always the address, so we can use the simpler function. llvm-svn: 241364
* Return ErrorOr from SymbolRef::getName.Rafael Espindola2015-07-023-55/+87
| | | | | | | | | | | | 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
* Expose getRel and getRela to reduce code duplication.Rafael Espindola2015-07-021-19/+10
| | | | llvm-svn: 241266
* Return ErrorOr from getSection.Rafael Espindola2015-07-011-8/+18
| | | | | | | | | | | | | | This also improves the logic of what is an error: * getSection(uint_32): only return an error if the index is out of bounds. The index 0 corresponds to a perfectly valid entry. * getSection(Elf_Sym): Returns null for symbols that normally don't have sections and error for out of bound indexes. In many places this just moves the report_fatal_error up the stack, but those can then be fixed in smaller patches. llvm-svn: 241156
* Fix the name of the iterator functions to match the coding standards.Rafael Espindola2015-06-301-3/+3
| | | | llvm-svn: 241074
* Don't return error_code from a function that doesn't fail.Rafael Espindola2015-06-301-3/+2
| | | | llvm-svn: 241042
* Move function to the only file that uses it.Rafael Espindola2015-06-301-2/+35
| | | | llvm-svn: 241040
* Don't return error_code from a function that doesn't fail.Rafael Espindola2015-06-301-5/+2
| | | | llvm-svn: 241039
* Don't return error_code from function that never fails.Rafael Espindola2015-06-293-29/+14
| | | | llvm-svn: 241021
* Convert obj->getSymbolName to sym->getName.Rafael Espindola2015-06-291-1/+1
| | | | | | I doesn't depend on the object anymore. llvm-svn: 240996
* Factor out the checking of string tables.Rafael Espindola2015-06-291-1/+5
| | | | | | | | | | This moves the error checking for string tables to getStringTable which returns an ErrorOr<StringRef>. This improves error checking, makes it uniform across all string tables and makes it possible to check them once instead of once per name. llvm-svn: 240950
* Remove Elf_Sym_Iter.Rafael Espindola2015-06-291-2/+5
| | | | | | | | | | | | | | | | | | | It was a fairly broken concept for an ELF only class. An ELF file can have two symbol tables, but they have exactly the same format. There is no concept of a dynamic or a static symbol. Storing this on the iterator also makes us do more work per symbol than necessary. To fetch a name we would: * Find if we had a static or a dynamic symbol. * Look at the corresponding symbol table and find the string table section. * Look at the string table section to fetch its contents. * Compute the name as a substring of the string table. All but the last step can be done per symbol table instead of per symbol. This is a step in that direction. llvm-svn: 240939
* Rename getObjectFile to getObject for consistency.Rafael Espindola2015-06-262-4/+4
| | | | llvm-svn: 240785
* Simplify getSymbolType.Rafael Espindola2015-06-262-14/+7
| | | | | | | | This is still a really odd function. Most calls are in object format specific contexts and should probably be replaced with a more direct query, but at least now this is not too obnoxious to use. llvm-svn: 240777
* Add an ELFSymbolRef type.Rafael Espindola2015-06-251-2/+2
| | | | | | | This allows user code to say Sym.getSize() instead of having to manually fetch the object. llvm-svn: 240708
* Change how symbol sizes are handled in lib/Object.Rafael Espindola2015-06-242-10/+10
| | | | | | | | | | | | | | COFF and MachO only define symbol sizes for common symbols. Reflect that in the class hierarchy by having a method for common symbols only in the base and a general one in ELF. This avoids the need of using a magic value for the size, which had a few problems * Most callers didn't check for it. * The ones that did could not tell the magic value from a file actually having that value. llvm-svn: 240529
* Revert "[FaultMaps] Move FaultMapParser to Object/"Sanjoy Das2015-06-231-1/+1
| | | | | | | This reverts commit r240364 (git c49542e5bb186). The issue r240364 was trying to fix was fixed independently in r240362. llvm-svn: 240448
* Don't pass a 32 bit value to "%08" PRIx64.Rafael Espindola2015-06-231-4/+4
| | | | | | Should fix the arm bots. llvm-svn: 240439
* objdump: Don't print a (always 0) size for MachO symbols.Rafael Espindola2015-06-231-10/+10
| | | | | | | | | | | Only common symbol on MachO and COFF have a size. For COFF we already had a custom format. For MachO, there is no native objdump and we were printing it as ELF. Now we only print the sizes for symbols that actually have them. llvm-svn: 240422
* [FaultMaps] Move FaultMapParser to Object/Sanjoy Das2015-06-231-1/+1
| | | | | | | | | | | | | | | | | | Summary: That way llvm-objdump can rely on it without adding an extra dependency on CodeGen. This change duplicates the FaultKind enum and the code that serializes it to a string. I could not figure out a way to get around this without adding a new dependency to Object Reviewers: rafael, ab Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10619 llvm-svn: 240364
* llvm/tools/llvm-objdump/CMakeLists.txt: Update libdeps to fix r240304.NAKAMURA Takumi2015-06-231-0/+1
| | | | llvm-svn: 240362
* [FaultMaps] Add a parser for the __llvm__faultmaps section.Sanjoy Das2015-06-221-1/+52
| | | | | | | | | | | | | | | Summary: The parser is exercised by llvm-objdump using -print-fault-maps. As is probably obvious, the code itself was "heavily inspired" by http://reviews.llvm.org/D10434. Reviewers: reames, atrick, JosephTremoulet Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10491 llvm-svn: 240304
* Fix "the the" in comments.Eric Christopher2015-06-191-1/+1
| | | | llvm-svn: 240112
* Remove object_error::success and use std::error_code() insteadRui Ueyama2015-06-092-8/+8
| | | | | | | | | | | | make_error_code(object_error) is slow because object::object_category() uses a ManagedStatic variable. But the real problem is that the function is called too frequently. This patch uses std::error_code() instead of object_error::success. In most cases, we return "success", so this patch reduces number of function calls to that function. http://reviews.llvm.org/D10333 llvm-svn: 239409
* [objdump] Moving PrintImmHex out of MachODump and in to llvm-objdump and ↵Colin LeMahieu2015-06-073-4/+6
| | | | | | setting instprinter appropriately. llvm-svn: 239265
* llvm-objdump: return non-zero exit code for certain cases of invalid inputAlexey Samsonov2015-06-041-7/+12
| | | | | | | | * If the input file is missing; * If the type of input object file can't be recognized; * If the object file can't be parsed correctly. llvm-svn: 239065
* Disassemble the start of sections even if there is no symbol there.Rafael Espindola2015-06-041-5/+3
| | | | | | | We already handled a section with no symbols, extend that to also handle a section with symbols that don't include the section start. llvm-svn: 239039
* [Object, MachO] Introduce MachOObjectFile::load_commands() range iterator.Alexey Samsonov2015-06-031-65/+18
| | | | | | | | | | | | | | | | | | Summary: Now users don't have to manually deal with getFirstLoadCommandInfo() / getNextLoadCommandInfo(), calculate the number of load segments, etc. No functionality change. Test Plan: regression test suite Reviewers: rafael, lhames, loladiro Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10144 llvm-svn: 238983
* Fix the interpretation of a 0 st_name.Rafael Espindola2015-06-031-11/+24
| | | | | | | | | | | | | | The ELF spec is very clear: ----------------------------------------------------------------------------- If the value is non-zero, it represents a string table index that gives the symbol name. Otherwise, the symbol table entry has no name. -------------------------------------------------------------------------- In particular, a st_name of 0 most certainly doesn't mean that the symbol has the same name as the section. llvm-svn: 238899
* Move to llvm-objdump a large amount of code to that is only used there.Rafael Espindola2015-06-031-3/+382
| | | | llvm-svn: 238898
OpenPOWER on IntegriCloud