diff options
Diffstat (limited to 'vespamalloc')
-rw-r--r-- | vespamalloc/src/vespamalloc/util/callstack.cpp | 16 | ||||
-rw-r--r-- | vespamalloc/src/vespamalloc/util/callstack.h | 91 |
2 files changed, 0 insertions, 107 deletions
diff --git a/vespamalloc/src/vespamalloc/util/callstack.cpp b/vespamalloc/src/vespamalloc/util/callstack.cpp index 7780701a1a9..088b277d3cf 100644 --- a/vespamalloc/src/vespamalloc/util/callstack.cpp +++ b/vespamalloc/src/vespamalloc/util/callstack.cpp @@ -59,20 +59,4 @@ asciistream & operator << (asciistream & os, const StackReturnEntry & v) return os << t; } -void StackFrameReturnEntry::info(FILE * os) const -{ - static char tmp[0x400]; - verifyAndCopy(_return, tmp, sizeof(tmp)); - fprintf(os, "%s(%p, %p)", tmp, _return, _stack); -} - -asciistream & operator << (asciistream & os, const StackFrameReturnEntry & v) -{ - static char tmp[0x100]; - static char t[0x200]; - verifyAndCopy(v._return, tmp, sizeof(tmp)); - snprintf(t, sizeof(t), "%s(%p, %p)", tmp, v._return, v._stack); - return os << t; -} - } diff --git a/vespamalloc/src/vespamalloc/util/callstack.h b/vespamalloc/src/vespamalloc/util/callstack.h index ebed00da581..fa9640b2a2d 100644 --- a/vespamalloc/src/vespamalloc/util/callstack.h +++ b/vespamalloc/src/vespamalloc/util/callstack.h @@ -9,7 +9,6 @@ namespace vespamalloc { -const void * dlNextSym(const void * f); const char * dlAddr(const void * addr); class StackReturnEntry { @@ -32,27 +31,6 @@ private: const void * _return; }; -class StackFrameReturnEntry { -public: - StackFrameReturnEntry(const void * returnAddress = NULL, - const void * stack = NULL) - : _return(returnAddress), - _stack(stack) - { } - int cmp(const StackFrameReturnEntry & b) const { - int diff (size_t(_return) - size_t(b._return)); - if (diff == 0) { - diff = size_t(_stack) - size_t(b._stack); - } - return diff; - } - friend asciistream & operator << (asciistream & os, const StackFrameReturnEntry & v); - void info(FILE * os) const; -private: - const void * _return; - const void * _stack; -}; - template <typename StackRep> class StackEntry { public: @@ -65,7 +43,6 @@ public: bool operator > (const StackEntry & b) const { return cmp(b) > 0; } void info(FILE * os) const { _stackRep.info(os); } bool valid() const { return _stackRep.valid(_stopAddr); } - static size_t fillStack2(StackEntry *stack, size_t nelems); static size_t fillStack(StackEntry *stack, size_t nelems); static void setStopAddress(const void * stopAddr) { _stopAddr = stopAddr; } private: @@ -77,26 +54,6 @@ private: static const void * _stopAddr; }; -template <typename S, int N> -inline bool generateStackEntry(S & stack) -{ - void * s = __builtin_frame_address(N); - void * r(NULL); - if (s && (s > (void*)0x1000000) && (s < (void *)(std::numeric_limits<long>::max()))) { - r = __builtin_return_address(N); - stack = S(r, s); - } else { - stack = S(0, 0); - } - return (r == NULL) || (s == NULL); -} - -#define CASESTACK(n) \ - case n: { \ - done = generateStackEntry< StackEntry<StackRep>, n >(stack[n]); \ - break; \ - } - template <typename StackRep> const void * StackEntry<StackRep>::_stopAddr = NULL; @@ -121,53 +78,5 @@ size_t StackEntry<StackRep>::fillStack(StackEntry<StackRep> *stack, size_t nelem return sz; } -template <typename StackRep> -size_t StackEntry<StackRep>::fillStack2(StackEntry<StackRep> *stack, size_t nelems) -{ - bool done(false); - size_t i(0); - for ( i=0; !done && (i < nelems); i++) { - switch (i) { - CASESTACK(31); - CASESTACK(30); - CASESTACK(29); - CASESTACK(28); - CASESTACK(27); - CASESTACK(26); - CASESTACK(25); - CASESTACK(24); - CASESTACK(23); - CASESTACK(22); - CASESTACK(21); - CASESTACK(20); - CASESTACK(19); - CASESTACK(18); - CASESTACK(17); - CASESTACK(16); - CASESTACK(15); - CASESTACK(14); - CASESTACK(13); - CASESTACK(12); - CASESTACK(11); - CASESTACK(10); - CASESTACK(9); - CASESTACK(8); - CASESTACK(7); - CASESTACK(6); - CASESTACK(5); - CASESTACK(4); - CASESTACK(3); - CASESTACK(2); - CASESTACK(1); - CASESTACK(0); - default: - break; - } - } - return i-1; -} - -#undef CASESTACK - } |