summaryrefslogtreecommitdiff
path: root/tools/llvm-symbolizer
AgeCommit message (Collapse)Author
2017-11-02[tools] Add option to install binutils symlinksShoaib Meenai
The LLVM tools can be used as a replacement for binutils, in which case it's convenient to create symlinks with the binutils names. Add support for these symlinks in the build system. As with any other llvm tool symlinks, the user can limit the installed symlinks by only adding the desired ones to `LLVM_TOOLCHAIN_TOOLS`. Differential Revision: https://reviews.llvm.org/D39530 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317272 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-30DebugInfo: Provide option for explicitly specifying the name of the DWP fileDavid Blaikie
If you've archived the DWP file somewhere it's probably useful to be able to just tell llvm-symbolizer where it is when you're symbolizing stack traces from the binary. This only provides a mechanism for specifying a single DWP file, good if you're symbolizing a program with a single DWP file, but it's likely if the program is dynamically linked that you might have a DWP for each dynamic library - in which case this feature won't help (at least as it's surfaced in llvm-symbolizer for now) - in theory it could be extended to specify a collection of DWP files that could all be consulted for split CU hash resolution. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31Add a verbose/human readable mode to llvm-symbolizer to investigate ↵David Blaikie
discriminators and other line table/backtrace features Patch by Simon Que! Differential Revision: https://reviews.llvm.org/D29094 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293697 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08Turn cl::values() (for enum) from a vararg function to using C++ variadic ↵Mehdi Amini
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283671 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272232 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03[Symbolize] Check if the PE file has a PDB and emit an error if we can't load itReid Kleckner
Summary: Previously we would try to load PDBs for every PE executable we tried to symbolize. If that failed, we would fall back to DWARF. If there wasn't any DWARF, we'd print mostly useless symbol information using the export table. With this change, we only try to load PDBs for executables that claim to have them. If that fails, we can now print an error rather than falling back silently. This should make it a lot easier to diagnose and fix common symbolization issues, such as not having DIA or not having a PDB. Reviewers: zturner, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20982 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271725 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26Remove autoconf supportChris Bieneman
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-09[llvm-symbolizer] -print-source-context-lines option to print source code ↵Mike Aizatsky
around the line. Differential Revision: http://reviews.llvm.org/D15909 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257236 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-07[llvm-symbolizer] Print out non-address lines verbatim.Mike Aizatsky
Differential Revision: http://reviews.llvm.org/D15876 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257115 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11[Symbolizer]: Add -pretty-print optionHemant Kulkarni
Differential Revision: http://reviews.llvm.org/D13671 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252798 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11Reverting r252760Colin LeMahieu
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252770 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11[Symbolizer]: Add -pretty-print optionHemant Kulkarni
Differential Revision: http://reviews.llvm.org/D13671 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252760 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04[LLVMSymbolize] Properly propagate object parsing errors from the library.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252021 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-03[LLVMSymbolize] Factor out the logic for printing structs from DIContext. NFC.Alexey Samsonov
Introduce DIPrinter which takes care of rendering DILineInfo and friends. This allows LLVMSymbolizer class to return a structured data instead of plain std::strings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251989 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30Let the users of LLVMSymbolizer decide whether they want to symbolize ↵Alexey Samsonov
inlined frames. Introduce LLVMSymbolizer::symbolizeInlinedCode() instead of switching on PrintInlining option passed to the constructor. This will be needed once we retrun structured data (instead of std::string) from LLVMSymbolizer and move printing logic out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251675 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26Move parts of llvm-symbolizer tool into LLVMSymbolize library.Alexey Samsonov
Summary: See http://lists.llvm.org/pipermail/llvm-dev/2015-October/091624.html Reviewers: echristo Subscribers: llvm-commits, aizatsky Differential Revision: http://reviews.llvm.org/D13998 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251316 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-24Simplify boolean conditional return statements in tools/llvm-symbolizer.Rafael Espindola
Patch by Richard. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251216 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16Speculative fix for GCC buildReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250585 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16[llvm-symbolizer] Use the export table if no symbols are presentReid Kleckner
This lets us make guesses about symbols in third party DLLs without debug info, like MSVCR120.dll or kernel32.dll. dbghelp does the same thing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250582 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12[llvm-symbolizer] Add -print-address optionHemant Kulkarni
Differential Revision: http://reviews.llvm.org/D13518 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12[llvm-symbolizer] Reverting r250067Colin LeMahieu
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250072 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12[llvm-symbolizer] Add -print-address optionHemant Kulkarni
Differential Revision http://reviews.llvm.org/D13518 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250067 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09Address review comments, remove error case and return 0 instead as required ↵Reid Kleckner
by tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249785 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09[llvm-symbolizer] Make --relative-address work with DWARF contextsReid Kleckner
Summary: Previously the relative address flag only affected PDB debug info. Now both DIContext implementations always expect to be passed virtual addresses. llvm-symbolizer is now responsible for adding ImageBase to module offsets when --relative-offset is passed. Reviewers: zturner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12883 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249784 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10[llvm-symbolizer] Remove underscores and other C mangling on WindowsReid Kleckner
Summary: This makes it so that reports symbolized after the fact with llvm-symbolizer are more similar to the ones we generate at runtime with in-process dbghelp. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11785 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244512 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-07Delete UnknownAddress. It is a perfectly valid symbol value.Rafael Espindola
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241605 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-03Return ErrorOr from getSymbolAddress.Rafael Espindola
It can fail trying to get the section on ELF and COFF. This makes sure the error is handled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241366 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-02Return ErrorOr from SymbolRef::getName.Rafael Espindola
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241297 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-02[Support] Lazy load of dbghlp.dll on WindowsLeny Kholodov
This patch changes linkage with dbghlp.dll for clang from static (at load time) to on demand (at the first use of required functions). Clang uses dbghlp.dll only in minor use-cases. First of all in case of crash and in case of plugin load. The dbghlp.dll library can be absent on system. In this case clang will fail to load. With lazy load of dbghlp.dll clang can work even if dbghlp.dll is not available. Differential Revision: http://reviews.llvm.org/D10737 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241271 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-26Simplify getSymbolType.Rafael Espindola
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240777 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-25Use computeSymbolSizes in llvm-symbolize.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240646 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-25Modernize getELFDynamicSymbolIterators.Rafael Espindola
* Have it return a iterator_range. * Remove the global function. * Rename to getDynamicSymbolIterators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240644 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-24Change how symbol sizes are handled in lib/Object.Rafael Espindola
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240529 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22[Object] Search for architecures by name in ↵Frederic Riss
MachOUniversalBinary::getObjectForArch() The reason we need to search by name rather than by Triple::ArchType is to handle subarchitecture correclty. There is no different ArchType for the x86_64h architecture (it identifies itself as x86_64), or for the various ARM subarches. The only way to get to the subarch slice in an universal binary is to search by name. This issue led to hard to debug and transient symbolication failures in Asan tests (it mostly works, because the files are very similar). This also affects the Profiling infrastucture as it is the other user of that API. Reviewers: samsonov, bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10604 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240339 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01Simplify another function that doesn't fail.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06A few fixes for llvm-symbolizer on Windows.Zachary Turner
Specifically, this patch correctly respects the -demangle option, and additionally adds a hidden --relative-address option allows input addresses to be relative to the module load address instead of absolute addresses into the image. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236653 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-27[llvm-symbolizer] Link DebugInfoPDB for the autoconf buildZachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235909 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-27Make llvm-symbolizer work on Windows.Zachary Turner
Differential Revision: http://reviews.llvm.org/D9234 Reviewed By: Alexey Samsonov git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235900 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-23Move DIContext.h to common DebugInfo location.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235612 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23Purge unused includes throughout libSupport.Benjamin Kramer
NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232976 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-30Move DebugInfo to DebugInfo/DWARF.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227586 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-07llvm-symbolizer: teach it about PowerPC64 ELF function descriptorsJay Foad
Summary: Teach llvm-symbolizer about PowerPC64 ELF function descriptors. Symbols in the .opd section point to function descriptors, the first word of which is a pointer to the real function. For the purposes of symbolizing we pretend that the symbol points directly to the function. This is enough to get decent function names in stack traces for unoptimized binaries, which fixes the sanitizer print-stack-trace test on PowerPC64 Linux. Reviewers: kcc, willschm, samsonov Reviewed By: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6110 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221514 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-31[Object] Modify OwningBinary's interface to separate inspection from ownership.Lang Hames
The getBinary and getBuffer method now return ordinary pointers of appropriate const-ness. Ownership is transferred by calling takeBinary(), which returns a pair of the Binary and a MemoryBuffer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221003 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-17[llvm-symbolizer] Introduce the -dsym-hint option.Alexander Potapenko
llvm-symbolizer will consult one of the .dSYM paths passed via -dsym-hint if it fails to find the .dSYM bundle at the default location. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220004 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-14[llvm-symbolizer] Minor typedef cleanup. NFC.Alexander Potapenko
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219682 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03Follow-up for r217020: actually commit the fix for PR20800,Alexander Potapenko
revert the accidentally committed changes to LLVMSymbolize.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217021 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03Fix PR20800: correctly calculate the offset of the subq instruction when ↵Alexander Potapenko
generating compact unwind info. This CL replaces the constant DarwinX86AsmBackend.PushInstrSize with a method that lets the backend account for different sizes of "push %reg" instruction sizes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217020 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19Don't own the buffer in object::Binary.Rafael Espindola
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216002 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13Canonicalize header guards into a common format.Benjamin Kramer
Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215558 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01Remove some calls to std::move.Rafael Espindola
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214516 91177308-0d34-0410-b5e6-96231b3b80d8