Commit Graph

49 Commits

Author SHA1 Message Date
Rafael Espindola 4453e42945 Remove 'using std::error_code' from tools.
llvm-svn: 210876
2014-06-13 03:07:50 +00:00
Rafael Espindola 3acea39853 Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.

llvm-svn: 210835
2014-06-12 21:46:39 +00:00
Rafael Espindola 5c4f829424 Use std::error_code instead of llvm::error_code.
The idea of this patch is to turn llvm/Support/system_error.h into a
transitional header that just brings in the erorr_code api to the llvm
namespace. I will remove it shortly afterwards.

The cases where the general idea needed some tweaking:

* std::errc is a namespace in msvc, so we cannot use "using std::errc". I could
add an #ifdef, but there were not that many uses, so I just added std:: to
them in this patch.

* Template specialization had to be moved to the std namespace in this
patch set already.

* The msvc implementation of default_error_condition doesn't seem to
provide the same transformations as we need. Not too surprising since
the standard doesn't actually say what "equivalent" means. I fixed the
problem by keeping our old mapping and using it at error_code
construction time.

Despite these shortcomings I think this is still a good thing. Some reasons:

* The different implementations of system_error might improve over time.
* It removes 925 lines of code from llvm already.
* It removes 6313 bytes from the text segment of the clang binary when
it is built with gcc and 2816 bytes when building with clang and
libstdc++.

llvm-svn: 210687
2014-06-11 19:05:50 +00:00
Alexey Samsonov cd01472a9b [DWARF parser] Teach DIContext to fetch short (non-linkage) function names for a given address.
Change --functions option in llvm-symbolizer tool to accept
values "none", "short" or "linkage". Update the tests and docs
accordingly.

llvm-svn: 209050
2014-05-17 00:07:48 +00:00
Alexey Samsonov dce67348a8 [DWARF parser] Use enums instead of bitfields in DILineInfoSpecifier.
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
2014-05-15 21:24:32 +00:00
Craig Topper e6cb63e471 [C++] Use 'nullptr'. Tools edition.
llvm-svn: 207176
2014-04-25 04:24:47 +00:00
David Blaikie 2f2021ad31 Use unique_ptr to manage ParsedBinariesAndObjects in LLVMSymbolizer
llvm-svn: 206866
2014-04-22 05:26:14 +00:00
Alexey Samsonov d010999abe [DWARF parser] Turn DILineInfo into a struct.
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
2014-04-18 21:36:39 +00:00
Alexey Samsonov 464d2e448b [C++11] Introduce ObjectFile::symbols() to use range-based loops.
Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3081

llvm-svn: 204031
2014-03-17 07:28:19 +00:00
Alexey Samsonov 48803e5ca9 [C++11] Use ObjectFile::sections() in commandline llvm tools
llvm-svn: 203802
2014-03-13 14:37:36 +00:00
Ahmed Charles 56440fd820 Replace OwningPtr<T> with std::unique_ptr<T>.
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
2014-03-06 05:51:42 +00:00
Ahmed Charles 96c9d95f51 [C++11] Replace OwningPtr::take() with OwningPtr::release().
llvm-svn: 202957
2014-03-05 10:19:29 +00:00
Alexey Samsonov a5f0768f5e llvm-symbolizer: use dynamic symbol table if the regular one is stripped.
llvm-svn: 202265
2014-02-26 13:10:01 +00:00
Rafael Espindola b5155a572f Change the begin and end methods in ObjectFile to match the style guide.
llvm-svn: 201108
2014-02-10 20:24:04 +00:00
Rafael Espindola 5e812afaeb Simplify the handling of iterators in ObjectFile.
None of the object file formats reported error on iterator increment. In
retrospect, that is not too surprising: no object format stores symbols or
sections in a linked list or other structure that requires chasing pointers.
As a consequence, all error checking can be done on begin() and end().

This reduces the text segment of bin/llvm-readobj in my machine from 521233 to
518526 bytes.

llvm-svn: 200442
2014-01-30 02:49:50 +00:00
Ed Maste ef6fed7c84 llvm-symbolizer: make mangled name heuristic apply to all symbols
PR: http://llvm.org/pr18431
Review: http://llvm-reviews.chandlerc.com/D2552
llvm-svn: 199404
2014-01-16 17:25:12 +00:00
Rafael Espindola 63da295045 Return an ErrorOr<Binary *> from createBinary.
I did write a version returning ErrorOr<OwningPtr<Binary> >, but it is too
cumbersome to use without std::move. I will keep the patch locally and submit
when we switch to c++11.

llvm-svn: 199326
2014-01-15 19:37:43 +00:00
Rafael Espindola 5cf521047f Check the error code and save a call to sys::fs::exists.
llvm-svn: 199293
2014-01-15 04:49:50 +00:00
Chandler Carruth 07baed53e8 Re-sort #include lines again, prior to moving headers around.
llvm-svn: 199080
2014-01-13 08:04:33 +00:00
Alexey Samsonov 60e59e29f8 llvm-symbolizer: add --obj flag to specify a single object file that should be symbolized.
llvm-svn: 197988
2013-12-24 19:33:22 +00:00
NAKAMURA Takumi b5c4b87690 [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.
llvm-svn: 196908
2013-12-10 11:13:32 +00:00
Alexey Samsonov 6f943e5fb8 llvm-symbolizer: don't always run demangler on global object names
llvm-svn: 192781
2013-10-16 09:54:49 +00:00
Alexey Samsonov a591ae6db3 llvm-symbolizer: use real path when looking for debug binary location
llvm-svn: 189250
2013-08-26 18:12:03 +00:00
Alexey Samsonov 3e9997f2c5 llvm-symbolizer: add support for .gnu_debuglink section
llvm-svn: 188386
2013-08-14 17:09:30 +00:00
NAKAMURA Takumi 8ee89c6a7e LLVMSymbolize.cpp: Fix build. Triple::ArchType is not a namespace.
llvm-svn: 186494
2013-07-17 06:53:51 +00:00
Alexey Samsonov b119b46065 llvm-symbolizer: be more careful with colons in file names
llvm-svn: 186493
2013-07-17 06:45:36 +00:00
NAKAMURA Takumi 234acdfdc8 llvm-symbolizer: Recognize a drive letter on win32. Then "REQUIRES: shell" can be removed.
FIXME: Could we use llvm::sys::Path here?
llvm-svn: 185322
2013-07-01 09:51:42 +00:00
Alexey Samsonov fe3a5d9cf5 llvm-symbolizer: don't leave dangling pointers after flushing LLVMSymbolizer. Add a destructor.
llvm-svn: 185154
2013-06-28 15:08:29 +00:00
Alexey Samsonov 7323383bd7 llvm-symbolizer: skip leading underscore in Mach-O symbol table entries
llvm-svn: 185151
2013-06-28 14:25:52 +00:00
Alexey Samsonov 601beb7afd llvm-symbolizer: make name demangling a public static method of LLVMSymbolizer
llvm-svn: 185143
2013-06-28 12:06:25 +00:00
Alexey Samsonov 2ca6536d7a llvm-symbolizer: add support for Mach-O universal binaries
llvm-svn: 185137
2013-06-28 08:15:40 +00:00
Alexey Samsonov 35c987dc11 [llvm-symbolizer] rewrite r183213 in a more clear way
llvm-svn: 183526
2013-06-07 15:25:27 +00:00
Alexey Samsonov 5239d58c8e [llvm-symbolizer] Avoid calling slow getSymbolSize for Mach-O files. Assume that symbols with zero size are in fact large enough.
llvm-svn: 183213
2013-06-04 07:57:38 +00:00
Alexey Samsonov 213527d9c9 Correct handling invalid filename in llvm-symbolizer
llvm-svn: 183102
2013-06-03 14:12:39 +00:00
Rafael Espindola 56f976f6bd At Jim Grosbach's request detemplate Object/MachO.h.
We are still able to handle mixed endian objects by swapping one struct at a
time.

llvm-svn: 179778
2013-04-18 18:08:55 +00:00
Rafael Espindola c2413f59e4 Convert MachOObjectFile to a template.
For now it is templated only on being 64 or 32 bits. I will add little/big
endian next.

llvm-svn: 179097
2013-04-09 14:49:08 +00:00
Alexey Samsonov d2069321e0 llvm-symbolizer: correctly parse filenames given in quotes
llvm-svn: 178859
2013-04-05 09:22:24 +00:00
Alexey Samsonov dd71c5b84a Fix for r177390: map values are pointers, use DeleteContainerSeconds() instead of .clear()
llvm-svn: 177409
2013-03-19 15:33:18 +00:00
Dmitry Vyukov e8504e269f llvm-symbolizer: flush internal caches functionality
llvm-svn: 177390
2013-03-19 10:24:42 +00:00
Alexey Samsonov d5d7bb5591 clang-formatize llvm-symbolizer code
llvm-svn: 175255
2013-02-15 08:54:47 +00:00
Dmitry Vyukov ef8fb72fc4 llvm-symbolizer: speedup symbol lookup
llvm-svn: 175158
2013-02-14 13:06:18 +00:00
Alexey Samsonov 741c688fe1 Print error messages from MemoryBuffer::getFile() in llvm-symbolizer
llvm-svn: 174346
2013-02-05 07:01:34 +00:00
Alexey Samsonov d6cef10af8 Replace global std::string with const char[]
llvm-svn: 174332
2013-02-04 15:55:26 +00:00
Alexey Samsonov ea83bafbda llvm-symbolizer: factor out bits of the tool into separate LLVMSymbolize.{h,cpp} files. No functionality change.
llvm-svn: 173159
2013-01-22 14:21:19 +00:00
Dmitry Vyukov d08bd13ac8 llvm-symbolizer: add DATA command that allows to symbolize global variables.
Example:
>DATA bin/clang 0x26e8e40
<llvm::SparcSubTypeKV
<40799808 416
The last line is address and size of the object.

llvm-svn: 172180
2013-01-11 07:16:20 +00:00
Chandler Carruth 4d88a1c233 Sort the #include lines for tools/...
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
2012-12-04 10:44:52 +00:00
Eric Christopher 7370b55262 Rewrite DIContext interface to take an object. Update all callers.
llvm-svn: 167757
2012-11-12 21:40:38 +00:00
Alexander Potapenko 5a578119ad Don't use __cxa_demangle under MSVC (which doesn't have it)
llvm-svn: 167730
2012-11-12 14:49:58 +00:00
Alexander Potapenko 8c07f55568 [ASan] Add llvm-symbolizer from to tools/
This is the second and last (2/2) part of a change that moves llvm-symbolizer to llvm/tools/, which will allow to build it
with both cmake and configure+make.

llvm-svn: 167723
2012-11-12 11:33:29 +00:00