summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwarfdump
Commit message (Collapse)AuthorAgeFilesLines
...
* Factor out duplicate code from llvm-dwarfdump (NFC)Adrian Prantl2017-09-131-38/+27
| | | | llvm-svn: 313211
* llvm-dwarfdump: automatically dump both regular and .dwo variant of sectionsAdrian Prantl2017-09-131-3/+2
| | | | | | | | | | | | Since users typically don't really care about the .dwo / non.dwo distinction, this patch makes it so dwarfdump --debug-<info,...> dumps .debug_info and (if available) also .debug_info.dwo. This simplifies the command line interface (I've removed all dwo-specific dump options) and makes the tool friendlier to use. Differential Revision: https://reviews.llvm.org/D37771 llvm-svn: 313207
* llvm-dwarfdump: support dumping UUIDs of Mach-O binaries.Adrian Prantl2017-09-131-4/+9
| | | | | | | This is a feature supported by Darwin dwarfdump. UUIDs are used to associate executables with their .dSYM bundles. llvm-svn: 313165
* [dwarfdump] Rename Brief to Verbose in DIDumpOptionsJonas Devlieghere2017-09-131-6/+10
| | | | | | | | | | | This patches renames "brief" to "verbose" in de DIDumpOptions and inverts the logic to match the new behavior where brief is the default. Changing the default value uncovered some bugs related to the DIDumpOptions not being propagated and have been fixed as well. Differential revision: https://reviews.llvm.org/D37745 llvm-svn: 313139
* Clean up the --help output of llvm-dwarfdump by hiding irrelevant options.Adrian Prantl2017-09-121-19/+41
| | | | llvm-svn: 313085
* llvm-dwarfdump: Make -brief the default and add a -verbose option instead.Adrian Prantl2017-09-111-5/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D37717 llvm-svn: 312972
* llvm-dwarfdump: Replace -debug-dump=sect option with individual options.Adrian Prantl2017-09-111-39/+18
| | | | | | | | | | | | | | | | | | | | | | As discussed on llvm-dev in http://lists.llvm.org/pipermail/llvm-dev/2017-September/117301.html this changes the command line interface of llvm-dwarfdump to match the one used by the dwarfdump utility shipping on macOS. In addition to being shorter to type this format also has the advantage of allowing more than one section to be specified at the same time. In a nutshell, with this change $ llvm-dwarfdump --debug-dump=info $ llvm-dwarfdump --debug-dump=apple-objc becomes $ dwarfdump --debug-info --apple-objc Differential Revision: https://reviews.llvm.org/D37714 llvm-svn: 312970
* [llvm-dwarfdump] Brief mode only dumps debug_info by defaultJonas Devlieghere2017-08-311-3/+12
| | | | | | | | | | | | This patch changes the default behavior in brief mode to only show the debug_info section. This is undoubtedly the most popular and likely the one you'd want in brief mode. Non-brief mode behavior is not affected and still defaults to all. Differential revision: https://reviews.llvm.org/D37334 llvm-svn: 312252
* cmake: Invent add_llvm_fuzzer to set up fuzzer targetsJustin Bogner2017-08-312-6/+2
| | | | | | | | | | | | | | | | This moves the cmake configuration for fuzzers in LLVM to a new macro, add_llvm_fuzzer. This will make it easier to keep things consistent while implementing llvm.org/pr34314. I've also made a couple of minor functional changes here: - the fuzzers now use add_llvm_executable rather than add_llvm_tool. This means they won't create install targets and stuff like that, because those made little sense for these fuzzers. - I've grouped these under "Fuzzers" rather than in with "Tools" for people who build with IDEs. llvm-svn: 312200
* [dwarfdump] Pretty print location expressions and location listsReid Kleckner2017-08-292-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Based on Fred's patch here: https://reviews.llvm.org/D6771 I can't seem to commandeer the old review, so I'm creating a new one. With that change the locations exrpessions are pretty printed inline in the DIE tree. The output looks like this for debug_loc entries: DW_AT_location [DW_FORM_data4] (0x00000000 0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3 0x000000000000000b - 0x0000000000000012: DW_OP_consts +7 0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4 0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0) And like this for debug_loc.dwo entries: DW_AT_location [DW_FORM_sec_offset] (0x00000000 Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4) Simple locations without ranges are printed inline: DW_AT_location [DW_FORM_block1] (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0) The debug_loc(.dwo) dumping in changed accordingly to factor the code. Reviewers: dblaikie, aprantl, friss Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere Differential Revision: https://reviews.llvm.org/D37123 llvm-svn: 312042
* fix llvm-dwarfdump-fuzzer.cpp to use the current libFuzzer APIKostya Serebryany2017-08-291-2/+3
| | | | llvm-svn: 311968
* Update LLVM fuzzers to use the libFuzzer bundled with the compiler toolchainGeorge Karpenkov2017-08-232-5/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D37041 llvm-svn: 311515
* Remove some leftover DWARFContextInMemory.Rafael Espindola2017-07-191-1/+1
| | | | | | Not sure how I missed these on the previous commit. llvm-svn: 308550
* Use delegation instead of inheritance.Rafael Espindola2017-07-191-3/+3
| | | | | | | | | | This changes DwarfContext to delegate to DwarfObject instead of having pure virtual methods. With this DwarfContextInMemory is replaced with an implementation of DwarfObject that is local to a .cpp file. llvm-svn: 308543
* [DWARF] Added a blank line in llvm-dwarfdump to test commit access.Spyridoula Gravani2017-06-121-0/+1
| | | | llvm-svn: 305220
* Introduce -brief command line option to llvm-dwarfdumpAdrian Prantl2017-06-061-0/+3
| | | | | | | | | | | | | This patch introduces a new command line option, called brief, to llvm-dwarfdump. When -brief is used, the attribute forms for the .debug_info section will not be emitted to output. Patch by Spyridoula Gravani! rdar://problem/21474365 Differential Revision: https://reviews.llvm.org/D33867 llvm-svn: 304844
* [DWARF] Adding support for the DWARF v5 string offsets table ↵Wolfgang Pieb2017-06-061-0/+1
| | | | | | | | | | (consumer/reader part only). Reviewers: dblaikie, aprantl Differential Revision: https://reviews.llvm.org/D32779 llvm-svn: 304759
* [DWARF] Introduce Dump OptionsAdrian Prantl2017-06-011-1/+5
| | | | | | | | | | | This commit introduces a structure that holds all the flags that control the pretty printing of dwarf output. Patch by Spyridoula Gravani! Differential Revision: https://reviews.llvm.org/D33749 llvm-svn: 304446
* Adds initial llvm-dwarfdump --verify support with unit tests.Greg Clayton2017-05-011-1/+52
| | | | | | | | | | | | | | | | | | lldb-dwarfdump gets a new "--verify" option that will verify a single file's DWARF debug info and will print out any errors that it finds. It will return an non-zero exit status if verification fails, and a zero exit status if verification succeeds. Adding the --quiet option will suppress any output the STDOUT or STDERR. The first part of the verify does the following: - verifies that all CU relative references (DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, DW_FORM_ref_udata) have valid CU offsets - verifies that all DW_FORM_ref_addr references have valid .debug_info offsets - verifies that all DW_AT_ranges attributes have valid .debug_ranges offsets - verifies that all DW_AT_stmt_list attributes have valid .debug_line offsets - verifies that all DW_FORM_strp attributes have valid .debug_str offsets Unit tests were added for each of the above cases. Differential Revision: https://reviews.llvm.org/D32707 llvm-svn: 301844
* Fix a bugs with using some Mach-O command line flags like "-arch armv7m".Kevin Enderby2016-12-161-1/+1
| | | | | | | | | | | | | | | | | | The Mach-O command line flag like "-arch armv7m" does not match the arch name part of its llvm Triple which is "thumbv7m-apple-darwin”. I think the best way to fix this is to have llvm::object::MachOObjectFile::getArchTriple() optionally return the name of the Mach-O arch flag that would be used with -arch that matches the CPUType and CPUSubType. Then change llvm::object::MachOUniversalBinary::ObjectForArch::getArchTypeName() to use that and change it to getArchFlagName() as the type name is really part of the Triple and the -arch flag name is a Mach-O thing for a specific Triple with a specific Mcpu value. rdar://29663637 llvm-svn: 290001
* dwarfdump: -summarize-types: print a short summary (unqualified type name, ↵David Blaikie2016-10-181-1/+5
| | | | | | | | | | hash, length) of type units rather than dumping contents This is just a quick utility handy for getting rough summaries of types in a given object or dwo file. I've been using it to investigate the amount of type info redundancy across a project build, for example. llvm-svn: 284537
* Turn cl::values() (for enum) from a vararg function to using C++ variadic ↵Mehdi Amini2016-10-081-1/+1
| | | | | | | | | | | | | | | template The core of the change is supposed to be NFC, however it also fixes what I believe was an undefined behavior when calling: va_start(ValueArgs, Desc); with Desc being a StringRef. Differential Revision: https://reviews.llvm.org/D25342 llvm-svn: 283671
* Revert r282238 "Revert r282235 "[llvm-dwarfdump] - Teach dwarfdump to dump ↵George Rimar2016-09-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | gdb-index section."" Build bot issues (http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15856/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3Adwarfdump-dump-gdbindex.test) should be fixed in that version. Issue was that MSVS does not support "%zu". Though it works fine on MSCS 2015, Bot looks running MSVS 2013 that does not like it. MSDN also says that "z" prefix is not supported: https://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx I had to use PRId64 instead. Original commit message: [llvm-dwarfdump] - Teach dwarfdump to dump gdb-index section. gold linker's --gdb-index option currently is able to create the .gdb_index section that allows GDB to locate and read the .dwo files as it needs them, this helps reduce the total size of the object files processed by the linker. More info about that: https://gcc.gnu.org/wiki/DebugFission https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html Patch teaches dwarfdump tool to dump this section. Differential revision: https://reviews.llvm.org/D21503 llvm-svn: 282239
* Revert r282235 "[llvm-dwarfdump] - Teach dwarfdump to dump gdb-index section."George Rimar2016-09-231-1/+0
| | | | | | | It broke BB: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15856 llvm-svn: 282238
* [llvm-dwarfdump] - Teach dwarfdump to dump gdb-index section.George Rimar2016-09-231-0/+1
| | | | | | | | | | | | | | | gold linker's --gdb-index option currently is able to create the .gdb_index section that allows GDB to locate and read the .dwo files as it needs them, this helps reduce the total size of the object files processed by the linker. More info about that: https://gcc.gnu.org/wiki/DebugFission https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html Patch teaches dwarfdump tool to dump this section. Differential revision: https://reviews.llvm.org/D21503 llvm-svn: 282235
* Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith2016-06-091-1/+1
| | | | | | | looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
* Apply most suggestions of clang-tidy's performance-unnecessary-value-paramBenjamin Kramer2016-06-081-1/+1
| | | | | | | Avoids unnecessary copies. All changes audited & pass tests with asan. No functional change intended. llvm-svn: 272190
* 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
* [llvm-dwarfdump-fuzzer] Get this compiling againDavid Majnemer2016-05-311-2/+4
| | | | | | | Looks like the dwarfdump fuzzer has bitrotted, update it to take into account updates to the libobject API. llvm-svn: 271242
* 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
* Remove autoconf supportChris Bieneman2016-01-261-17/+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
* 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
* Add llvm-dwarfdump-fuzzer that uses LibFuzzer to fuzz llvm-dwarfdump tool.Alexey Samsonov2015-05-283-0/+52
| | | | | | | | The fuzzer is very simple, but not quite useful at the moment: it's unable to discover "interesting" examples, as LLVMObject library is terrible at error recovery, calling "report_fatal_error()" far too often. llvm-svn: 238451
* 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-304-4/+4
| | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud