diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-04-30 10:39:07 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-04-30 10:39:07 +0000 |
commit | ef2d9c2afad050b827e250e11d45e7417f8bed52 (patch) | |
tree | 2db1e90a12ccde75f4687d1b23dad809be56006b /vespamalloc/src | |
parent | 6b3369713065f41e23f81486ff6ca15d2dd40a9f (diff) |
GC unused code
Diffstat (limited to 'vespamalloc/src')
-rw-r--r-- | vespamalloc/src/tests/stacktrace/CMakeLists.txt | 1 | ||||
-rw-r--r-- | vespamalloc/src/tests/stacktrace/backtrace.c | 84 | ||||
-rw-r--r-- | vespamalloc/src/tests/stacktrace/backtrace.h | 17 |
3 files changed, 0 insertions, 102 deletions
diff --git a/vespamalloc/src/tests/stacktrace/CMakeLists.txt b/vespamalloc/src/tests/stacktrace/CMakeLists.txt index 491b0d4089e..0cc0107ce84 100644 --- a/vespamalloc/src/tests/stacktrace/CMakeLists.txt +++ b/vespamalloc/src/tests/stacktrace/CMakeLists.txt @@ -2,7 +2,6 @@ vespa_add_executable(vespamalloc_stacktrace_test_app TEST SOURCES stacktrace.cpp - backtrace.c DEPENDS ) vespa_add_test( diff --git a/vespamalloc/src/tests/stacktrace/backtrace.c b/vespamalloc/src/tests/stacktrace/backtrace.c deleted file mode 100644 index 44b33ca4572..00000000000 --- a/vespamalloc/src/tests/stacktrace/backtrace.c +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "backtrace.h" - -#if defined(__i386__) -// use GLIBC version, hope it works -extern int backtrace(void **buffer, int size); -#define HAVE_BACKTRACE -#endif - -#if defined(__x86_64__) - -/** - Written by Arne H. J. based on docs: - - http://www.kernel.org/pub/linux/devel/gcc/unwind/ - http://www.codesourcery.com/public/cxx-abi/abi-eh.html - http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/libgcc-s-ddefs.html -**/ - -#include <unwind.h> - -struct trace_context { - void **array; - int size; - int index; -}; - -static _Unwind_Reason_Code -trace_fn(struct _Unwind_Context *ctxt, void *arg) -{ - struct trace_context *tp = (struct trace_context *)arg; - void *ip = (void *)_Unwind_GetIP(ctxt); - - if (ip == 0) { - return _URC_END_OF_STACK; - } - if (tp->index <= tp->size) { - // there's no point filling in the address of the backtrace() - // function itself, that doesn't provide any extra information, - // so skip one level - if (tp->index > 0) { - tp->array[tp->index - 1] = ip; - } - tp->index++; - } else { - return _URC_NORMAL_STOP; - } - return _URC_NO_REASON; // "This is not the destination frame" -> try next frame -} - -#define HAVE_BACKTRACE -int -backtrace (void **array, int size) -{ - struct trace_context t; - t.array = array; - t.size = size; - t.index = 0; - _Unwind_Backtrace(trace_fn, &t); - return t.index - 1; -} -#endif // x86_64 - - -#ifdef HAVE_BACKTRACE - -int -FastOS_backtrace (void **array, int size) -{ - return backtrace(array, size); -} - -#else - -# warning "backtrace not supported on this CPU" -int -FastOS_backtrace (void **array, int size) -{ - (void) array; - (void) size; - return 0; -} - -#endif diff --git a/vespamalloc/src/tests/stacktrace/backtrace.h b/vespamalloc/src/tests/stacktrace/backtrace.h deleted file mode 100644 index 3700319162e..00000000000 --- a/vespamalloc/src/tests/stacktrace/backtrace.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -int FastOS_backtrace (void **array, int size); - -#if defined(__x86_64__) -int backtrace (void **array, int size); -#endif - -#ifdef __cplusplus -} -#endif - |