[compiler-rt] r196875 - Revert a final patch that was committed without the author contributing
Bill Wendling
isanbard at gmail.com
Sun Dec 15 18:49:20 PST 2013
The patch wasn’t in the 3.4 release branch. So bonus!
-bw
On Dec 9, 2013, at 8:47 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
> Bill, please also merge this into the 3.4 branch.
>
> -Chandler
>
>
> On Mon, Dec 9, 2013 at 8:40 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
> Author: chandlerc
> Date: Mon Dec 9 22:40:39 2013
> New Revision: 196875
>
> URL: http://llvm.org/viewvc/llvm-project?rev=196875&view=rev
> Log:
> Revert a final patch that was committed without the author contributing
> it to the LLVM project through the appropriate channels.
>
> This reverts:
> r195837: "[Sanitizer] Add rudimentary support for using libbacktrace in ..."
>
> Removed:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h
> Modified:
> compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt?rev=196875&r1=196874&r2=196875&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt Mon Dec 9 22:40:39 2013
> @@ -28,7 +28,6 @@ set(SANITIZER_LIBCDEP_SOURCES
> sanitizer_posix_libcdep.cc
> sanitizer_stacktrace_libcdep.cc
> sanitizer_stoptheworld_linux_libcdep.cc
> - sanitizer_symbolizer_libbacktrace.cc
> sanitizer_symbolizer_libcdep.cc
> sanitizer_symbolizer_posix_libcdep.cc)
>
> @@ -66,7 +65,6 @@ set(SANITIZER_HEADERS
> sanitizer_stoptheworld.h
> sanitizer_suppressions.h
> sanitizer_symbolizer.h
> - sanitizer_symbolizer_libbacktrace.h
> sanitizer_syscall_generic.inc
> sanitizer_syscall_linux_x86_64.inc
> sanitizer_thread_registry.h)
>
> Removed: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc?rev=196874&view=auto
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc (removed)
> @@ -1,146 +0,0 @@
> -//===-- sanitizer_symbolizer_libbacktrace.cc ------------------------------===//
> -//
> -// The LLVM Compiler Infrastructure
> -//
> -// This file is distributed under the University of Illinois Open Source
> -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -//
> -// This file is shared between AddressSanitizer and ThreadSanitizer
> -// run-time libraries.
> -// Libbacktrace implementation of symbolizer parts.
> -//===----------------------------------------------------------------------===//
> -
> -#include "sanitizer_platform.h"
> -
> -#include "sanitizer_internal_defs.h"
> -#include "sanitizer_symbolizer.h"
> -#include "sanitizer_symbolizer_libbacktrace.h"
> -
> -#if SANITIZER_LIBBACKTRACE
> -# include "backtrace-supported.h"
> -# if SANITIZER_POSIX && BACKTRACE_SUPPORTED && !BACKTRACE_USES_MALLOC
> -# include "backtrace.h"
> -# else
> -# define SANITIZER_LIBBACKTRACE 0
> -# endif
> -#endif
> -
> -namespace __sanitizer {
> -
> -#if SANITIZER_LIBBACKTRACE
> -
> -namespace {
> -
> -struct SymbolizeCodeData {
> - AddressInfo *frames;
> - uptr n_frames;
> - uptr max_frames;
> - const char *module_name;
> - uptr module_offset;
> -};
> -
> -extern "C" {
> -static int SymbolizeCodePCInfoCallback(void *vdata, uintptr_t addr,
> - const char *filename, int lineno,
> - const char *function) {
> - SymbolizeCodeData *cdata = (SymbolizeCodeData *)vdata;
> - if (function) {
> - AddressInfo *info = &cdata->frames[cdata->n_frames++];
> - info->Clear();
> - info->FillAddressAndModuleInfo(addr, cdata->module_name,
> - cdata->module_offset);
> - info->function = internal_strdup(function);
> - if (filename)
> - info->file = internal_strdup(filename);
> - info->line = lineno;
> - if (cdata->n_frames == cdata->max_frames)
> - return 1;
> - }
> - return 0;
> -}
> -
> -static void SymbolizeCodeCallback(void *vdata, uintptr_t addr,
> - const char *symname, uintptr_t, uintptr_t) {
> - SymbolizeCodeData *cdata = (SymbolizeCodeData *)vdata;
> - if (symname) {
> - AddressInfo *info = &cdata->frames[0];
> - info->Clear();
> - info->FillAddressAndModuleInfo(addr, cdata->module_name,
> - cdata->module_offset);
> - info->function = internal_strdup(symname);
> - cdata->n_frames = 1;
> - }
> -}
> -
> -static void SymbolizeDataCallback(void *vdata, uintptr_t, const char *symname,
> - uintptr_t symval, uintptr_t symsize) {
> - DataInfo *info = (DataInfo *)vdata;
> - if (symname && symval) {
> - info->name = internal_strdup(symname);
> - info->start = symval;
> - info->size = symsize;
> - }
> -}
> -
> -static void ErrorCallback(void *, const char *, int) {}
> -} // extern "C"
> -
> -} // namespace
> -
> -LibbacktraceSymbolizer *LibbacktraceSymbolizer::get(LowLevelAllocator *alloc) {
> - // State created in backtrace_create_state is leaked.
> - void *state = (void *)(backtrace_create_state("/proc/self/exe", 0,
> - ErrorCallback, NULL));
> - if (!state)
> - return 0;
> - return new(*alloc) LibbacktraceSymbolizer(state);
> -}
> -
> -uptr LibbacktraceSymbolizer::SymbolizeCode(uptr addr, AddressInfo *frames,
> - uptr max_frames,
> - const char *module_name,
> - uptr module_offset) {
> - SymbolizeCodeData data;
> - data.frames = frames;
> - data.n_frames = 0;
> - data.max_frames = max_frames;
> - data.module_name = module_name;
> - data.module_offset = module_offset;
> - backtrace_pcinfo((backtrace_state *)state_, addr, SymbolizeCodePCInfoCallback,
> - ErrorCallback, &data);
> - if (data.n_frames)
> - return data.n_frames;
> - backtrace_syminfo((backtrace_state *)state_, addr, SymbolizeCodeCallback,
> - ErrorCallback, &data);
> - return data.n_frames;
> -}
> -
> -bool LibbacktraceSymbolizer::SymbolizeData(DataInfo *info) {
> - backtrace_syminfo((backtrace_state *)state_, info->address,
> - SymbolizeDataCallback, ErrorCallback, info);
> - return true;
> -}
> -
> -#else // SANITIZER_LIBBACKTRACE
> -
> -LibbacktraceSymbolizer *LibbacktraceSymbolizer::get(LowLevelAllocator *alloc) {
> - return 0;
> -}
> -
> -uptr LibbacktraceSymbolizer::SymbolizeCode(uptr addr, AddressInfo *frames,
> - uptr max_frames,
> - const char *module_name,
> - uptr module_offset) {
> - (void)state_;
> - return 0;
> -}
> -
> -bool LibbacktraceSymbolizer::SymbolizeData(DataInfo *info) {
> - return false;
> -}
> -
> -#endif // SANITIZER_LIBBACKTRACE
> -
> -} // namespace __sanitizer
>
> Removed: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h?rev=196874&view=auto
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h (removed)
> @@ -1,40 +0,0 @@
> -//===-- sanitizer_symbolizer_libbacktrace.h -------------------------------===//
> -//
> -// The LLVM Compiler Infrastructure
> -//
> -// This file is distributed under the University of Illinois Open Source
> -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -//
> -// This file is shared between AddressSanitizer and ThreadSanitizer
> -// run-time libraries.
> -// Header for libbacktrace symbolizer.
> -//===----------------------------------------------------------------------===//
> -
> -#include "sanitizer_platform.h"
> -#include "sanitizer_common.h"
> -#include "sanitizer_symbolizer.h"
> -
> -#ifndef SANITIZER_LIBBACKTRACE
> -# define SANITIZER_LIBBACKTRACE 0
> -#endif
> -
> -namespace __sanitizer {
> -
> -class LibbacktraceSymbolizer {
> - public:
> - static LibbacktraceSymbolizer *get(LowLevelAllocator *alloc);
> -
> - uptr SymbolizeCode(uptr addr, AddressInfo *frames, uptr max_frames,
> - const char *module_name, uptr module_offset);
> -
> - bool SymbolizeData(DataInfo *info);
> -
> - private:
> - explicit LibbacktraceSymbolizer(void *state) : state_(state) {}
> -
> - void *state_; // Leaked.
> -};
> -
> -} // namespace __sanitizer
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc?rev=196875&r1=196874&r2=196875&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc Mon Dec 9 22:40:39 2013
> @@ -21,7 +21,6 @@
> #include "sanitizer_placement_new.h"
> #include "sanitizer_procmaps.h"
> #include "sanitizer_symbolizer.h"
> -#include "sanitizer_symbolizer_libbacktrace.h"
>
> #include <errno.h>
> #include <stdlib.h>
> @@ -387,12 +386,10 @@ class InternalSymbolizer {
> class POSIXSymbolizer : public Symbolizer {
> public:
> POSIXSymbolizer(ExternalSymbolizer *external_symbolizer,
> - InternalSymbolizer *internal_symbolizer,
> - LibbacktraceSymbolizer *libbacktrace_symbolizer)
> + InternalSymbolizer *internal_symbolizer)
> : Symbolizer(),
> external_symbolizer_(external_symbolizer),
> - internal_symbolizer_(internal_symbolizer),
> - libbacktrace_symbolizer_(libbacktrace_symbolizer) {}
> + internal_symbolizer_(internal_symbolizer) {}
>
> uptr SymbolizeCode(uptr addr, AddressInfo *frames, uptr max_frames) {
> BlockingMutexLock l(&mu_);
> @@ -403,17 +400,9 @@ class POSIXSymbolizer : public Symbolize
> return 0;
> const char *module_name = module->full_name();
> uptr module_offset = addr - module->base_address();
> - // First, try to use libbacktrace symbolizer (if it's available).
> - if (libbacktrace_symbolizer_ != 0) {
> - mu_.CheckLocked();
> - uptr res = libbacktrace_symbolizer_->SymbolizeCode(
> - addr, frames, max_frames, module_name, module_offset);
> - if (res > 0)
> - return res;
> - }
> const char *str = SendCommand(false, module_name, module_offset);
> if (str == 0) {
> - // Symbolizer was not initialized or failed. Fill only data
> + // External symbolizer was not initialized or failed. Fill only data
> // about module name and offset.
> AddressInfo *info = &frames[0];
> info->Clear();
> @@ -474,11 +463,6 @@ class POSIXSymbolizer : public Symbolize
> info->address = addr;
> info->module = internal_strdup(module_name);
> info->module_offset = module_offset;
> - if (libbacktrace_symbolizer_ != 0) {
> - mu_.CheckLocked();
> - if (libbacktrace_symbolizer_->SymbolizeData(info))
> - return true;
> - }
> const char *str = SendCommand(true, module_name, module_offset);
> if (str == 0)
> return true;
> @@ -490,8 +474,7 @@ class POSIXSymbolizer : public Symbolize
> }
>
> bool IsAvailable() {
> - return internal_symbolizer_ != 0 || external_symbolizer_ != 0 ||
> - libbacktrace_symbolizer_ != 0;
> + return internal_symbolizer_ != 0 || external_symbolizer_ != 0;
> }
>
> bool IsExternalAvailable() {
> @@ -584,30 +567,24 @@ class POSIXSymbolizer : public Symbolize
>
> ExternalSymbolizer *external_symbolizer_; // Leaked.
> InternalSymbolizer *const internal_symbolizer_; // Leaked.
> - LibbacktraceSymbolizer *libbacktrace_symbolizer_; // Leaked.
> };
>
> Symbolizer *Symbolizer::PlatformInit(const char *path_to_external) {
> InternalSymbolizer* internal_symbolizer =
> InternalSymbolizer::get(&symbolizer_allocator_);
> ExternalSymbolizer *external_symbolizer = 0;
> - LibbacktraceSymbolizer *libbacktrace_symbolizer = 0;
>
> if (!internal_symbolizer) {
> - libbacktrace_symbolizer =
> - LibbacktraceSymbolizer::get(&symbolizer_allocator_);
> - if (!libbacktrace_symbolizer) {
> - // Find path to llvm-symbolizer if it's not provided.
> - if (!path_to_external)
> - path_to_external = FindPathToBinary("llvm-symbolizer");
> - if (path_to_external && path_to_external[0] != '\0')
> - external_symbolizer = new(symbolizer_allocator_)
> - ExternalSymbolizer(path_to_external);
> - }
> + // Find path to llvm-symbolizer if it's not provided.
> + if (!path_to_external)
> + path_to_external = FindPathToBinary("llvm-symbolizer");
> + if (path_to_external && path_to_external[0] != '\0')
> + external_symbolizer = new(symbolizer_allocator_)
> + ExternalSymbolizer(path_to_external);
> }
>
> - return new(symbolizer_allocator_) POSIXSymbolizer(
> - external_symbolizer, internal_symbolizer, libbacktrace_symbolizer);
> + return new(symbolizer_allocator_)
> + POSIXSymbolizer(external_symbolizer, internal_symbolizer);
> }
>
> } // namespace __sanitizer
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131215/014a687f/attachment.html>
More information about the llvm-commits
mailing list