Commit Graph

53 Commits

Author SHA1 Message Date
Timur Iskhodzhanov 6c66ad0d75 [Sanitizer RT] Put the Symbolizer module name string ownership in order
Reviewed at http://reviews.llvm.org/D8666

llvm-svn: 233687
2015-03-31 12:50:05 +00:00
Alexey Samsonov c9d9610317 Improve SUMMARY reporting in sanitizers.
Make sure SUMMARY is always reported unless print_summary flag is set to
false, even if symbolizer is unavailable or report stack trace is empty.
If file/line info for PC can't be evaluated, print module name/offset
like we do in stack trace.

llvm-svn: 232567
2015-03-17 23:46:06 +00:00
Kuba Brecka ae219d3d3c Symbolizer refactoring: Merge common parts of POSIXSymbolizer and WinSymbolizer
Reviewed at http://reviews.llvm.org/D8105

llvm-svn: 231680
2015-03-09 18:36:28 +00:00
Kostya Serebryany 07aee9c2c6 [sanitizer] when dumping coverage bitset, dump seperate file for every module, instead of dumping a single combined bitset
llvm-svn: 231319
2015-03-04 23:41:55 +00:00
Kuba Brecka e87a26c0ed Symbolizer refactoring: Turn FillAddressAndModuleInfo into FillModuleInfo
Reviewed at http://reviews.llvm.org/D8020

llvm-svn: 231061
2015-03-03 09:18:44 +00:00
Kuba Brecka 898270513d Symbolizer refactoring: Move internals to separate files
Reviewed at http://reviews.llvm.org/D7972

llvm-svn: 231014
2015-03-02 21:15:09 +00:00
Kuba Brecka 8f23ce244c Symbolizer refactoring: SymbolizerTool and better interface
Reviewed at: http://reviews.llvm.org/D7936

llvm-svn: 230842
2015-02-28 09:39:05 +00:00
Kuba Brecka 1cd77d4f13 [compiler-rt] Symbolizer refactoring: Abstract SymbolizerProcess better
Reviewed at http://reviews.llvm.org/D7889

llvm-svn: 230749
2015-02-27 11:11:05 +00:00
Kuba Brecka 8f12ce0825 [compiler-rt] Symbolizer refactoring: Move SymbolizerProcess interface to header
Reviewed at http://reviews.llvm.org/D7868

llvm-svn: 230530
2015-02-25 19:50:38 +00:00
Alexey Samsonov 0e90668f14 Simplify Symbolizer::SymbolizePC() interface.
Return a linked list of AddressInfo objects, instead of using an array of
these objects as an output parameter. This simplifies the code in callers
of this function (especially TSan).

Fix a few memory leaks from internal allocator, when the returned
AddressInfo objects were not properly cleared.

llvm-svn: 223145
2014-12-02 19:48:40 +00:00
Alexey Samsonov 0b622f1d64 Correct the usage of DataInfo structure in TSan
llvm-svn: 221297
2014-11-04 21:26:56 +00:00
Alexey Samsonov 611c906cb3 [Sanitizer] Get rid of Symbolizer::Get() and Symbolizer::GetOrNull().
We may as well just use Symbolizer::GetOrInit() in all the cases.
Don't call Symbolizer::Get() early in tools initialization: these days
it doesn't do any important setup work, and we may as well create the
symbolizer the first time it's actually needed.

llvm-svn: 217558
2014-09-10 22:45:09 +00:00
Alexey Samsonov 1440105338 [Sanitizer] Simplify Symbolizer creation interface.
Get rid of Symbolizer::Init(path_to_external) in favor of
thread-safe Symbolizer::GetOrInit(), and use the latter version
everywhere. Implicitly depend on the value of external_symbolizer_path
runtime flag instead of passing it around manually.

No functionality change.

llvm-svn: 214005
2014-07-26 01:37:23 +00:00
Alexey Samsonov 23347de6ef [Sanitizer] Add Symbolizer::GetModuleNameAndOffsetForPC() and use it in LSan suppression matching.
This allows us to avoid retrieving file/line info for suppressed modules.

llvm-svn: 198025
2013-12-25 20:15:46 +00:00
Alexey Samsonov 6322e036aa [Sanitizer] Replace Symbolizer::IsAvailable and Symbolizer::IsExternalAvailable with Symbolizer::CanReturnFileLineInfo.
Remove now redundant checks in symbolizer initialization in TSan and MSan.

llvm-svn: 198000
2013-12-25 07:09:44 +00:00
Timur Iskhodzhanov 1c84bd64db [Sanitizer] Implement Symbolizer class on Windows
llvm-svn: 197571
2013-12-18 14:29:16 +00:00
Timur Iskhodzhanov b5f983e4b0 [Sanitizers] Rename Symbolizer::SymbolizeCode to Symbolizer::SymbolizePC
llvm-svn: 197569
2013-12-18 14:17:39 +00:00
Alexey Samsonov 25d010a98d [Sanitizer] Always initialize a Symbolizer (even if 'symbolize' is false).
If 'symbolize' flag is not set, we still want to transform virtual address
to module+offset pair in the call to Symbolizer::SymbolizeCode().
See https://code.google.com/p/address-sanitizer/issues/detail?id=251 for
more details.

llvm-svn: 197491
2013-12-17 11:15:39 +00:00
Alexey Samsonov 627e2c0dd7 [Sanitizer] Add Symbolizer::AddHooks() and use it in TSan and MSan.
Summary:
TSan and MSan need to know if interceptor was called by the
user code or by the symbolizer and use pre- and post-symbolization hooks
for that. Make Symbolizer class responsible for calling these hooks instead.
This would ensure the hooks are only called when necessary (during
in-process symbolization, they are not needed for out-of-process) and
save specific sanitizers from tracing all places in the code where symbolization
will be performed.

Reviewers: eugenis, dvyukov

Reviewed By: eugenis

CC: llvm-commits

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

llvm-svn: 193807
2013-10-31 21:44:07 +00:00
Alexey Samsonov 3c845b6f1b [Sanitizer] Update comment in sanitizer_symbolizer.h
llvm-svn: 193700
2013-10-30 17:17:35 +00:00
Alexey Samsonov 78928c1d2a [Sanitizer] Use SpinMutex for Symbolizer initialization (per dvyukov's suggestion)
llvm-svn: 193697
2013-10-30 17:05:37 +00:00
Peter Collingbourne 791e65dcfb Overhaul the symbolizer interface.
This moves away from creating the symbolizer object and initializing the
external symbolizer as separate steps.  Those steps now always take place
together.

Sanitizers with a legacy requirement to specify their own symbolizer path
should use InitSymbolizer to initialize the symbolizer with the desired
path, and GetSymbolizer to access the symbolizer.  Sanitizers with no
such requirement (e.g. UBSan) can use GetOrInitSymbolizer with no need for
initialization.

The symbolizer interface has been made thread-safe (as far as I can
tell) by protecting its member functions with mutexes.

Finally, the symbolizer interface no longer relies on weak externals, the
introduction of which was probably a mistake on my part.

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

llvm-svn: 193448
2013-10-25 23:03:29 +00:00
Daniel Jasper 333e0cb055 Revert r190520 as it wasn't the right fix.
llvm-svn: 190524
2013-09-11 12:53:04 +00:00
Daniel Jasper 2b3f143f23 Add empty virtual destructor...
... as this otherwise triggers -Wnon-virtual-dtor.

llvm-svn: 190520
2013-09-11 12:28:15 +00:00
Alexey Samsonov 7a36e6126b [Sanitizer] Refactor symbolization interface: use class instead of several functions. Move some code around to get rid of extra source files
llvm-svn: 190410
2013-09-10 14:36:16 +00:00
Alexey Samsonov 5b5c99d219 ASan, LSan, MSan: try to find llvm-symbolizer binary in PATH if it is not provided. Now we don't need to explicitly set the location of llvm-symbolizer in lit test configs.
llvm-svn: 189801
2013-09-03 13:22:51 +00:00
Timur Iskhodzhanov eee13914e2 Define SANITIZER_INTERFACE_ATTRIBUTE on Windows and fix all the places where SANITIZER_INTERFACE_ATTRIBUTE or SANITIZER_ATTRIBUTE_WEAK are used
llvm-svn: 188261
2013-08-13 11:42:45 +00:00
Alexey Samsonov 6a5b0758ec Demangle names using pluggable internal symbolizer if possible
llvm-svn: 185146
2013-06-28 12:30:24 +00:00
Alexey Samsonov c8e7364763 [Sanitizer] support running external llvm-symbolizer on Mac
llvm-svn: 183730
2013-06-11 08:13:36 +00:00
Peter Collingbourne 112e5ba281 [nolibc] Unweak SymbolizerPrepareForSandboxing and move it to libc-independent part.
Fixes the Go build.

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

llvm-svn: 182851
2013-05-29 12:11:43 +00:00
Peter Collingbourne fb1a9f17e3 [nolibc] Make SymbolizerPrepareForSandboxing weak and optional.
Differential Revision: http://llvm-reviews.chandlerc.com/D872

llvm-svn: 182765
2013-05-28 11:05:05 +00:00
Peter Collingbourne 5b2669049a [nolibc] Make AddressInfo::Clear a weak function.
llvm-svn: 182743
2013-05-27 21:00:36 +00:00
Alexander Potapenko 6535f510a3 [ASan] Introduce SymbolizerPrepareForSandboxing(), which is a no-op on every platform except Linux (because we don't support sandboxing anywhere else yet)
On Linux we pre-cache the value of readlink("/proc/self/exe"), so that it can be later used when the sandbox has been turned on.

llvm-svn: 182579
2013-05-23 11:53:36 +00:00
Peter Collingbourne c787d42f40 [nolibc] Move symbolizer to RTSanitizerCommonLibc, and make it optional using a weak symbol.
llvm-svn: 182372
2013-05-21 12:08:37 +00:00
Kostya Serebryany 2b42716213 [asan] fix powerpc build and one test; fix lint
llvm-svn: 181881
2013-05-15 12:36:29 +00:00
Sergey Matveev 4b603e5c50 [sanitizer] Filtering in GetListOfModules.
llvm-svn: 181791
2013-05-14 14:04:06 +00:00
Dmitry Vyukov 29f335ae80 tsan: symbolizer "flush caches" functinality
llvm-svn: 177388
2013-03-19 10:23:17 +00:00
Dmitry Vyukov 7943b69002 tsan: add IsSymbolizerAvailable() function for querying for presence of internal/external symbolizer
llvm-svn: 173783
2013-01-29 09:35:14 +00:00
Dmitry Vyukov 5cb6c62641 tsan: symbolize global variables
llvm-svn: 172181
2013-01-11 07:23:51 +00:00
Richard Smith 64e25ce53d Move C++ name demangling support from ubsan into sanitizer_common.
llvm-svn: 170666
2012-12-20 05:00:13 +00:00
Dmitry Vyukov e982a1d368 tsan: describe global vars (module+offset for now)
llvm-svn: 169122
2012-12-03 11:45:34 +00:00
Alexey Samsonov 68791d162a [Sanitizer] symbolizer: increase the maximal number of shared libraries to 16K
llvm-svn: 166098
2012-10-17 13:12:23 +00:00
Alexey Samsonov 3ebf2fa654 [Sanitizer] remove unused field
llvm-svn: 163296
2012-09-06 08:47:38 +00:00
Alexey Samsonov 6f696f4d17 [Sanitizer] Support for reading inlined frames from llvm-symbolizer
llvm-svn: 163140
2012-09-04 15:34:43 +00:00
Alexey Samsonov 419f610a74 [Sanitizer] Switch the symbolization strategy that would be used by sanitizer tools family: as compiling in-process symbolizer into runtime involves certain difficulties, we may instead launch an external symbolizer program (fork + execl) in a subprocess and communicate with it via pipe.
llvm-svn: 162437
2012-08-23 07:32:06 +00:00
Alexey Samsonov 500e99639d [Sanitizer] Wrapper around llvm::DIContext from LLVM DebugInfo library. If a macro SANITIZER_USES_LLVM_LIBS is defined (by default it is not), then sanitizer runtime includes llvm headers and tries to use LLVM libs for in-process symbolization. To make it functional, we have to link with these LLVM libs - either pass them to linker from Clang driver, or link them into static ASan runtime when we build it.
llvm-svn: 161045
2012-07-31 11:51:26 +00:00
Alexey Samsonov 7acdc1738f [Sanitizer] When obtaining the data for loaded modules, add address ranges of loadable segments only. Looks like address range of PT_TLS segment may intersect with loadable segments of other modules.
llvm-svn: 160498
2012-07-19 07:51:20 +00:00
Alexey Samsonov 38b1ec4317 [ASan] Add a default constructor for DWARFSection to initialize it with zeros.
llvm-svn: 159748
2012-07-05 14:28:37 +00:00
Alexey Samsonov 961276af26 [Sanitizer] Extend a symbolizer code. Implemented for Linux only. Use dl_iterate_phdr to get virtual addresses of mapped module sections. To symbolize an address from a module, map this module to memory and obtain pointers to debug info sections. Later these pointers can be passed to constructor of DWARF context-in-memory from LLVM DebugInfo lib.
llvm-svn: 159652
2012-07-03 08:24:14 +00:00
Alexey Samsonov 0d76e8983f [Sanitizer] Use ProcessMaps in symbolizer to get module name and offset for instruction address
llvm-svn: 158522
2012-06-15 14:00:25 +00:00